Skip to content

Ask Lagan Stream

POST
/api/agents/chat/stream

Streaming freeform chat — NDJSON events from start → complete / error.

Each line of the response body is a JSON-encoded AgentChatStreamEvent. The generator polls request.is_disconnected() on every heartbeat tick so aborting the fetch stops the generator within one tick even while idle-waiting on a long tool run. Timeout enforcement mirrors the blocking endpoint; overrun emits a terminal error event with the same settings-guidance message plus the correlation id.

AgentChatRequest

Request body for freeform agent chat across core conversational agents.

object
message
required
Message

User’s freeform message to the agent

string
conversationHistory
Conversationhistory

Prior conversation turns. Capped at 50 so the prompt stays bounded — older turns are dropped by the caller.

Array<object>
<= 50 items
AgentChatTurn

A single turn in a freeform agent conversation history.

object
role
required
Role

Message role (user or assistant)

string
Allowed values: user assistant
content
required
Content

Message content

string
context
Any of:
AgentChatContext

Ambient author context attached to a freeform agent request.

object
activeUrl
Any of:
string
pageTitle
Any of:
string
pageContentExcerpt
Any of:
string
activeDocumentTitle
Any of:
string
activeDocumentExcerpt
Any of:
string

NDJSON stream — one AgentChatStreamEvent per line, camelCase keys. Terminal event is always complete or error. Error events carry a short (id: ...) correlation id matching the backend MimeLogger context.

Validation Error

HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object