This release is a pre-release and may not be stable for production use.
OpenTelemetry Qwen-Agent Instrumentation
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
Release files for opentelemetry-instrumentation-genai-qwen-agent 1.2b0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opentelemetry_instrumentation_genai_qwen_agent-1.2b0.tar.gz | 22.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opentelemetry_instrumentation_genai_qwen_agent-1.2b0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.4 kB
Release files / opentelemetry_instrumentation_genai_qwen_agent-1.2b0.tar.gz
| Download URL | opentelemetry_instrumentation_genai_qwen_agent-1.2b0.tar.gz |
|---|---|
| Size | 22.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67787c1c65f345685fa0e5d5c4797fec81feb465bf730903c5758a62fa7c8de8
|
|
BLAKE2b-256 checksum How to use checksums |
38672b17ed22b1641b68d62e20bab68903173829eb4410c6dadc4ce7e78c4acf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 24, 2026.
Transparency logRelease files / opentelemetry_instrumentation_genai_qwen_agent-1.2b0-py3-none-any.whl
| Download URL | opentelemetry_instrumentation_genai_qwen_agent-1.2b0-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f18d5b817aaedf7e1b1da2b9288978d7a86cf4026d62610e06dcfe735c84f7d0
|
|
BLAKE2b-256 checksum How to use checksums |
8c1c2a02b86688750f48543291520dcbe340260dd165ad69be730ae59838d655
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 24, 2026.
Transparency log