Skip to main content

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.

Bitfab integrates with the OpenAI Agents SDK via a tracing processor that automatically captures agent runs, tool calls, handoffs, and guardrails as traced spans — no manual withSpan or @span decorators needed. Canonical signatures: TypeScript reference · Python reference

Supported Languages

LanguageMethodStatus
TypeScriptgetOpenAiTracingProcessor()✅ Supported
Pythonget_openai_tracing_processor()✅ Supported
RubyNot yet supported
GoNot yet supported

Quick Start

import { Bitfab } from "bitfab"
import { setTraceProcessors } from "@openai/agents"

const bitfab = new Bitfab({ apiKey: process.env.BITFAB_API_KEY })
const processor = bitfab.getOpenAiTracingProcessor()
setTraceProcessors([processor])

// All agent.run() calls are now automatically traced

TypeScript

Installation

npm install bitfab @openai/agents

Method Signature

bitfab.getOpenAiTracingProcessor(): BitfabOpenAITracingProcessor
Parameters: None. Returns: A BitfabOpenAITracingProcessor instance that implements the OpenAI Agents SDK TracingProcessor interface.

Usage

import { Bitfab } from "bitfab"
import { Agent, run, setTraceProcessors } from "@openai/agents"

const bitfab = new Bitfab({ apiKey: process.env.BITFAB_API_KEY })
const processor = bitfab.getOpenAiTracingProcessor()
setTraceProcessors([processor])

const agent = new Agent({
  name: "my-agent",
  instructions: "You are a helpful assistant.",
  model: "gpt-4o",
})

const result = await run(agent, "What's the weather?")

What Gets Captured

The processor implements the TracingProcessor interface and captures:
EventWhat’s Captured
onTraceStartTrace ID, workflow name, group ID
onTraceEndTrace completion with timing
onSpanStartSpan ID, parent ID, span type, name
onSpanEndOutput data, error (if any), timing
Span types from the OpenAI Agents SDK (agent, function, generation, guardrail, handoff, etc.) are mapped to Bitfab span data automatically.

Nesting with Core Tracing

If you wrap an agent invocation with withSpan, the OpenAI Agents spans nest as children:
const pipeline = bitfab.getFunction("my-pipeline")

const tracedRun = pipeline.withSpan(
  { name: "RunAgent", type: "agent" },
  async (query: string) => {
    return run(agent, query)
  },
)

await tracedRun("What's the weather?")
// OpenAI Agents spans appear nested under the "RunAgent" span

Error Handling

All processor callbacks are wrapped in try/catch — errors are logged but never thrown. Your agent execution is never affected by tracing failures.

Python

Installation

pip install bitfab-py[openai-tracing]
The openai-tracing extra installs openai-agents as a dependency.

Method Signature

bitfab.get_openai_tracing_processor() -> BitfabOpenAITracingProcessor
Parameters: None. Returns: A BitfabOpenAITracingProcessor instance that implements the OpenAI Agents SDK TracingProcessor interface.

Usage

import os
from bitfab import Bitfab
from agents import Agent, Runner, set_trace_processors

bitfab = Bitfab(api_key=os.environ["BITFAB_API_KEY"])
processor = bitfab.get_openai_tracing_processor()
set_trace_processors([processor])

agent = Agent(
    name="my-agent",
    instructions="You are a helpful assistant.",
    model="gpt-4o",
)

result = await Runner.run(agent, "What's the weather?")

What Gets Captured

Same as TypeScript — the processor implements the TracingProcessor interface:
EventWhat’s Captured
on_trace_startTrace ID, workflow name, group ID
on_trace_endTrace completion with timing
on_span_startSpan ID, parent ID, span type, name
on_span_endOutput data, error (if any), timing

Nesting with Core Tracing

@bitfab.span("my-pipeline", type="agent")
async def run_agent(query: str):
    return await Runner.run(agent, query)

await run_agent("What's the weather?")
# OpenAI Agents spans appear nested under the "my-pipeline" span

Error Handling

All processor callbacks are wrapped in try/except — errors are logged but never raised. Your agent execution is never affected by tracing failures. Traces flush automatically via atexit hook.