defineAgent

defineAgent

Declares the agent. src/agent/agent.tsx exports its result.

import { defineAgent } from "curb";

function defineAgent(definition: AgentDefinition): AgentDefinition;

Options

OptionTypeDefaultWhat it does
appcomponentThe agent’s React tree
maxLoadedSkillsnumber3Skills open at once. The least recently used leaves past this
maxStepsnumber8Model steps per turn
maxTranscriptMessagesnumber60Messages sent to the model per step. The full transcript is kept
timeZonestring"UTC"An IANA time zone. Every request carries today’s date and time in it
firstTurn"user", "agent", { say }"user"Who opens the call (Who speaks first)
mcpServersarrayRemote MCP servers (MCP servers)
goalsobjectWhat counts as a successful call (Goals and experiments)
experimentsobjectA/B experiments, by name
afterCallCallHookRuns once the call is over (After-call code)
afterEvaluationCallHookRuns once the call’s goals are judged
pipelineobjectChanges the LiveKit pipeline of voice calls (Override the LiveKit pipeline)
preview{ suggestedPrompts?, chatPlaceholder? }Hints for the preview. Never reach the model

It refuses a time zone that does not exist, a firstTurn no conversation can open with, goals or experiments a host could not evaluate, and a hook that is not a function.

CallHook, CallEvent and CallRecord are the types of those functions and of what they receive.

Example

import { defineAgent } from "curb";

export const agent = defineAgent({ app: App, timeZone: "Europe/Berlin", firstTurn: "agent" });

Version history

VersionChanges
v1.15.0afterCall, afterEvaluation and pipeline added
v1.8.0goals and experiments added
v1.4.33timeZone added, and firstTurn takes { say }
v0.3.0firstTurn added
v0.1.2defineAgent introduced