Send Message

Send a message to an agent and receive a response.

Endpoint

POST https://api.irisos.xyz/v1/agents/{agentId}/messages

Authentication

This endpoint requires an API key. Include it in the request headers:

Authorization: Bearer YOUR_API_KEY

Path Parameters

Parameter
Type
Required
Description

agentId

string

Yes

The unique identifier of the agent

Request Body

Parameter
Type
Required
Description

text

string

Yes

The message text to send to the agent

userId

string

No

Unique identifier for the user (for conversation continuity)

roomId

string

No

Conversation room ID (for multi-user conversations)

context

object

No

Additional context for the conversation

stream

boolean

No

Enable streaming response (default: false)

Example Request Body

Response

Success Response (200 OK)

Error Response (400 Bad Request)

Error Response (404 Not Found)

Error Response (503 Service Unavailable)

Example Request

cURL

JavaScript

Python

Streaming Responses

For real-time responses, enable streaming mode:

JavaScript with Streaming

Conversation Context

The agent maintains conversation context using userId and roomId:

Rate Limits

  • Rate Limit: 60 requests per minute per agent

  • Concurrent Requests: 10 simultaneous requests per agent

Rate limit headers are included in the response:

  • X-RateLimit-Limit: Maximum requests per minute

  • X-RateLimit-Remaining: Remaining requests

  • X-RateLimit-Reset: Reset timestamp

Best Practices

  1. Use userId consistently: Always send the same userId for the same user to maintain context

  2. Handle rate limits: Implement exponential backoff for rate limit errors

  3. Set timeouts: Configure appropriate request timeouts (30s recommended)

  4. Stream long responses: Use streaming for responses that may be lengthy

  5. Validate input: Sanitize user input before sending to the agent

Last updated