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

# Framework Integrations

> Automatic tracing for popular AI frameworks with Bitfab

Bitfab provides automatic tracing for popular AI frameworks. Instead of manually wrapping every function with `withSpan` or `@span`, use a framework-specific handler that hooks into the framework's execution lifecycle and captures spans automatically.

## Framework Support

| Framework                                        | TypeScript | Python | Ruby |  Go |
| ------------------------------------------------ | :--------: | :----: | :--: | :-: |
| [LangGraph / LangChain](/frameworks/langgraph)   |      ✅     |    ✅   |   -  |  -  |
| [OpenAI Agents SDK](/frameworks/openai-agents)   |      ✅     |    ✅   |   -  |  -  |
| [BAML](/frameworks/baml)                         |      ✅     |    ✅   |   -  |  -  |
| [Claude Agent SDK](/frameworks/claude-agent-sdk) |      ✅     |    ✅   |   -  |  -  |
| [Vercel AI SDK](/frameworks/vercel-ai-sdk)       |      ✅     |    -   |   -  |  -  |

## Choose a Framework

<CardGroup cols={2}>
  <Card title="LangGraph / LangChain" icon="diagram-project" href="/frameworks/langgraph">
    Callback handler that captures graph nodes, LLM calls, tool invocations, and retriever queries as traced spans.
  </Card>

  <Card title="OpenAI Agents SDK" icon="robot" href="/frameworks/openai-agents">
    Trace processor that captures agent runs, tool calls, and handoffs from the OpenAI Agents SDK, plus a run wrapper that records a replayable root.
  </Card>

  <Card title="BAML" icon="wand-magic-sparkles" href="/frameworks/baml">
    Auto-capture rendered prompts and LLM metadata (model, tokens, duration) from BAML function calls.
  </Card>

  <Card title="Claude Agent SDK" icon="microchip" href="/frameworks/claude-agent-sdk">
    Handler that captures LLM turns, tool invocations, and subagent execution from the Claude Agent SDK.
  </Card>

  <Card title="Vercel AI SDK" icon="bolt" href="/frameworks/vercel-ai-sdk">
    Language model middleware that captures every generateText / streamText / generateObject / streamObject call, with full streaming support.
  </Card>
</CardGroup>

## How It Works

Each framework handler integrates with Bitfab's tracing pipeline:

1. **Create a handler** via the Bitfab client (e.g., `bitfab.getLangGraphCallbackHandler("my-agent")`)
2. **Pass the handler** to the framework (as a callback, processor, or hook)
3. **Spans are created automatically** for each execution step (LLM calls, tool invocations, etc.)
4. **Add core tracing only around real surrounding work** - callback handlers such as LangGraph / LangChain already create a replayable root for the framework invocation. Use a same-key `withSpan` or `@span` outer root only when input prep, non-framework retrieval, post-processing, persistence, or downstream calls should be part of the same trace.

All framework handlers are fire-and-forget - they never throw errors or affect your application's execution.
