Skip to content

GenAI Utils | Add support for ToolCall Invocations#4356

Draft
keith-decker wants to merge 29 commits intoopen-telemetry:mainfrom
keith-decker:toolcall-handler-and-spans
Draft

GenAI Utils | Add support for ToolCall Invocations#4356
keith-decker wants to merge 29 commits intoopen-telemetry:mainfrom
keith-decker:toolcall-handler-and-spans

Conversation

@keith-decker
Copy link
Copy Markdown
Contributor

@keith-decker keith-decker commented Mar 24, 2026

Description

! Draft status - Waiting on ToolCall Types to merge, this PR is built on that. PR will also be refactored once the Embeddings PR with the API for a single start/end/fail methods are implemented: #4219

Implementing the ToolCall handler methods. Check out the example app here

Some output from the example app:

Trace ID: 9db02aa0f3f04e3280383277aeb8daa1
└── Span ID: a6aac8039683ad5f (Parent: none) - Name: agent_workflow [op:invoke_agent] (Type: span)
    ├── Span ID: f225d302435ccab6 (Parent: a6aac8039683ad5f) - Name: chat gpt-4o-mini [op:chat] (Type: span)
    │   ├── Metric: gen_ai.client.operation.duration [op:chat] (Type: metric)
    │   ├── Metric: gen_ai.client.token.usage (input) [op:chat] (Type: metric)
    │   └── Metric: gen_ai.client.token.usage (output) [op:chat] (Type: metric)
    └── Span ID: a56510b4b1a902c5 (Parent: a6aac8039683ad5f) - Name: execute_tool get_weather [op:execute_tool] (Type: span)
Span #1
    Trace ID       : 9db02aa0f3f04e3280383277aeb8daa1
    Parent ID      : a6aac8039683ad5f
    ID             : a56510b4b1a902c5
    Name           : execute_tool get_weather
    Kind           : Internal
    Start time     : 2026-03-24 21:12:59.832384 +0000 UTC
    End time       : 2026-03-24 21:12:59.833126 +0000 UTC
    Status code    : Ok
    Status message : 
Attributes:
     -> gen_ai.operation.name: Str(execute_tool)
     -> gen_ai.tool.name: Str(get_weather)
     -> gen_ai.tool.call.id: Str(019d21b1-96b8-7f00-961c-e2e9c1a0baa1)
     -> gen_ai.tool.type: Str(function)
     -> gen_ai.tool.description: Str(Get current weather for a location.

    Args:
        location: The city name to get weather for.

    Returns:
        Weather information as a string.)

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

keith-decker and others added 29 commits February 19, 2026 15:55
…pentelemetry-python-contrib into pr1-enhance-toolcall-type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants