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

# LangChain.js

> Give LangChain.js and LangGraph.js agents an Archil disk

`@archildata/langchain` gives [LangChain.js](https://js.langchain.com) and LangGraph.js 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. For Python, use [Python agent tools](https://docs.archil.com/integrations/python-agent-tools.md).

## 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 langchain @langchain/core @langchain/anthropic disk @archildata/langchain
```

The example uses an Anthropic model, so also set `ANTHROPIC_API_KEY`.

## Disk tools

`createDiskTools` returns LangChain tools for the disk. Pass them to an agent, or bind them to a model:

```ts theme={null}
import { createAgent } from "langchain";
import * as archil from "disk";
import { createDiskTools } from "@archildata/langchain";

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

const agent = createAgent({
  model: "anthropic:claude-sonnet-5",
  tools: createDiskTools(disk),
});

const result = await agent.invoke({
  messages: [{ role: "user", content: "Summarize the files in reports/ into reports/summary.md." }],
});
console.log(result.messages.at(-1)?.content);
```

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.