[Research] Protocol spec + gateway routing for research messages #75

Closed
opened 2026-03-20 14:43:41 -04:00 by perplexity · 1 comment
Owner

Overview

Add research message types to the Matrix protocol and wire gateway routing.

Protocol Additions (PROTOCOL.md)

research_request (World → Server)

Any agent or browser can request research.

{
  "type": "research_request",
  "agent_id": "timmy",
  "topic": "WebRTC vs WebSocket for real-time agent voice",
  "max_loops": 3,
  "request_id": "req-uuid"
}

research_progress (Server → World)

Sent by the researching agent each iteration.

{
  "type": "research_progress",
  "agent_id": "timmy",
  "request_id": "req-uuid",
  "loop": 2,
  "max_loops": 3,
  "current_query": "WebRTC audio latency benchmarks 2025",
  "summary_excerpt": "WebRTC provides sub-200ms latency...",
  "sources_count": 6
}

research_complete (Server → World)

Final result with full markdown report.

{
  "type": "research_complete",
  "agent_id": "timmy",
  "request_id": "req-uuid",
  "summary": "## Full markdown report...",
  "sources": ["url1", "url2"],
  "loops_completed": 3,
  "duration_seconds": 45
}

Gateway Changes (server/gateway.py)

Routing Rules

  • research_request → route to target agent_id (like task_action)
  • research_progress → broadcast to all browsers (visual update)
  • research_complete → broadcast to all browsers + send to requesting agent if different

_route_message additions

Add research types to the routing switch in _route_message().

Acceptance Criteria

  • 3 new message types documented in PROTOCOL.md with examples
  • Gateway routes research_request to target agent
  • Gateway broadcasts research_progress and research_complete to browsers
  • Gateway tests updated in server/test_gateway.py
  • Cross-references #50 (original deep research issue)

Depends On

Nothing — can be done in parallel with engine + bridge work.

Closes

  • Partially closes #50 (replaces human-in-the-loop Kimi workflow with automated local research)
  • Advances #45 (adds 3 more message types to bridge protocol)
## Overview Add research message types to the Matrix protocol and wire gateway routing. ## Protocol Additions (PROTOCOL.md) ### `research_request` (World → Server) Any agent or browser can request research. ```json { "type": "research_request", "agent_id": "timmy", "topic": "WebRTC vs WebSocket for real-time agent voice", "max_loops": 3, "request_id": "req-uuid" } ``` ### `research_progress` (Server → World) Sent by the researching agent each iteration. ```json { "type": "research_progress", "agent_id": "timmy", "request_id": "req-uuid", "loop": 2, "max_loops": 3, "current_query": "WebRTC audio latency benchmarks 2025", "summary_excerpt": "WebRTC provides sub-200ms latency...", "sources_count": 6 } ``` ### `research_complete` (Server → World) Final result with full markdown report. ```json { "type": "research_complete", "agent_id": "timmy", "request_id": "req-uuid", "summary": "## Full markdown report...", "sources": ["url1", "url2"], "loops_completed": 3, "duration_seconds": 45 } ``` ## Gateway Changes (`server/gateway.py`) ### Routing Rules - `research_request` → route to target `agent_id` (like `task_action`) - `research_progress` → broadcast to all browsers (visual update) - `research_complete` → broadcast to all browsers + send to requesting agent if different ### _route_message additions Add research types to the routing switch in `_route_message()`. ## Acceptance Criteria - [ ] 3 new message types documented in PROTOCOL.md with examples - [ ] Gateway routes `research_request` to target agent - [ ] Gateway broadcasts `research_progress` and `research_complete` to browsers - [ ] Gateway tests updated in `server/test_gateway.py` - [ ] Cross-references #50 (original deep research issue) ## Depends On Nothing — can be done in parallel with engine + bridge work. ## Closes - Partially closes #50 (replaces human-in-the-loop Kimi workflow with automated local research) - Advances #45 (adds 3 more message types to bridge protocol)
Author
Owner

Closed via PR #76. All acceptance criteria met — 21/21 tests pass.

Closed via PR #76. All acceptance criteria met — 21/21 tests pass.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: perplexity/the-matrix#75