Skip to content

Add invoke_workflow operation name span#3249

Merged
lmolkova merged 28 commits intoopen-telemetry:mainfrom
wrisa:invoke-workflow-agent-span
Mar 9, 2026
Merged

Add invoke_workflow operation name span#3249
lmolkova merged 28 commits intoopen-telemetry:mainfrom
wrisa:invoke-workflow-agent-span

Conversation

@wrisa
Copy link
Copy Markdown
Contributor

@wrisa wrisa commented Jan 6, 2026

Fixes #
Issue: 2912 partly

Agentic framework Mapping to Workflow References
Langchain/LangGraph First chain can indicate start of the workflow workflow agents
CrewAI Crew kickoff can start workflow Crew kickoff
OpenAI agents Higher level Trace can be started as workflow Higher trace
Custom/In-house Multiple LLMs or agents can be grouped under a workflow In-house

Changes

Workflow proposal https://github.com/open-telemetry/semantic-conventions/blob/b6bfc44631e28e87a0252011a8898e8098cb0ff9/docs/gen-ai/Session-and-Workflow-for-GenAI-Observability.md discussion led to suggestion of invoke workflow operation name in agent span.

Important

Pull requests acceptance are subject to the triage process as described in Issue and PR Triage Management.
PRs that do not follow the guidance above, may be automatically rejected and closed.

Merge requirement checklist

  • CONTRIBUTING.md guidelines followed.
  • Change log entry added, according to the guidelines in When to add a changelog entry.
    • If your PR does not need a change log, start the PR title with [chore]
  • Links to the prototypes or existing instrumentations (when adding or changing conventions)

Comment thread model/gen-ai/registry.yaml
Comment thread model/gen-ai/spans.yaml Outdated
@wrisa wrisa marked this pull request as ready for review January 12, 2026 20:45
@wrisa wrisa requested review from a team as code owners January 12, 2026 20:45
Copy link
Copy Markdown

@91pavan 91pavan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Comment thread model/gen-ai/registry.yaml Outdated
Comment thread model/gen-ai/registry.yaml Outdated
Comment thread model/gen-ai/spans.yaml Outdated
Comment thread model/gen-ai/spans.yaml Outdated
Copy link
Copy Markdown

@zhirafovod zhirafovod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some conditional notes left on the PR.

Comment thread model/gen-ai/registry.yaml
Comment thread model/gen-ai/spans.yaml
Comment thread model/gen-ai/registry.yaml Outdated
Comment thread model/gen-ai/spans.yaml
Comment thread .chloggen/genai-invoke-workflow-operation-name.yaml Outdated
Comment thread .chloggen/genai-invoke-workflow-operation-name.yaml Outdated
@singankit
Copy link
Copy Markdown
Contributor

@wrisa Is there any active discussions or doc about conditional nodes and how they can be represented, especially with gen ai workflows. For example conditional edges in langgraph.

@wrisa
Copy link
Copy Markdown
Contributor Author

wrisa commented Jan 21, 2026

Is there any active discussions or doc about conditional nodes and how they can be represented, especially with gen ai workflows

@singankit Not exactly, but we briefly presented step for intermediate steps like langchain's chains or CrewAi's tasks. According to SIG discussions, it seemed expensive as all the info could be captured on agent span as well and also it seemed more framework specific. If we can have more use cases like you suggested we can start the discussion maybe again.
P.S: We added assigned agents attribute in step for the chain invoking agent, crewAI's task executed by an agent and can be used for nodes in conditional edge. May be conditional edge can be a 'step' or an extension to it.

@wrisa wrisa changed the title Added invoke workflow operation name to agent span Add invoke workflow operation name to agent span Feb 20, 2026
@wrisa wrisa changed the title Add invoke workflow operation name to agent span Add invoke_workflow operation name span Feb 20, 2026
@lmolkova lmolkova moved this from Untriaged to Awaiting codeowners approval in Semantic Conventions Triage Feb 20, 2026
@lmolkova
Copy link
Copy Markdown
Member

Summarizing the story:

LangGraph

StateGraph operations would be 'workflows`. E.g.

parallel_builder  = StateGraph(State)
...
parallel_workflow = parallel_builder.compile()
state = parallel_workflow.invoke({"topic": "cats"})   <--- this would be workflow span, no workflow name available?

alternatively it could be

@entrypoint()
def parallel_workflow(topic: str):  <--- this would be workflow span, workflow name would be the function name - `parallel_workflow`
    joke_fut = call_llm_1(topic)
   ...
    return aggregator(
        topic, joke_fut.result(), ...    ).result()

examples

OpenAI

Terminology like higher level traces OpenAI uses is not correct or applicable to OTel world, but what's important they use workflow in their docs.

    agent = Agent(name="Joke generator", instructions="Tell funny jokes.")

    with trace("Joke workflow"): #    <----- this would be workflow span, with "Joke workflow" as a name
        first_result = await Runner.run(agent, "Tell me a joke")
        second_result = await Runner.run(agent, f"Rate this joke: {first_result.final_output}")

Warning

This trace thing could mean absolutely anything, users might use it to track calls to their database (by mistake)
I would not rely on it meaning workflow - an operation that wraps calls to (presumably) multiple agents

examples

Agent wrapping agents

orchestrator_agent = Agent(
    name="orchestrator_agent",
    instructions=....,
    tools=[
        spanish_agent.as_tool(tool_name="translate_to_spanish", ...),
        french_agent.as_tool(tool_name="translate_to_french", ...),
        italian_agent.as_tool(tool_name="translate_to_italian", ...),
    ],
)
...
await Runner.run(orchestrator_agent, msg)  # <---- this one might or might not know whether it's doing orchestration

ADK

from google.adk.agents import LlmAgent, SequentialAgent

hello_agent = LlmAgent(model="gemini-2.5-flash",  name="hello_agent",  instruction="Your job is to creatively say hello")
bye_agent = LlmAgent(model="gemini-2.5-flash", name="bye_agent",  instruction="Your job is to creatively reply to the greeting and reply with a quip")
root_agent = SequentialAgent(name="root_agent", sub_agents=[hello_agent, bye_agent])  # <--- this could be a workflow span, it knows it wraps other agents, workflow name could be `root_agent` or `SequentialAgent` if name is optional

examples

CreaAI

also use2 workflow terminology in the docs

 crew = Crew(
            agents=self.agents,  # Automatically collected by the @agent decorator
            tasks=self.tasks,    # Automatically collected by the @task decorator.
            process=Process.sequential,
            verbose=True,
        )
crew.kickoff(inputs={"any": "input here"}) #    <----- this would be workflow span, no workflow name

examples

MS agent framework

    workflow = GroupChatBuilder(
        participants=[researcher, writer],
        intermediate_outputs=True,
        orchestrator_agent=AzureOpenAIResponsesClient(...).as_agent(
            name="Orchestrator",
            instructions="You coordinate a team conversation to solve the user's task.",
        ),
    ).build()
    workflow_agent = workflow.as_agent(name="GroupChatWorkflowAgent")
    agent_result = await workflow_agent.run(task)  #  <----- this probably should be the workflow span? Or the orchestrator? Or both?

examples

Agno

article_workflow = Workflow(
    name="Enhanced Article Creation Workflow",
    description="Automated article creation with conditional parallel research",
    steps=[article_creation_sequence],
)

full example

Let me write down more thoughts in a separate comment

@lmolkova
Copy link
Copy Markdown
Member

It seems we have two types of design:

  1. Workflow as a separate API (CrewAI, LangGraph, Agno, MS agent framework, OpenAI with @\trace annotation). Note: I didn't check if they also support calling agents from agents via tools)
  2. Workflow as a specialized agent that is a composition of one or more agents (ADK, OpenAI Agents)

And there are several ways to address is:

  1. Workflow is a separate operation name (not an invoke_agent)
    • Pros: we can have different metrics for workflows and individual agents
    • Cons:
      • not clear what to do with workflows-that-are-also-agents.
      • We can't really demand one operation name for everyone (crew ai would probably prefer kickoff - it'd be more user friendly)
  2. Workflow is the same span as invoke_agent, gen_ai.workflow.name attribute means it's a workflow. We'll probably need a more reliable criteria.
    • Pros: can model agents and workflows
    • Cons: same workflow and agent metrics, might be problematic if latency is tremendously different
      We could even report

It seems there is no perfect solution. I'm going to sleep on this and let's discuss it on the call tomorrow.

Copy link
Copy Markdown
Member

@aabmass aabmass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but still need to figure out relationship to agent spans imo.

Comment thread model/gen-ai/spans.yaml
Comment thread model/gen-ai/spans.yaml
Comment thread docs/gen-ai/gen-ai-agent-spans.md Outdated
Comment thread model/gen-ai/spans.yaml Outdated
Comment thread model/gen-ai/spans.yaml Outdated
Comment thread model/gen-ai/spans.yaml Outdated
Comment thread model/gen-ai/spans.yaml Outdated
@lmolkova lmolkova added this pull request to the merge queue Mar 9, 2026
Merged via the queue into open-telemetry:main with commit fd03200 Mar 9, 2026
17 of 18 checks passed
liustve added a commit to aws-observability/aws-otel-python-instrumentation that referenced this pull request Apr 3, 2026
…ow span support for LlamaIndex AgentWorkflow and CrewAI (#705)

*Description of changes:*

- Add `invoke_workflow` span for LlamaIndex `AgentWorkflow.run()` and
CrewAI `Crew.kickoff()` following the OTel GenAI semantic conventions
[open-telemetry/semantic-conventions#3249](open-telemetry/semantic-conventions#3249)
- Add `invoke_agent` span for LlamaIndex workflow agent steps, merging
ReAct iterations into one span per agent
- Suppress `jinja2` instrumentation in agent observability mode to
reduce trace noise from LlamaIndex template rendering
- Bump LlamaIndex minimum from `0.10.44` to `0.13.0` 

Testing:

- Unit tests added
- E2E testing with CrewAI and LLamaIndex:

```
WARNING:root:LLM event emitted outside call context - generating fallback call_id
{
    "name": "chat gpt-4",
    "context": {
        "trace_id": "0x9e7cb9200dc4e94da082ca558872ff3b",
        "span_id": "0xbb52e545f367b9ac",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": "0x9886147b550546f6",
    "start_time": "2026-04-02T19:31:11.176007Z",
    "end_time": "2026-04-02T19:31:11.178020Z",
    "status": {
        "status_code": "OK"
    },
    "attributes": {
        "gen_ai.operation.name": "chat",
        "gen_ai.provider.name": "openai",
        "gen_ai.request.model": "gpt-4",
        "gen_ai.system_instructions": "[{\"type\": \"text\", \"content\": \"You are Greeter. You are a friendly greeter.\\nYour personal goal is: Greet people\"}]",
        "gen_ai.input.messages": "[{\"role\": \"user\", \"parts\": [{\"type\": \"text\", \"content\": \"\\nCurrent Task: Greet World\\n\\nThis is the expected criteria for your final answer: A greeting.\\nyou MUST return the actual complete content as the final answer, not a summary.\"}]}]",
        "gen_ai.output.messages": "[{\"role\": \"assistant\", \"parts\": [{\"type\": \"tool_call\", \"name\": \"get_greeting\", \"arguments\": {\"name\": \"World\"}}], \"finish_reason\": \"tool_call\"}]",
        "gen_ai.response.model": "gpt-4",
        "gen_ai.usage.input_tokens": 1,
        "gen_ai.usage.output_tokens": 1
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.40.0",
            "service.name": "unknown_service"
        },
        "schema_url": ""
    }
}
{
    "name": "execute_tool get_greeting",
    "context": {
        "trace_id": "0x9e7cb9200dc4e94da082ca558872ff3b",
        "span_id": "0x16c12ef0f504dd8f",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": "0x9886147b550546f6",
    "start_time": "2026-04-02T19:31:11.178242Z",
    "end_time": "2026-04-02T19:31:11.178453Z",
    "status": {
        "status_code": "OK"
    },
    "attributes": {
        "gen_ai.operation.name": "execute_tool",
        "gen_ai.tool.type": "function",
        "gen_ai.tool.name": "get_greeting",
        "gen_ai.tool.description": "Tool Name: get_greeting\nTool Arguments: {\n  \"properties\": {\n    \"name\": {\n      \"title\": \"Name\",\n      \"type\": \"string\"\n    }\n  },\n  \"required\": [\n    \"name\"\n  ],\n  \"title\": \"Get_Greeting\",\n  \"type\": \"object\",\n  \"additionalProperties\": false\n}\nTool Description: Get a greeting for someone",
        "gen_ai.provider.name": "openai",
        "gen_ai.request.model": "gpt-4",
        "gen_ai.tool.call.arguments": "{\"name\": \"World\"}",
        "gen_ai.tool.call.result": "\"Hello World!\""
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.40.0",
            "service.name": "unknown_service"
        },
        "schema_url": ""
    }
}
{
    "name": "chat gpt-4",
    "context": {
        "trace_id": "0x9e7cb9200dc4e94da082ca558872ff3b",
        "span_id": "0x672dbb753d2a9c19",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": "0x9886147b550546f6",
    "start_time": "2026-04-02T19:31:11.178651Z",
    "end_time": "2026-04-02T19:31:11.180069Z",
    "status": {
        "status_code": "OK"
    },
    "attributes": {
        "gen_ai.operation.name": "chat",
        "gen_ai.provider.name": "openai",
        "gen_ai.request.model": "gpt-4",
        "gen_ai.system_instructions": "[{\"type\": \"text\", \"content\": \"You are Greeter. You are a friendly greeter.\\nYour personal goal is: Greet people\"}]",
        "gen_ai.input.messages": "[{\"role\": \"user\", \"parts\": [{\"type\": \"text\", \"content\": \"\\nCurrent Task: Greet World\\n\\nThis is the expected criteria for your final answer: A greeting.\\nyou MUST return the actual complete content as the final answer, not a summary.\"}]}, {\"role\": \"assistant\", \"parts\": [{\"type\": \"tool_call\", \"id\": \"call_1\"}]}, {\"role\": \"tool\", \"parts\": [{\"type\": \"tool_call_response\", \"id\": \"call_1\", \"response\": \"Hello World!\"}]}, {\"role\": \"user\", \"parts\": [{\"type\": \"text\", \"content\": \"Analyze the tool result. If requirements are met, provide the Final Answer. Otherwise, call the next tool. Deliver only the answer without meta-commentary.\"}]}]",
        "gen_ai.output.messages": "[{\"role\": \"assistant\", \"parts\": [{\"type\": \"text\", \"content\": \"Thought: I now know the final answer\\nFinal Answer: Hello World!\"}], \"finish_reason\": \"stop\"}]",
        "gen_ai.response.model": "gpt-4",
        "gen_ai.usage.input_tokens": 1,
        "gen_ai.usage.output_tokens": 1
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.40.0",
            "service.name": "unknown_service"
        },
        "schema_url": ""
    }
}
{
    "name": "invoke_agent Greeter",
    "context": {
        "trace_id": "0x9e7cb9200dc4e94da082ca558872ff3b",
        "span_id": "0x9886147b550546f6",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": "0x03496a39dc7be2d7",
    "start_time": "2026-04-02T19:31:11.175538Z",
    "end_time": "2026-04-02T19:31:11.180400Z",
    "status": {
        "status_code": "OK"
    },
    "attributes": {
        "gen_ai.operation.name": "invoke_agent",
        "gen_ai.agent.name": "Greeter",
        "gen_ai.agent.id": "6e4c0852-87ae-4be5-b11d-df203ead6cb6",
        "gen_ai.agent.description": "Greet people",
        "gen_ai.system_instructions": "You are a friendly greeter.",
        "gen_ai.provider.name": "openai",
        "gen_ai.request.model": "gpt-4"
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.40.0",
            "service.name": "unknown_service"
        },
        "schema_url": ""
    }
}
{
    "name": "invoke_workflow GreetingCrew",
    "context": {
        "trace_id": "0x9e7cb9200dc4e94da082ca558872ff3b",
        "span_id": "0x03496a39dc7be2d7",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": null,
    "start_time": "2026-04-02T19:31:11.168711Z",
    "end_time": "2026-04-02T19:31:11.183189Z",
    "status": {
        "status_code": "OK"
    },
    "attributes": {
        "gen_ai.operation.name": "invoke_workflow",
        "gen_ai.workflow.name": "GreetingCrew",
        "gen_ai.agent.id": "7eebdca4-e295-464a-a1d7-329998e02f93",
        "gen_ai.tool.definitions": "[{\"type\": \"function\", \"name\": \"get_greeting\", \"description\": \"Tool Name: get_greeting\\nTool Arguments: {\\n  \\\"properties\\\": {\\n    \\\"name\\\": {\\n      \\\"title\\\": \\\"Name\\\",\\n      \\\"type\\\": \\\"string\\\"\\n    }\\n  },\\n  \\\"required\\\": [\\n    \\\"name\\\"\\n  ],\\n  \\\"title\\\": \\\"Get_Greeting\\\",\\n  \\\"type\\\": \\\"object\\\",\\n  \\\"additionalProperties\\\": false\\n}\\nTool Description: Get a greeting for someone\", \"parameters\": {\"properties\": {\"name\": {\"title\": \"Name\", \"type\": \"string\"}}, \"required\": [\"name\"], \"title\": \"Get_Greeting\", \"type\": \"object\"}}]"
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.40.0",
            "service.name": "unknown_service"
        },
        "schema_url": ""
    }
}
```


```
{
    "name": "chat us.anthropic.claude-sonnet-4-20250514-v1:0",
    "context": {
        "trace_id": "0xc626744ad1f2632500b94131f23f6090",
        "span_id": "0x09ec58e5f0a11a30",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": "0x20887e9dbe3d8c5d",
    "start_time": "2026-04-02T19:30:48.591392Z",
    "end_time": "2026-04-02T19:30:49.060111Z",
    "status": {
        "status_code": "OK"
    },
    "attributes": {
        "gen_ai.request.model": "us.anthropic.claude-sonnet-4-20250514-v1:0",
        "gen_ai.provider.name": "aws.bedrock",
        "gen_ai.request.temperature": 0.1,
        "gen_ai.request.max_tokens": 200,
        "gen_ai.tool.definitions": "[\"tools\", \"toolChoice\"]",
        "gen_ai.operation.name": "chat",
        "gen_ai.system_instructions": "[{\"type\": \"text\", \"content\": \"You are a pet records specialist. Use tools to look up pets.\"}]",
        "gen_ai.input.messages": "[{\"role\": \"user\", \"parts\": [{\"type\": \"text\", \"content\": \"Look up pet PET001\"}]}]"
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.40.0",
            "service.name": "unknown_service"
        },
        "schema_url": ""
    }
}
Open span is missing for span_id=BedrockConverse.astream_chat-3e1d0f16-6d83-46d3-9337-b02e89091539, event_id=7f63a06d-196f-4fed-8272-a074eb2bc9eb
Open span is missing for span_id=BedrockConverse.astream_chat-3e1d0f16-6d83-46d3-9337-b02e89091539, event_id=340d5fb1-46b6-4bb0-b88c-2c9e6d8a5638
Open span is missing for span_id=BedrockConverse.astream_chat-3e1d0f16-6d83-46d3-9337-b02e89091539, event_id=0e630fb1-4428-46b0-a4f3-e56cffaed0a5
Open span is missing for span_id=BedrockConverse.astream_chat-3e1d0f16-6d83-46d3-9337-b02e89091539, event_id=8a09f7fa-893a-4627-9242-b3f697e854a5
Open span is missing for span_id=BedrockConverse.astream_chat-3e1d0f16-6d83-46d3-9337-b02e89091539, event_id=fbc0f545-5b57-4fd4-87e2-4f4896241fb6
Open span is missing for span_id=BedrockConverse.astream_chat-3e1d0f16-6d83-46d3-9337-b02e89091539, event_id=511d0877-d42d-45e0-bac4-2f08c91c3fee
Open span is missing for span_id=BedrockConverse.astream_chat-3e1d0f16-6d83-46d3-9337-b02e89091539, event_id=21f1c125-fbf2-4754-b41c-36c2bfaea374
Open span is missing for span_id=BedrockConverse.astream_chat-3e1d0f16-6d83-46d3-9337-b02e89091539, event_id=4bf025d9-ff17-421b-97c5-d231f3bdc8ac
Open span is missing for span_id=BedrockConverse.astream_chat-3e1d0f16-6d83-46d3-9337-b02e89091539, event_id=be322542-33af-4d71-8d7b-08be813b6c6c
Open span is missing for span_id=BedrockConverse.astream_chat-3e1d0f16-6d83-46d3-9337-b02e89091539, event_id=b6dcac60-dfab-40c7-a1c9-53cd7fa51664
{
    "name": "execute_tool lookup_pet",
    "context": {
        "trace_id": "0xc626744ad1f2632500b94131f23f6090",
        "span_id": "0x2ac5b771c3a2286c",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": "0x33756b5d86a90ed0",
    "start_time": "2026-04-02T19:30:50.387954Z",
    "end_time": "2026-04-02T19:30:50.388194Z",
    "status": {
        "status_code": "OK"
    },
    "attributes": {
        "gen_ai.operation.name": "execute_tool",
        "gen_ai.tool.description": "Look up a pet by ID",
        "gen_ai.tool.name": "lookup_pet",
        "gen_ai.tool.call.arguments": "{\"pet_id\": \"PET001\"}",
        "gen_ai.tool.call.result": "{\"pet_id\": \"PET001\", \"name\": \"Buddy\", \"species\": \"dog\", \"breed\": \"Golden Retriever\"}"
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.40.0",
            "service.name": "unknown_service"
        },
        "schema_url": ""
    }
}
{
    "name": "chat us.anthropic.claude-sonnet-4-20250514-v1:0",
    "context": {
        "trace_id": "0xc626744ad1f2632500b94131f23f6090",
        "span_id": "0xcb946943a01edace",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": "0x20887e9dbe3d8c5d",
    "start_time": "2026-04-02T19:30:50.389761Z",
    "end_time": "2026-04-02T19:30:50.390160Z",
    "status": {
        "status_code": "OK"
    },
    "attributes": {
        "gen_ai.request.model": "us.anthropic.claude-sonnet-4-20250514-v1:0",
        "gen_ai.provider.name": "aws.bedrock",
        "gen_ai.request.temperature": 0.1,
        "gen_ai.request.max_tokens": 200,
        "gen_ai.tool.definitions": "[\"tools\", \"toolChoice\"]",
        "gen_ai.operation.name": "chat",
        "gen_ai.system_instructions": "[{\"type\": \"text\", \"content\": \"You are a pet records specialist. Use tools to look up pets.\"}]",
        "gen_ai.input.messages": "[{\"role\": \"user\", \"parts\": [{\"type\": \"text\", \"content\": \"Look up pet PET001\"}]}, {\"role\": \"assistant\", \"parts\": [{\"type\": \"text\", \"content\": \"I'll look up the pet with ID \\\"PET001\\\" for you.\"}]}, {\"role\": \"tool\", \"parts\": [{\"type\": \"text\", \"content\": \"{\\\"pet_id\\\": \\\"PET001\\\", \\\"name\\\": \\\"Buddy\\\", \\\"species\\\": \\\"dog\\\", \\\"breed\\\": \\\"Golden Retriever\\\"}\"}]}]"
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.40.0",
            "service.name": "unknown_service"
        },
        "schema_url": ""
    }
}
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=f522e128-e10c-4e24-90b4-08be4f6cbbfc
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=dccab180-dc82-4a14-af1b-284d086ab1f8
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=2707786f-1c4c-40aa-bde1-e0cb21eccba1
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=be99782a-ddca-4faf-a706-a42c18904c8e
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=496fdd2e-4e6d-4ca4-a9fe-64f6f62e68f2
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=6aadad22-90de-43bc-8907-f4d931f18665
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=fc5e72d8-551a-4cf6-98b0-faae7936437b
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=3a533ea8-1cdd-4f9b-961d-46354a7c644b
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=13db4508-66b3-47da-bde0-876d1135995f
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=5c5244dd-be41-4fae-8439-441b3b6eb2b4
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=4d59f5cb-cd98-44d0-93be-f4116621c54a
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=815a1216-59fc-410c-9268-3ae1291071f2
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=50b7dff5-059d-4fd6-943e-d3d51a829f46
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=db6e6dc9-628e-4527-a8a9-9eb84e2e1e34
Open span is missing for span_id=BedrockConverse.astream_chat-b958be4d-e3c0-4f55-99ba-7bc31488ed5a, event_id=20f94aa2-8d0e-4efa-bd75-edf58ae61d37
Failed to detach context
Traceback (most recent call last):
  File "/Users/liustve/aws-otel-python-instrumentation/AgentsStudioForTriton/pet-clinic-agents/.venv/lib/python3.12/site-packages/opentelemetry/context/__init__.py", line 155, in detach
    _RUNTIME_CONTEXT.detach(token)
  File "/Users/liustve/aws-otel-python-instrumentation/AgentsStudioForTriton/pet-clinic-agents/.venv/lib/python3.12/site-packages/opentelemetry/context/contextvars_context.py", line 53, in detach
    self._current_context.reset(token)
ValueError: <Token var=<ContextVar name='current_context' default={} at 0x105b93ec0> at 0x115cb9280> was created in a different Context
{
    "name": "invoke_agent RecordsAgent",
    "context": {
        "trace_id": "0xc626744ad1f2632500b94131f23f6090",
        "span_id": "0x20887e9dbe3d8c5d",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": "0x33756b5d86a90ed0",
    "start_time": "2026-04-02T19:30:48.589952Z",
    "end_time": "2026-04-02T19:30:51.620018Z",
    "status": {
        "status_code": "OK"
    },
    "attributes": {
        "gen_ai.operation.name": "invoke_agent",
        "gen_ai.agent.name": "RecordsAgent",
        "gen_ai.system_instructions": "You are a pet records specialist. Use tools to look up pets."
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.40.0",
            "service.name": "unknown_service"
        },
        "schema_url": ""
    }
}
{
    "name": "invoke_workflow pet_records_search",
    "context": {
        "trace_id": "0xc626744ad1f2632500b94131f23f6090",
        "span_id": "0x33756b5d86a90ed0",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": null,
    "start_time": "2026-04-02T19:30:48.490262Z",
    "end_time": "2026-04-02T19:30:51.620132Z",
    "status": {
        "status_code": "OK"
    },
    "attributes": {
        "gen_ai.operation.name": "invoke_workflow",
        "gen_ai.workflow.name": "pet_records_search"
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.40.0",
            "service.name": "unknown_service"
        },
        "schema_url": ""
    }
}
```

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

This PR contains changes to area(s) that do not have an active SIG/project and will be auto-closed:

  • gen-ai

Such changes may be rejected or put on hold until a new SIG/project is established.

Please refer to the Semantic Convention Areas
document to see the current active SIGs and also to learn how to kick start a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

10 participants