Quickstart
You will build an agent that watches expenses dropped into a folder, and proposes a warning when the month’s spending passes a budget. The warning waits for your approval.
1. Write the bundle
Section titled “1. Write the bundle”Create a folder with an inbox/ inside it, and save this as budget.yaml:
name: budget-watchschema_version: v1
goal: objectives: under_budget: "m.spent < 500" evaluate_every: 10m
measures: spent: aggregation: sum field: fields.amount filter: "type == 'expense'" window: 30d default: 0
behavior: directive: "Watch monthly spending and warn before the budget runs out."
adapters: - name: expenses transport: native auth: { type: none } trigger: { mode: poll } normalize: mode: declarative identity: { strategy: natural_key, key: ["$.data.id"] } timestamp_from: "$.data.date" type: expense fields: amount: { path: "$.data.amount" } note: { path: "$.data.note" } catalog: expense: { amount: number, note: string } options: path: inbox pattern: "*.json" format: json
capabilities: - method: send_warning risk: dangerous approval: human params_schema: type: object properties: message: { type: string } required: [message] additionalProperties: false handler: "budget_actions:send_warning" workspace: true
inference: provider: claude-cli model: haikuEach block has one job:
goal: what “on target” means, as a condition over measures. Checked every 10 minutes.measures: numbers computed from observations, here the sum of the last 30 days.adapters: where data comes from. This one reads every JSON file ininbox/.capabilities: the only actions the model may propose. This one always needs a person.inference: the model. Any provider works.
Then the code behind send_warning, beside it. Loom calls it with the validated params, plus a
folder it made for this capability:
from pathlib import Path
def send_warning(*, message: str, workspace: Path) -> dict: """Write the warning to a file in the folder Loom gives this capability.""" target = workspace / "warning.txt" target.write_text(message) return {"path": str(target)}Check the bundle loads:
uv run --project /path/to/loom python -m loom.config budget.yamlA typo or an unknown field is refused here, with the reason.
2. Add some data
Section titled “2. Add some data”Drop two expenses into inbox/. Use today’s date: the measure only counts the last 30 days.
{ "id": "e1", "date": "2026-12-02T09:00:00Z", "amount": 320, "note": "rent share" }{ "id": "e2", "date": "2026-12-02T10:00:00Z", "amount": 240, "note": "flights" }3. Turn a cycle
Section titled “3. Turn a cycle”uv run --project /path/to/loom python -m loom.core budget.yamlLoom reads both files, computes spent = 560, and finds under_budget failed. Only now does it call
the model, which answers with a proposal to call send_warning. Because the capability needs a
human, the proposal is parked: nothing has been sent.
Everything is stored in .loom/data/budget-watch.sqlite3, next to where you ran the command.
4. Approve it
Section titled “4. Approve it”Issue yourself a token and serve the agent’s API:
uv run --project /path/to/loom python -m loom.api.tokens issue budget.yaml me --kind humanuv run --project /path/to/loom python -m loom.api budget.yamlThe first command prints your token: export it as TOKEN. List what is waiting, then approve it:
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:8000/proposalsCopy the proposal_id it returns, then approve it:
ID=prop-... # the proposal_id from the listcurl -X POST -H "Authorization: Bearer $TOKEN" http://127.0.0.1:8000/proposals/$ID/approveThe response says "outcome": "success" and gives the path of warning.txt.
Approval re-runs validation and the gate, then calls send_warning: the model’s message lands in
warning.txt. The ledger records who approved it.
- Bundles explains every block.
- Safety pipeline explains what happens to a proposal.
- Capabilities covers handlers, approval and conditions.