> For the complete documentation index, see [llms.txt](https://docs.aios.foundation/aios-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aios.foundation/aios-docs/aios-kernel/storage/sto_create_file.md).

# sto\_create\_file

```python
def sto_create_file(file_name: str, file_path: str, collection_name: str = None) -> str
```

[Source code](https://github.com/agiresearch/AIOS/blob/main/aios/storage/filesystem/lsfs.py)

Description: Create a file based on either file\_name or file\_path

* If the file\_path is provided, it will create the file directly at the location of the file\_path
* Else If the file\_name is provided, the file will be created at the path of os.path.join(self.root\_dir, file\_name)

Parameters:

* file\_name (str): Name of the file to create
* file\_path (str): Full path where to create the file
* collection\_name (str): Name of the collection/agent (optional)

Returns:

* Success message (str): "File has been created successfully at: {file\_path}"
* Exists message (str): "File already exists at: {file\_path}"
* Error message (str): "Error creating file: {error\_message}"
