Skip to content

[opentelemetry-instrumentation-genai-smolagents] instrument agent runs - #403

Draft
alexander-akhmetov wants to merge 1 commit into
open-telemetry:mainfrom
alexander-akhmetov:alexander-akhmetov/smolagents-invoke-agent
Draft

[opentelemetry-instrumentation-genai-smolagents] instrument agent runs#403
alexander-akhmetov wants to merge 1 commit into
open-telemetry:mainfrom
alexander-akhmetov:alexander-akhmetov/smolagents-invoke-agent

Conversation

@alexander-akhmetov

@alexander-akhmetov alexander-akhmetov commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Description

Adds invoke_agent instrumentation, duration and token-usage metrics for smolagents MultiStepAgent.run. The span records agent and model metadata, tool and managed-agent definitions, token usage from the current run, finish reason, task and answer content when capture is enabled.

Known gaps:

Part of #141

Type of change

  • New feature (non-breaking change which adds functionality)

How has this been tested?

uv run tox -e py310-test-instrumentation-genai-smolagents-oldest
uv run tox -e py314-test-instrumentation-genai-smolagents-latest
uv run tox -e py314-test-instrumentation-genai-smolagents-conformance
uv run tox -e precommit
uv run tox -e typecheck
uv run tox -e readme

Checklist

See CONTRIBUTING.md
for the style guide, changelog guidance, and more.

  • Followed the style guidelines of this project
  • Changelog updated if the change requires an entry
  • Unit tests added
  • Documentation updated

@alexander-akhmetov
alexander-akhmetov force-pushed the alexander-akhmetov/smolagents-invoke-agent branch 2 times, most recently from 38ee113 to a143831 Compare August 19, 2026 23:03
…trumentation

Managed agents called from generated code run in the local executor worker without the caller's context, so their spans become root spans. Propagate the context into the worker to keep managed agent runs under the manager span.
@alexander-akhmetov
alexander-akhmetov force-pushed the alexander-akhmetov/smolagents-invoke-agent branch from a143831 to b34031c Compare August 19, 2026 23:15
@opentelemetry-pr-dashboard

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-08-20 15:38 UTC

Move out of draft to request review.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

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.

1 participant