Breadbox has built-in support for running Claude Agent SDK sessions on a schedule. You define an agent (slug, prompt, model, cron schedule, cost ceiling), enable it, and Breadbox spawns the agent at the configured cadence — minting and revoking a scoped API key per run, persisting the full transcript, and surfacing the result on the dashboard. The same machinery powers the multi-agent reviewer pattern. This page is the concept guide. For the CLI surface, see Agent automation; for the worked patterns, see the Common workflows tab.Documentation Index
Fetch the complete documentation index at: https://docs.breadbox.sh/llms.txt
Use this file to discover all available pages before exploring further.
What a scheduled agent is
An entry in theagent_definitions table that wires together:
- A slug — used in the admin URL and the per-run audit trail.
- A prompt — system message + user prompt scaffolding. Can include shared prompt blocks that other agents reuse.
- A model —
claude-sonnet-4-6,claude-opus-4-7, etc. - A cron schedule — when to fire. Optional; agents can be disabled or manual-only.
- A max-cost ceiling in USD — runs above this cost are killed.
- An enabled flag.
- Mints a scoped
actor_type='agent'API key namedagent:<slug>:<runShortID>. - Spawns the sidecar binary (Node, Claude Agent SDK).
- Streams every tool call and assistant turn into an NDJSON transcript file.
- Persists an
agent_runsrow with the final status, token usage, and total cost. - Revokes the API key in a deferred cleanup — even if the run crashed or timed out.
Configure your first agent
Set identity and schedule
Pick a slug (used in URLs and audit), display name, model, and a cron expression. Cron is standard 5-field syntax —
0 6 * * * runs at 6am daily, 0 6 * * 1 runs Mondays at 6am.Write the prompt
Use the wizard’s prompt editor. You can reference reusable prompt blocks (shared instructions across agents — household composition, rule conventions, output format) by name. Blocks let you avoid duplicating “here’s how this household is structured” across every agent.
Set guardrails
The max-cost-per-run field caps spend per individual run. The orchestrator’s semaphore caps concurrency to one in-flight run per agent.
Watch runs
Every run gets:- Status —
running,success,error,skipped,cancelled. - Tokens — input + output + cached, per assistant turn.
- Cost — USD, computed from token counts and model pricing.
- Transcript — the full NDJSON timeline of tool calls and assistant turns, rendered on the dashboard as a chronological feed.
From the CLI
Prompt blocks
Prompt blocks are reusable snippets you maintain in one place and reference from many agents. Typical contents:- Household composition — who lives here, what their accounts look like.
- Categorization conventions — how this household uses categories that are ambiguous in your rule library.
- Output contract — what fields the agent’s summary should always contain.
GET/POST/PATCH/DELETE /api/v1/agents/prompt-blocks — see the API Reference.
Concurrency
A per-agent semaphore guarantees at most one in-flight run per definition:- Cron firing while a run is still going — the new run is recorded with
status='skipped'. The history shows what was missed. - Manual trigger (CLI or dashboard) while a run is in flight — the request returns
503 SyncInProgress(CLI exit4) without writing a newagent_runsrow, so retries don’t pollute the history.
Credentials
The sidecar reads its Anthropic credential from one of:ANTHROPIC_API_KEY(env)CLAUDE_CODE_OAUTH_TOKEN(env)- The saved subscription token under Settings → Agents → SDK settings
Transcripts on disk
Each run writes one<runID>.ndjson file in the transcript directory. Default location depends on deployment:
- Docker —
/app/transcripts/agents(mounted as a named volume in the compose file). - Local —
BREADBOX_AGENT_TRANSCRIPT_DIRif set, otherwise the cwd-relativetranscripts/agents. - Worktrees — set
BREADBOX_AGENT_TRANSCRIPT_DIR=~/.local/share/breadbox/transcripts/agentsonce so every worktree’s server writes to a shared location.
agent.transcript_dir key in App config for a persistent value that survives restarts.
When to use scheduled agents vs MCP
A scheduled agent can call into Breadbox MCP too — that’s exactly what the sidecar does. The schedule is the difference; everything else is the same agent stack.
Next steps
Multi-agent reviewer
Chain multiple scheduled agents into a review pipeline.
CLI agent commands
Trigger runs and smoke-test from the command line.