@threadplane/ag-uiInterfacev0.3.7

SessionCommonOptions

The options every session takes, whatever it sends its requests with.

import type { SessionCommonOptions } from '@threadplane/ag-ui';

Declaration

export interface SessionCommonOptions extends DurabilityOptions, InstrumentOptions  {
  readonly agentId?: string;
  readonly clientOptions?: object | undefined;
  readonly continuationPolicy?: ClientToolContinuationPolicy;
  readonly interruptMode?: InterruptMode;
  readonly interruptTransport?: InterruptTransport;
  readonly messages?: readonly Message[] | Transcript;
  readonly onThreadId?: ((threadId: string) => void) | undefined;
  readonly state?: unknown;
  readonly stateType?: StateDeclaration;
  readonly subagents?: Subagents;
  readonly threadId?: string | null;
}

Members

agentId

Names the agent, when an endpoint serves more than one. Published as session.agentId.

readonly agentId?: string;

clientOptions

Accepted and ignored, so a binding's whole session context can be spread into these options. An AG-UI session has no client to configure: url, headers and fetch are its transport options.

readonly clientOptions?: object | undefined;

continuationPolicy

How many consecutive client-tool groups one submit runs automatically (default 10; 0 removes the limit). A blocked group raises the limit blocker and the submit ends interrupted. Used only with tools.

readonly continuationPolicy?: ClientToolContinuationPolicy;

interruptMode

How a root CUSTOM on_interrupt notice is read; 'native' when omitted. See InterruptMode.

readonly interruptMode?: InterruptMode;

interruptTransport

How a pause is answered. Absent, a session answers the protocol's own interrupt outcome only, as with 'protocol'. 'auto', 'legacy-command' and 'mastra-command' also answer a CUSTOM on_interrupt notice, through forwardedProps.command.

readonly interruptTransport?: InterruptTransport;

messages

The conversation the session begins with, before any restore.

readonly messages?: readonly Message[] | Transcript;

onThreadId

Called once, while the session is created, with the id of a thread the caller did not name: one the session generated, or the handed agent's own. Never called for a threadId given as an option. A throwing callback affects nothing.

readonly onThreadId?: ((threadId: string) => void) | undefined;

state

The state document the session begins with, before any restore.

readonly state?: unknown;

stateType

The type of the state document: type<T>() to declare it, or a Standard Schema to also check each state. The snapshot's state has this type. Requests still send the literal document, whatever is declared here.

readonly stateType?: StateDeclaration;

subagents

Child evidence saved with this thread, published as earlierSubagents. Their attributed messages belong in messages.

readonly subagents?: Subagents;

threadId

The thread this session owns. Absent, the handed agent's threadId is used, or else a new one is generated; read it from session.threadId. persistence needs one the application chose, and replay is skipped without one: a new conversation has nothing to replay. null reads as absent, so a binding's "no thread selected" can be passed as it is.

readonly threadId?: string | null;