Get communication system statistics
GET /api/agent-communication/communications/stats
Get comprehensive communication system statistics.
Retrieves system-wide metrics about inter-agent communications. All fields are populated from the AgentCommunicationHub’s live in-memory tracking:
total_messages: length of the hub’s boundedmessage_history.active_consultations: the hub’spending_consultationsmap.completed_handoffs: count ofMessageType.HANDOFFmessages the hub has successfully routed throughmessage_history.failed_communications: the hub’s_failed_message_countcounter (incremented on permission denial and exceptions during send).average_response_time_ms: mean of the per-agentAgentMetrics.avg_response_time, averaged across agents that have at least one recorded response-time sample.agent_communication_matrix: sender→recipient edge counts folded from the hub’stop_communication_patternslist.
Returns: CommunicationStatsResponse: Communication statistics and metrics.
Raises: HTTPException(500): Unexpected failure while collecting stats.
Example Response: { “totalMessages”: 1542, “activeConsultations”: 5, “completedHandoffs”: 23, “failedCommunications”: 2, “averageResponseTimeMs”: 145.3, “agentCommunicationMatrix”: { “HAWKEN”: {“LAGAN”: 45, “ORCHESTRATOR”: 23}, “LAGAN”: {“HAWKEN”: 45} } }
Responses
Section titled “ Responses ”Successful Response
Communication statistics response model.
Provides comprehensive statistics about inter-agent communications including message counts, active conversations, consultation metrics, and system health. Used for communication monitoring and analytics.
Fields:
total_messages: Total messages sent through system (non-negative integer)active_consultations: Currently active consultation requests (non-negative integer)completed_handoffs: Successfully completed handoffs (non-negative integer)failed_communications: Failed communication attempts (non-negative integer)average_response_time_ms: Average agent response time in milliseconds (non-negative float)agent_communication_matrix: Matrix of agent-to-agent communication counts
Usage: GET /api/agent-communication/communications/stats returns this response model.
JSON Example:
{
"totalMessages": 1542,
"activeConsultations": 5,
"completedHandoffs": 23,
"failedCommunications": 2,
"averageResponseTimeMs": 145.3,
"agentCommunicationMatrix": {
"HAWKEN": {"LAGAN": 45, "ORCHESTRATOR": 23},
"LAGAN": {"HAWKEN": 45}
}
}object
Total messages sent through system
Currently active consultation requests
Successfully completed handoffs
Failed communication attempts
Average agent response time in ms
Matrix of agent-to-agent communication counts