Skip to main content

agtw - Agent Team Work

一個類似 Git/Docker CLI 的多智能體協調系統。

PyPI version GitHub

功能特色

  • Session 管理 - 建立、加入、刪除工作階段
  • 多元代理 - Planner(規劃)、Executor(執行)、Evaluator(評估)
  • 安全審查 - Shell 命令由 Guard 代理審查後才執行
  • WebSocket 伺服器 - 持久化連線,支援推播
  • 雙模式 CLI - 支援 One-shot 指令和 REPL 互動模式
  • Session 持久化 - 用戶端自動記憶當前 session

安裝

pip install agtw

或開發模式:

git clone https://github.com/ccc-py/agtw.git
cd agtw
pip install -e ".[dev]"

快速開始

One-shot 模式

# 啟動伺服器
agtw server

# 在另一終端:
agtw session new myproject          # 建立 session
agtw session join myproject         # 加入 session
agtw agent exec "寫一個 hello.py"  # 建立 executor
agtw agent list                     # 列出 agents

REPL 互動模式

agtw shell

[無 session] agtw> session new myproject
[myproject] agtw> agent exec "寫 hello"
[myproject] agtw> agent list
[myproject] agtw> exit

指令列表

伺服器

指令 說明
agtw server 啟動 agtw 伺服器

Session 管理

指令 說明
agtw session new [name] 建立新 session
agtw session list 列出所有 sessions
agtw session join <id> 加入 session
agtw session leave 離開目前 session
agtw session delete <id> 刪除 session

Agent 操作

指令 說明
agtw agent list 列出目前 session 的 agents
agtw agent exec <task> 建立 executor
agtw agent eval <desc> 建立 evaluator

其他

指令 說明
agtw planner <prompt> 執行 planner
agtw status 顯示狀態
agtw shell 進入 REPL 互動模式

系統架構

┌─────────────────────────────────────────────────┐
│                   agtw CLI                      │
│         (One-shot 或 REPL 模式)                  │
└─────────────────┬───────────────────────────────┘
                  │ WebSocket
┌─────────────────▼───────────────────────────────┐
│               agtw Server                       │
│  ┌─────────────────────────────────────────┐   │
│  │           SessionManager               │   │
│  │  ┌─────────┐ ┌─────────┐ ┌─────────┐  │   │
│  │  │ Session │ │ Session │ │ Session │  │   │
│  │  │  ┌────┐ │ │  ┌────┐ │ │  ┌────┐ │  │   │
│  │  │  │Planner│ │  │Planner│ │  │Planner│ │  │   │
│  │  │  └────┘ │ │  └────┘ │ │  └────┘ │  │   │
│  │  │  ┌────┐ │ │  ┌────┐ │ │  ┌────┐ │  │   │
│  │  │  │Exec │ │ │  │Exec │ │ │  │Exec │ │  │   │
│  │  │  └────┘ │ │  └────┘ │ │  └────┘ │  │   │
│  │  │  ┌────┐ │ │  ┌────┐ │ │  ┌────┐ │  │   │
│  │  │  │Eval │ │ │  │Eval │ │ │  │Eval │ │  │   │
│  │  │  └────┘ │ │  └────┘ │ │  └────┘ │  │   │
│  │  └────┬────┘ └────┬────┘ └────┬────┘  │   │
│  │       └───────────┼───────────┘       │   │
│  │              ┌────▼────┐               │   │
│  │              │  Guard  │               │   │
│  │              └────┬────┘               │   │
│  └──────────────────┼─────────────────────┘   │
└─────────────────────┼───────────────────────────┘
                      │ Shell Commands
              ┌───────▼───────┐
              │    System     │
              └───────────────┘

代理說明

  • Planner - 分析需求、規劃任務、協調團隊
  • Executor - 執行 Planner 交辦的具體任務
  • Evaluator - 驗證 Executor 的執行結果
  • Guard - 安全審查員,檢查 Shell 命令是否危險

開發指令

# 執行測試
python -m pytest tests/ -v

# 打包上傳 PyPI
python -m build
twine upload dist/*

依賴

  • Python >= 3.10
  • aiohttp >= 3.8.0
  • websockets >= 10.0

License

MIT

Metadata

Release files for agtw 0.2.2

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

Source distribution (sdist)

Source distribution for agtw 0.2.2
File Size Uploaded Provenance
agtw-0.2.2.tar.gz 22.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agtw 0.2.2
File Interpreter ABI Platform
agtw-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 42.1 kB

Release files / agtw-0.2.2.tar.gz

Download URL agtw-0.2.2.tar.gz
Size 22.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2bcd704139dd2ddbf08679ab4fcdc2b7e866ad32a49a2a894db8618c3269a93f
BLAKE2b-256 checksum
How to use checksums
78c7cedf431f4e37b89595416ffb3c2fce5e291216c9fe18e93e1d27ad519454
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / agtw-0.2.2-py3-none-any.whl

Download URL agtw-0.2.2-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eabbc65270c81f588c641b025ff756531ca241e37750b6bf38b4fcd98259ef57
BLAKE2b-256 checksum
How to use checksums
d98e87df902221b87a22ccaee865bea1ac350bbf4a015ef2508a4853c10e333a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for agtw 0.2.2

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.

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