Skip to main content

Pywen

Python 3.8+ License: MIT Alpha

中文版 | 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.

🎯 Project Background

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.

Why Choose Qwen3-Coder?

  • 🚀 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.

Differences from Other Code Agent CLIs

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.

✨ Features

  • 🤖 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

🚀 Quick Start

Installation

pip install pywen
Build 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\activate

First Use

Simply run the pywen command to start:

pywen

If 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!

Basic Usage

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

📖 User Guide

Command Line Interface

Available Commands

# System commands
/help, /?     - Show help information
/clear        - Clear screen and conversation history
/status       - Show agent status
/config       - Show current configuration
/stats        - Check session statistics (API calls, tokens, etc.)
/quit, /exit  - Exit Pywen

# Special commands
@<file>       - Include file content in prompt
!<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 agent

YOLO Mode

Use with caution:

  • Press Ctrl+Y to 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

Configuration Management

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:

  1. Command line arguments (highest)
  2. Configuration file values
  3. Environment variables
  4. Default values (lowest)

Environment Variables

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"

Getting API Keys

Serper API (Web Search):

  1. Visit serper.dev
  2. Sign up for a free account
  3. Get your API key from the dashboard

Jina API (Content Reading):

  1. Visit jina.ai
  2. Sign up for a free account
  3. Get your API key from the dashboard

🛠️ Available Tools

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.

📊 Trajectory Recording

Pywen automatically records detailed execution trajectories for debugging and analysis:

# Trajectory files are automatically saved to trajectories/ directory
trajectories/trajectory_xxxxxx.json

Trajectory 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

📈 Session Statistics

Monitor your usage with real-time statistics:

> /stats

Tracks:

  • API calls and token consumption
  • Tool usage patterns
  • Session duration
  • Model performance metrics

🤝 Contributing

We welcome contributions to Pywen! Here's how to get started:

  1. Fork the repository
  2. 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
    
  3. Create a feature branch
  4. Make your changes and add tests
  5. Submit a pull request

Development Guidelines

  • Follow PEP 8 style guidelines
  • Add tests for new features
  • Update documentation as needed
  • Use type hints appropriately
  • Ensure all tests pass before submitting

📋 Requirements

  • Python 3.8+
  • Qwen API key (recommended) or other supported LLM provider API keys
  • Internet connection for API access

🔧 Troubleshooting

Common Issues

Configuration Issues:

# Re-run configuration wizard
rm pywen_config.json
pywen

API Key Issues:

# Verify your API key is set
echo $QWEN_API_KEY

# Check configuration in Pywen
> /config

🙏 Acknowledgments

We 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

📄 License

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! 🚀

Metadata

Release files for pywen-agent 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywen-agent 0.1.1
File Size Uploaded Provenance Actions
pywen_agent-0.1.1.tar.gz 212.3 kB Without provenance Details for pywen_agent-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pywen-agent 0.1.1
File Interpreter ABI Platform Actions
pywen_agent-0.1.1-py3-none-any.whl Python 3 none any Details for pywen_agent-0.1.1-py3-none-any.whl

Total release size: 464.6 kB

Release files / pywen_agent-0.1.1.tar.gz

Download URL pywen_agent-0.1.1.tar.gz
Size 212.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a537f6b09ecfacbe5c46603a25c2f913f4bf65993bc599dc25a2940328d91dc3
BLAKE2b-256 checksum
How to use checksums
a41abc881da981ff3c00d9f0210d2515bcbc3bd8846f1179375d09d7eb7ef7df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / pywen_agent-0.1.1-py3-none-any.whl

Download URL pywen_agent-0.1.1-py3-none-any.whl
Size 252.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
338b13c99edbc0ce0ce545a499f279237ae021f47f045d932f05d84e31d16ad8
BLAKE2b-256 checksum
How to use checksums
0779306dbc6a0956ed6767b81c3ae93d9825684e9f0036146ac62abc24f4c16c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Security for pywen-agent 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page