Skip to main content

Agent Team Work - A git-style multi-agent coordination system

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agtw-0.2.0.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agtw-0.2.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file agtw-0.2.0.tar.gz.

File metadata

  • Download URL: agtw-0.2.0.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for agtw-0.2.0.tar.gz
Algorithm Hash digest
SHA256 03567522bab8ebd04a4eb30e5583f0884bb4fbf9867615271bd95d91f6593741
MD5 ab49d9548a8c2e7264e479709c1185ac
BLAKE2b-256 5425b4b7292a4461d85d0176a6d7002ab28f613c73213653865d7a6959287a44

See more details on using hashes here.

File details

Details for the file agtw-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: agtw-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for agtw-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96a35686d2f29fb6a932a8990bcbb15e74f071908caa133a60b71b620033a3bb
MD5 bf4d0295882bbaed40c38a28cad9bf49
BLAKE2b-256 5898d5c4ea1aa26c4a87b76acdf7cf6f4f1be4be648d82a0d12fa4fdffcff69c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page