Skip to content

Text chat SSE

Text chat uses a normal HTTP POST and streams assistant output through Server-Sent Events.

Terminal window
curl -X POST "https://api.hyponema.ai/sessions" \
-H "Authorization: Bearer $HYPONEMA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent_...",
"user_id": "user_123",
"modality": "text"
}'
Terminal window
curl -N -X POST "https://api.hyponema.ai/sessions/$SESSION_ID/messages" \
-H "Authorization: Bearer $HYPONEMA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Can you summarize our last conversation?"
}'

The text field is required and must be between 1 and 8000 characters.

The response emits Server-Sent Events. Full payload shapes live in the Chat API reference; the events you’ll see are:

EventWhen it fires
turn_startAssistant turn started. Carries turn_id and the resolved model.
tokenStreamed text chunk.
tool_callThe model invoked a tool. Includes the streaming-JSON arguments_partial.
tool_resultTool returned. Includes the final result the assistant sees.
guardA guard fired (no-go zone, escalation, redirect).
turn_endAssistant turn completed. Includes latency and token counts.
errorTurn failed. Carries detail and error_kind.

The chat runner streams tokens, executes tool calls inline, applies guards, and persists the assistant and tool turns through a fresh unit of work.

Do not build a second chat loop in your application. Treat the SSE stream as the source of assistant output and use traces for debugging.