Skip to main content
This cookbook provides copy-paste recipes for common ABV patterns. Each recipe includes both Python and JavaScript/TypeScript examples.

What’s in the Cookbook

Prerequisites

pip install abvdev openai
import os
os.environ["ABV_API_KEY"] = "sk-abv-..."
os.environ["OPENAI_API_KEY"] = "sk-proj-..."

Quick Reference

PatternUse When
@observe / observe()Tracing existing functions without modification
Context managersManual control over span lifecycle
Manual spansFine-grained control, custom nesting
GatewayUnified LLM API across providers
GuardrailsInput/output validation
ScoresQuality measurement and feedback