Skip to content

bodhi-realtime-agent / MainAgent

Interface: MainAgent

Defined in: types/agent.ts:29

Defines a top-level voice agent that Gemini interacts with directly. Each agent has its own system instructions, tool set, and lifecycle hooks. Agents are registered with VoiceSession and selected via agent transfers.

Properties

googleSearch?

optional googleSearch: boolean

Defined in: types/agent.ts:38

Enable Gemini's built-in Google Search grounding for this agent.

Deprecated

Use providerOptions.googleSearch instead.


greeting?

optional greeting: string

Defined in: types/agent.ts:51

Optional greeting prompt sent to Gemini when this agent activates and a client is connected. Gemini will generate a spoken response based on this prompt.


instructions

instructions: string | () => string

Defined in: types/agent.ts:33

System instructions sent to Gemini. Can be a static string or a factory function.


language?

optional language: string

Defined in: types/agent.ts:42

IETF BCP 47 language tag for this agent (e.g., 'zh-CN', 'es-ES', 'ja-JP'). When set, a language directive is prepended to the system instruction.


name

name: string

Defined in: types/agent.ts:31

Unique name used for routing (e.g. "main", "math_expert").


providerOptions?

optional providerOptions: Record<string, unknown>

Defined in: types/agent.ts:40

Provider-specific options passed to the transport during agent transfer.


tools

tools: ToolDefinition[]

Defined in: types/agent.ts:35

Tools available to Gemini when this agent is active.

Methods

onEnter()?

optional onEnter(ctx): Promise<void>

Defined in: types/agent.ts:44

Called when this agent becomes the active agent (after a transfer or initial start).

Parameters

ctx

AgentContext

Returns

Promise<void>


onExit()?

optional onExit(ctx): Promise<void>

Defined in: types/agent.ts:46

Called when this agent is being replaced by another agent.

Parameters

ctx

AgentContext

Returns

Promise<void>


onTurnCompleted()?

optional onTurnCompleted(ctx, transcript): Promise<void>

Defined in: types/agent.ts:48

Called after each completed turn while this agent is active.

Parameters

ctx

AgentContext

transcript

string

Returns

Promise<void>

Built with VitePress