Creates a text chat runtime with optional shared agent state.
API
export declare function createChatRuntime<
Tools extends Chat.AnyTool ,
State = unknown,
>(init: {
debugName?: string;
system: string;
state?: State;
messages?: Chat.Message <string, Tools>[];
tools?: Tools[];
debounce?: number;
retries?: number;
transport?: TransportOrFactory ;
ui?: boolean;
threadId?: string;
}): ChatRuntime <string, Tools, State>;createChatRuntime
ChatRuntime<string, Tools, State>@paraminit:{
debugName?: string;
system: string;
state?: State;
messages?: Chat.Message<string, Tools>[];
tools?: Tools[];
debounce?: number;
retries?: number;
transport?: TransportOrFactory;
ui?: boolean;
threadId?: string;
}Runtime options. Initial state is JSON-validated, cloned, and frozen before the runtime is created.
@typeToolsChat.AnyTool@typeState@returnsChatRuntime<string, Tools, State>API
export declare function createChatRuntime<
Schema extends s.SchemaOutput ,
Tools extends Chat.AnyTool ,
Output extends s.InferSchemaOutput <Schema> =
s.InferSchemaOutput <Schema>,
State = unknown,
>(init: {
debugName?: string;
system: string;
state?: State;
messages?: Chat.Message <Output, Tools>[];
tools?: Tools[];
responseSchema: Schema;
debounce?: number;
retries?: number;
transport?: TransportOrFactory ;
ui?: boolean;
threadId?: string;
}): ChatRuntime <Output, Tools, State>;createChatRuntime
ChatRuntime<Output, Tools, State>@paraminit:{
debugName?: string;
system: string;
state?: State;
messages?: Chat.Message<Output, Tools>[];
tools?: Tools[];
responseSchema: Schema;
debounce?: number;
retries?: number;
transport?: TransportOrFactory;
ui?: boolean;
threadId?: string;
}Runtime options including the response schema. Initial state is JSON-validated, cloned, and frozen before creation.
@typeSchemas.SchemaOutput@typeToolsChat.AnyTool@typeOutputs.InferSchemaOutput<Schema>@typeState@returnsChatRuntime<Output, Tools, State>