diff options
Diffstat (limited to 'A2A_protocol_spec.md')
| -rw-r--r-- | A2A_protocol_spec.md | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/A2A_protocol_spec.md b/A2A_protocol_spec.md index e73b0e9..bb3d713 100644 --- a/A2A_protocol_spec.md +++ b/A2A_protocol_spec.md @@ -1,7 +1,7 @@ -# A2A Protocol Specification v0.1 +# A2A Protocol Specification v0.2 ## Overview -Agent-to-Agent (A2A) is a decentralized message protocol for agent negotiation within newOS4. Agents discover each other via VFS registrations and communicate through a shared message queue. No central broker. +Agent-to-Agent (A2A) is a decentralized message protocol for agent negotiation within newOS4. Agents discover each other via VFS registrations and communicate through a VFS mailbox system. No central broker. ## Message Format All messages are JSON with this envelope: @@ -26,8 +26,19 @@ All messages are JSON with this envelope: } ``` -## Transport Layer -Each agent has a VFS mailbox at `/agents/<agent_id>/inbox.json` and publishes to `/agents/<agent_id>/outbox.json`. The orchestrator monitors inboxes via periodic polling (500ms interval). +## Transport Layer (VFS Mailbox) +Each agent has a VFS mailbox: +- **Inbox** — `/agents/<agent_id>/inbox.json` — receives incoming A2A messages +- **Outbox** — `/agents/<agent_id>/outbox.json` — agent writes results here after execution + +The orchestrator polls all agent inboxes every **500ms** via `_pollAgentMailboxes()`. When a new A2A message appears, it: +1. Reads the message envelope +2. Routes by type: + - `request` — task delegation, checks outbox for completion + - `response` — task result from agent + - `broadcast` — capability advertisement + - `heartbeat` — updates agent's lastHeartbeat timestamp +3. Marks messages as `_processed` to avoid re-routing ## Message Types - **request**: Point-to-point task delegation. From=orchestrator, To=worker. @@ -36,10 +47,23 @@ Each agent has a VFS mailbox at `/agents/<agent_id>/inbox.json` and publishes to - **lease**: Time-bound contract granting a worker exclusive task rights. - **heartbeat**: Alive signal. Every 5 seconds. Missing 3 consecutive = presumed dead. +## Commands +- `a2a-send <agent-id> <json-message>` — Send an A2A message to an agent's inbox +- `a2a-list` — Show all A2A messages across agents with status + ## Lifecycle -1. Orchestrator broadcasts AGENT_REQUEST -2. Workers respond with capability claim -3. Orchestrator issues LEASE with TTL -4. Worker executes, sends RESPONSE -5. Orchestrator ACKs, LEASE expires -6. Worker returns to available pool
\ No newline at end of file +1. Orchestrator sends `request` to agent's inbox via `a2a-send` +2. AI module receives delegated task, executes it +3. Result written to agent's outbox +4. Polling loop detects outbox completion, sends `response` message +5. Orchestrator marks lease as complete, agent returns to idle pool + +## Implementation Status +- ✅ Message format (v0.1 envelope) +- ✅ VFS mailbox transport (inbox.json / outbox.json) +- ✅ 500ms polling loop in orchestrator +- ✅ Type routing (request, response, broadcast, heartbeat) +- ✅ a2a-send / a2a-list CLI commands +- ⬜ Heartbeat sending from worker agents +- ⬜ Full broadcast discovery flow +- ⬜ Lease revocation via A2A message (currently uses separate LeaseModule)
\ No newline at end of file |