# Use with AI agents

Coding agents such as Claude Code, Cursor or Codex can write a step, run it with fob-worker, read the error, fix it and run it again. That's the same loop you'd follow by hand, and it stays on your machine.

## 1. Set up the repo yourself

Create the worker repo and fill in `.env` ([Quickstart](/docs/quickstart)) before you hand it to an agent, so the agent never needs your API key. If it needs credentials, it should ask you; it should never invent them.

Local runs are real: `fob-worker steps run` really runs your step, so if the step calls an API or writes to a system, that happens. Point `.env` at test accounts while an agent is iterating, and keep your agent's approval prompts on.

## 2. Paste this into the agent's instructions

Add it to the repo's `CLAUDE.md` or `AGENTS.md` (the template's `CLAUDE.md` already describes the layout and `defineStep()`):

```markdown
## Assembly Line: running and debugging steps

- List steps: `fob-worker steps list`. Run one: `fob-worker steps run <slug> --scenario <name>` (or `--station <CODE>`, or `--empty`).
- Save test configs as `.orchestrator/scenarios/<slug>/<name>.json`. Outputs land in `temp/<slug>.json`.
- On failure, read the `Resolved config` line and the error; rerun with `DEBUG=1` for a stack trace.
- Workpieces: `fob-worker lines status <LINE>`, `fob-worker workpieces show <id>`, and `error.txt` in the failed bin.
- Ask me before: `fob-orc lines push`, `fob-orc stations push`, `fob-orc stations run`, `fob-worker lines empty-bins`, `fob-worker stations empty-bins`.
- Docs (raw Markdown): https://assemblyline.sh/llms.txt and https://finopsbricks.com/llms.txt
```

## 3. Commands to confirm first

| Command | Why |
| --- | --- |
| `fob-orc lines push`, `fob-orc stations push` | Changes the line and station definitions on the Orchestrator |
| `fob-orc stations run <CODE>` | Starts a real run on your worker |
| `fob-worker lines empty-bins`, `fob-worker stations empty-bins` | Deletes local workpieces |
| `fob-worker steps run` | Runs your step for real, including any API calls it makes |

## 4. Example asks

- "Add a step `IN1_02_report` that attaches a markdown report of the flagged invoices. Write a scenario and run it." The agent writes the step, saves a scenario and runs `fob-worker steps run IN1_02_report --scenario …`.
- "`IN1_01_check` fails with the `two-invoices` scenario. Find out why and fix it." The agent reruns with `DEBUG=1`, reads the error and edits the step.
- "INV-1002 is stuck in IN1/failed. Tell me what happened." The agent runs `fob-worker workpieces show INV-1002` and reads `error.txt`.

## Docs for agents

- Index of every page on this site: [`/llms.txt`](/llms.txt)
- Any page as raw Markdown: add `/md` after `/docs`. This page is at [`/docs/md/ai-agents`](/docs/md/ai-agents).
- Full worker, fob-worker and fob-orc reference: [finopsbricks.com/llms.txt](https://finopsbricks.com/llms.txt)
