Sub-Agent Tool Message Streaming Analysis
Status: π’ In-use Category: Architecture & Core Design Date: October 25, 2024
Note: This is a historical debugging/investigation document from October 2024. For comprehensive A2A protocol documentation with actual event data, see A2A Event Flow Architecture.
Overviewβ
This document tracks the investigation and implementation of enhanced transparency for sub-agent tool messages in the CAIPE streaming architecture conducted in October 2024. The goal was to make detailed sub-agent tool executions visible to end users for better debugging and transparency.
Document Purpose: Historical record of debugging process (October 2024), architectural limitations discovered, and implementation attempts.
Date: October 25, 2024
Motivationβ
Users were only seeing high-level supervisor notifications like:
π§ Calling argocd...β argocd completed
But not the detailed sub-agent tool messages like:
π§ Calling tool: **version_service__version**β Tool **version_service__version** completed
Current Statusβ
β Successfully Implementedβ
- Transparent status-update processing - All sub-agent messages are captured and processed
- Real-time streaming infrastructure - Events are immediately passed to stream writer
- Robust error handling - Client disconnections handled gracefully
- Enhanced logging - Full visibility into event processing pipeline
- Comprehensive architecture mapping - Complete understanding of event flow
β Architectural Limitationβ
- Custom events not displayed: Due to LangGraph's
astream_eventsmode not processing custom events fromget_stream_writer() - Sub-agent tool details not visible: Users still don't see detailed tool execution steps
π Current User Experienceβ
What Users See:
β¦π― Execution Plan: Retrieve ArgoCD Version Informationβ§
π§ Calling argocd...
β
argocd completed
[Final response with version details]
What Users Don't See (but is captured):
π§ Calling tool: **version_service__version**
β
Tool **version_service__version** completed
Testing Validationβ
Test Commandβ
curl -X POST http://10.99.255.178:8000 \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{"id":"test","method":"message/stream","params":{"message":{"role":"user","parts":[{"kind":"text","text":"show argocd version"}],"messageId":"msg-test"}}}'
Log Validationβ
docker logs platform-engineer-p2p --since=2m | grep -E "(Streamed.*accumulated|Processing.*custom)"
Expected Output:
β
Streamed + accumulated text from status-update: 45 chars
β
Streamed + accumulated text from status-update: 46 chars
β
Streamed + accumulated text from status-update: 400+ chars
Current Status & Updated Documentationβ
β οΈ Historical Document: This document captures the investigation as of October 25, 2024.
For the current, comprehensive A2A protocol documentation with actual event data, real-world examples, and complete event flow analysis, see:
π A2A Event Flow Architecture (2025-10-27)β
What's included in the new documentation:
- β Complete architecture flowchart (Client β Supervisor β Sub-Agent β MCP β Tools)
- β Detailed sequence diagram showing all 6 phases of execution
- β Actual A2A event structures from real tests
- β Token-by-token streaming analysis with append flags
- β Comprehensive event type reference (task, artifact-update, status-update)
- β Event count metrics (600+ events for simple query)
- β Frontend integration examples
- β Testing commands for both supervisor and sub-agents
Use cases:
- Understanding A2A protocol: β New doc
- Debugging streaming issues: β This doc (historical context)
- Implementing frontend clients: β New doc
- Understanding architectural limitations: β This doc
Investigation Date: October 25, 2024
Document Status: Historical - See 2025-10-27-a2a-event-flow-architecture.md for current documentation
Findings: Infrastructure Complete - Architecture Limitation Identified
Outcome: LangGraph streaming limitation documented; sub-agent tool details not visible to end users via astream_events
Relatedβ
- Architecture: architecture.md