Skip to content

agent_simulation: report a job's failure_reason, how its call ran, and each turn's text - #1867

Draft
u9g wants to merge 3 commits into
mainfrom
jason/simulation-job-failure-reason
Draft

u9g wants to merge 3 commits into
mainfrom
jason/simulation-job-failure-reason

Conversation

@u9g

@u9g u9g commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Adds to SimulationRun what agent-service already knows about each simulation job but couldn't return through the API. Today a client such as lk agent simulate export or a CI check sees only that a job failed and its timings and scores. It can't see why the job failed, how the call ended, or what was said.

SimulationRun.Job.failure_reason (field 19)

A machine-readable cause for a failed job, with a FailureReason enum. Its one cause so far is FAILURE_REASON_AGENT_JOIN_TIMEOUT, meaning the agent under test never joined. agent-service already stores it on every failed job and gives it to the summarizer. Without the field, a client has to match on the human-readable error. The enum numbers match agent-service's internal jobs.FailureReason, so the service copies the stored value straight across. It's field 19 because #1862 claims 17 and 18 on the same message.

SimulationRun.JobMetrics: how the call ran

These are facts the simulator already knows, which until now only reached its logs:

Field Meaning
end_reason How the call ended: the caller finished the scenario, the agent ended it, the agent went silent, the turn limit was hit, empty replies, or an agent error. A failing end still also sets the job's error.
caller_language The simulated caller's language, as a language tag.
caller_listen_language Audio only: the language the caller transcribed the agent in. "" means the same as caller_language.
impairments Audio only: the background noise played (e.g. "cafe"), and whether low-quality microphone or packet loss was applied. Absent for a clean call.
conversation.backchannel_count How many acknowledgements ("mm-hm", "right") the caller made over the agent's speech.

SimulationRun.JobMetrics.Turn.text (field 18)

Each turn's words as the simulation's judges read them: the speaker's own words, or, when those are unknown, the words as the other side heard them. The agent's own words are unknown when it has no RemoteSession, e.g. over SIP.

A job already reports one row per turn with timings and scores, but not what was said. So a reader can see that a turn was slow or interrupted but not what it said. They also can't check the judged transcript's shape, such as one caller line per turn with each reply after the line it answers.

Consumers

@changeset-bot

changeset-bot Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f97eec3

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 Patch
@livekit/protocol Patch

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

The service already records a machine-readable cause for a failed job (today: the agent never joined the room), but SimulationRun.Job had no field for it, so API clients could only pattern-match the error text.
@u9g
u9g force-pushed the jason/simulation-job-failure-reason branch from 68da9ab to 7604ce1 Compare October 19, 2026 20:40
…er sounded like

JobMetrics gains end_reason, caller_language, caller_listen_language, impairments and conversation.backchannel_count. The simulator knows all of them, but until now they only reached its logs.
A job's transcript reached only the simulator's logs, so a client reading the job (lk agent simulate export, a CI check) could see each turn's timings and scores but not the words that were scored.
@u9g u9g changed the title agent_simulation: add SimulationRun.Job.failure_reason agent_simulation: report a job's failure_reason, how its call ran, and each turn's text Oct 19, 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.

1 participant