Send Agent Message
POST /api/agents/message
Send a direct message to a specific agent through the communication hub.
Args: request_data: Agent message request containing recipient, content, and context request: FastAPI Request object for backend access background_tasks: FastAPI BackgroundTasks for async analytics logging
Returns: Dict[str, object]: Message delivery status and response information
Note: Creates and sends a message through the communication hub with proper message type classification, priority handling, and response tracking for inter-agent communication coordination. Analytics are logged asynchronously via BackgroundTasks.
Request Body required
Section titled “Request Body required ”API request model for sending messages to agents.
Simplified message request model used by API endpoints to send messages to specific agents. Automatically converted to AgentMessage internally with proper typing and validation.
Fields: agent_id: Target agent identifier message: Message content string context: Optional context data for message processing priority: Message priority level as string (converted to enum)
Used By: - POST /api/agents/message endpoint - Agent communication API routes - Frontend agent interaction components
Responses
Section titled “ Responses ”Successful Response
Send message response model.
Provides message delivery confirmation and status for agent-to-agent messaging operations. Includes delivery information and target agent identification.
Fields:
status: Operation status (success or failed)response: MessageDeliveryInfo object containing delivery detailsagent_id: Target agent identifiermessage: Status message providing additional context
Usage: POST /api/agent-communication/messages/send returns this response model.
JSON Example:
{
"status": "success",
"response": {
"messageId": "msg_123",
"delivered": true,
"error": null
},
"agentId": "hawken",
"message": "Message delivered successfully"
}object
Operation status (success or failed)
Target agent identifier
Status message
Validation Error