LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangChain
  • Browser
  • Universal
  • Hub
  • Node
  • Load
  • Serializable
  • Encoder Backed
  • File System
  • In Memory
  • Tools
LangChain Core
  • Agents
  • Caches
  • Base
  • Dispatch
  • Web
  • Manager
  • Promises
  • Chat History
  • Context
  • Base
  • Langsmith
  • Documents
  • Embeddings
  • Errors
  • Example Selectors
  • Indexing
  • Base
  • Chat Models
  • Compat
  • Event
  • Llms
  • Openai Completions Stream
  • Profile
  • Stream
  • Structured Output
  • Load
  • Serializable
  • Memory
  • Messages
  • Tool
  • Output Parsers
  • Openai Functions
  • Openai Tools
  • Outputs
  • Prompt Values
  • Prompts
  • Retrievers
  • Document Compressors
  • Runnables
  • Graph
  • Singletons
  • Stores
  • Structured Query
  • Testing
  • Tools
  • Base
  • Console
  • Log Stream
  • Run Collector
  • Tracer Langchain
  • Stream
  • Async Caller
  • Chunk Array
  • Context
  • Env
  • Event Source Parse
  • Format
  • Function Calling
  • Gateway
  • Hash
  • Json Patch
  • Json Schema
  • Math
  • Ssrf
  • Standard Schema
  • Stream
  • Testing
  • Tiktoken
  • Types
  • Uuid
  • Vectorstores
Text Splitters
MCP Adapters
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangChain
BrowserUniversalHubNodeLoadSerializableEncoder BackedFile SystemIn MemoryTools
LangChain Core
AgentsCachesBaseDispatchWebManagerPromisesChat HistoryContextBaseLangsmithDocumentsEmbeddingsErrorsExample SelectorsIndexingBaseChat ModelsCompatEventLlmsOpenai Completions StreamProfileStreamStructured OutputLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryTestingToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingGatewayHashJson PatchJson SchemaMathSsrfStandard SchemaStreamTestingTiktokenTypesUuidVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScript@langchain/coretracerslog_streamStreamEvent
Typeā—Since v1.0

StreamEvent

Copy
StreamEvent

Properties

View source on GitHub
property
data: StreamEventData
property
event: string
property
metadata: Record<string, any>
property
name: string
property
run_id: string
property
tags: string[]

A streaming event.

Schema of a streaming event which is produced from the streamEvents method.

Event data.

The contents of the event data depend on the event type.

Event names are of the format: on_[runnable_type]_(start|stream|end).

Runnable types are one of:

  • llm - used by non chat models
  • chat_model - used by chat models
  • prompt -- e.g., ChatPromptTemplate
  • tool -- LangChain tools
  • chain - most Runnables are of this type

Further, the events are categorized as one of:

  • start - when the runnable starts
  • stream - when the runnable is streaming
  • end - when the runnable ends

start, stream and end are associated with slightly different data payload.

Please see the documentation for EventData for more details.

Metadata associated with the runnable that generated this event.

The name of the runnable that generated the event.

An randomly generated ID to keep track of the execution of the given runnable.

Each child runnable that gets invoked as part of the execution of a parent runnable is assigned its own unique ID.

Tags associated with the runnable that generated this event. Tags are always inherited from parent runnables.