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

# Agents inside

> Run Claude Code or Codex inside any machine, from your code. Run agents in the background, put them in production, or let one agent delegate to others.

boxd runs a coding agent inside a machine for you, and you drive it from code: the TypeScript and Python SDKs, or the CLI. The agent works in the machine, not in your process, so it keeps going when your script exits or your laptop closes.

```typescript TypeScript theme={"theme":"github-dark"}
import { Boxd } from "@boxd-sh/sdk";

const boxd = new Boxd();
const agents = boxd.machines.agents;

const result = await agents.run("myapp", {
  harness: "claude-code",
  text: "Add a /health endpoint",
});
console.log(result.reply);
```

```python Python theme={"theme":"github-dark"}
from boxd import Boxd

boxd = Boxd()
agents = boxd.machines.agents

result = agents.run("myapp", "claude-code", "Add a /health endpoint")
print(result.reply)
```

```bash CLI theme={"theme":"github-dark"}
boxd agent run myapp claude-code "Add a /health endpoint"
```

To run it, [connect Claude Code or Codex](https://docs.boxd.sh/guides/agents/sign-in.md) once, and install the SDK with `npm install @boxd-sh/sdk` or `pip install boxd`. The client reads your API key from `BOXD_API_KEY`. The CLI needs nothing extra.

## What you can build

* **Background agents.** Start a task from a webhook, a CI job or a schedule, and return at once. The agent works on in its machine, and you collect the result later.
* **Agents in production.** Give each user or each job of your product its own machine with an agent in it, with a time limit, a step limit and a record of every turn.
* **Agents that delegate.** An agent on one machine can hand work to agents on other machines.

## In this guide

* [Harnesses and models](https://docs.boxd.sh/guides/agents/harnesses.md): Claude Code and Codex, and the models and effort levels they take.
* [Sign-in and API keys](https://docs.boxd.sh/guides/agents/sign-in.md): connect a harness once, or give it an API key.
* [Conversations](https://docs.boxd.sh/guides/agents/conversations.md): give an agent a task, send it more, and step in while it works.
* [Sessions](https://docs.boxd.sh/guides/agents/sessions.md): a session's settings and state, closing it, and how it follows the machine.
* [Watch and history](https://docs.boxd.sh/guides/agents/history.md): see what an agent is doing, and what it did.
* [Reference](https://docs.boxd.sh/guides/agents/reference.md): every SDK method and CLI command, with its options.


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