Required Attributes
All LLM spans MUST include:openinference.span.kind: Set to"LLM"llm.system: The AI system/product (e.g., “openai”, “anthropic”)
Common Attributes
LLM spans typically include:Context Attributes
All LLM spans automatically inherit context attributes when they are set via the instrumentation context API. These attributes are propagated to every span in the trace without needing to be explicitly set on each span:See Configuration for details on how to set these context attributes.
Attribute Flattening
While the examples below show attributes in a nested JSON format for readability, in actual OpenTelemetry spans, these attributes are flattened using indexed dot notation:
llm.input_messages.0.message.roleinstead ofllm.input_messages[0].message.rolellm.output_messages.0.message.tool_calls.0.tool_call.function.namefor nested tool callsllm.tools.0.tool.json_schemafor tool definitions
Tool Role Messages
When a message withmessage.role set to "tool" represents the result of a function call, the message.name attribute MAY be set to identify which function produced the result. This complements message.tool_call_id, which links the result back to the original tool call request. For example:
See Tool Calling for the complete tool calling flow.