Expectations reference
Every field of a golden's expect, what it checks, and the judge it is reported as.
A golden says what must be true in two places. Each line it says can carry then: what must happen right
after that line, step by step, in order. The golden's expect says what must be true of the whole
conversation when it ends. Each step and each field you set becomes one check, and the report names the
check. Most are settled by code; intent, grounded and judges ask the judge model.
A golden asks no judge it does not name.
How it works#
{
"turns": [
{ "say": "Hi, this is Tom Baker, about the refund. When will they call me back?",
"then": [
{ "tool": "takeMessage", "args": { "name": "Tom Baker" } },
{ "reply": { "not": ["tomorrow", "today"], "intent": "promises a call back without naming a day" } },
{ "nothing_else": true }
] }
],
"expect": { "register": "usted" }
}
After the line, the next tool call must be takeMessage with name among its arguments; then the agent's
next message must not say "tomorrow" or "today", and must promise a call back without naming a day; then
nothing else may happen in the turn. At the end, the agent must have kept to usted throughout.
The steps run on LiveKit's own test run of the line (AgentSession.run), with LiveKit's own assertions where
it has one. The first step that breaks ends the golden: no later turn is played and expect is not
checked, because the conversation it describes never happened.
After a line: then#
| step | check | holds when |
|---|---|---|
{"tool": "book"} |
t1.tool:book |
the turn's next tool call is book |
{"tool": "book", "args": {"day": "Thursday"}} |
t1.tool:book |
…and day is Thursday among its arguments; others may be there too |
{"tool": "book", "within_ms": 1500} |
t1.tool:book |
…and it started within 1.5 s of the line |
{"no_tool": "book"} |
t1.no_tool:book |
book was not called anywhere in the turn |
{"reply": {}} |
t1.reply |
the agent sent a message in the turn |
{"reply": {"says": […], "says_any": […], "not": […]}} |
t1.reply |
that message has every phrase of says, one of says_any, none of not |
{"reply": {"intent": "…"}} |
t1.reply, then t1.intent |
the agent sent a message, and the judge model says it does what the sentence says |
{"reply": {"within_ms": 2000}} |
t1.reply |
that message came within 2 s of the line |
{"end": "agent"} |
t1.end |
the call ended in this turn, by the agent (caller, supervisor, platform). The agent ends a call only when it may hang up — hangup set (pinecall agent set --hangup …), or the class calling hangup — so with neither, end: agent cannot hold. "Says goodbye and hangs up" is a reply step (says_any: ["bye", "goodbye"]) before the end step |
{"nothing_else": true} |
t1.nothing_else |
nothing follows the step before it in the turn |
The checks are named by the turn's number: t3.reply is the third turn's. A second step of the same kind in a
turn is t3.reply#2.
Steps are found in order: a reply after a tool is the first message after that tool call. A reply
skips the lines that only cover a tool's wait — one said while a tool call has no answer yet, or one that
leads straight into a tool call ("Let me look") — and reads the message after them. A tool step
looks at the turn's next tool call, whatever its name, and breaks if it is another one: write the tools in
the order the agent must call them.
An event turn (a fact your backend sends) is { "event": { "name": "slot.released", "data": { … } } }, the
event's name and its data as your app's call.event sends them; the flat { "event": "slot.released", "data": … }
is refused. It takes no then: what the agent does with the fact is checked in the next line's turn.
intent#
intent is one sentence the judge model holds the agent's message to — LiveKit's judge(llm, intent=…), on
your run's judge model. Write what the message must do, not words it must contain: "asks for a yes before
booking", "offers one slot on Tuesday afternoon". Words belong in says and not, which cost nothing.
Each intent is one judge call; with no judge model at hand it breaks, saying so, rather than pass a message
nobody read.
At the end: expect#
| field | check | holds when |
|---|---|---|
tools |
tools |
every tool named was called, anywhere, in any order |
not_tools |
not_tools |
none of the tools named was called |
says |
says |
the agent said every phrase named, in any turn |
says_any |
says_any |
the agent said at least one of the phrases named |
not |
silence |
the agent said none of the phrases named, in any turn |
grounded: true |
grounded |
every concrete fact the agent stated is in what the call carried |
register |
register |
the agent kept to tu or usted in every turn |
judges |
each judge named | that judge does not answer broken when it is asked of the golden's call |
Use expect for what is true of the whole call and then for what must happen at one moment. "Never says
free" is expect.not; "does not book before the yes" is {"no_tool": "book"} on the turn before the yes.
state, memory and today sit beside turns and expect, at the top of the golden.
Goldens describes them.
The phrases: says, says_any, not#
The same three words in a reply and in expect: in a reply they read that one message, in expect every
turn of the agent. They match a phrase anywhere inside the text, ignoring case, and never read the caller's
words.
saysneeds every phrase. Use it for words that must appear.says_anyneeds one of them. Use it when there are several right answers:["9 to 2", "nine to two"].notforbids every phrase, and is reported assilenceinexpect.
A phrase is matched as text, so
not: ["free"]also catches "freedom". Write the shortest phrase that can only mean the thing you forbid.
Tools#
Use a tool step or not_tools, not not, when an action must not happen. "Did not say booked" passes when
the agent books silently; "did not call book" does not.
grounded#
"grounded": true asks the library's grounded of the golden's call: every
concrete fact the agent stated — a price, an hour, a date, a name, an address, a policy, an availability —
must appear, in any wording or language, in what the agent could read: its knowledge, the documents it
searched, the facts recalled, its tool answers, or what the caller said. A call that states no such fact
holds.
intent,groundedandjudgesask the judge model. In a run with no judge model at hand they break the golden, saying so, rather than pass a call nobody read.
register#
For Spanish agents. "register": "usted" breaks on any whole word of the informal register (tú, ti,
te, contigo, tu, tus, tuyo…). "register": "tu" breaks on usted, ustedes, consigo, suyo and
its forms. le, les, su and sus are never counted: they are as often the third person.
judges#
judges names any judge — one of the library such as promises or consent, or one
of your own — and asks each of the golden's call, as it would be asked at hang-up,
whether or not your org switched it on. The golden breaks when one answers broken; na and a choice or
score answer never break it.
{
"turns": [{ "say": "So you'll call me tomorrow to confirm?" }],
"expect": { "judges": ["promises"] }
}
A case a judge broke on expects exactly this. A name nobody wrote breaks the golden and names the
judges there are. expected-outcome is never useful here: a golden plays written lines, so its caller expects
nothing and the judge says na.