v1
latestOpenAPI 3.1.02026-07-17193883.6 KBAgent Stream Events
Stream events from the given runnable.
This endpoint allows to stream events from the runnable, including events from all intermediate steps.
Attention
This is a new endpoint that only works for langchain-core >= 0.1.14.
It belongs to a Beta API that may change in the future.
Important Specify filters to the events you want to receive by setting the appropriate filters in the request body.
This will help avoid sending too much data over the network.
It will also prevent serialization issues with
any unsupported types since it won't need to serialize events
that aren't transmitted.
The endpoint uses a server sent event stream to stream the output.
https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events
The encoding of events follows the following format:
-
data - for streaming the output of the runnable
{ "event": "data", "data": { ... } }
-
error - for signaling an error in the stream, also ends the stream.
{ "event": "error", "data": { "status_code": 500, "message": "Internal Server Error" } }
-
end - for signaling the end of the stream.
This helps the client to know when to stop listening for events and know that the streaming has ended successfully.
{ "event": "end", }
data for the data event is a JSON object that corresponds to a serialized representation of a StreamEvent.
See LangChain documentation for more information about astream_events.
Query parameters
Request body
Response
Successful Response