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

# Python agent tools

> Give OpenAI Agents SDK and LangChain agents an Archil disk

The [Python SDK](https://docs.archil.com/sdks/python.md) turns a disk or [workspace](https://docs.archil.com/disks/workspaces.md) into a filesystem toolset for agent frameworks. The agent reads, writes, searches, and runs commands against your data.

## Setup

Install the SDK with the extra for your framework, and set `ARCHIL_API_KEY` and `ARCHIL_REGION`:

```bash theme={null}
pip install "archil[openai-agents]"   # OpenAI Agents SDK
pip install "archil[langchain]"       # LangChain and LangGraph
```

## OpenAI Agents SDK

`agent_tools()` returns a toolset, and `for_openai_agents()` turns it into OpenAI Agents SDK tools:

```python theme={null}
import archil
from agents import Agent, Runner

disk = archil.get_disk("dsk-0123456789abcdef")

agent = Agent(
    name="analyst",
    instructions="You analyze the files on the disk and write reports to reports/.",
    tools=disk.agent_tools().for_openai_agents(),
)
result = Runner.run_sync(agent, "Summarize the files in reports/ into reports/summary.md.")
print(result.final_output)
```

## LangChain

`for_langchain()` returns LangChain tools for agents and LangGraph graphs. This example also needs `pip install langchain langchain-anthropic`:

```python theme={null}
import archil
from langchain.agents import create_agent

disk = archil.get_disk("dsk-0123456789abcdef")

agent = create_agent("anthropic:claude-sonnet-5", tools=disk.agent_tools().for_langchain())
result = agent.invoke({"messages": [{"role": "user", "content": "Summarize the files in reports/."}]})
```

## Tools

| Tool | What it does |
| - | - |
| `read_file` | Reads a text file. |
| `write_file` | Creates or overwrites a file. |
| `delete_file` | Deletes a file. |
| `list_files` | Lists files under a path. |
| `grep` | Searches file contents with [server-side search](https://docs.archil.com/compute/search-files.md). |
| `run_bash` | Runs a command with [serverless execution](https://docs.archil.com/compute/serverless-execution.md), with the disk mounted. |

Pass `tools` to give the agent a subset, such as read-only research tools:

```python theme={null}
toolset = disk.agent_tools(tools=["read_file", "list_files", "grep"])
```

## Workspaces

A [workspace](https://docs.archil.com/disks/workspaces.md) spans several disks, each a top-level directory. File operations route to the right disk by path, and `grep` and `list_files` search all of them. A disk mounted with `read_only=True` can't be changed by the agent:

```python theme={null}
from archil import ExecMountSpec

ws = archil.workspace({
    "data": ExecMountSpec(disk=archil.get_disk("dsk-data"), read_only=True),
    "reports": archil.get_disk("dsk-reports"),
})
tools = ws.agent_tools().for_openai_agents()
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.