Conducts surveys with support for multiple question types, conditional branching based on answers, per-answer scoring, and a completion callback. The agent guides the caller through each question, validates answers, and tracks progress per call.
Human-readable survey name used in prompts and global data.
Ordered list of survey questions. Each SurveyQuestion object has:
id (string, required) — Unique question identifier.text (string, required) — The question text to ask the caller.type (string, required) — One of "multiple_choice", "open_ended", "rating", or "yes_no".options (string[]) — Required for multiple_choice questions.scale (number, default 5) — For rating questions, the upper bound of the scale (1..scale).required (boolean, default true) — Whether the question must be answered.nextQuestion (string | Record<string, string>) — Next question ID, or a map from answer value to next question ID for branching. If omitted, proceeds in array order.points (number | Record<string, number>) — Fixed points for any answer, or per-answer scoring map.Opening message before the first question. Defaults to a generic intro.
Closing message spoken after the survey completes.
Brand or company name the agent represents. Used in prompt sections.
Maximum number of times to retry invalid answers before moving on.
Callback fired when the survey is finished. Receives all responses and the total score.
Agent display name.
HTTP route for the agent.
Additional AgentBase options forwarded to the constructor.
Questions support conditional branching via the nextQuestion property. When set to a
Record<string, string>, the agent routes to different follow-up questions based on the
caller’s answer. Use the key "_default" as a fallback branch.
Scoring is configured via the points property. A fixed number awards the same points
for any answer. A Record<string, number> awards different points per answer value.