span_kind field that describes the type of operation it represents. The span kind controls how the span is rendered in the flame graph, which icon it gets in the trace detail view, and how it is counted in agent analytics. Understanding span kinds is essential for building multi-agent systems that look correct in the dashboard.
Complete span kind reference
llm
A direct call to a language model API. This is the most common span kind. Set automatically by all provider wrappers (
wrapOpenAI, wrapAnthropic, wrapGoogle, wrapGoogleGenAI, etc.).image_gen
An image generation call. Set automatically when a Gemini image model (e.g.
gemini-3.1-flash-image) returns inline_data parts, or when ai.models.generateImages() is called via the @google/genai SDK.video_gen
A video generation call. Set automatically when
ai.models.generateVideos() is called (Veo models). Tracks initiation latency; the actual video is retrieved separately via the returned long-running operation.embedding
A text embedding call. Set automatically when
ai.models.embedContent() or genai.embed_content() is used. output_tokens is always 0; cost is calculated on input tokens only.agent
The execution scope of a single agent. Created by
withAgent() in TypeScript, with_agent() in Python, and the ADK/LangChain integrations automatically. Contains all child spans produced during the agent’s run.tool
A single tool or function invocation by an agent. Created by
agent.traceTool() or automatically by the LangChain and ADK integrations when a tool is called.planning
A planning step created by
agent.logPlan(). Records the steps the agent intends to take before executing them. Useful for debugging agent reasoning.handoff
An agent-to-agent delegation. Created by
agent.delegateTo() or automatically by multi-agent frameworks. Links to the target agent span in the trace tree.retriever
A document retrieval operation (vector search, keyword search, hybrid). Set on manual spans in RAG pipelines via
startSpan({ span_kind: "retriever" }) or automatically by the LangChain retriever handler.guardrail
A guardrail check execution. Set automatically when the SDK’s guardrail client makes a check request. Shows pre/post phase, action taken (allowed/blocked/redacted), and latency.
mcp_client
A call made through an MCP client (
initialize, tools/list, tools/call), recorded by the SDKs automatically. Carries the MCP server, transport, whether the tool was listed, whether the arguments fit its schema, and the error code. See MCP.mcp_server_tool
A tool of your own MCP server, wrapped with
mcpServerTool() (TypeScript) or @mcp_server_tool (Python); joins the caller’s trace. See MCP.gateway
A span from an AI gateway that is not a model call: the gateway’s proxy, routing and infrastructure spans and the retry or fallback attempts of one request, stored when a gateway exports OTLP to
/v1/traces. Never counted as a model call (model-call and LLM call counts); proxy, routing and infrastructure spans have no model, tokens or cost of their own. Like any span they still count toward your span quota and appear in trace and request totals. Failed attempts keep their HTTP status, error type and provider. See AI gateways.general
A generic custom operation that doesn’t fit another category. The default for manually created spans that don’t specify a
span_kind.Flame graph rendering
Each span kind is rendered differently in the trace flame graph:Setting span kind manually
When creating a manual span withstartSpan(), set the span_kind explicitly:
- TypeScript
- Python
How span kinds appear in the agent registry
The Agents section of the dashboard uses span kinds to build its agent registry:- Spans with
span_kind: "agent"appear as agent nodes - Their
parent_span_idis used to build the coordinator-specialist hierarchy toolspans are aggregated under their parent agent to build the tool inventoryhandoffspans are used to draw delegation arrows between agents
agentRole: "coordinator" on orchestrators and agentRole: "specialist" on sub-agents.

SpanKind in the event schema
Thespan_kind field is part of the ZespanEvent schema sent to the ingest endpoint. When building a custom integration (not using an SDK wrapper), include it explicitly:
"llm", "image_gen", "video_gen", "embedding", "agent", "tool", "planning", "handoff", "retriever", "guardrail", "general".
