Skip to content

[opentelemetry-instrumentation-genai-agno] Add instrumentation for Agno Team, Workflow, and Model response methods. - #350

Open
DylanRussell wants to merge 21 commits into
open-telemetry:mainfrom
DylanRussell:add_agno_3
Open

[opentelemetry-instrumentation-genai-agno] Add instrumentation for Agno Team, Workflow, and Model response methods.#350
DylanRussell wants to merge 21 commits into
open-telemetry:mainfrom
DylanRussell:add_agno_3

Conversation

@DylanRussell

@DylanRussell DylanRussell commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

Add instrumentation for the following methods:

Agno Class & Method(s) SemConv Concept / Kind
Team.runTeam.arun Agent (gen_ai.span.kind = AGENT)
Workflow.runWorkflow.arun Workflow (gen_ai.span.kind = WORKFLOW)
Model.responseModel.aresponse Inference (gen_ai.span.kind = LLM)

I'm not certain if it makes sense to model teams function call as a invoke agent span or if we might want to add a new sem conv span name for it.. But that is how both open inference and alibaba longsuite modeled it and it sort of makes sense. https://docs.agno.com/teams/overview#when-to-use-teams and https://docs.agno.com/workflows/overview#when-to-use-workflows describe the differences between workflows / agents / teams..

Next steps:

Add run_stream / arun_stream / response_stream / aresponse_stream using SyncStreamWrapper and AsyncStreamWrapper.
Add Parallel.execute and Parallel.aexecute wrapping for workflow parallel steps.
Enrich InputMessage / OutputMessage extraction to include tool calls, tool responses, and multimodal parts (for Model calls)
Instrument Step (awaiting on open-telemetry/semantic-conventions-genai#188)

Type of change

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

How has this been tested?

Unit tests

Checklist

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

@DylanRussell
DylanRussell requested a review from a team as a code owner August 3, 2026 17:19
Copilot AI review requested due to automatic review settings August 3, 2026 17:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds additional Agno instrumentation coverage by patching Team, Workflow, Step, and Model response methods to emit GenAI spans via opentelemetry-util-genai, and updates package docs/tests accordingly.

Changes:

  • Extend patching to Team.run/arun, Workflow.run/arun, Step.execute/aexecute, and Model.response/aresponse.
  • Add unit tests covering Team + Model response instrumentation and basic Workflow/Step coverage.
  • Document supported operations in README.rst and add a changelog fragment.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
instrumentation/opentelemetry-instrumentation-genai-agno/src/opentelemetry/instrumentation/genai/agno/patch.py Adds wrappers for Team/Workflow/Step/Model methods and model message extraction for inference spans.
instrumentation/opentelemetry-instrumentation-genai-agno/tests/test_agent.py Adds tests for Team + Model response spans and basic Workflow/Step span assertions.
instrumentation/opentelemetry-instrumentation-genai-agno/README.rst Documents newly supported operations.
instrumentation/opentelemetry-instrumentation-genai-agno/.changelog/350.added Changelog entry for the added instrumentation coverage.
Suppressed comments (2)

instrumentation/opentelemetry-instrumentation-genai-agno/src/opentelemetry/instrumentation/genai/agno/patch.py:108

  • This PR instruments Step.aexecute, but there is no corresponding async test coverage validating that span emission works for the async variant.
        wrap_function_wrapper(
            _AGNO_STEP_MODULE,
            f"{_STEP_CLASS}.aexecute",
            _step_aexecute(handler),
        )

instrumentation/opentelemetry-instrumentation-genai-agno/tests/test_agent.py:309

  • Skipping only on fastapi being absent may not cover other optional dependency/import failures in agno.workflow.step. It’s more robust to skip on importing the step module itself.
    pytest.importorskip("fastapi")
    from agno.workflow.step import Step  # noqa: PLC0415

Comment thread instrumentation/opentelemetry-instrumentation-genai-agno/tests/test_agent.py Outdated
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Aug 3, 2026

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-08-06 13:42 UTC

Respond to 1 review item (e.g. link a commit, explain why not, ask a follow-up):

  • Top-level threads: 1
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.
  • Should this be with reviewers? Comment /dashboard route:reviewers to route it to them.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

@DylanRussell DylanRussell changed the title [opentelemetry-instrumentation-genai-agno] Add instrumentation for Agno Team, Workflow, Step, and Model response methods. [opentelemetry-instrumentation-genai-agno] Add instrumentation for Agno Team, Workflow, and Model response methods. Aug 3, 2026

@lmolkova lmolkova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but the metric should be gen_ai.invoke_workflow.duration

Comment thread util/opentelemetry-util-genai/.changelog/350.fixed Outdated
# Conflicts:
#	instrumentation/opentelemetry-instrumentation-genai-agno/src/opentelemetry/instrumentation/genai/agno/patch.py
…low.duration and make upstream semconv filter optional
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants