Open Agent Loops
API Reference

StreamEvent

@open-agent-loops/core


type StreamEvent = 
  | {
  text: string;
  type: ReasoningDelta;
}
  | {
  text: string;
  type: TextDelta;
}
  | {
  toolCall: ToolCall;
  type: ToolCall;
}
  | {
  finishReason?: FinishReason;
  message: AssistantMessage;
  type: Done;
}
  | {
  error: Error;
  message: AssistantMessage;
  type: Error;
};

Defined in: model.types.ts:76

Incremental output from the model.

Union Members

Type Literal

{
  text: string;
  type: ReasoningDelta;
}
NameTypeDescriptionDefined in
textstringA chunk of the model's reasoning channel.model.types.ts:81
typeReasoningDeltaDiscriminant; see StreamEventType.ReasoningDelta.model.types.ts:79

Type Literal

{
  text: string;
  type: TextDelta;
}
NameTypeDescriptionDefined in
textstringA chunk of the model's text content.model.types.ts:87
typeTextDeltaDiscriminant; see StreamEventType.TextDelta.model.types.ts:85

Type Literal

{
  toolCall: ToolCall;
  type: ToolCall;
}
NameTypeDescriptionDefined in
toolCallToolCallThe fully-formed tool invocation the model wants to make.model.types.ts:93
typeToolCallDiscriminant; see StreamEventType.ToolCall.model.types.ts:91

Type Literal

{
  finishReason?: FinishReason;
  message: AssistantMessage;
  type: Done;
}
NameTypeDescriptionDefined in
finishReason?FinishReasonWhy the turn ended, when the provider reported it. The same value is mirrored onto Message.finishReason; it is surfaced on the event too so a consumer reading the stream need not wait to inspect the message.model.types.ts:109
messageAssistantMessageThe assembled assistant message for the turn. Carries the verbatim reasoning_details (when the provider streamed structured blocks) and the finishReason, both reassembled from the stream.model.types.ts:103
typeDoneDiscriminant; see StreamEventType.Done.model.types.ts:97

Type Literal

{
  error: Error;
  message: AssistantMessage;
  type: Error;
}
NameTypeDescriptionDefined in
errorErrorThe failure that ended the turn.model.types.ts:115
messageAssistantMessageWhatever assistant message was assembled before the failure.model.types.ts:117
typeErrorDiscriminant; see StreamEventType.Error.model.types.ts:113

Remarks

See StreamEventType for each tag.

On this page