Wuwei - 无为而治的 AI 智能体框架
Project description
Wuwei
Wuwei 是一个轻量、可扩展的 Python Agent 框架,目标是把模型调用、会话管理、工具注册与执行、plan-and-execute 拆成边界清晰的模块,方便学习和继续扩展。
当前目录结构
wuwei/
├─ examples/ # 可直接运行的示例
├─ tests/ # pytest 测试
├─ wuwei/ # 框架源码
│ ├─ agent/ # Agent、PlanAgent、Session、基础抽象
│ ├─ runtime/ # AgentRunner、PlannerExecutorRunner
│ ├─ planning/ # Planner、Task
│ ├─ memory/ # Context
│ ├─ llm/ # Gateway、Types、Adapters
│ └─ tools/ # Tool、Registry、Executor
├─ pyproject.toml
└─ README.md
这次目录调整的核心是:
tests/只放测试examples/只放示例agent/只放门面对象和会话runtime/单独承接执行器planning/单独承接规划相关模型memory/单独承接上下文
安装
要求:
- Python
>=3.10
使用 pip:
pip install -e .
安装开发依赖:
pip install -e ".[dev]"
如果你使用 uv:
uv sync
核心模块
-
wuwei.agentAgent:普通单 agent 门面PlanAgent:plan-and-execute 门面AgentSession:会话对象BaseAgent / BaseSessionAgent:基础抽象
-
wuwei.runtimeAgentRunner:普通 agent 执行器PlannerExecutorRunner:plan-and-execute 执行器
-
wuwei.planningPlanner:任务规划器Task / TaskList:任务模型
-
wuwei.memoryContext:消息上下文
-
wuwei.llmLLMGateway:统一模型调用入口Message / ToolCall / LLMResponse / LLMResponseChunk:统一类型定义
-
wuwei.toolsToolRegistry:工具注册ToolExecutor:工具执行Tool / ToolParameters:工具 schema
快速开始
最简单的方式是直接运行 examples/ 里的示例。
离线示例:
python examples/tool_executor_minimal.py
在线示例:
$env:WUWEI_API_KEY="your_key"
python examples/agent_minimal.py
python examples/agent_session_minimal.py
python examples/plan_agent_minimal.py
更详细的说明可以看:
- examples/README.md
- docs/agent_framework_core_features.md:上下文压缩、滑动窗口、MySQL 历史、长期记忆、HITL 等核心能力实现指南
示例目录
-
- 完全离线可运行,适合先理解工具系统
-
- 最小
Agent示例,演示流式输出和工具调用
- 最小
-
- 演示 session 多轮复用
-
- 演示
PlanAgent的“先规划、再执行”
- 演示
当前建议的扩展方向
-
先完善
PlanAgent / PlannerExecutorRunner- 比如 task 并行执行、失败恢复、重规划
-
再增强
ToolExecutor- 比如更丰富的执行事件、超时控制、重试策略
-
最后再考虑可观测和 Web 可视化
- 这样不会过早把主链路搞复杂
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wuwei-0.1.4.tar.gz.
File metadata
- Download URL: wuwei-0.1.4.tar.gz
- Upload date:
- Size: 42.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2aa1909cbc9f33980e8164bac28e004114c9ceb2dfd686e558d24ca2656a563c
|
|
| MD5 |
0ad80fce624ab2a7e51adbe242e82a6a
|
|
| BLAKE2b-256 |
cee73fd06b78753144bc2b415bdf073ac62481262f91fcfb83b9470129a8deb7
|
File details
Details for the file wuwei-0.1.4-py3-none-any.whl.
File metadata
- Download URL: wuwei-0.1.4-py3-none-any.whl
- Upload date:
- Size: 49.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e508dea2ed9b06a70f6e9ce6607bdae863677809f21075ab482ca623e934ae2
|
|
| MD5 |
ac034d1d9093de63cdd1dec41cf62e42
|
|
| BLAKE2b-256 |
5e84797116017588cb044600f61aded7946a116af4560a88c2e5c7d2b8067ec9
|