Skip to content

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.

AgentMessageRequest

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

object
agentId
required
Agentid
string
message
required
Message
string
context
Any of:
object
key
additional properties
Any of:
string
priority
Priority
string
default: medium

Successful Response

SendMessageResponse

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 details
  • agent_id: Target agent identifier
  • message: 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
status
required
Status

Operation status (success or failed)

string
response
required
MessageDeliveryInfo

Message delivery details

object
messageId
required
Messageid

Unique message identifier

string
delivered
required
Delivered

Whether message was successfully delivered

boolean
error
Any of:
string
agentId
required
Agentid

Target agent identifier

string
message
required
Message

Status message

string

Validation Error

HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object