代理接口协议(AIP)
状态:正在进行中 --核心工作正常,有201个通过测试,但这还处于早期阶段。非常欢迎贡献、反馈和新的后端适配器。
与提供商无关的多代理编排,基础设施几乎为零。tmux处理进程管理、进程间通信和会话持久性。共享的MCP服务器和文件系统工作区处理协调。LLM已经可以解析彼此的自然语言输出,因此代理之间的协议规范化可能是不必要的。
想法
| 而不是。.. | AIP使用。.. |
|---|---|
| 消息代理 | tmux服务器(共享内存) |
| 代理框架 | bash+tmux命令 |
| 自定义协议 | 代理以本机方式相互读取(LLM作为解析器) |
| 服务发现 | tmux list-windows |
| 状态数据库 | 带原子的文件系统 mv |
| SSE流媒体 | tmux窗格缓冲区 |
| HTTP传输(远程) | SSH |
| 可观察性 | workspace/events.jsonl (仅附加日志) |
建筑
tmux server "aip"
├── window 0: orchestrator (any CLI agent)
├── window 1: coder (claude/gemini/aider/etc)
├── window 2: reviewer (any CLI agent)
└── ...spawned and killed as needed
workspace/
├── summaries/ ← agent output summaries (markdown)
├── status/ ← agent status files (JSON, merge semantics)
├── tasks/ ← task queue (atomic claiming via mv)
│ ├── pending/ ← unclaimed tasks
│ ├── claimed/ ← in-progress (agent-name prefixed)
│ ├── done/ ← completed
│ └── failed/ ← move back to pending/ to retry
├── events.jsonl ← append-only event log
└── agent_tree.json ← teammate hierarchy and parent/child links三层存储器
| 层 | 存储 | 访问 | 重启后仍然存在 |
|---|---|---|---|
| 热 | tmux窗格缓冲区 | tmux capture-pane | 否(滚动窗) |
| 事件日志 | workspace/events.jsonl | tail -n 50 | 是的 |
| 冷 | 工作区文件(摘要、状态、任务) | cat | 是的 |
读取层次结构(令牌效率)
始终按此顺序检查——当存在结构化数据时,切勿跳到窗格读取:
| 级别 | 命令 | 成本 | 何时 |
|---|---|---|---|
| 1 | tail -n 20 workspace/events.jsonl | 约50个代币 | 发生了什么事? |
| 2 | cat workspace/status/coder.json | 约20个代币 | 谁在做什么? |
| 3 | cat workspace/summaries/coder-0317.md | ~100个代币 | 他们生产了什么? |
| 4 | read_pane(incremental=true) | 约20个代币 | 自上次检查以来发生了什么变化? |
| 5 | tmux capture-pane -pt aip:coder -S -5 | 约30个代币 | 快速浏览(最后5行) |
| 6 | tmux capture-pane -pt aip:coder -S -20 | ~100个令牌 | 更多上下文 |
| 7 | 完整窗格已读 | ~1000+个令牌 | 几乎从不需要 |
快速开始
pip install -e .
# Initialize workspace and tmux session
aip init --ensure-session
# Spawn an agent
aip agent spawn coder "gemini"
# Read what the agent is doing
aip agent capture coder
# Send it a task
aip agent send coder "implement the auth module"
# List all agents
aip agent list看 examples/two-agent-review.sh 对于完整的两代理场景,您可以在不到一分钟的时间内运行(不需要API密钥)。
支持的后端
AIP目前有跨两个集成层的11个CLI代理的适配器:
| 后端 | 层 | 钩子配置 | 注释 |
|---|---|---|---|
| 克劳德代码 | 一级(本地) | .claude/settings.json | 挂钩+MCP |
| 副驾驶 | 一级(本地) | .github/copilot/hooks.json | 挂钩+MCP |
| 双子座 | 一级(本地) | .gemini/settings.json | 挂钩+MCP |
| 基洛 | 一级(本地) | .kiro/agents/{name}.json | 挂钩+MCP |
| 食品法典 | 一级(本土) | .codex/hooks.json | 挂钩+MCP |
| OpenCode | 第1层(本机) | 插件事件 | MCP,手动挂钩连接 |
| 光标 | 第1层(本机) | .cursor/settings.json | 挂钩+MCP |
| Qwen | 一级(本地) | .qwen/settings.json | 挂钩+MCP |
| Kilo | 第1层(原生) | 插件事件 | OpenCode分叉 |
| Vibe(Mistral) | 第2层(垫片) | aip-shim 拦截 | MCP+匀场监视器 |
| Amp | Tier 2(垫片) | aip-shim 拦截 | MCP+匀场监视器 |
添加新后端是最简单的贡献方式之一——请参阅 贡献.md.
接下来是什么
AIP目前可用于本地多代理工作流,但还有很大的发展空间:
- \[ \] PyPI发布 --可通过以下方式安装
pip install agent-interface-protocol - \[ \] 更多端到端示例 --演示脚本之外的真实场景
- \[ \]
aip dashboard--实时工作的所有代理的实时多路视图 - \[ \] 额外的2级垫片 --Windsurf、Cline、Aider和其他没有本地挂钩的CLIs
- \[ \] ACP/A2A兼容层 --可选标志,用于在文件写入时发出ACP格式的事件
- \[ \] 远程多机编排 --基于SSH的跨主机工作区同步
- \[ \] IDE扩展(VSIX) --将AIP透明地集成到VS Code、Cursor、Windsurf中
安装
一个运行时依赖关系: mcp SDK。其他都是Python stdlib。
git clone https://github.com/dev-boz/agent-interface-protocol.git
cd agent-interface-protocol
pip install -e . # installs `aip` and `aip-mcp` commands
pip install -e '.[dev]' # also installs pytest for development需求:Python 3.10+,tmux。
发展
python -m pytest tests/ -q可选套房:
AIP_RUN_LIVE_TMUX=1 python -m pytest -q tests/integration/test_live_core.py
AIP_RUN_LIVE_TMUX=1 AIP_RUN_LIVE_CLI=1 python -m pytest -q tests/integration/test_live_backends.py202个测试,涵盖了工作区原语、任务队列、钩子规范化、MCP工具、CLI命令、多后端协作和选择性实时tmux/CLI覆盖率。看 贡献.md 了解详情。
文档
- 📖 完整的CLI和MCP参考
- 🏗️ 建筑深潜
- ⚡ 快速参考卡
- 📋 设计规范
许可证
麻省理工学院
