Skip to content

feat(qwen-agent): add instrumentation for Qwen-Agent#154

Open
sipercai wants to merge 3 commits intoalibaba:mainfrom
sipercai:liuyu/qwen-agent
Open

feat(qwen-agent): add instrumentation for Qwen-Agent#154
sipercai wants to merge 3 commits intoalibaba:mainfrom
sipercai:liuyu/qwen-agent

Conversation

@sipercai
Copy link
Copy Markdown
Collaborator

@sipercai sipercai commented Mar 24, 2026

Description

This PR adds loongsuite-instrumentation-qwen-agent: OpenTelemetry instrumentation for Qwen-Agent using ExtendedTelemetryHandler from opentelemetry-util-genai. It emits GenAI semantic-convention traces for agent runs, LLM calls, ReAct steps, and tool execution (invoke_agent, chat, react step, execute_tool), registers an opentelemetry_instrumentor entry point, and includes unit tests plus VCR-based integration tests.

Fixes #11

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?

pip install -e ".[test]" under instrumentation-loongsuite/loongsuite-instrumentation-qwen-agent, then pytest on that package’s tests/
From repo root: tox -c tox-loongsuite.ini -e py312-test-loongsuite-instrumentation-qwen-agent-oldest, py312-test-loongsuite-instrumentation-qwen-agent-latest, lint-loongsuite-instrumentation-qwen-agent

  • 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

Change-Id: I5ab30c79fea5e6f2070ef182da505084092632b2
Co-developed-by: Cursor <noreply@cursor.com>
@sipercai sipercai added enhancement New feature or request instrumentaion The instrumentation label represents issues related to instrumentation. genai The genai label represents issues related to generative AI. labels Mar 24, 2026
Change-Id: I6e70c5771f05d4915546bf6c2d4b96dc50582ce7
Co-developed-by: Cursor <noreply@cursor.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new LoongSuite OpenTelemetry instrumentation package for the Qwen-Agent framework, integrating ExtendedTelemetryHandler to emit GenAI semantic-convention spans for agent runs, LLM chat calls, ReAct steps, and tool execution, along with CI/tox wiring and test coverage (unit + VCR-based integration).

Changes:

  • Introduces loongsuite-instrumentation-qwen-agent with wrappers around Agent.run, BaseChatModel.chat, Agent._call_llm, and Agent._call_tool.
  • Adds unit tests validating span creation/hierarchy and VCR-backed integration tests with recorded HTTP cassettes.
  • Wires the new package into tox-loongsuite.ini and GitHub Actions test/lint workflows.

Reviewed changes

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

Show a summary per file
File Description
tox-loongsuite.ini Adds tox envs/deps/commands for qwen-agent tests + lint.
.github/workflows/loongsuite_test_0.yml Adds CI test jobs for qwen-agent across py39–py313 (oldest/latest).
.github/workflows/loongsuite_lint_0.yml Adds CI lint job for qwen-agent package.
instrumentation-loongsuite/loongsuite-instrumentation-qwen-agent/pyproject.toml New package metadata, deps, and opentelemetry_instrumentor entry point.
instrumentation-loongsuite/loongsuite-instrumentation-qwen-agent/src/opentelemetry/instrumentation/qwen_agent/init.py Instrumentor implementation wiring wrapt wrappers + uninstrumentation.
instrumentation-loongsuite/loongsuite-instrumentation-qwen-agent/src/opentelemetry/instrumentation/qwen_agent/patch.py Core wrappers emitting spans for agent/LLM/tools/ReAct.
instrumentation-loongsuite/loongsuite-instrumentation-qwen-agent/src/opentelemetry/instrumentation/qwen_agent/utils.py Message/tool/provider conversion helpers for GenAI types.
instrumentation-loongsuite/loongsuite-instrumentation-qwen-agent/tests/* Unit tests, VCR integration tests, conftest, and VCR cassettes.
instrumentation-loongsuite/loongsuite-instrumentation-qwen-agent/README.md Usage/config docs for the new instrumentation.
instrumentation-loongsuite/loongsuite-instrumentation-qwen-agent/CHANGELOG.md Changelog entry for initial release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…or utility functions

Change-Id: Ie0b1fc3e63c84fa082ca600d44451f308a679de5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request genai The genai label represents issues related to generative AI. instrumentaion The instrumentation label represents issues related to instrumentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat]Add support for qwen-agent

5 participants