Chat with an agent (streaming)
Send a message to an agent and stream back the reply as SSE events.
The response is a text/event-stream where each frame carries a
JSON-serialised :class:~agentscope.event.AgentEvent.
Args:
request (ChatRequest):
JSON body with agent_id, session_id, and input.
user_id (str):
Injected user id.
storage (StorageBase):
Injected application storage backend.
session_manager (SessionManager):
Injected session manager.
workspace_manager (WorkspaceManagerBase):
Injected workspace manager.
background_task_manager (BackgroundTaskManager):
Injected background task manager.
Returns:
StreamingResponse:
SSE stream of AgentEvent frames.
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
Caller's user ID. Temporary header-based identity; will be replaced by JWT auth.
Body
Request body for the chat endpoint.
Agent ID for the chat endpoint.
The session to send the message to.
The message class in AgentScope, responsible for information storage and transmission among different agents.
- Msg · object
- Msg · object[]
- UserConfirmResultEvent · object
- ExternalExecutionResultEvent · object
Response
Server-Sent Events stream of AgentEvent objects