DAG-based workflows
Define workflows as directed acyclic graphs in YAML or Python. Steps, dependencies and routing are declared upfront: the LLM generates text, not control flow.
Native observability
OpenTelemetry traces and Prometheus metrics for every step, and a Grafana dashboard to read them. No external SaaS required.
Built-in resilience
Retries with backoff, timeouts, and a circuit breaker and rate limiter per provider. Checkpoints let a failed or paused run resume where it left off.
Cost control
Tokens and cost tracked for every step, and a budget per workflow: once
budget_usdis spent, no further step starts.
Requirements
- Python 3.11 or newer. AgentLoom supports 3.11 to 3.14.
- A model to call. An API key for OpenAI, Anthropic or Google, or a local Ollama. No key at all works too: the
mockprovider answers offline. - No provider SDKs. AgentLoom calls each provider’s HTTP API itself, so
pipinstalls nothing from OpenAI, Anthropic or Google.
Installation
pip install agentloompip install "agentloom[observability]"OpenTelemetry and the Prometheus client, for traces and metrics.
pip install "agentloom[graph]"NetworkX, for the Graph API.
pip install "agentloom[all]"With extras, keep the quotes: zsh reads unquoted brackets as a file pattern. To check the install, agentloom info prints the version, the Python it runs on, which optional extras are installed and which provider keys are set (never their values).
Quick start
1. Create a workflow — my_workflow.yaml:
name: simple-qaconfig: provider: openai model: gpt-4o-mini
state: question: "What is Python in one sentence?"
steps: - id: answer type: llm_call prompt: "Answer this question concisely: {state.question}" output: answerOne step calls the model with a prompt built from the state, and writes the reply to the answer key.
2. Run it with the provider you have:
export OPENAI_API_KEY=sk-...agentloom run my_workflow.yamlexport ANTHROPIC_API_KEY=sk-ant-...agentloom run my_workflow.yaml --provider anthropic --model claude-haiku-4-5-20251001export GOOGLE_API_KEY=...agentloom run my_workflow.yaml --provider google --model gemini-2.5-flashollama pull phi4agentloom run my_workflow.yaml --provider ollama --model phi4Free and local. Ollama must be running (ollama serve) at http://localhost:11434.
agentloom run my_workflow.yaml --provider mockEvery call answers with the placeholder text Mock response: enough to try the CLI and check a workflow’s wiring. Testing & Replay shows how to replay real responses instead.
3. Read the result. The run prints a summary:
Running workflow: simple-qa
============================================================Workflow: simple-qaStatus: [OK] successDuration: 812.4msTokens: 41Cost: $0.0000
Steps: [OK] answer (809ms)
Final State Keys: ['question', 'answer', 'steps']============================================================The summary lists what each step did, not what the model said. To see the answer, ask for the whole result as JSON, or stream the text as it arrives:
agentloom run my_workflow.yaml --json | jq -r .final_state.answeragentloom run my_workflow.yaml --stream4. Validate and visualize:
agentloom validate my_workflow.yaml # check the file without running itagentloom visualize my_workflow.yaml # draw the DAG as text; --format mermaid for a diagramKeys and providers
- Keys come from the environment:
OPENAI_API_KEY,ANTHROPIC_API_KEYandGOOGLE_API_KEY. AgentLoom reads no.envfile, so load one with your shell or a tool like direnv. Each provider whose key is set is available to every step. - The model name finds the providers.
gpt-*,o1,o3ando4models go to OpenAI,claude*to Anthropic,gemini*to Google.--providersays which provider is tried first, if it can serve the model. On a workflow with nomodel,--provider anthropicbrings Anthropic’s default; on one that names a model, pass--modeltoo. - Ollama takes no key. It is used when a workflow says
provider: ollama(or--provider ollama), and accepts any model name. - Endpoints can be changed with
OPENAI_BASE_URL,ANTHROPIC_BASE_URL,GOOGLE_BASE_URLandOLLAMA_BASE_URL, for a proxy or a self-hosted gateway. Any other OpenAI-compatible server works through thegeneric_openaiprovider.
Providers covers every provider, model and capability.
What a run leaves behind
| Path | Written | What it is |
|---|---|---|
agentloom_runs/<run_id>.json | Every run | A record of the run: status, steps, tokens and cost. AGENTLOOM_RUNS_DIR moves it; agentloom history reads it. See run history. |
.agentloom/checkpoints/<run_id>.json | With --checkpoint | The state a run stopped with, which agentloom resume continues from. |
| Traces and metrics | With the observability extra installed | Sent over OTLP to OTEL_EXPORTER_OTLP_ENDPOINT (default http://localhost:4317). --lite turns them off. See Observability. |
Both directories sit in the current directory: add agentloom_runs/ and .agentloom/ to your .gitignore.
Exit codes
| Code | When |
|---|---|
0 | The workflow succeeded, or paused at an approval gate. |
1 | The workflow failed, timed out or ran out of budget, or the file did not load. |
2 | The command was misused: a missing file or options that cannot go together. |
Scripts and CI jobs can rely on them; --json prints the full result either way.
Common first-run errors
| You see | Why | Fix |
|---|---|---|
No provider registered for model 'gpt-4o-mini' | No key is set for the provider that serves the model. | Export the key; agentloom info shows which keys are set. |
All providers failed for model … with a 401 or 403 | The key is wrong or revoked. | Check the key in the provider’s console. |
All providers failed for model … with a 404 | The provider doesn’t know the model, often a retired alias. | Use one of the recommended model IDs. |
A connection error with --provider ollama | Ollama isn’t running, or the model isn’t pulled. | ollama serve, then ollama pull phi4. |
Error loading workflow with Extra inputs are not permitted | A key in the YAML is misspelled. | agentloom validate names the field. |
A prompt shows an empty value, or a literal {name} | The template names a state key that doesn’t exist: {state.name} renders empty, {name} stays as written. | Check the key against state: and the steps’ output:. See Missing keys. |
zsh: no matches found: agentloom[all] | The extras aren’t quoted. | pip install "agentloom[all]". |
| Export errors in the log after a run | The observability extra is installed, but no collector listens at the OTLP endpoint. | Pass --lite, or start the observability stack. |
What’s next
Workflows, steps, state, providers and runs: the ideas every other page builds on.
Every key of a workflow file, every config option and what validate checks.
The seven step types, with routers, subworkflows, approval gates and embeddings in full.
How steps write to the state, and the template syntax that reads it.
Providers, models, attachments, reasoning and pricing.
Every
agentloomcommand and option.39 example workflows, from one LLM call to production-grade pipelines.
Build and run workflows from Python.
Record real runs and replay them offline, deterministically.
Traces, metrics, dashboards and run records.
Docker, Kubernetes, Helm, Terraform and ArgoCD.
How the engine schedules, runs and records a workflow.
Analyze, visualize and export workflow DAGs.
Every release and what changed in it.