> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Files Generation Tools

> Generate files in different formats with Agno agents.

Agno provides the [`FileGenerationTools`](/tools/toolkits/file-generation/file-generation) to generate files in different formats.

```python file_generation.py theme={null}
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIResponses
from agno.tools.file_generation import FileGenerationTools

agent = Agent(
    model=OpenAIResponses(id="gpt-5.2"),
    db=SqliteDb(db_file="tmp/test.db"),
    tools=[FileGenerationTools(output_directory="tmp")],
    description="You are a helpful assistant that can generate files in various formats.",
    instructions=[
        "When asked to create files, use the appropriate file generation tools.",
        "Always provide meaningful content and appropriate filenames.",
        "Explain what you've created and how it can be used.",
    ],
    markdown=True,
)

response = agent.run(
    "Create a PDF report about renewable energy trends in 2024. Include sections on solar, wind, and hydroelectric power."
)
print(response.content)
if response.files:
    for file in response.files:
        print(f"Generated file: {file.filename} ({file.size} bytes)")
        if file.url:
            print(f"File location: {file.url}")
```

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U openai sqlalchemy reportlab python-docx agno
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
        export OPENAI_API_KEY="your_openai_api_key_here"
      ```

      ```bash Windows theme={null}
        $Env:OPENAI_API_KEY="your_openai_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run Agent">
    ```bash theme={null}
    python file_generation.py
    ```
  </Step>
</Steps>

## Developer Resources

* See the [File Generation Tools](/tools/toolkits/file-generation/file-generation) documentation.
