Which agent spans are CLIENT and which are INTERNAL
RolesAI Evaluation and ReliabilityInference EngineeringAI Data Systems
The question
You add tracing to an agent. In one run it calls a model API twice, runs two tools inside its own process and sends one request to a tool server on another machine. Which of these operations get a CLIENT span, which get an INTERNAL span, and why does anyone care?
Answer it first, aloud or on paper. Then open the answer.
The answer
Show short answer
A call that leaves the process gets a CLIENT span: the two model API calls and the request to the remote tool server. The agent loop step and a tool that runs in your own process get INTERNAL spans. The kind tells a backend the direction of each call, so it can show which operations left the process and which did not.
Show full answer
The tree for this run
invoke_agent INTERNAL
├── chat CLIENT
├── execute_tool INTERNAL
│ └── remote call CLIENT
├── execute_tool INTERNAL
└── chat CLIENTEvery span shares one trace id. Each child carries the id of its parent. That is what makes the run one tree instead of six loose records.
The rule
CLIENT marks a call across a process boundary: a model provider, a tool server, a hosted agent service. INTERNAL marks the agent's own loop steps and any tool that runs in the same process. The conventions apply the same rule to the agent span itself: an agent that runs as a remote service is CLIENT from the caller, and an in-process agent framework is INTERNAL.
The attributes that go with each kind
| Span | Attributes |
|---|---|
| model call | gen_ai.operation.name, gen_ai.provider.name, gen_ai.request.model, gen_ai.response.model, gen_ai.usage.input_tokens, gen_ai.usage.output_tokens, gen_ai.response.id |
| tool call | gen_ai.tool.name, gen_ai.tool.call.id |
| agent run | gen_ai.agent.name, gen_ai.agent.id |
Why it matters
Backends draw a waterfall from the kinds and the parent links. A CLIENT span with no response id cannot be matched to the provider log. A tool span with no parent is an orphan, and you can no longer see which agent step caused the call.
Follow-ups
L1ScreenWhat joins the spans into one tree?
Show expected answer
one shared trace id, and a parent span id on every child.
L2WorkingThe agent calls a hosted agent service instead of a local one. What kind is that span?
Show expected answer
CLIENT, because the agent runs in another process.
L2WorkingWhich attribute lets a dashboard split cost by provider?
Show expected answer
gen_ai.provider.name, and multi-provider dashboards break when it is missing.L3SeniorA sub-agent runs inside the same process. Does it start a new trace?
Show expected answer
no. It is a child span under the parent agent span, so the whole run stays in one trace.
Wrong answers
Show the wrong answers that interviewers hear
“Every tool call is a CLIENT span.”
A tool that runs in your process is INTERNAL. Only the call that leaves the process is CLIENT.
“The kind is decoration.”
Backends read the kind to show direction, and the conventions set it per span category.
“Start a new trace for each tool call, for isolation.”
Separate traces lose the parent link, so you cannot see which step caused the call.
Taught in
The OpenTelemetry GenAI lesson draws the span hierarchy, and the conventions lesson names the span categories and their kinds.