Skip to main content
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

Choose a Framework

LangGraph / LangChain

Callback tracing for framework calls, plus experimental replayable LangGraph ToolNode execution in TypeScript and Python.

LangChain Deep Agents

One middleware that records a deep agent’s todo list, file tools, and subagents as a replayable trace, with subagent runs skipped on replay.

OpenAI Agents SDK

Trace processor that captures agent runs, tool calls, and handoffs from the OpenAI Agents SDK, plus a run wrapper that records a replayable root.

BAML

Auto-capture rendered prompts and LLM metadata (model, tokens, duration) from BAML function calls.

Jev

Record the model, token usage, and duration of calls to Jev, TypeSafe’s System One model.

OpenRouter

Record prompts, routed models, tokens, and OpenRouter’s reported cost for direct OpenRouter calls, automatically under a trace root.

Anthropic

Record prompts, models, tokens, and cost for direct Anthropic API calls, automatically under a trace root.

OpenAI Responses API

Record prompts, models, tokens, and cost for direct OpenAI Responses API calls, automatically under a trace root.

Claude Agent SDK

Handler that captures LLM turns, tool invocations, and subagent execution from the Claude Agent SDK.

Vercel AI SDK

Language model middleware that captures every generateText / streamText / generateObject / streamObject call, with full streaming support.

Rivet

Bind a live actor context to one existing subtree root, hydrate captured state during replay, and explicitly mock supported context paths.

How It Works

Each framework handler integrates with Bitfab’s tracing pipeline:
  1. Make the trace function, then the handler (const myAgent = bitfab.getFunction("my-agent"), then myAgent.getLangGraphCallbackHandler()). The client-level bitfab.getLangGraphCallbackHandler("my-agent") is equally supported; binding the key once just keeps the handler and any outer root on the same key.
  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.
Tracing-only handlers are fire-and-forget and do not affect application execution. The experimental LangGraph replay-aware execution hooks can substitute selected calls; if an expected tool recording is missing, the tool does not run and LangGraph applies the ToolNode’s configured error behavior.