Skip to content

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.

Terminal window
# Set an API key for examples that call an LLM
export OPENAI_API_KEY="sk-or-v1-..."
# Run one example
PYTHONPATH=$(pwd) uv run python examples/orchestration/basic_chain_example.py
# Or run them all
make examples

Tool-only and metric examples run without an API key.

ExampleShows
basic_chainCore chain, dependencies, serialization.
parallel_branchesDAG parallelism across independent steps.
conditionsConditional branching.
loop_untilLoop-back until a condition holds.
execution_modes_mock / pipelineFAST vs SELF_CRITIC.
ExampleShows
tool_stepsTool steps, memory, mixed chains.
structured_outputSchema-constrained JSON output.
ExampleShows
supervisor_routingLLM routing to specialists.
llm_councilN-sample voting.
human_in_the_loopPause for human input.
agent_skillAgentSkill execution.
ExampleShows
metricsCustom + built-in metrics (no API key).
dataset_evaluatorBatch evaluation + report.
reflection / reflection_metricsReflection, metric-fed reflection.
ExampleShows
deterministic · llm_checker · voting · checkpoint_rollback · budget_guardThe RE-PLAN strategies.
ExampleShows
chain_from_descriptionGenerate a chain from NL.
skill_resolverURI-based skill resolution.
openrouter · token_usageOpenRouter, token accounting.

See the end-to-end tutorial — a multi-step agent built from scratch, combining LLM, tool, memory, and conditional steps.