Overview
AgenticPal uses a two-step streaming pattern to provide real-time agent responses via Server-Sent Events (SSE):- POST /chat/message - Store the user’s message and receive a thread ID
- GET /chat/stream - Open SSE connection to stream the agent’s response
Step 1: POST /chat/message
Store the user’s message server-side and receive a thread ID for streaming.Authentication
Requires a valid session cookie (session_id) obtained through the OAuth flow.
Request Body
The user’s message or query to the agent.
- Minimum length: 1 character
- Maximum length: 10,000 characters
"What meetings do I have tomorrow?""Send an email to John about the project update"
Optional thread ID for conversation continuity. If not provided, a new thread is created.
Request Example
Response
Thread ID to use when opening the SSE stream in Step 2
Message status - always
"queued" indicating the message is ready for processingResponse Example
Status Codes
| Code | Description |
|---|---|
| 200 | Message stored successfully |
| 401 | Not authenticated - missing or invalid session cookie |
| 429 | Rate limit exceeded |
| 500 | Server error |
cURL Example
Step 2: GET /chat/stream
Open an SSE connection to stream the agent’s response in real-time.Authentication
Requires a valid session cookie (session_id) obtained through the OAuth flow.
Query Parameters
The thread ID returned from POST /chat/message
Response Format
Returns atext/event-stream (Server-Sent Events) with the following event types:
Event Types
Emitted when the agent starts processing a graph node.Data:
node(string): Name of the node that started
Emitted when the agent completes processing a graph node.Data:
node(string): Name of the node that ended
Emitted for each token generated by the language model during response generation.Data:
token(string): The token/text chunk
Emitted when the agent completes processing successfully.Data:
thread_id(string): Thread IDresponse(string): Complete final responseresults(object): Execution results from tools
Emitted when the agent needs user confirmation before executing actions.Data:
thread_id(string): Thread IDmessage(string): Confirmation messagepending_actions(array): Actions waiting for confirmation
Emitted when an error occurs during agent processing.Data:
error(string): Error type codemessage(string): Error message
SSE Stream Example
Confirmation Required Example
Status Codes
| Code | Description |
|---|---|
| 200 | SSE stream established successfully |
| 400 | No pending message found - must call POST /chat/message first |
| 401 | Not authenticated - missing or invalid session cookie |
| 429 | Rate limit exceeded |
| 500 | Server error |