Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

OpenTelemetry Qwen-Agent Instrumentation

pypi

This library allows tracing agent runs and tool executions made through the Qwen-Agent framework.

It produces spans following the GenAI semantic conventions:

  • invoke_agent for Agent.run()

  • execute_tool for Agent._call_tool()

LLM call (chat) spans are intentionally not emitted by this instrumentation: the model client libraries qwen-agent calls into have their own instrumentations, and emitting them here as well would duplicate the LLM spans. Enable the instrumentation of the underlying model client library (e.g. opentelemetry-instrumentation-genai-openai for OpenAI-compatible backends) alongside this package to capture LLM calls.

Installation

pip install opentelemetry-instrumentation-genai-qwen-agent

Usage

from opentelemetry.instrumentation.genai.qwen_agent import (
    QwenAgentInstrumentor,
)
from qwen_agent.agents import Assistant

QwenAgentInstrumentor().instrument()

bot = Assistant(
    llm={"model": "qwen-max", "model_type": "qwen_dashscope"},
    name="my-assistant",
)
for responses in bot.run([{"role": "user", "content": "Hello!"}]):
    pass

Message content capture is disabled by default. Set OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT to one of NO_CONTENT, SPAN_ONLY, EVENT_ONLY, or SPAN_AND_EVENT to record prompts, completions, and tool arguments/results.

Uploading prompts and completions

Instead of recording message content inline, prompts and completions can be uploaded to external storage via a completion hook. To enable the built-in upload hook, set:

  • OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK=upload

  • OTEL_INSTRUMENTATION_GENAI_UPLOAD_BASE_PATH to an fsspec-compatible URI/path (e.g. /path/to/prompts or gs://my_bucket), and install the upload extra (pip install opentelemetry-util-genai[upload]).

A custom CompletionHook can also be passed programmatically, taking precedence over the environment variable:

QwenAgentInstrumentor().instrument(completion_hook=my_hook)

References

Metadata

Release files for opentelemetry-instrumentation-genai-qwen-agent 1.3b0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opentelemetry-instrumentation-genai-qwen-agent 1.3b0
File Size Uploaded Provenance Actions
opentelemetry_instrumentation_genai_qwen_agent-1.3b0.tar.gz 23.9 kB With provenance Details for opentelemetry_instrumentation_genai_qwen_agent-1.3b0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opentelemetry-instrumentation-genai-qwen-agent 1.3b0
File Interpreter ABI Platform Actions
opentelemetry_instrumentation_genai_qwen_agent-1.3b0-py3-none-any.whl Python 3 none any Details for opentelemetry_instrumentation_genai_qwen_agent-1.3b0-py3-none-any.whl

Total release size: 38.6 kB

Release files / opentelemetry_instrumentation_genai_qwen_agent-1.3b0.tar.gz

Download URL opentelemetry_instrumentation_genai_qwen_agent-1.3b0.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0ec9b26f433a19ae31ec5fba600181e46fe29a86f32bf8cb616c97f024d709b6
BLAKE2b-256 checksum
How to use checksums
2aeb33b8fcd70f01d0902ba80bae7d9026b38a407677467edc8175e55b4e6893
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / opentelemetry_instrumentation_genai_qwen_agent-1.3b0-py3-none-any.whl

Download URL opentelemetry_instrumentation_genai_qwen_agent-1.3b0-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cff583cf8233e5fffcf1790ed0ddd3951ba110158a927bc4df065c79d39c2566
BLAKE2b-256 checksum
How to use checksums
71aa2092697db4451125acf4c73e7b2d297337745e18166052b7b3f7eb0a6a95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for opentelemetry-instrumentation-genai-qwen-agent 1.3b0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for opentelemetry_instrumentation_genai_qwen_agent-1.3b0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page