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

# AI Agents

> Using lager agent to give an AI coding agent a guide to the lager CLI

An AI coding agent, such as Claude Code, Codex, or Cursor, can use the
`lager` CLI as a person does. `lager agent` gives the agent a guide. The guide
tells the agent how to find boxes and nets, and how to run tests. It also
tells the agent which commands are safe, and when to ask a human first.

The guide is part of the CLI, so it always agrees with the installed version.
After you update the CLI, run `lager agent install` again.

## Syntax

```bash theme={null}
lager agent install [--target TARGET] [--scope SCOPE] [--force]
lager agent uninstall [--target TARGET] [--scope SCOPE] [--force]
lager agent status
lager agent guide [--topic TOPIC]
```

## Commands

| Command | Description |
| - | - |
| `install` | Install or update the guide for an agent |
| `uninstall` | Remove the guide that `install` wrote |
| `status` | Show where the guide is installed, and if it is current |
| `guide` | Print the guide, for any agent to read |

## Options

| Option | Description |
| - | - |
| `--target claude` | A skill in `.claude/skills/lager/`. This is the default |
| `--target codex` | A block in `AGENTS.md`. Other agents that read `AGENTS.md` also use it |
| `--target cursor` | A rule in `.cursor/rules/lager.mdc` |
| `--target all` | All targets that the scope supports |
| `--scope project` | The repository root (the folder with `.git`), or the current folder. This is the default |
| `--scope user` | Your home folder: `~/.claude/skills/lager/` or `~/.codex/AGENTS.md`. Cursor has no user scope |
| `--force` | Replace a file that you changed, or a file that lager did not write |
| `--json` | Print the result as one JSON object |
| `--topic TOPIC` | For `guide`: `skill`, `commands`, `python-api`, `troubleshooting`, or `agents` |
| `--list` | For `guide`: list the topics |

## Usage

```bash theme={null}
# Give Claude Code the guide for this repository
lager agent install

# Give every agent the guide for this repository
lager agent install --target all

# Give Claude Code the guide in every project
lager agent install --scope user

# Print the list of commands and the safety class of each
lager agent guide --topic commands
```

## What the Agent Learns

The guide tells the agent to:

* Name the box in every command, with `--box` or `LAGER_BOX`.
* Use JSON output, and read the error envelope and the exit code.
* Use a time limit on every stream, for example `lager uart NET --duration 10`.
* Read the DUT context and the metadata of each net before it plans a test.
* Write tests as `lager python` scripts, and turn power off at the end.

Each command has a safety class:

| Class | Meaning | The agent |
| - | - | - |
| `read` | The command changes nothing | Runs it |
| `actuate` | The command changes an instrument or the DUT | Asks a human first |
| `admin` | The command changes the box, the nets, or the configuration | Asks a human first |
| `interactive` | The command needs a human at a terminal | Does not run it |

The guide is text that the agent reads. It does not prevent a command.

## Your Changes Are Safe

`install` and `uninstall` change only the files that lager wrote. If you
change a file, lager keeps your version and exits with code 1. Use `--force`
to replace it. In `AGENTS.md`, lager changes only the text between its
`BEGIN lager-cli agent guide` and `END lager-cli agent guide` markers.

You can commit a project install to your repository. A teammate who runs
`lager agent install` gets the same update rules.


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