Interface AgentCreateOptions<UserData>

interface AgentCreateOptions<UserData> {
    allowInterruptions?: boolean;
    chatCtx?: ChatContext;
    id?: string;
    instructions: string | Instructions;
    llm?: llm.LLM | llm.RealtimeModel | LLMModels;
    llmNode?: ((ctx, chatCtx, toolCtx, modelSettings) => AgentHookNodeResult<string | ChatChunk>);
    minConsecutiveSpeechDelay?: number;
    onEnter?: ((ctx) => void | Promise<void>);
    onExit?: ((ctx) => void | Promise<void>);
    onUserTurnCompleted?: ((ctx, chatCtx, newMessage) => void | Promise<void>);
    realtimeAudioOutputNode?: ((ctx, audio, modelSettings) => AgentHookNodeResult<AudioFrame>);
    stt?: stt.STT | STTModelString;
    sttNode?: ((ctx, audio, modelSettings) => AgentHookNodeResult<string | SpeechEvent>);
    toolHandling?: ToolHandlingOptions;
    tools?: ToolContextLike<UserData>;
    transcriptionNode?: ((ctx, text, modelSettings) => AgentHookNodeResult<string | TimedString>);
    tts?: tts.TTS | TTSModelString;
    ttsNode?: ((ctx, text, modelSettings) => AgentHookNodeResult<AudioFrame>);
    turnDetection?: TurnDetectionMode;
    turnHandling?: TurnHandlingOptions;
    useTtsAlignedTranscript?: boolean;
    vad?: VAD;
}

Type Parameters

  • UserData = any

Hierarchy (view full)

Properties

allowInterruptions?: boolean

Deprecated

use turnHandling.interruption.enabled instead

chatCtx?: ChatContext
id?: string
instructions: string | Instructions
llmNode?: ((ctx, chatCtx, toolCtx, modelSettings) => AgentHookNodeResult<string | ChatChunk>)

Produces LLM chunks or text from the current chat and tool context.

Type declaration

minConsecutiveSpeechDelay?: number
onEnter?: ((ctx) => void | Promise<void>)

Called when the agent becomes active in a session.

Type declaration

onExit?: ((ctx) => void | Promise<void>)

Called when the agent is leaving the active session.

Type declaration

onUserTurnCompleted?: ((ctx, chatCtx, newMessage) => void | Promise<void>)

Called after the user's turn has been committed to the chat context.

Type declaration

realtimeAudioOutputNode?: ((ctx, audio, modelSettings) => AgentHookNodeResult<AudioFrame>)

Processes realtime model audio before it is sent to the agent output.

Type declaration

sttNode?: ((ctx, audio, modelSettings) => AgentHookNodeResult<string | SpeechEvent>)

Transforms incoming audio into speech events or transcript text for the agent.

Type declaration

toolHandling?: ToolHandlingOptions
transcriptionNode?: ((ctx, text, modelSettings) => AgentHookNodeResult<string | TimedString>)

Transforms the agent's output transcript before it is forwarded.

Type declaration

ttsNode?: ((ctx, text, modelSettings) => AgentHookNodeResult<AudioFrame>)

Synthesizes agent text into audio frames for playout.

Type declaration

turnDetection?: TurnDetectionMode

Deprecated

use turnHandling.turnDetection instead

turnHandling?: TurnHandlingOptions
useTtsAlignedTranscript?: boolean
vad?: VAD