δΈζη | English
Pywen is a Python CLI tool based on Qwen3-Coder, designed specifically for intelligent software engineering tasks. It provides a conversational interface that can understand natural language instructions and execute complex development workflows through an advanced agent system.
- 2025.08.26 Updated the
/agentmodule by adding the Claude Code agent, with execution logic aligned to Claude Code, and introducing dedicated tools such as the task tool and todowrite tool. You can switch to the Claude Code agent using/agent claude. - 2025.08.08: Updated the
/agentswitch agent module, added DeepResearch agent, with execution logic aligned with Google's open-source DeepResearch LangGraph version. You can use/agent researchto switch GeminiResearchDemo agent.Before you use it, please make sure you have the serper api key. - 2025.08.06: Released the first version of Pywen, with execution logic aligned with Gemini CLI/Qwen Code
Pywen is built on the Qwen3-Coder large language model, aiming to provide developers with an efficient and intelligent code assistant. The project is primarily adapted from Qwen-Code, with deep optimizations for Python developers and the Qwen3-Coder model.
- π Code Specialization: Qwen3-Coder excels in code generation, understanding, and debugging
- β‘ Efficient Inference: Optimized model architecture providing fast responses
- π§ Engineering Practicality: Specifically trained for real-world software development scenarios
Project Status: The project is still under active development. We welcome your help in improving Pywen.
Pywen is a Python-based CLI tool with excellent Python ecosystem compatibility and developer-friendliness. It provides a transparent, modular architecture that allows researchers and developers to easily modify, extend, and analyze, making it an ideal platform for researching AI Agent architectures, conducting ablation studies, and developing new Agent capabilities. This research-friendly design enables academia and the open-source community to more easily contribute to foundational Agent frameworks and build innovative applications, facilitating continuous breakthroughs in the rapidly evolving AI Agent field.
- π€ Qwen3-Coder-Plus Powered: Based on Alibaba Cloud's latest code-specialized large model
- π¦ Modular: Built on modular architecture, extensible and customizable (future support for multi-agent frameworks)
- π οΈ Rich Tool Ecosystem: File editing, bash execution, sequential thinking, and more
- π Trajectory Recording: Detailed logging of all Agent operations for debugging and analysis
- βοΈ Smart Configuration: Automatic guided configuration on first run, supports environment variables
- π Session Statistics: Real-time tracking of API calls, tool usage, and token consumption
pip install pywenBuild from source with uv (recommended)
git clone https://github.com/PAMPAS-Lab/Pywen.git
cd Pywen
uv venv
uv sync --all-extras
# linux/macos
source .venv/bin/activate
# windows
.venv\Scripts\activateSimply run the pywen command to start:
pywenIf it's your first run and there's no configuration file, Pywen will automatically start the configuration wizard:
βββββββ βββ ββββββ βββββββββββββββ βββ
ββββββββββββ βββββββ ββββββββββββββββ βββ
ββββββββ βββββββ βββ ββ βββββββββ ββββββ βββ
βββββββ βββββ ββββββββββββββββ ββββββββββ
βββ βββ βββββββββββββββββββββ ββββββ
βββ βββ ββββββββ βββββββββββ βββββ
Configuration file not found, starting setup wizard...
API Key: [Enter your Qwen API key]
Base URL: https://dashscope.aliyuncs.com/compatible-mode/v1
Model: qwen3-coder-plus
...
β
Configuration saved to pywen_config.json
After configuration is complete, you can start using Pywen!
Once you enter the Pywen command-line interface, you can:
# File operations
> Create a Python script to calculate Fibonacci sequence
> Refactor functions in main.py to make them more efficient
# Code analysis and debugging
> Fix bugs in this project and add unit tests
> Analyze performance bottlenecks in my code
# Project management
> Create a new Flask web application with proper structure
> Add comprehensive documentation to this codebase# System commands
/about show version info
/auth change the auth method
/clear clear the screen and conversation history
/help for help on pywen code
/memory Commands for interacting with memory.show
Show the current memory contents.add
Add content to the memory.refresh
Refresh the memory from the source.
/stats check session stats. Usage:/stats
/tools list available Pywen tools
/bug submit a bug report
/quit exit the cli
! shell command
# Special commands
!<command> - Execute shell command
# Keyboard shortcuts
Ctrl+Y - Toggle YOLO mode (auto-approve all operations - use with caution!)
# Direct input of task descriptions to execute agentUse with caution:
- Press
Ctrl+Yto toggle YOLO mode - Default behavior: All tool calls require user confirmation for safety
- In YOLO mode, all tool calls are automatically approved without user confirmation
- This speeds up execution but removes safety checks
- Mode status is displayed in the interface
- You can also type 'a' (always) when prompted for tool confirmation to enable YOLO mode
Pywen uses the pywen_config.json file for configuration:
{
"default_provider": "qwen",
"max_steps": 20,
"enable_lakeview": false,
"model_providers": {
"qwen": {
"api_key": "your-qwen-api-key",
"base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"model": "qwen3-coder-plus",
"max_tokens": 4096,
"temperature": 0.5
}
}
}Configuration Priority:
- Command line arguments (highest)
- Configuration file values
- Environment variables
- Default values (lowest)
You can set API keys through environment variables:
# Qwen (required)
export QWEN_API_KEY="your-qwen-api-key"
# Tool API Keys (optional but recommended)
export SERPER_API_KEY="your-serper-api-key" # For web search
export JINA_API_KEY="your-jina-api-key" # For content reading
# Other supported providers
export OPENAI_API_KEY="your-openai-api-key"
export ANTHROPIC_API_KEY="your-anthropic-api-key"Serper API (Web Search):
- Visit serper.dev
- Sign up for a free account
- Get your API key from the dashboard
Jina API (Content Reading):
- Visit jina.ai
- Sign up for a free account
- Get your API key from the dashboard
Pywen provides a comprehensive toolkit for software development:
- File Operations: Create, edit, read, and manage files
- Bash Execution: Run shell commands and scripts
- Sequential Thinking: Structured problem-solving approach
- Task Completion: Mark tasks as complete with summaries
- JSON Operations: Parse and manipulate JSON data
For detailed information about all available tools and their capabilities, see docs/tools.md.
Pywen also supports MCP (Model Context Protocol) to connect external tools and services such as playwright.
- Open your configuration file:
~/.pywen/pywen_config.json - Locate the
mcpsection and enable it:"mcp": { "enabled": true, "isolated": true, "servers": [ { "name": "playwright", "command": "npx", "args": [ "@playwright/mcp@latest" ], "enabled": true, "include": [ "browser_*" ], "save_images_dir": "./outputs/playwright", "isolated": true } ] }
Ensure that you have Node.js installed. You can verify it with the following command:
node -vIf you donβt have it installed, please follow the Node.js installation guide.
If your device does not have a browser installed, install browser for Playwright with:
npx playwright install --with-depsAfter enabling MCP and installing the required browser, Pywen will be able to call the playwright MCP server for tasks like browser automation, screenshot capture, and web interaction.
Pywen automatically records detailed execution trajectories for debugging and analysis:
# Trajectory files are automatically saved to trajectories/ directory
trajectories/trajectory_xxxxxx.jsonTrajectory files contain:
- LLM Interactions: All messages, responses, and tool calls
- Agent Steps: State transitions and decision points
- Tool Usage: Which tools were called and their results
- Metadata: Timestamps, token usage, and execution metrics
Monitor your usage with real-time statistics:
> /statsTracks:
- API calls and token consumption
- Tool usage patterns
- Session duration
- Model performance metrics
We welcome contributions to Pywen! Here's how to get started:
- Fork the repository
- Set up the development environment:
git clone https://github.com/your-username/Pywen.git cd Pywen uv venv uv sync --all-extras # linux/macos source .venv/bin/activate # windows .venv\Scripts\activate
- Create a feature branch
- Make your changes and add tests
- Submit a pull request
- Follow PEP 8 style guidelines
- Add tests for new features
- Update documentation as needed
- Use type hints appropriately
- Ensure all tests pass before submitting
- Python 3.9+,<3.13
- Qwen API key (recommended) or other supported LLM provider API keys
- Internet connection for API access
Configuration Issues:
# Re-run configuration wizard
rm pywen_config.json
pywenAPI Key Issues:
# Verify your API key is set
echo $QWEN_API_KEY
# Check configuration in Pywen
> /configWe thank:
- Google for the Gemini CLI project, which provided agent execution logic and rich tool ecosystem libraries for this project
- Alibaba Cloud Qwen Team for providing the powerful Qwen3-Coder model and Qwen-Code reference implementation
- ByteDance for the trae-agent project, which provided valuable foundational architecture for this project
- Yuyz0112 for the claude-code-reverse project, and shareAI-lab for the Kode project, both of which provided inspiration for the Claude code agent development in this project
This project is licensed under the MIT License - see the LICENSE file for details.
Pywen - Making the power of Qwen3-Coder accessible for intelligent software development! π
PAMPAS-Lab - Dedicated to breakthroughs in large model agent frameworks, bridging AI research and applications! π