Skip to main content
POST
/
chat
Chat with an agent (streaming)
curl --request POST \
  --url https://api.example.com/chat/ \
  --header 'Content-Type: application/json' \
  --header 'x-user-id: <x-user-id>' \
  --data '
{
  "agent_id": "<string>",
  "session_id": "<string>",
  "input": {
    "name": "<string>",
    "content": [
      {
        "text": "<string>",
        "type": "text",
        "id": "<string>"
      }
    ],
    "id": "<string>",
    "metadata": {},
    "created_at": "<string>",
    "finished_at": "<string>",
    "usage": {
      "input_tokens": 123,
      "output_tokens": 123
    }
  }
}
'
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>",
      "input": "<unknown>",
      "ctx": {}
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://docs.agentscope.io/llms.txt

Use this file to discover all available pages before exploring further.

Headers

x-user-id
string
required

Caller's user ID. Temporary header-based identity; will be replaced by JWT auth.

Body

application/json

Request body for the chat endpoint.

agent_id
string
required

Agent ID for the chat endpoint.

session_id
string
required

The session to send the message to.

input
Msg · object
required

The message class in AgentScope, responsible for information storage and transmission among different agents.

Response

Server-Sent Events stream of AgentEvent objects