QwenLM/Qwen-Agent
Python SDK for Qwen assistants that use tools, MCP, and document retrieval
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Qwen-Agent is a Python SDK with separate extension points for model access, tools, and agent orchestration. BaseChatModel provides the model-facing interface, including function calling. BaseTool defines the tool contract; register_tool makes custom implementations available by name. Agent is the base class for orchestration, and the built-in Assistant takes a model configuration, system message, tool list, and optional files.
The chatbot example makes state ownership explicit: application code keeps the message list, passes it to Assistant.run, consumes streamed responses, and appends the returned messages to the history. Tool integrations can use Python implementations or configured MCP servers; the local MCP examples launch server processes through npx or uvx. The repository separates the qwen_agent package, examples, and tests from application and serving code in browser_qwen/, qwen_server/, and run_server.py.
Key Capabilities & Differentiators
Function calling is available at the model layer and underpins agents such as FnCallAgent and ReActChat. The default tool-calling template supports parallel function calls. MCP extends the available tool set beyond in-process Python implementations, and v0.0.24 added support for treating an MCP server resource as a tool. The same release added a fallback for invalid tool-call output and allowed empty tool responses.
Assistant can take PDF files for document workflows. The long-document examples offer a retrieval-oriented implementation in assistant_rag.py and a more expensive agent approach in parallel_doc_qa.py; the one-million-token example is a single-needle retrieval test, not a general document QA accuracy guarantee. Model access includes DashScope and self-hosted OpenAI-compatible endpoints. Transformers model support and audio input were added in v0.0.24. Gradio WebUI provides a demo interface, while BrowserQwen is a separate example application.
Trade-offs & Limitations
Compared with calling a model API directly, Qwen-Agent is useful when one application needs tool dispatch, document retrieval, and MCP integration. A small application with a fixed set of tools may be easier to maintain with a direct API loop. Compared with a provider-neutral framework, the main reason to adopt Qwen-Agent is its integration with Qwen's tool-calling behavior. An OpenAI-compatible endpoint gives you serving choices, but it does not remove the need to test parsing against the specific model and backend.
DashScope avoids operating an inference server but introduces an external dependency and service costs. Self-hosting gives you more control over model placement, not automatic control over every tool's data flow. In production, scope MCP permissions and validate tool arguments at the execution boundary. The Docker interpreter mounts only the specified working directory and provides basic isolation; do not treat that alone as a sufficient boundary for untrusted workloads. Apache-2.0 covers the framework, not necessarily the models, services, or tools you pair with it.
Hardware & Deployment Guide
Install the Python package from PyPI and select the extras you need: gui, rag, code_interpreter, and mcp. Editable installation from source is also available. DashScope uses DASHSCOPE_API_KEY or an explicitly configured API key. For self-hosting, use an OpenAI-compatible endpoint: vLLM is the GPU-oriented route and Ollama is the local CPU or GPU option. Size inference separately from orchestration using the chosen model, representative context lengths, and expected concurrency; no fixed VRAM requirement is established.
Match tool parsing to the model before rollout. For QwQ and Qwen3 on vLLM, omit --enable-auto-tool-choice and --tool-call-parser hermes so Qwen-Agent handles parsing. For Qwen3-Coder, enable both flags and pair vLLM's built-in parser with use_raw_api. The interpreter requires a running Docker installation and may need network access for its initial image build, so prepare the image and tool dependencies before an offline rollout. For MCP, v0.0.25 added Streamable HTTP and switched the license to Apache-2.0; v0.0.26 added configurable SSE read timeouts and automatic reconnection.
Python teams building Qwen-based assistants that combine document retrieval, custom tools, and selected MCP servers, with the option to use DashScope or self-host inference.
A direct model API call covers your workflow, model-provider portability is the top priority, or you need production-grade isolation for untrusted code without building additional controls.
Quick Start & Installation
pip install -U "qwen-agent[gui,rag,code_interpreter,mcp]" # Or use `pip install -U qwen-agent` for the minimal requirements. # The optional requirements, specified in double brackets, are: # [gui] for Gradio-based GUI support; # [rag] for RAG support; # [code_interpreter] for Code Interpreter support; # [mcp] for MCP support.
Comparison vs. Top Agents & Frameworks Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| Qwen-Agent ★ | 17.3k | +26 | Python | Apache-2.0 | Python SDK for Qwen assistants that use tools, MCP, and document retrieval |
| browser-use | 122.7k | +477 | Python | MIT | Python REPL and CDP for adaptive browser automation |
| langchain | 150.4k | +299 | Python | MIT | Modular Python framework for building agents across model providers |
| agentscope | 37.2k | +342 | Python | Apache-2.0 | Python ReAct SDK and FastAPI service for observable, interruptible agent workflo |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/QwenLM/Qwen-Agent.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about Qwen-Agent
How do I integrate an existing Python service as an agent tool?
What hardware and VRAM do I need?
Can I use it commercially in a self-hosted product?
When should I choose Qwen-Agent over a direct API or a provider-neutral SDK?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy