OpenAI Chat Completion
Initialize tracing before constructing the OpenAI client. The SDK patches Chat Completions and emits anLLM span with input messages, output messages,
model name, invocation parameters, finish reason, and token counts.
OpenAI Tool Round Trip
Tool calls are captured on the model span. The first turn records the assistant tool call and arguments; the second turn records the tool result in the input message list.TOOL span, see
Manual spans.
OpenAI Structured Output
Structured-output requests keep the schema inllm.invocation_parameters and
the model response in output.value.
OpenAI Responses API
The Responses API is traced separately from Chat Completions. Function-call items are normalized into the same OpenInference tool-call attributes used by Chat Completions, so the dashboard renders them the same way.Anthropic Messages
Anthropic Messages calls emitLLM spans with user and assistant content
blocks, model name, invocation parameters, finish reason, and usage.
Anthropic Prompt Caching
When Anthropic returns prompt-cache usage fields, Catalyst maps them to OpenInference token detail attributes so they show up alongside the regular token counts on the LLM span.llm.token_count.prompt_details.cache_write and
llm.token_count.prompt_details.cache_read. See the
Attributes reference for the
full set of token-detail keys.
Manual Parent Around Automatic Children
Use an outer agent span around orchestration code when you want nested LLM, tool, or framework spans grouped under one product-level operation. Spans created inside the callback auto-parent under the agent span via OTel context propagation.OpenAI Agents With Outer Span
Pair OpenAI Agents with OpenAI instrumentation. UseagentSpan() /
agent_span() for an explicit outer span; nested OpenAI calls are captured
automatically and parent under it.
OpenAI Agents Handoff
Handoffs create a useful trace tree when wrapped in an outer agent span: the triage agent, specialist agent, model calls, and tools are all grouped under one customer request.TypeScript
LangChain Agent With Tools
LangChain instrumentation hooks the callback manager. You do not need to wrap each tool or model call manually; chain, LLM, and tool spans are emitted from the framework callbacks. If the same agent is already wrapped with LangSmith@traceable, keep that
decorator in place and install the langsmith extra. Catalyst uses the
LangSmith OTel span as the active parent, so the LangChain and provider spans
stay grouped under the decorated run.
Pydantic AI Structured Agent (Python)
Pydantic AI ships native OpenTelemetry instrumentation. Catalyst registers its provider and enables Pydantic AI instrumentation duringsetup().
Python
Claude Agent SDK
Python can patch the SDK duringsetup() before query is imported.
TypeScript uses an explicit wrapper because ESM namespace bindings cannot be
safely patched.
CLI Or Subprocess Work
When a tool has no instrumentable SDK, wrap the subprocess call in an agent span and set the input, output, and token usage when available.Recommended Reading Order
- Traces Quickstart — install, configure export, capture your first span.
- OpenAI traces or Anthropic traces — the provider you use first.
- Manual spans — tool, chain, and retriever spans inside your agent loop.
- Production Agent Example — a production-shaped agent end to end.
- Agent identity — stable IDs for dashboard grouping.
- Troubleshooting — missing spans, missing attributes, shutdown.