[RFC] Semantic Conventions for AI Agent Observability
OpenTelemetry Semantic Conventions for AI Agents
Table of Contents
- Introduction
- Overview
- Span Definitions
- Attribute Registry
- Event Definitions - in a comment
- Metrics Definitions - in a comment
Introduction
This document defines semantic conventions for observability of AI agent systems built with frameworks like LangGraph, CrewAI, Autogen, Google ADK, LlamaIndex, OpenAI Agents SDK, Agno, MastraAI, Smolagents, Haystack, and AWS Bedrock AgentCore.
These conventions extend the existing OpenTelemetry Semantic Conventions for GenAI by adding specialized concepts for:
- Agent lifecycle and orchestration - Creation, execution, handoffs, termination
- Multi-agent coordination - Teams, crews, agent-to-agent communication
- Task management - Task creation, execution, delegation, hierarchies
- Memory systems - Short-term, long-term, vector-based memory operations
- Tool execution - Function calling, MCP integrations, error handling
- Workflow orchestration - Graph-based execution, state transitions, checkpointing
- Quality assurance - Guardrails, runtime evaluations, human-in-the-loop
- Session management - Conversations, context, checkpointing
Design Principles
- Framework Agnostic - Conventions work across all major agent frameworks
- Extend, Don't Replace - Build on existing
gen_ai.*conventions
Namespace Convention
All agent-specific attributes use the gen_ai.* prefix to align with existing OpenTelemetry GenAI semantic conventions:
gen_ai.agent.*- Agent-specific attributesgen_ai.team.*- Multi-agent team attributesgen_ai.task.*- Task-specific attributesgen_ai.tool.*- Tool execution attributes (extends existing)gen_ai.memory.*- Memory system attributesgen_ai.workflow.*- Workflow orchestration attributesgen_ai.session.*- Session management attributes- And more...
Overview
Agent System Architecture
Modern AI agent systems typically consist of:
Session (Conversation)
├── Agent(s)
│ ├── Workflow/Graph (Orchestration)
│ │ ├── Task(s) (Work Units)
│ │ │ ├── LLM Calls (Reasoning)
│ │ │ ├── Tool Executions (Actions)
│ │ │ ├── Memory Operations (Context)
│ │ │ └── Guardrails (Quality)
│ │ └── State Transitions
│ ├── Handoffs (Agent-to-Agent)
│ └── Human Reviews (HITL)
└── Artifacts (Outputs)Span Types Summary
This specification defines 20 primary span types organized into categories:
- Lifecycle (4): session, agent.create, agent.invoke, agent.terminate
- Orchestration (6): team.create, team.execute, team.coordinate, workflow.execute, workflow.transition, workflow.branch
- Task Execution (4): task.create, task.execute, task.delegate, agent.handoff
- Memory (5): memory.store, memory.retrieve, memory.search, memory.update, memory.delete
- Tools & Integration (3): tool.execute, mcp.connect, mcp.execute
- Context & State (2): context.checkpoint, context.compress
- Quality & Control (3): guardrail.check, eval.execute, human.review
Plus existing gen_ai.client.* spans for LLM operations.
Span Definitions
Naming Convention
All span names follow the pattern: gen_ai.<component>.<operation>
Examples:
gen_ai.agent.invokegen_ai.memory.retrievegen_ai.workflow.execute
1. Lifecycle Spans
1.1 gen_ai.session
Description: Represents a complete agent session, conversation, or autonomous run. This is the top-level span encompassing all agent activities.
Span Kind: INTERNAL
Required Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.session.id |
string | Unique session identifier (stable across resumptions) | "sess_abc123", "conv_456def" |
gen_ai.session.start_time |
timestamp | Session start timestamp | 2025-01-23T10:30:00Z |
Optional Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.session.type |
string | Session category | "chat", "autonomous_run", "multi_agent_session", "batch" |
gen_ai.session.thread_id |
string | Thread identifier (multi-tenant scenarios) | "thread_789" |
gen_ai.session.user_id |
string | End-user identifier (hashed/PII-safe) | "user_hash_xyz" |
gen_ai.session.persistent |
boolean | Whether session state persists | true, false |
gen_ai.session.message_count |
int | Total messages in session | 15 |
gen_ai.session.turn_count |
int | Total conversation turns | 7 |
gen_ai.session.start_reason |
string | What triggered this session | "user_message", "scheduled_task", "api_call", "webhook" |
gen_ai.agent.framework |
string | Primary agent framework used | "langgraph", "crewai", "autogen", "openai-agents" |
gen_ai.agent.framework.version |
string | Framework version | "0.2.0", "1.5.3" |
gen_ai.environment |
string | Deployment environment | "dev", "staging", "prod" |
Framework Examples:
- LangGraph: Session maps to a thread with persistent checkpoint history
- CrewAI: Session encompasses full crew execution
- OpenAI Agents SDK: Session corresponds to SQLiteSession or custom session
- Google ADK: Session managed by SessionService (in-memory, SQL, or Vertex AI)
1.2 gen_ai.agent.create
Description: Agent initialization and configuration. Captures the creation of an agent instance with its configuration.
Span Kind: INTERNAL
Required Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.agent.id |
string | Unique agent instance identifier | "agent_123", "researcher_01" |
gen_ai.agent.name |
string | Human-readable agent name | "TravelAssistant", "CodeReviewer", "ResearchAgent" |
gen_ai.agent.type |
string | Agent implementation type | "react", "function_calling", "conversational", "task_executor" |
gen_ai.agent.framework |
string | Framework used to build agent | "langgraph", "crewai", "llamaindex", "smolagents" |
Optional Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.agent.role |
string | Agent's role or persona | "Senior Python Engineer", "Support Specialist", "Researcher" |
gen_ai.agent.goal |
string | Agent's high-level objective | "Research AI trends", "Fix bugs in codebase" |
gen_ai.agent.backstory |
string | Agent's personality/context description | "You're a seasoned researcher..." |
gen_ai.agent.mode |
string | Architectural pattern | "react", "plan_and_solve", "autonomous", "supervisor", "code_interpreter" |
gen_ai.agent.version |
string | Agent version | "1.0.0", "v2" |
gen_ai.agent.capabilities |
string[] | List of agent capabilities | ["web_search", "code_execution", "file_access"] |
gen_ai.agent.tools |
string[] | List of tool names available to agent | ["calculator", "search_web", "read_file"] |
gen_ai.agent.memory_enabled |
boolean | Whether agent has memory | true, false |
gen_ai.agent.delegation_enabled |
boolean | Whether agent can delegate to others | true, false |
gen_ai.agent.max_iterations |
int | Maximum execution iterations | 10, 50 |
gen_ai.agent.timeout_ms |
int | Execution timeout in milliseconds | 30000, 60000 |
Framework Examples:
- CrewAI:
@agentdecorator with role, goal, backstory, tools - Autogen:
AssistantAgentwith name, system_message, tools, max_tool_iterations - OpenAI SDK:
Agentwith name, instructions, tools, handoffs, output_type - Agno:
Agent(name, model, instructions, tools, add_history_to_context)
1.3 gen_ai.agent.invoke
Description: A single agent invocation/execution. This is the primary span for agent activity.
Span Kind: INTERNAL
Required Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.agent.id |
string | Agent instance identifier | "agent_123" |
gen_ai.agent.name |
string | Agent name | "TravelAssistant" |
gen_ai.operation.name |
string | Operation being performed | "execute", "run", "process" |
Optional Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.session.id |
string | Associated session ID | "sess_abc123" |
gen_ai.session.thread_id |
string | Thread identifier | "thread_789" |
gen_ai.request.model |
string | Primary LLM model used | "gpt-4", "claude-3-5-sonnet" |
gen_ai.response.model |
string | Actual model that responded | "gpt-4-0613" |
gen_ai.usage.total_tokens |
int | Total tokens consumed | 1523 |
gen_ai.runtime.llm_calls_count |
int | Number of LLM calls made | 3 |
gen_ai.runtime.tool_calls_count |
int | Number of tool invocations | 5 |
gen_ai.runtime.duration_ms |
int | Total execution duration | 4500 |
gen_ai.runtime.iterations |
int | Number of agent loop iterations | 3 |
error.type |
string | Error type if failed | "timeout", "tool_error", "model_error" |
Framework Examples:
- LlamaIndex:
agent.run()oragent.chat()invocation - LangGraph:
graph.invoke()orgraph.stream()execution - OpenAI SDK:
Runner.run()orRunner.run_sync()call - Smolagents:
agent.run()with ReAct loop
1.4 gen_ai.agent.terminate
Description: Agent cleanup and termination. Captures the end of an agent's lifecycle.
Span Kind: INTERNAL
Required Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.agent.id |
string | Agent instance identifier | "agent_123" |
gen_ai.agent.name |
string | Agent name | "TravelAssistant" |
Optional Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.agent.termination_reason |
string | Why agent terminated | "completed", "error", "timeout", "user_cancelled" |
gen_ai.runtime.total_invocations |
int | Total times agent was invoked | 15 |
gen_ai.runtime.total_duration_ms |
int | Cumulative execution time | 125000 |
2. Orchestration Spans
2.1 gen_ai.team.create
Description: Multi-agent team or crew initialization.
Span Kind: INTERNAL
Required Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.team.id |
string | Unique team identifier | "team_research", "crew_123" |
gen_ai.team.name |
string | Team name | "Research Team", "Support Crew" |
gen_ai.team.size |
int | Number of agents in team | 3, 5 |
gen_ai.team.orchestration_pattern |
string | How team coordinates | "sequential", "hierarchical", "round_robin", "selector" |
Optional Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.team.manager_agent_id |
string | Manager/coordinator agent ID | "agent_manager_1" |
gen_ai.agent.framework |
string | Framework used | "crewai", "autogen" |
gen_ai.team.agents |
string[] | List of agent IDs in team | ["agent_1", "agent_2", "agent_3"] |
Framework Examples:
- CrewAI:
Crew(agents=[...], process=Process.SEQUENTIAL) - Autogen:
GroupChat(participants=[...], max_rounds=10) - Agno: Multi-agent teams with shared state
2.2 gen_ai.team.execute
Description: Execution of a multi-agent team workflow.
Span Kind: INTERNAL
Required Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.team.id |
string | Team identifier | "team_research" |
gen_ai.team.name |
string | Team name | "Research Team" |
gen_ai.workflow.type |
string | Type of workflow | "sequential", "hierarchical", "parallel" |
Optional Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.workflow.id |
string | Workflow instance ID | "workflow_run_456" |
gen_ai.workflow.status |
string | Execution status | "running", "completed", "failed", "paused" |
gen_ai.runtime.total_duration_ms |
int | Total execution time | 45000 |
gen_ai.runtime.total_tokens |
int | Total tokens consumed | 5000 |
gen_ai.team.rounds_completed |
int | Conversation rounds completed | 3 |
error.type |
string | Error type if failed | "coordination_error", "timeout" |
2.3 gen_ai.team.coordinate
Description: Coordination action between team members (e.g., turn selection, task routing).
Span Kind: INTERNAL
Required Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.team.id |
string | Team identifier | "team_research" |
gen_ai.team.coordination_type |
string | Type of coordination | "turn_selection", "task_routing", "conflict_resolution" |
Optional Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.team.current_speaker |
string | Agent currently active | "agent_researcher" |
gen_ai.team.next_speaker |
string | Next agent to activate | "agent_writer" |
gen_ai.team.selection_method |
string | How next speaker selected | "round_robin", "llm_selected", "manual" |
Framework Examples:
- Autogen: GroupChatManager selecting next speaker
- CrewAI: Hierarchical process with manager delegation
2.4 gen_ai.workflow.execute
Description: Execution of a workflow, graph, or orchestration pattern.
Span Kind: INTERNAL
Required Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.workflow.id |
string | Workflow identifier | "workflow_123", "graph_main" |
gen_ai.workflow.name |
string | Workflow name | "Research Pipeline", "RAG Workflow" |
gen_ai.workflow.type |
string | Workflow pattern | "graph", "sequential", "parallel", "loop", "conditional" |
Optional Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.workflow.status |
string | Execution status | "running", "completed", "failed", "interrupted" |
gen_ai.workflow.total_nodes |
int | Number of nodes/steps | 10 |
gen_ai.workflow.execution_path |
string[] | Nodes executed in order | ["start", "retrieve", "grade", "generate", "end"] |
gen_ai.workflow.depth |
int | Nesting depth (for nested workflows) | 1, 2 |
gen_ai.team.id |
string | Associated team if applicable | "team_research" |
gen_ai.runtime.total_duration_ms |
int | Total execution time | 12000 |
Framework Examples:
- LangGraph:
StateGraph.invoke()execution - Mastra:
Workflow.execute()with .then()/.branch()/.parallel() - CrewAI: Flow execution with @start, @listen, @router
- Google ADK: SequentialAgent, ParallelAgent, LoopAgent execution
2.5 gen_ai.workflow.transition
Description: State transition between workflow nodes/steps.
Span Kind: INTERNAL
Required Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.workflow.id |
string | Workflow identifier | "workflow_123" |
gen_ai.state.transition_from |
string | Source node/state | "retrieve_docs" |
gen_ai.state.transition_to |
string | Destination node/state | "grade_docs" |
Optional Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.workflow.current_node |
string | Current node name | "grade_docs" |
gen_ai.state.current |
string (JSON) | Current state snapshot (truncated) | "{\"messages\": [...], \"docs\": [...]}" |
gen_ai.state.keys_changed |
string[] | State keys modified | ["documents", "relevance_scores"] |
gen_ai.agent.id |
string | Agent executing this transition | "agent_grader" |
Framework Examples:
- LangGraph: Edge traversal in StateGraph with state updates
- Mastra: .then() or .branch() transitions
2.6 gen_ai.workflow.branch
Description: Conditional branching decision in workflow.
Span Kind: INTERNAL
Required Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.workflow.id |
string | Workflow identifier | "workflow_123" |
gen_ai.workflow.branch_node |
string | Node where branching occurs | "route_question" |
gen_ai.workflow.branch_condition |
string | Condition evaluated | "is_relevant", "needs_retrieval" |
gen_ai.workflow.branch_taken |
string | Which branch was taken | "relevant_path", "irrelevant_path" |
Optional Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.workflow.branch_options |
string[] | Available branches | ["relevant", "irrelevant", "uncertain"] |
gen_ai.workflow.branch_reason |
string | Why this branch chosen | "relevance_score > 0.8" |
Framework Examples:
- LangGraph: Conditional edges with routing functions
- Mastra:
.branch()with conditional logic - CrewAI:
@routerdecorator in Flows
3. Task Execution Spans
3.1 gen_ai.task.create
Description: Creation and definition of a task.
Span Kind: INTERNAL
Required Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.task.id |
string | Unique task identifier | "task_123", "research_task_1" |
gen_ai.task.name |
string | Task name | "Research AI trends", "Write summary" |
gen_ai.task.type |
string | Task category | "research", "analysis", "generation", "review" |
Optional Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.task.description |
string | Detailed task description | "Research latest developments in AI and summarize" |
gen_ai.task.assigned_agent |
string | Agent assigned to task | "agent_researcher" |
gen_ai.task.parent_task_id |
string | Parent task (for hierarchies) | "task_parent_1" |
gen_ai.task.priority |
int | Task priority (higher = more urgent) | 1, 5, 10 |
gen_ai.task.deadline |
timestamp | Task deadline | 2025-01-24T10:00:00Z |
gen_ai.task.expected_output |
string | Expected output specification | "A markdown report with 3 sections" |
Framework Examples:
- CrewAI:
@taskdecorator with description, expected_output, agent - Google ADK: Task submitted to agent with instructions
3.2 gen_ai.task.execute
Description: Execution of a task by an agent.
Span Kind: INTERNAL
Required Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.task.id |
string | Task identifier | "task_123" |
gen_ai.task.name |
string | Task name | "Research AI trends" |
gen_ai.task.status |
string | Execution status | "running", "completed", "failed", "pending" |
gen_ai.agent.id |
string | Executing agent | "agent_researcher" |
Optional Attributes:
| Attribute | Type | Description | Examples |
|---|---|---|---|
gen_ai.task.type |
string | Task category | "research", `"analys |
Source: traceloop/openllmetry