v1

latestOpenAPI 3.1.02026-07-17193883.6 KB
agent

Agent 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.

post/agent/stream_events

Query parameters

config_hashstring

Request body

configAgentLangGraphConfig
include_namesstring[] nullable

If specified, filter to runnables with matching names

include_typesstring[] nullable

If specified, filter to runnables with matching types

include_tagsstring[] nullable

If specified, filter to runnables with matching tags

exclude_namesstring[] nullable

If specified, exclude runnables with matching names

exclude_typesstring[] nullable

If specified, exclude runnables with matching types

exclude_tagsstring[] nullable

If specified, exclude runnables with matching tags

kwargsobject

Response

Successful Response

{"stackTrail":"paths:/agent/stream_events:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}