Cookbook
Every concept in these docs has a runnable example in the CARL repo. This is the index; each links to a complete, executable script.
Running examples
Section titled “Running examples”# Set an API key for examples that call an LLMexport OPENAI_API_KEY="sk-or-v1-..."
# Run one examplePYTHONPATH=$(pwd) uv run python examples/orchestration/basic_chain_example.py
# Or run them allmake examplesTool-only and metric examples run without an API key.
Orchestration
Section titled “Orchestration”| Example | Shows |
|---|---|
| basic_chain | Core chain, dependencies, serialization. |
| parallel_branches | DAG parallelism across independent steps. |
| conditions | Conditional branching. |
| loop_until | Loop-back until a condition holds. |
| execution_modes_mock / pipeline | FAST vs SELF_CRITIC. |
Tool calling
Section titled “Tool calling”| Example | Shows |
|---|---|
| tool_steps | Tool steps, memory, mixed chains. |
| structured_output | Schema-constrained JSON output. |
Agents (multi-agent)
Section titled “Agents (multi-agent)”| Example | Shows |
|---|---|
| supervisor_routing | LLM routing to specialists. |
| llm_council | N-sample voting. |
| human_in_the_loop | Pause for human input. |
| agent_skill | AgentSkill execution. |
Evaluation
Section titled “Evaluation”| Example | Shows |
|---|---|
| metrics | Custom + built-in metrics (no API key). |
| dataset_evaluator | Batch evaluation + report. |
| reflection / reflection_metrics | Reflection, metric-fed reflection. |
RE-PLAN
Section titled “RE-PLAN”| Example | Shows |
|---|---|
| deterministic · llm_checker · voting · checkpoint_rollback · budget_guard | The RE-PLAN strategies. |
Skills & LLM inference
Section titled “Skills & LLM inference”| Example | Shows |
|---|---|
| chain_from_description | Generate a chain from NL. |
| skill_resolver | URI-based skill resolution. |
| openrouter · token_usage | OpenRouter, token accounting. |
Build one yourself
Section titled “Build one yourself”See the end-to-end tutorial — a multi-step agent built from scratch, combining LLM, tool, memory, and conditional steps.