# 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..."
    }
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aios.foundation/aios-docs/aios-agent-sdk/llm-core-api/llm_operate_file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
