Cookbook¶
Mature, runnable examples for every major capability, in the
cookbook/ tree.
Each recipe is one focused file; each app is a realistic multi-feature
application. Everything runs offline with a deterministic TestModel (so it and
its CI test need no key) and runs live by setting YAAB_SAMPLE_MODEL.
export YAAB_SAMPLE_MODEL=gemini/gemini-2.5-flash # any LiteLLM model id
python -m cookbook.recipes.agents
python -m cookbook.apps.support_desk
Flagship apps¶
Realistic applications that combine several capabilities end-to-end.
| App | Scenario | Capabilities |
|---|---|---|
support_desk |
Grounded, governed, safe-to-act support | RAG · tools · HITL approval · per-tenant spend caps · OpenAI-compat serving |
refund_pipeline |
Durable workflow with a human gate | Flow · pause→decide→resume · durable checkpoint + approval store |
research_assistant |
Durable multi-step research | Flow · hybrid (BM25+dense) retrieval · streaming · browser + record/replay (live) |
coding_agent |
Plan, then run code in a sandbox | multi-agent (planner→coder) · sandboxed exec · tool approval |
Recipes¶
One focused, self-checking example per capability (python -m cookbook.recipes.<name>).
| Recipe | Capability | Docs |
|---|---|---|
agents |
The typed Agent unit of work |
Agents |
tools |
Give an agent a typed function to call | Tools |
typed_output |
Get a validated Pydantic object back | Agents |
sessions |
Durable, multi-turn conversations | State |
memory |
Long-term recall, scoped per user | State |
rag |
Ground answers in your documents | RAG |
hybrid_retrieval |
Fuse sparse (BM25) + dense recall | RAG |
streaming |
Token-by-token output | Streaming |
sequential |
Fixed steps, each building on the last | Multi-agent |
parallel |
Fan out the same input to several agents | Multi-agent |
map_agent |
One agent across many inputs | Multi-agent |
loop |
Re-run until a quality bar (or a cap) | Multi-agent |
swarm |
Autonomous hand-off between peers | Multi-agent |
conditions |
Guard steps with when=/stop=/else_= |
Conditions |
router |
Deterministic exclusive choice | Conditions |
flow |
Explicit, durable control flow | Flow |
hitl |
Gate a sensitive tool on approval | Human-in-the-loop |
durable_runs |
Runs as durable records; multi-pod | Durable runs |
spend_governance |
Per-identity / per-tenant budget caps | Governance |
governance |
Guardrails that block unsafe input | Governance |
evaluation |
Score outputs against expectations | Evaluation |
optimization |
Tune a prompt at build time, freeze it | Optimization |
serving |
Expose an agent over HTTP | Serving |
openai_compat |
Serve /v1/chat/completions |
OpenAI-compatible API |
record_replay |
Deterministic offline tests of real runs | Record & replay |
browser |
Drive a real browser, safely | Tools |
interop |
Expose YAAB tools over MCP | Interop |
harness |
Sandboxed, approval-gated coding agent that edits a file | Coding harness |
How they're tested¶
tests/test_cookbook.py auto-discovers every recipe and app and runs it offline,
and each one self-checks its result — so an example that imports clean but does
the wrong thing fails CI.