feat(agent-mail): Add Python adapter library for Agent Mail integration

- Created lib/beads_mail_adapter.py with AgentMailAdapter class
- Automatic health check on initialization
- Graceful degradation when server unavailable
- Methods: reserve_issue(), release_issue(), notify(), check_inbox()
- Environment-based configuration (AGENT_MAIL_URL, AGENT_MAIL_TOKEN)
- Comprehensive unit tests (15 tests, 100% passing)
- Full documentation in lib/README.md

Closes bd-m9th

Amp-Thread-ID: https://ampcode.com/threads/T-caa26228-0d18-4b35-b98a-9f95f6a099fe
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-11-08 00:15:07 -08:00
parent 716424e52a
commit 9351044539
10 changed files with 1233 additions and 15 deletions

View File

@@ -1,25 +1,44 @@
# MCP Agent Mail Integration - Current Status
## Completed
-**bd-muls**: MCP Agent Mail server installed and tested locally
- Server running successfully on port 8765
- Web UI accessible at http://127.0.0.1:8765/mail
- Installation location: `mcp_agent_mail/`
## Proof of Concept ✅ COMPLETE
## Known Issues
- ⚠️ MCP API tool execution errors when calling `ensure_project`
- Core HTTP infrastructure works
- Web UI functional
- Needs debugging of tool wrapper layer
**Epic:** bd-spmx (Investigation & Proof of Concept) - CLOSED
## Next Ready Work
- **bd-6hji** (P0): Test exclusive file reservations with two agents
- Requires working MCP API (fix tool execution first)
### Completed Validation
- **bd-muls**: Server installed and tested (~/src/mcp_agent_mail)
- **bd-27xm**: MCP API tool execution issues resolved
-**bd-6hji**: File reservation collision prevention validated
- Two agents (BrownBear, ChartreuseHill) tested
- First agent gets reservation, second gets conflict
- Collision prevention works as expected
-**bd-htfk**: Latency benchmarking completed
- Agent Mail: <100ms (HTTP API round-trip)
- Git sync: 2000-5000ms (full cycle)
- **20-50x latency reduction confirmed**
-**bd-pmuu**: Architecture Decision Record created
- File: [docs/adr/002-agent-mail-integration.md](docs/adr/002-agent-mail-integration.md)
- Documents integration approach, alternatives, tradeoffs
### Validated Benefits
1. **Collision Prevention**: Exclusive file reservations prevent duplicate work
2. **Low Latency**: <100ms vs 2000-5000ms (20-50x improvement)
3. **Lightweight**: <50MB memory, simple HTTP API
4. **Optional**: Git-only mode remains fully supported
## Next Phase: Integration (bd-wfmw)
Ready to proceed with integration layer implementation:
- HTTP client wrapper for Agent Mail API
- Reservation checks in bd update/ready
- Graceful fallback when server unavailable
- Environment-based configuration
## Quick Start Commands
```bash
# Start server
cd mcp_agent_mail && source .venv/bin/activate && uv run python -m mcp_agent_mail.cli serve-http
# Start Agent Mail server (optional)
cd ~/src/mcp_agent_mail
source .venv/bin/activate
uv run python -m mcp_agent_mail.cli serve-http
# Access web UI
open http://127.0.0.1:8765/mail
@@ -27,3 +46,8 @@ open http://127.0.0.1:8765/mail
# Stop server
pkill -f "mcp_agent_mail.cli"
```
## Resources
- [Latency Benchmark Results](latency_results.md)
- [ADR 002: Agent Mail Integration](docs/adr/002-agent-mail-integration.md)
- [Agent Mail Repository](https://github.com/Dicklesworthstone/mcp_agent_mail)