
# 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 loop is the same one you'd follow by hand, and fob-worker keeps it on your machine.

<Video title="Write and debug a worker step with Claude Code and fob-worker (3–4 min)" />

## 1. Set up the repo yourself

Create the worker repo, fill in `.env` and pull your station files ([Get started](/docs/workers/get-started)) before you hand it to an agent, so the agent never needs your API key.

<Callout type="warning" title="Local runs are real">
`fob-worker steps run` really runs your step: 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.
</Callout>

## 2. Tell the agent about the repo

The template's `CLAUDE.md` already describes the layout, `defineStep()` and the station files. Add the fob-worker loop to it (or to `AGENTS.md`):

```markdown
## 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` and feed the next step's `step_outputs`.
- 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.
- Never push station files (`fob-orc stations push`) or run stations on the Orchestrator without asking me.
- Docs: https://finopsbricks.com/docs/workers (raw Markdown: https://finopsbricks.com/llms.txt)
```

## 3. Ask

- "Add a step `IN1_02_report` that attaches a markdown report of the flagged invoices. Write a scenario and run it."
- "`IN1_01_check` fails with the `two-invoices` scenario. Find out why and fix it."
- "INV-1002 is stuck in IN1/failed. Read its error and tell me what happened."
- "Write Jest tests for the parsing function in `IN0_01_seed`."

## Docs for agents

Every docs page is also served as raw Markdown:

- Index of all pages: [`/llms.txt`](/llms.txt)
- Any page: add `/md` after `/docs`. This page is at [`/docs/md/workers/ai-agents`](/docs/md/workers/ai-agents)
