---
url: /automate/ai-agents.md
---
# Use by AI agents

An AI agent that works for you can run other agents, read their answers, and continue their conversations, with the commands you use. Set this environment variable for the commands your AI agent runs, so Pandra never asks it a question:

```sh
export PANDRA_NO_INTERACTIVE=1
```

In Claude Code, put it in the `env` of your `settings.json`:

```json
{
  "env": {
    "PANDRA_NO_INTERACTIVE": "1"
  }
}
```

## Never wait for an answer

Some harnesses run commands in a terminal, where a question would wait for an answer nobody gives and `pandra run` would open the harness's interface. `PANDRA_NO_INTERACTIVE=1` prevents both, and `--no-interactive` does the same for one command. A command that would have asked fails instead, and its error lists the commands that fix the problem, as [Automate Pandra](/automate.md) shows; once they are done, run the original command again.

Do not give an AI agent `--yes` instead: it answers Pandra's confirmations rather than stopping at them, so a run approves an agent before you see what the agent contains ([what `--yes` does](/automate.md#what---yes-does)). Agents that Pandra itself runs need none of this, because a `pandra` command inside a Pandra run never asks a question.

## Run Pandra from a sandboxed agent

A harness's sandbox can refuse what `pandra run`, `pandra resume`, `pandra guild run`, and `pandra quest run` need: writing Pandra's data directory and listening on a Unix socket there. The command then fails with `harness_sandboxed` before anything starts, and the agent runs it again with the sandbox's escalation, which you approve in your harness ([Codex](/harnesses/codex.md#run-pandra-from-your-own-codex)). Read-only commands such as `pandra agent list` and `pandra ps` work inside the sandbox.

## Teach it Pandra

`pandra skill` prints Pandra's `SKILL.md`, which tells an AI agent how to run agents and read their answers, run several at once, carry out a repository's quests, create, lock, build, and publish agents, and change Pandra's configuration when you ask it to. Every run that Pandra starts gets the skill, unless the agent has a skill of its own named `pandra`.

Pandra never changes your own harness's configuration, so you install the skill there yourself, in one of the ways below. Each copy describes the Pandra version it came from, so install it again after you upgrade Pandra.

To write it into a skill directory your harness reads, such as Claude Code's `~/.claude/skills`, or `~/.agents/skills`, which Codex and Pi read:

```sh
pandra skill --dir ~/.claude/skills
```

To install it from Pandra's repository with a skill installer instead, name the tag of your release, `v` followed by the version `pandra version` prints. Either installer is enough. Pandra's repository has no skill during the `0.1.0-rc.2` preview, so until `0.1.0` write the skill with `pandra skill --dir`, alone or with an installer as the last two examples show. With `npx skills`:

```sh
npx skills add pandra-io/pandra@v0.1.0 --skill pandra -g -a claude-code
```

Or with the GitHub CLI:

```sh
gh skill install pandra-io/pandra pandra@v0.1.0 --agent claude-code --scope user
```

To give an installer the copy your Pandra prints, write it to a directory first, then name that directory with `npx skills`:

```sh
pandra skill --dir ./pandra-skill/skills
npx skills add ./pandra-skill --skill pandra -g -a claude-code
```

Or with the GitHub CLI:

```sh
pandra skill --dir ./pandra-skill/skills
gh skill install ./pandra-skill pandra --from-local --agent claude-code --scope user
```

## Find the agents it can run

`pandra agent list --json` lists the agents an AI agent can run, from local state only. Each entry has a `reference` that runs exactly that package, the `harness` the configuration selects, and `ready` with the `blockers` that would stop a run. Here the document is formatted on several lines:

```json
{
  "schema_version": "1.0",
  "agents": [
    {
      "agent": "ghcr.io/acme/reviewer",
      "reference": "ghcr.io/acme/reviewer@sha256:4f2a9c1e7b3d5a6f8e0c1b2a3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f67",
      "references": [{"reference": "ghcr.io/acme/reviewer:0.1.0", "label": "0.1.0"}],
      "package_digest": "sha256:4f2a9c1e7b3d5a6f8e0c1b2a3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f67",
      "description": "Reviews pull requests",
      "harness": "claude-code",
      "ready": false,
      "blockers": [
        {"code": "package_not_approved", "message": "ghcr.io/acme/reviewer@sha256:4f2a9c1e7b3d5a6f8e0c1b2a3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f67 has not been approved", "details": {"agent": "ghcr.io/acme/reviewer", "package_digest": "sha256:4f2a9c1e7b3d5a6f8e0c1b2a3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f67"}}
      ]
    }
  ],
  "warnings": []
}
```

In a repository with a guild, `pandra guild list --json` lists the agents the repository works with under their member names, `pandra guild run NAME` runs one ([running members](/guilds/running.md#for-scripts-and-ai-agents)), and `pandra quest run NAME` carries out a quest ([agent workflows](/quests.md)). Pandra's skill tells an agent to look there first.

## Check a run before starting it

`pandra run AGENT --dry-run --json` prints the plan of a run as one document, with where each value comes from and the `problems` that would stop it, without starting or asking anything. What only a start can check, such as whether the harness accepts the model, is listed apart.

`pandra config show --agent AGENT --json` lists what an agent needs, such as its MCP servers, their inputs, and its variables, next to what is set and allowed, with the commands that fill each gap.

## Let it change your configuration

An AI agent changes your configuration with your commands: `pandra config set` and `unset` for one key, and `config target set` and `config secret set` ([show and edit the file](/configure/agent-settings.md#show-and-edit-the-file)). For a change no command makes, it edits the file that `pandra config path` prints and checks it with `pandra config validate`. A `pandra` command inside a Pandra run cannot change the configuration: it refuses and says that you have to run it.

## What stays with you

A remediation step marked `needs_user`, such as approving a package or allowing a server, is yours:

* An AI agent can pull and inspect an agent, which approves nothing. `pandra agent trust` is yours.
* `pandra config setup AGENT --template` prints a file to fill in. Applying it with `pandra config setup AGENT --file FILE` allows the agent's servers to receive your values, so that step is yours.

::: security
Pandra's skill tells AI agents never to approve packages, pass secret values, allow servers, assign secrets, or publish an agent without your permission. Pandra cannot enforce this, because an agent running as you can edit your configuration.
:::

## Agents that run agents

A run that an agent starts, a nested run, has the limits that [agents that run agents](/configure/agent-settings.md#agents-that-run-agents) lists, such as never approving a package; each error it hits names the command that is yours to run.

`pandra session inspect` lists the sessions an agent started from a session, its children. To check how a child reached its answer, such as whether the tests behind "the tests pass" ran, an agent reads the child's log with `pandra logs SESSION_ID --failed` or `--item N` ([see what an agent did](/run/workspaces.md#see-what-an-agent-did)). The log holds the text of the files and pages the child read, so instructions planted in them reach the agent that reads the log.

## Running several agents at once

An agent in a headless run that Pandra started can start runs in the background with `--detach`, as you can. Its run waits for these children, and the agent does not poll: when children end, it gets one message, at its next tool call or as a new turn:

```text
[Pandra] Detached runs that you started have ended. `pandra session wait SESSION` prints a run's whole answer.

- 4ee0a19d357d42ecbcd45dd22c132f7f: completed, exit code 0
  > ORCHID
```

* A run has at most 4 detached children at once; a fifth fails with `detached_children_exceeded`.
* When the agent's run ends first, it stops its children that still run.
* Inside a TUI run or an ACP endpoint, `--detach` fails with `nested_mode_unsupported`. There, an agent starts its runs in the background of one shell command and waits for that command to end. On Codex and Pi, it waits before it ends its turn, because the run can end with the turn.

An agent in your own harness, outside a Pandra run, can use `--detach` too ([running in the background](/run/background.md)), but nothing tells it when a run ends. To start a review and a changelog:

```sh
pandra run github.com/acme/reviewer@v1.2.0 --detach --prompt "Review PR 12."
pandra run github.com/acme/changelog@v2.0.0 --detach
```

To wait for the review later, with a `--timeout` shorter than the time the harness lets a command run:

```sh
pandra session wait --timeout 9m 5895c85ecd07 > review.md
```

When it exits 124, the run is still going: run the same command again. A detached run uses your credentials until it ends or `pandra session stop` stops it ([what keeps running](/run/background.md#what-keeps-running)).

## Messages between agents

An agent can tell a running run something with `pandra session send`, as you can ([send a message to a run](/run/background.md#send-a-message-to-a-run)). A message from inside a Pandra run to a run that it did not start arrives after the line `[Pandra] This message was sent by the agent of run RUN_ID, not by the user.`, and the receiving agent can decline what it asks. Write such a message as information rather than as an order. The mark is what the sender reports, so an agent that hides it sends an unmarked message.

## Schemas and external evaluation tools

`pandra schema` lists the JSON Schemas built into Pandra, `pandra schema run-event` prints one, and `pandra schema --dir ./schemas` writes them all for offline use. The `#:schema` lines of `pandra.toml`, `config.toml`, a guild file, and a quest file point at URLs that redirect to the schemas of the latest release, so an editor that follows redirects checks the files as you write them. To check offline, point the editor at a file that `pandra schema --dir` wrote.

An evaluation tool that runs an external program can call `pandra run AGENT --json --output-schema FILE` to evaluate an agent.
