中文版 | English

Pywen is a full-stack Python Code Agent platform built for transparent engineering practice and reproducible research. It serves both as a practical coding assistant for developers and as a unified foundation where different agents can be compared, debugged, and evolved in a controllable environment.
Pywen is positioned as a unified foundation for the Code Agent ecosystem, with two complementary roles:
Core design goals:
/agent module 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./agent switch agent module, added DeepResearch agent, with execution logic aligned with Google's open-source DeepResearch LangGraph version. You can use /agent research to switch GeminiResearchDemo agent. Before you use it, please make sure you have the serper api key.Pywen was developed in response to common pain points in existing Code Agent tooling for Python users: fragmented tech stacks, limited observability, difficult customization, and poor cross-agent comparability.
From implementation perspective, Pywen references and learns from projects such as Qwen-Code and Codex, and can run with code-capable models including Qwen3-Coder. We acknowledge and appreciate these open-source contributions. These are development choices rather than the primary product positioning.
Project Status: The project is still under active development. We welcome your help in improving Pywen.
Pywen is a Python-native CLI with strong ecosystem compatibility and a transparent modular architecture. It is designed for both practical delivery and scientific iteration: developers can inspect and control execution paths, while researchers can run fair comparisons and reproducible studies in a unified environment. This research-friendly and engineering-oriented design helps build an open, evolvable foundation for the Code Agent community.
/agent commandpip install pywen
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
Simply run the pywen command to start:
# Interactive mode (default)
pywen
# Single prompt mode
pywen "Create a Python hello world script"
# Specify agent type
pywen --agent pywen
pywen --agent claude
pywen --agent codex
# Specify model and API key via command line
pywen --model "Qwen/Qwen3-Coder-Plus" --api_key "your-key"
If it's your first run and there's no configuration file:
~/.pywen/pywen_config.yamlpywen_config.yaml in the current working directory or any parent directorypywen_config.example.yaml and copy it to the default path:# built-in example configuration located at `pywen/config/pywen_config.example.yaml`
cp pywen/config/pywen_config.example.yaml ~/.pywen/pywen_config.yaml
pywen_config.yaml and edit fields like api_key / modelPYWEN_API_KEY, PYWEN_MODEL, PYWEN_BASE_URL)Therefore, the recommended workflow is to prepare pywen_config.yaml (or the relevant environment variables) according to the example configuration before running 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
/agent switch between different agents (pywen/claude/codex/research)
/clear clear the screen and conversation history
/help for help on pywen code
/model view and manage model configurations
/stats check session stats
/tools list available Pywen tools
/bug submit a bug report
/quit exit the cli
# 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 agent
Pywen supports multiple specialized agents:
# List available agents
/agent
# Switch to Pywen Agent (default, Qwen3-Coder based)
/agent pywen
# Switch to Claude Code Agent
/agent claude
# Switch to Codex Agent (OpenAI GPT-5 Codex)
/agent codex
# Switch to Research Agent (Gemini-based)
/agent research
Available Agents:
pywen): General-purpose coding assistant based on Qwen3-Coderclaude): Advanced file operations and project understandingcodex): OpenAI Codex-based coding assistantresearch): Multi-step research agent for comprehensive information gatheringUse with caution:
Ctrl+Y to toggle YOLO modePywen uses YAML configuration files. The default configuration file is located at ~/.pywen/pywen_config.yaml.
Example Configuration:
# Default agent to use
default_agent: pywen
# Model configurations
agents:
# Pywen Agent (Qwen3-Coder)
- agent_name: pywen
model: "Qwen/Qwen3-Coder-Plus"
api_key: "your-api-key"
base_url: "https://api-inference.modelscope.cn/v1"
provider: openai
wire_api: chat
# Claude Code Agent
- agent_name: claude
provider: anthropic
model: "claude-3.5-sonnet"
api_key: "your-anthropic-key"
base_url: "https://api.anthropic.com/v1"
wire_api: chat
# Codex Agent
- agent_name: codex
provider: openai
model: "gpt-5.1"
api_key: "your-openai-key"
base_url: "https://api.openai.com/v1/"
wire_api: responses
# Permission level: locked / edit_only / planning / yolo
permission_level: locked
# Maximum conversation turns
max_turns: 10
# Memory monitor settings
memory_monitor:
check_interval: 3
maximum_capacity: 100000
model: "Qwen/Qwen3-235B-A22B-Instruct-2507"
Configuration Priority:
Configuration File Location: Pywen ships an embedded example configuration; on first run it will copy it to the default config path.
~/.pywen/pywen_config.yaml--config flagYou can set API keys through environment variables. Pywen supports agent-specific environment variables:
# Pywen Agent (Qwen3-Coder)
export PYWEN_PYWEN_API_KEY="your-api-key"
export PYWEN_PYWEN_BASE_URL="https://api-inference.modelscope.cn/v1"
export PYWEN_PYWEN_MODEL="Qwen/Qwen3-Coder-Plus"
# Claude Agent
export PYWEN_CLAUDE_API_KEY="your-anthropic-key"
export PYWEN_CLAUDE_BASE_URL="https://api.anthropic.com/v1"
export PYWEN_CLAUDE_MODEL="claude-3.5-sonnet"
# Codex Agent
export PYWEN_CODEX_API_KEY="your-openai-key"
export PYWEN_CODEX_BASE_URL="https://api.openai.com/v1/"
export PYWEN_CODEX_MODEL="gpt-5.1"
# Generic fallback (if agent-specific not set)
export PYWEN_API_KEY="your-api-key"
export PYWEN_BASE_URL="https://api-inference.modelscope.cn/v1"
# 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
Environment Variable Format:
PYWEN_<AGENT_NAME>_<FIELD> (e.g., PYWEN_PYWEN_API_KEY)PYWEN_<FIELD> (fallback if agent-specific not set)Serper API (Web Search):
Jina API (Content Reading):
Pywen provides a comprehensive toolkit for software development. Different agents may have access to different tools:
Common Tools (Available to most agents):
read_file, write_file, edit, read_many_filesls, glob, grepbash - Run shell commands and scriptsweb_search, web_fetchmemory - Store and retrieve informationAgent-Specific Tools:
task, todo - Task planning and managementupdate_plan, apply_patch - Codex-specific operationsFor 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.
~/.pywen/pywen_config.yaml
mcp section and enable it:
mcp:
enabled: true
isolated: false
servers:
- name: "playwright"
command: "npx"
args:
- "@playwright/mcp@latest"
enabled: true
include:
- "browser_*"
save_images_dir: "./outputs/playwright"
Ensure that you have Node.js installed. You can verify it with the following command:
node -v
If 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-deps
After 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.json
Trajectory files contain:
Monitor your usage with real-time statistics:
> /stats
Tracks:
We welcome contributions to Pywen! Here's how to get started:
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
Configuration Issues:
# re-create config from the built-in example template
rm ~/.pywen/pywen_config.yaml
pywen
API Key Issues:
# Verify your API key is set (for Pywen agent)
echo $PYWEN_PYWEN_API_KEY
# Or check generic fallback
echo $PYWEN_API_KEY
# Check configuration in Pywen
> /model
Agent Switching Issues:
# List available agents
> /agent
# Check current agent type
> /stats
We thank:
This project is licensed under the MIT License - see the LICENSE file for details.
Pywen - Making the power of Code Agent accessible for intelligent software development! 🚀
PAMPAS-Lab - Dedicated to breakthroughs in large model agent frameworks, bridging AI research and applications! 🚀
Python
100.0%
中文版 | English

Pywen is a full-stack Python Code Agent platform built for transparent engineering practice and reproducible research. It serves both as a practical coding assistant for developers and as a unified foundation where different agents can be compared, debugged, and evolved in a controllable environment.
Pywen is positioned as a unified foundation for the Code Agent ecosystem, with two complementary roles:
Core design goals:
/agent module 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./agent switch agent module, added DeepResearch agent, with execution logic aligned with Google's open-source DeepResearch LangGraph version. You can use /agent research to switch GeminiResearchDemo agent. Before you use it, please make sure you have the serper api key.Pywen was developed in response to common pain points in existing Code Agent tooling for Python users: fragmented tech stacks, limited observability, difficult customization, and poor cross-agent comparability.
From implementation perspective, Pywen references and learns from projects such as Qwen-Code and Codex, and can run with code-capable models including Qwen3-Coder. We acknowledge and appreciate these open-source contributions. These are development choices rather than the primary product positioning.
Project Status: The project is still under active development. We welcome your help in improving Pywen.
Pywen is a Python-native CLI with strong ecosystem compatibility and a transparent modular architecture. It is designed for both practical delivery and scientific iteration: developers can inspect and control execution paths, while researchers can run fair comparisons and reproducible studies in a unified environment. This research-friendly and engineering-oriented design helps build an open, evolvable foundation for the Code Agent community.
/agent commandpip install pywen
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
Simply run the pywen command to start:
# Interactive mode (default)
pywen
# Single prompt mode
pywen "Create a Python hello world script"
# Specify agent type
pywen --agent pywen
pywen --agent claude
pywen --agent codex
# Specify model and API key via command line
pywen --model "Qwen/Qwen3-Coder-Plus" --api_key "your-key"
If it's your first run and there's no configuration file:
~/.pywen/pywen_config.yamlpywen_config.yaml in the current working directory or any parent directorypywen_config.example.yaml and copy it to the default path:# built-in example configuration located at `pywen/config/pywen_config.example.yaml`
cp pywen/config/pywen_config.example.yaml ~/.pywen/pywen_config.yaml
pywen_config.yaml and edit fields like api_key / modelPYWEN_API_KEY, PYWEN_MODEL, PYWEN_BASE_URL)Therefore, the recommended workflow is to prepare pywen_config.yaml (or the relevant environment variables) according to the example configuration before running 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
/agent switch between different agents (pywen/claude/codex/research)
/clear clear the screen and conversation history
/help for help on pywen code
/model view and manage model configurations
/stats check session stats
/tools list available Pywen tools
/bug submit a bug report
/quit exit the cli
# 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 agent
Pywen supports multiple specialized agents:
# List available agents
/agent
# Switch to Pywen Agent (default, Qwen3-Coder based)
/agent pywen
# Switch to Claude Code Agent
/agent claude
# Switch to Codex Agent (OpenAI GPT-5 Codex)
/agent codex
# Switch to Research Agent (Gemini-based)
/agent research
Available Agents:
pywen): General-purpose coding assistant based on Qwen3-Coderclaude): Advanced file operations and project understandingcodex): OpenAI Codex-based coding assistantresearch): Multi-step research agent for comprehensive information gatheringUse with caution:
Ctrl+Y to toggle YOLO modePywen uses YAML configuration files. The default configuration file is located at ~/.pywen/pywen_config.yaml.
Example Configuration:
# Default agent to use
default_agent: pywen
# Model configurations
agents:
# Pywen Agent (Qwen3-Coder)
- agent_name: pywen
model: "Qwen/Qwen3-Coder-Plus"
api_key: "your-api-key"
base_url: "https://api-inference.modelscope.cn/v1"
provider: openai
wire_api: chat
# Claude Code Agent
- agent_name: claude
provider: anthropic
model: "claude-3.5-sonnet"
api_key: "your-anthropic-key"
base_url: "https://api.anthropic.com/v1"
wire_api: chat
# Codex Agent
- agent_name: codex
provider: openai
model: "gpt-5.1"
api_key: "your-openai-key"
base_url: "https://api.openai.com/v1/"
wire_api: responses
# Permission level: locked / edit_only / planning / yolo
permission_level: locked
# Maximum conversation turns
max_turns: 10
# Memory monitor settings
memory_monitor:
check_interval: 3
maximum_capacity: 100000
model: "Qwen/Qwen3-235B-A22B-Instruct-2507"
Configuration Priority:
Configuration File Location: Pywen ships an embedded example configuration; on first run it will copy it to the default config path.
~/.pywen/pywen_config.yaml--config flagYou can set API keys through environment variables. Pywen supports agent-specific environment variables:
# Pywen Agent (Qwen3-Coder)
export PYWEN_PYWEN_API_KEY="your-api-key"
export PYWEN_PYWEN_BASE_URL="https://api-inference.modelscope.cn/v1"
export PYWEN_PYWEN_MODEL="Qwen/Qwen3-Coder-Plus"
# Claude Agent
export PYWEN_CLAUDE_API_KEY="your-anthropic-key"
export PYWEN_CLAUDE_BASE_URL="https://api.anthropic.com/v1"
export PYWEN_CLAUDE_MODEL="claude-3.5-sonnet"
# Codex Agent
export PYWEN_CODEX_API_KEY="your-openai-key"
export PYWEN_CODEX_BASE_URL="https://api.openai.com/v1/"
export PYWEN_CODEX_MODEL="gpt-5.1"
# Generic fallback (if agent-specific not set)
export PYWEN_API_KEY="your-api-key"
export PYWEN_BASE_URL="https://api-inference.modelscope.cn/v1"
# 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
Environment Variable Format:
PYWEN_<AGENT_NAME>_<FIELD> (e.g., PYWEN_PYWEN_API_KEY)PYWEN_<FIELD> (fallback if agent-specific not set)Serper API (Web Search):
Jina API (Content Reading):
Pywen provides a comprehensive toolkit for software development. Different agents may have access to different tools:
Common Tools (Available to most agents):
read_file, write_file, edit, read_many_filesls, glob, grepbash - Run shell commands and scriptsweb_search, web_fetchmemory - Store and retrieve informationAgent-Specific Tools:
task, todo - Task planning and managementupdate_plan, apply_patch - Codex-specific operationsFor 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.
~/.pywen/pywen_config.yaml
mcp section and enable it:
mcp:
enabled: true
isolated: false
servers:
- name: "playwright"
command: "npx"
args:
- "@playwright/mcp@latest"
enabled: true
include:
- "browser_*"
save_images_dir: "./outputs/playwright"
Ensure that you have Node.js installed. You can verify it with the following command:
node -v
If 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-deps
After 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.json
Trajectory files contain:
Monitor your usage with real-time statistics:
> /stats
Tracks:
We welcome contributions to Pywen! Here's how to get started:
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
Configuration Issues:
# re-create config from the built-in example template
rm ~/.pywen/pywen_config.yaml
pywen
API Key Issues:
# Verify your API key is set (for Pywen agent)
echo $PYWEN_PYWEN_API_KEY
# Or check generic fallback
echo $PYWEN_API_KEY
# Check configuration in Pywen
> /model
Agent Switching Issues:
# List available agents
> /agent
# Check current agent type
> /stats
We thank:
This project is licensed under the MIT License - see the LICENSE file for details.
Pywen - Making the power of Code Agent accessible for intelligent software development! 🚀
PAMPAS-Lab - Dedicated to breakthroughs in large model agent frameworks, bridging AI research and applications! 🚀
Python
100.0%