> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abv.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Cookbook Overview

> Practical recipes for building AI applications with ABV

<Info>
  This cookbook provides copy-paste recipes for common ABV patterns. Each recipe includes both Python and JavaScript/TypeScript examples.
</Info>

## What's in the Cookbook

<CardGroup cols={2}>
  <Card title="Tracing Basics" icon="route" href="/developer/cookbook/tracing-basics">
    Spans, generations, decorators, and nested observations
  </Card>

  <Card title="Gateway Patterns" icon="server" href="/developer/cookbook/gateway-patterns">
    Multi-provider LLM routing, streaming, and cost tracking
  </Card>

  <Card title="Guardrails" icon="shield-check" href="/developer/cookbook/guardrails-patterns">
    Content validation, safety checks, and custom rules
  </Card>

  <Card title="Evaluations" icon="chart-line" href="/developer/cookbook/evaluation-patterns">
    Datasets, scoring, experiments, and LLM-as-judge
  </Card>

  <Card title="Integration Patterns" icon="puzzle-piece" href="/developer/cookbook/integration-patterns">
    Combining tracing + guardrails + scoring in workflows
  </Card>

  <Card title="Production Patterns" icon="rocket" href="/developer/cookbook/production-patterns">
    Chatbots, RAG systems, agents, and error handling
  </Card>
</CardGroup>

## Prerequisites

<Tabs>
  <Tab title="Python" icon="python">
    ```bash theme={null}
    pip install abvdev openai
    ```

    ```python theme={null}
    import os
    os.environ["ABV_API_KEY"] = "sk-abv-..."
    os.environ["OPENAI_API_KEY"] = "sk-proj-..."
    ```
  </Tab>

  <Tab title="JavaScript" icon="js">
    ```bash theme={null}
    npm install @abvdev/client @abvdev/tracing @abvdev/otel openai
    ```

    ```typescript theme={null}
    // .env
    ABV_API_KEY=sk-abv-...
    OPENAI_API_KEY=sk-proj-...
    ```
  </Tab>
</Tabs>

## 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                |
