Open Agent Loops
API Reference

AgentEventBody

@open-agent-loops/core


type AgentEventBody = 
  | {
  sessionId: string;
  system?: string;
  tools?: ToolSpec[];
  type: AgentStart;
}
  | {
  step: number;
  type: TurnStart;
}
  | {
  text: string;
  type: ReasoningDelta;
}
  | {
  text: string;
  type: TextDelta;
}
  | {
  message: Message;
  type: Message;
}
  | {
  message: Message;
  origin: InjectedMessageOrigin;
  type: MessageInjected;
}
  | {
  args: ToolArguments;
  toolCallId: string;
  toolName: string;
  type: ToolStart;
}
  | {
  isError: boolean;
  result: string;
  toolCallId: string;
  toolName: string;
  type: ToolEnd;
}
  | {
  messages: Message[];
  steps: number;
  type: AgentEnd;
};

Defined in: types/events.ts:70

The payload of an event, minus the timestamp.

Union Members

Type Literal

{
  sessionId: string;
  system?: string;
  tools?: ToolSpec[];
  type: AgentStart;
}
NameTypeDescriptionDefined in
sessionIdstringThe session whose run is starting.types/events.ts:75
system?string[observability] The run's system prompt, if any. Carried on this event so an observer (a tracer, a UI) sees it without having to tap the model request — the loop already knows it at start.types/events.ts:81
tools?ToolSpec[][observability] The full tool specs available to the model this run — same rationale as system: surfaced once up front so observers needn't reconstruct the tool surface from later events.types/events.ts:87
typeAgentStartDiscriminant; see AgentEventType.AgentStart.types/events.ts:73

Type Literal

{
  step: number;
  type: TurnStart;
}
NameTypeDescriptionDefined in
stepnumber1-based index of the model turn that is starting.types/events.ts:93
typeTurnStartDiscriminant; see AgentEventType.TurnStart.types/events.ts:91

Type Literal

{
  text: string;
  type: ReasoningDelta;
}
NameTypeDescriptionDefined in
textstringA chunk of the assistant's reasoning channel.types/events.ts:99
typeReasoningDeltaDiscriminant; see AgentEventType.ReasoningDelta.types/events.ts:97

Type Literal

{
  text: string;
  type: TextDelta;
}
NameTypeDescriptionDefined in
textstringA chunk of the assistant's text content.types/events.ts:105
typeTextDeltaDiscriminant; see AgentEventType.TextDelta.types/events.ts:103

Type Literal

{
  message: Message;
  type: Message;
}
NameTypeDescriptionDefined in
messageMessageThe complete message that was appended to the conversation.types/events.ts:111
typeMessageDiscriminant; see AgentEventType.Message.types/events.ts:109

Type Literal

{
  message: Message;
  origin: InjectedMessageOrigin;
  type: MessageInjected;
}
NameTypeDescriptionDefined in
messageMessageThe caller-supplied message injected into the live run.types/events.ts:117
originInjectedMessageOriginWhich queue it was drained from — steering or follow-up.types/events.ts:119
typeMessageInjectedDiscriminant; see AgentEventType.MessageInjected.types/events.ts:115

Type Literal

{
  args: ToolArguments;
  toolCallId: string;
  toolName: string;
  type: ToolStart;
}
NameTypeDescriptionDefined in
argsToolArgumentsThe parsed arguments the tool will receive.types/events.ts:129
toolCallIdstringId of the tool call about to run, matching its AgentEventType.ToolEnd event.types/events.ts:125
toolNamestringName of the tool about to run.types/events.ts:127
typeToolStartDiscriminant; see AgentEventType.ToolStart.types/events.ts:123

Type Literal

{
  isError: boolean;
  result: string;
  toolCallId: string;
  toolName: string;
  type: ToolEnd;
}
NameTypeDescriptionDefined in
isErrorbooleanWhether the tool reported an error.types/events.ts:141
resultstringThe tool result text folded back into the conversation.types/events.ts:139
toolCallIdstringId of the finished tool call, matching its AgentEventType.ToolStart event.types/events.ts:135
toolNamestringName of the tool that ran.types/events.ts:137
typeToolEndDiscriminant; see AgentEventType.ToolEnd.types/events.ts:133

Type Literal

{
  messages: Message[];
  steps: number;
  type: AgentEnd;
}
NameTypeDescriptionDefined in
messagesMessage[]The full conversation as of run end.types/events.ts:147
stepsnumberTotal number of model turns the run took.types/events.ts:149
typeAgentEndDiscriminant; see AgentEventType.AgentEnd.types/events.ts:145

Remarks

The loop's call sites construct these; emit stamps each one centrally on the way out (see AgentEvent), so no call site has to remember to set the time.

On this page