Overview
Qwen-Agent is a framework for developing LLM applications based on the instruction following, tool usage, planning, and memory capabilities of Qwen. This guide will walk you through the installation process and initial setup.Prerequisites
Before installing Qwen-Agent, ensure you have:- Python 3.8 or higher (Python 3.10+ required for GUI features)
- pip package manager
- (Optional) Docker installed and running for Code Interpreter functionality
Installation Methods
- PyPI (Stable)
- Source (Development)
Install from PyPI
Install the stable version with all optional dependencies:The
-U flag ensures you get the latest version. If you encounter any issues, try running the command without quotes.Optional Dependencies
Qwen-Agent supports modular installation with optional dependencies for specific features:Minimal Installation
dashscope>=1.11.0json5,jsonlines,jsonschemaopenai,pydantic>=2.3.0requests,tiktoken,pillow
GUI Support
gradio==5.23.1gradio-client==1.8.0modelscope_studio==1.1.7pydantic==2.9.2
RAG Support
charset-normalizerrank_bm25,jieba,snowballstemmerbeautifulsoup4pdfminer.six,pdfplumberpython-docx,python-pptxpandas,tabulate
Code Interpreter
anyio>=3.7.1fastapi>=0.103.1jupyter>=1.0.0uvicorn>=0.23.2
MCP Support
mcp
- Node.js (latest version)
- uv 0.4.18 or higher
- Git
All Features
Model Service Configuration
Qwen-Agent requires a model service to function. You have two options:Option 1: DashScope (Alibaba Cloud)
Get API Key
Sign up for DashScope and obtain your API key from the dashboard.
Set Environment Variable
Configure your API key as an environment variable:
Add this to your shell profile (
.bashrc, .zshrc, etc.) to persist across sessions.Option 2: Self-Hosted Models
Deploy your own OpenAI-compatible model service using open-source Qwen models.- vLLM (High-Throughput GPU)
- Ollama (Local CPU+GPU)
- SGLang (Alternative)
Deploy with vLLM
Recommended for high-throughput production deployments.Docker Setup for Code Interpreter
The Code Interpreter tool requires Docker for secure code execution in isolated containers.Install Docker
Download and install Docker Desktop from docker.com
MCP Additional Setup
For Model Context Protocol (MCP) support, install additional system dependencies:Verification
Verify your installation by running a simple test:test_installation.py
Next Steps
Quickstart Guide
Build your first agent in 5 minutes
Examples
Explore example implementations
API Reference
Dive into the API documentation
GitHub
View source code and contribute
Troubleshooting
ImportError: cannot import name 'XXX'
ImportError: cannot import name 'XXX'
This usually indicates missing dependencies. Try reinstalling with all optional features:
GUI won't start - Python version error
GUI won't start - Python version error
The GUI requires Python 3.10 or higher due to Gradio 5 dependencies. Upgrade Python or use the CLI interface:
Docker connection error in Code Interpreter
Docker connection error in Code Interpreter
Ensure Docker is installed and running:On macOS/Windows, make sure Docker Desktop is running.
DashScope API Key not recognized
DashScope API Key not recognized
Verify your environment variable is set:If empty, set it again and restart your terminal/IDE.