Chat Session Context - Sub-Agent Tool Message Streaming Fix
Status: ๐ข In-use Category: Session & Context Date: October 25, 2024 Session Goal: Enable sub-agent tool messages to stream to end users for better transparency and debugging
๐งช Testing Resultsโ
Test Command:โ
curl -X POST http://10.99.255.178:8000 \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{"id":"test-clean-output","method":"message/stream","params":{"message":{"role":"user","parts":[{"kind":"text","text":"show argocd version"}],"messageId":"msg-clean-test"}}}'
Output - What Users Now See:โ
โ Sub-agent tool messages (NEW):
"text":"๐ง Calling tool: **version_service__version**\n""text":"โ Tool **version_service__version** completed\n""text":"The current version of ArgoCD is **v3.1.8+becb020**..."
โ Token-level streaming (still working):
- Individual tokens:
"###"," Ar","go","CD"," Version", etc.
โ Supervisor notifications (still working):
๐ง Calling argocd...โ argocd completed
โ Raw JSON (REMOVED):
- No more
{'id': '...', 'jsonrpc': '2.0', 'result': {...}}
Supervisor Logs Confirm Success:โ
2025-10-25 18:30:55 [root] [INFO] [stream:85] Processing custom a2a_event from sub-agent: 45 chars
2025-10-25 18:30:56 [root] [INFO] [stream:85] Processing custom a2a_event from sub-agent: 46 chars
2025-10-25 18:30:57 [root] [INFO] [stream:85] Processing custom a2a_event from sub-agent: 403 chars
- 45 chars =
๐ง Calling tool: **version_service__version**\n - 46 chars =
โ Tool **version_service__version** completed\n - 403 chars = Full version response
๐ Related Documentationโ
Files to Reference:โ
-
Architecture Diagram: 2024-10-25-sub-agent-tool-message-streaming
- Comprehensive Mermaid diagram showing event flow
- A2A event type specifications
- Protocol communication details
-
Previous Work: 2024-10-22-a2a-intermediate-states
- Background on A2A protocol
-
Prompt Config:
charts/ai-platform-engineering/data/prompt_config.deep_agent.yaml- System prompt for Deep Agent (๐ Querying instructions removed)
Docker Configuration:โ
- docker-compose.dev.yaml line 11: Volume mount for prompt config
platform-engineer-p2p:
volumes:
- ./charts/ai-platform-engineering/data/prompt_config.deep_agent.yaml:/app/prompt_config.yaml
โ TODO Statusโ
Completed:
- Switch supervisor from astream_events to astream with custom mode
- Remove raw JSON streaming from a2a_remote_agent_connect.py
- Update Mermaid diagram to show working flow
- Test and verify sub-agent tool messages stream to users
Pending:
- Commit all changes
- Add on_tool_start logic to base_langgraph_agent.py for ๐ Querying announcements
End of Session Context
Relatedโ
- Architecture: architecture.md