Interface AgentTaskContext<ResultT, UserData>

Context passed to hooks created with AgentTask.create().

interface AgentTaskContext<ResultT, UserData> {
    agent: AgentTask<ResultT, UserData>;
    chatCtx: ReadonlyChatContext;
    id: string;
    instructions: string | Instructions;
    llm: undefined | llm.LLM | llm.RealtimeModel;
    minConsecutiveSpeechDelay: undefined | number;
    session: AgentSession<UserData>;
    stt: undefined | stt.STT;
    toolCtx: ToolContext<UserData>;
    tts: undefined | tts.TTS;
    turnHandling: undefined | Partial<TurnHandlingOptions>;
    useTtsAlignedTranscript: undefined | boolean;
    vad: undefined | VAD;
    complete(result): void;
}

Type Parameters

  • ResultT = unknown
  • UserData = unknown

Hierarchy (view full)

Properties

The task instance currently running the hook.

chatCtx: ReadonlyChatContext

Readonly view of the agent's current chat context.

id: string

Agent identifier.

instructions: string | Instructions

Agent instructions.

llm: undefined | llm.LLM | llm.RealtimeModel

LLM or realtime model configured for the agent.

minConsecutiveSpeechDelay: undefined | number

Minimum delay between consecutive speech.

Current session for the agent.

stt: undefined | stt.STT

Speech-to-text model configured for the agent.

Copy of the agent tool context.

tts: undefined | tts.TTS

Text-to-speech model configured for the agent.

turnHandling: undefined | Partial<TurnHandlingOptions>

Agent-level turn handling configuration.

useTtsAlignedTranscript: undefined | boolean

Whether TTS-aligned transcripts are enabled for the agent.

vad: undefined | VAD

Voice activity detector configured for the agent.

Methods