Skip to content

agent_simulation: add simulator flow nodes to scenarios - #1856

Draft
chenghao-mou wants to merge 2 commits into
mainfrom
chenghao/feat/AGT-3725-public-simulator-flow-schema
Draft

chenghao-mou wants to merge 2 commits into
mainfrom
chenghao/feat/AGT-3725-public-simulator-flow-schema

Conversation

@chenghao-mou

@chenghao-mou chenghao-mou commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Adds simulator flows to agent simulation scenarios.

A scenario today describes one persona. For an outbound call, the simulator needs to play the far end: a voicemail greeting and beep, an IVR menu that routes on DTMF, a screener, a hold, and the person who picks up after it. A flow is a set of named nodes; the simulator walks them as the call goes.

  • ScenarioGroup.nodes: named SimulatorNodes, shared by every scenario in the group. Nodes can also name the built-ins livekit/hangup, livekit/voicemail, and livekit/unavailable.
  • Scenario.start: the node a call starts at. A scenario sets start or instructions, not both.
  • Scenario.max_duration: a cap on such a call (unset is 300s).

livekit/voicemail is the only voicemail box, and nodes cannot configure one. Each run picks the box: whether it beeps, how long it waits for silence, and whether a send-or-re-record menu follows the message. Repeated runs then show how an agent handles different boxes.

In scenarios.yaml:

nodes:
  menu:
    say: "For appointments, press 1. For voicemail, press 2."
    speaker: MACHINE
    routes:
      - { match: "1", to: hold }
      - { match: "2", to: livekit/voicemail }
    timeout: { after: 8s, to: menu }
    max_visits: { count: 3, to: livekit/hangup }
  hold:
    say: "Please hold while I connect you."
    speaker: MACHINE
    timeout: { after: 4s, to: sam }
  sam:
    say: "Hi, this is Sam."
    instructions: You are Sam Lee. Confirm tomorrow's 10am cleaning, then say goodbye.
scenarios:
  - label: menu-to-sam
    start: menu
    agent_expectations: Presses 1, stays silent on hold, and confirms the appointment with Sam.

All fields are new, so the change is wire-compatible. The server compiles and validates each scenario's flow at CreateSimulationRun and keeps the nodes out of SimulationDispatch, so the agent under test never reads them.

Companion PRs: livekit/livekit-cli#1031 reads nodes and start from scenarios.yaml; the agent-service compile, validator, and runtime are in a private PR.

Addresses AGT-3725

A scenario could only describe one persona. For outbound calls the
simulator needs to play the far end: voicemail, IVR menus, screeners,
holds, and people, and the transitions between them.

ScenarioGroup.steps holds named SimulatorSteps shared by the group's
scenarios, and Scenario.start names the step a call starts at.
Scenario.max_duration caps such a call.
@changeset-bot

changeset-bot Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6cffd83

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
github.com/livekit/protocol Minor
@livekit/protocol Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

// One step of the far end of a simulated outbound call: a machine line, a
// person, a voicemail box, or silence. Steps name each other in then, routes,
// timeout, max_visits, and voicemail.next.
message SimulatorStep {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call them Node instead of Step?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we can.


// livekit/voicemail with these parameters: a beep, then the agent is recorded
// in silence.
message Voicemail {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VoicemailOptions

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌


// livekit/voicemail with these parameters: a beep, then the agent is recorded
// in silence.
message Voicemail {

@theomonnom theomonnom Oct 12, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a lot of those options may not be that relevant to users?

They seem like a lot of "options" or "randomness" that we should handle automatically.

Then, the failure rate across multiple runs (let's say 5) would determine how robust your agent is at handling voicemails. (because we just pick "randomly")

@chenghao-mou chenghao-mou Oct 12, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mainly for the machine node, where you want some degree of rigidity. But we can fix it, or at least, most of them, for the user too.

…lt-in

SimulatorStep becomes SimulatorNode and ScenarioGroup.steps becomes nodes.
Nodes no longer configure voicemail: the built-in livekit/voicemail picks the
box per run (beep, waits, and whether a menu follows the message), so repeated
runs show how an agent handles different boxes.
@chenghao-mou chenghao-mou changed the title agent_simulation: add simulator flow steps to scenarios agent_simulation: add simulator flow nodes to scenarios Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants