Registry / llm-agents / qwen-agent

qwen-agent

JSON →
library0.0.34pypypi✓ verified 25d ago

Qwen-Agent is a Python library designed to enhance Large Language Models (LLMs) with advanced capabilities such as Agent Workflows, Retrieval-Augmented Generation (RAG), Function Calling, and Code Interpreters. It's actively developed, with version 0.0.34 released recently, maintaining a rapid release cadence with frequent minor updates.

pip install qwen-agent
INSTALL
IMPORT
SIG · QWEN-AGENT
Q
qwen-agent
llm-agentspythonv0.0.34
Install
26.2s avg
Import
Disk
574MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.34 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 580.2MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 26.2s · import 0.000s · 575MB
574MB installed
● package 574MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AssistantAgent
from qwen_agent.agents import AssistantAgent
from qwen_agent.agents import AssistantAgent

This quickstart demonstrates how to initialize an `AssistantAgent` with a Code Interpreter tool and use it to execute a simple task. It requires an API key for DashScope (for Qwen models) or OpenAI, which should be set as an environment variable.

import os from qwen_agent.agents import AssistantAgent from qwen_agent.tools.tool_code_interpreter import CodeInterpreter # Configure your LLM access # Ensure DASHSCOPE_API_KEY or OPENAI_API_KEY is set in your environment variables. llm_config = { 'model': 'qwen-turbo', 'model_server': 'dashscope', # or 'openai', 'ollama', etc. 'api_key': os.environ.get('DASHSCOPE_API_KEY', os.environ.get('OPENAI_API_KEY', '')) } if not llm_config['api_key']: raise ValueError("Please set DASHSCOPE_API_KEY or OPENAI_API_KEY environment variable.") # Initialize the agent with tools agent = AssistantAgent( llm=llm_config, tools=[CodeInterpreter()] ) # Run the agent with a prompt response = agent.run("Please write a python code snippet to calculate the sum of 123 and 456.") print(response)
qwen_agent --version
Debug
Known issues
gotchaAPI Key Configuration: Users often forget to set the correct environment variables (e.g., `DASHSCOPE_API_KEY` or `OPENAI_API_KEY`) or pass them incorrectly to the LLM configuration, leading to authentication errors.
fix
Ensure `DASHSCOPE_API_KEY` or `OPENAI_API_KEY` is set in your environment or explicitly passed in the `llm_config` dictionary. Double-check `model_server` matches your `model` and API key.
affects: All versions
gotchaMulti-Modal Compute Platform (MCP) is an optional dependency. Features relying on MCP (e.g., certain multi-modal capabilities) may not work without a specific setup or additional installation steps.
fix
If using MCP-dependent features, refer to the official documentation for specific installation and configuration instructions, as it may not be part of the base `qwen-agent` install.
affects: >=0.0.17
gotchaDefault LLM call and token limits can lead to unexpected truncations or early termination of agent runs. Defaults are `QWEN_AGENT_MAX_LLM_CALL_PER_RUN=20` and `QWEN_AGENT_DEFAULT_MAX_INPUT_TOKENS=58k`.
fix
For complex or lengthy tasks, consider adjusting these limits by setting the `QWEN_AGENT_MAX_LLM_CALL_PER_RUN` and `QWEN_AGENT_DEFAULT_MAX_INPUT_TOKENS` environment variables before running the agent.
affects: >=0.0.20
gotchaThe `gradio` dependency for GUI features has seen version modifications. If you encounter issues with the GUI, it might be due to `gradio` version incompatibility.
fix
Install `qwen-agent[gui]` to ensure the correct `gradio` version is used. If problems persist, check the library's `pyproject.toml` or `setup.py` for the exact `gradio` version pinned and adjust your environment accordingly.
affects: >=0.0.18
Upgrade
Version history
0.0.34latest on PyPI · released Feb 16, 2026
Audit
Dependencies
dashscoperequiredRequired for using Qwen models via the DashScope API.
openairequiredRequired for using OpenAI models.
gradiooptionalOptional dependency for GUI features, installed with `qwen-agent[gui]`.
Agent activity
56 hits · last 30 days
node
46
OpenAI (training)
1
Resources
qwen-agent — pip install qwen-agent · libregistry