> 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-agent-sdk/llm-core-api/llm_operate_file.md).

# llm\_operate\_file

#### `llm_operate_file`: File Management Operations

Uses the language model to perform file operations based on user instructions.

```python
def llm_operate_file(
    agent_name: str, 
    messages: List[Dict[str, Any]], 
    tools: List[Dict[str, Any]] = None, 
    base_url: str = aios_kernel_url,
    llms: List[Dict[str, Any]] = None
) -> LLMResponse
```

**Parameters:**

* `agent_name`: Identifier for the agent making the request
* `messages`: List of message dictionaries
* `tools`: Optional list of tools (usually not needed for file operations)
* `base_url`: API endpoint URL
* `llms`: Optional list of LLM configurations

**Returns:**

* `LLMResponse` object containing file operation results

**Example:**

```python
# Create a text file
response = llm_operate_file(
    "file_assistant",
    messages=[
        {"role": "user", "content": "Create a new file called notes.txt with a todo list for today"}
    ]
)

# Process the response
print(response["response"]["response_message"])  # Contains information about the file operation
```

### Common Message Formats

All functions accept messages in the following format:

```python
messages = [
    {
        "role": "system",  # Can be "system", "user", or "assistant"
        "content": "You are a helpful assistant specialized in...",  # Message content
        "name": "example_name"  # Optional name for the message sender
    },
    {
        "role": "user",
        "content": "Please help me with..."
    }
]
```
