Skip to main content
Version: 0.19.0

Interface: AgentRun

Defined in: core/runner.ts:104

A running session, as runQuery() returns it: its events and the controls of the SDK's Query.

Properties​

PropertyTypeDescriptionDefined in
close() => voidEnds the session. No further events arrive after this; safe to call even if events is still being iterated elsewhere (e.g. from a SIGINT handler racing the main loop).core/runner.ts:110
contextUsage() => Promise<ContextUsage | null>How full the context window is now, or null if the session can't tell (see the SDK's Query.getContextUsage()).core/runner.ts:114
eventsAsyncIterable<AgentEvent>Normalized events for this run — iterate with for await.core/runner.ts:106
interrupt() => Promise<unknown>Interrupts the current turn (doesn't end the session — a caller wanting a full stop should also call close()).core/runner.ts:108
supportedCommands() => Promise<SlashCommand[]>This session's own slash commands (skills doubling as typable commands, etc.) — only meaningful once the session has actually started (see the SDK's own Query.supportedCommands()).core/runner.ts:112