This cookbook provides copy-paste recipes for common ABV patterns. Each recipe includes both Python and JavaScript/TypeScript examples.
What’s in the Cookbook
Tracing Basics
Spans, generations, decorators, and nested observations
Gateway Patterns
Multi-provider LLM routing, streaming, and cost tracking
Guardrails
Content validation, safety checks, and custom rules
Evaluations
Datasets, scoring, experiments, and LLM-as-judge
Integration Patterns
Combining tracing + guardrails + scoring in workflows
Production Patterns
Chatbots, RAG systems, agents, and error handling
Prerequisites
- Python
- JavaScript
Quick Reference
| Pattern | Use When |
|---|---|
@observe / observe() | Tracing existing functions without modification |
| Context managers | Manual control over span lifecycle |
| Manual spans | Fine-grained control, custom nesting |
| Gateway | Unified LLM API across providers |
| Guardrails | Input/output validation |
| Scores | Quality measurement and feedback |