Get Enhanced Agent Metrics
GET /api/agents/enhanced/metrics
Retrieve aggregated performance metrics for agents.
Returns comprehensive performance metrics including request statistics, success rates, response times, and operational status. Can retrieve metrics for a specific agent or aggregated system-wide metrics.
Args: request: FastAPI Request object for backend service access background_tasks: FastAPI BackgroundTasks for async analytics logging agent_id: Optional agent ID for specific agent metrics (query param)
Returns: AgentMetricsResponse: Performance metrics for the requested agent (or system-wide aggregate when no agent_id is supplied).
Raises: HTTPException 404: If specific agent not found HTTPException 500: For unexpected errors during data retrieval HTTPException 503: If backend service is unavailable
Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ”Responses
Section titled “ Responses ”Successful Response
Agent performance metrics response model.
Provides comprehensive performance metrics for a single agent including request statistics, success rates, response times, and operational status. Used for agent performance monitoring and analytics endpoints.
Fields:
agent_id: Unique agent identifier (e.g., “HAWKEN”, “LAGAN”)agent_name: Human-readable agent nametotal_requests: Total number of requests processed lifetimesuccessful_requests: Number of successfully completed requestsfailed_requests: Number of failed requestsavg_response_time: Average response time in secondssuccess_rate: Success rate as decimal (0.0-1.0, e.g., 0.98 = 98%)performance_score: Overall performance score (0.0-1.0, higher is better)status: Current operational status (online, offline, busy, error)capabilities: List of agent capabilities and specializationslast_used: ISO 8601 timestamp of last usagelast_activity: ISO 8601 timestamp of last activitymodel_used: AI model being used (e.g., “gpt-4”, “llama3”)specialization: Agent specialization area
Usage: GET /api/agent-communication/agents/{agent_id}/metrics returns this response model.
JSON Example:
{
"agentId": "hawken",
"agentName": "HAWKEN",
"totalRequests": 1542,
"successfulRequests": 1510,
"failedRequests": 32,
"avgResponseTime": 1.2,
"successRate": 0.98,
"performanceScore": 0.95,
"status": "online",
"capabilities": ["creative_writing", "storytelling"],
"lastUsed": "2025-01-31T10:30:00Z",
"lastActivity": "2025-01-31T10:30:00Z",
"modelUsed": "llama3",
"specialization": "creative_writing"
}object
ID of the agent being reported on
Agent name
Total number of requests processed
Number of successfully completed requests
Number of failed requests
Average response time in seconds
Success rate (0.0-1.0)
Performance score (0.0-1.0)
Current operational status (online, offline, busy, error)
List of agent capabilities and specializations
AI model being used
Agent specialization area
Validation Error