Skip to main content
The most common production pattern: auto-instrumentation handles LLM provider calls, manual spans cover the custom parts (tool executions, orchestration, domain logic). They stitch together automatically into the same trace because they share the same TracerProvider. If your app uses tool/function calling and auto only captures the LLM API call — not your code that runs the tool — this pattern fills in the gaps.
1

Set up auto-instrumentation

Register your tracer provider and auto-instrument your LLM provider:
2

Get a tracer for manual spans

Use the same TracerProvider to get a tracer — this ensures manual and auto spans end up in the same trace:
3

Add manual CHAIN and TOOL spans around your logic

Manual spans automatically nest as children of each other and alongside auto-instrumented spans:
The result is a complete trace tree: CHAIN (manual) → LLM (auto) → TOOL (manual). Without the manual spans, you’d only see the LLM call — the tool execution and agent orchestration would be invisible.

Next step

Visualize your agent’s execution as an interactive graph:

Next: Agent Trajectory