> ## 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.

# Mastra

> Give Mastra agents an Archil disk

`@archildata/mastra` gives [Mastra](https://mastra.ai) agents a filesystem over an Archil disk or [workspace](https://docs.archil.com/disks/workspaces.md). The agent reads, writes, searches, and runs commands against your data.

## Setup

**1. Create a disk and an API key**

Create a disk in the [Archil console](https://console.archil.com) in a [region with compute](https://docs.archil.com/reference/regions.md#compute-availability), and [create an API key](https://console.archil.com/api-keys) in the same region. Set them in your environment:

```sh theme={null}
ARCHIL_API_KEY=key-...
ARCHIL_REGION=aws-us-east-1
ARCHIL_DISK_ID=dsk-...
```

**2. Install the packages**

```bash theme={null}
npm install @mastra/core disk @archildata/mastra
```

## Disk tools

`createDiskTools` returns a record of Mastra tools for the disk. Pass it as an agent's `tools`:

```ts theme={null}
import { Agent } from "@mastra/core/agent";
import * as archil from "disk";
import { createDiskTools } from "@archildata/mastra";

const disk = await archil.getDisk(process.env.ARCHIL_DISK_ID!);

export const analyst = new Agent({
  id: "analyst",
  name: "Analyst",
  instructions: "You analyze the files on the disk and write reports to reports/.",
  model: "anthropic/claude-sonnet-5",
  tools: createDiskTools(disk),
});
```

The agent gets the same tools as the [AI SDK integration](https://docs.archil.com/integrations/ai-sdk.md#disk-tools): `read_file`, `write_file`, `delete_file`, `list_files`, `glob`, `grep`, and `run_bash`. To span several disks, pass a [workspace](https://docs.archil.com/disks/workspaces.md) instead of a disk.


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