Skip to content

fix(drive_thru): call the ordering tool before confirming an order - #3136

Merged
chenghao-mou merged 1 commit into
mainfrom
motivate-sub-tarred
Dec 2, 2026
Merged

chenghao-mou merged 1 commit into
mainfrom
motivate-sub-tarred

Conversation

@rosetta-livekit-bot

@rosetta-livekit-bot rosetta-livekit-bot Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Verification

  • pnpm build passes (43/43 workspace tasks)
  • pnpm --filter livekit-agents-examples lint passes with two pre-existing TSDoc warnings
  • changed-file ESLint and Prettier checks pass
  • full examples test suite: 109 passed, 2 skipped, 1 unrelated failure in examples/src/testing/agent_task.test.ts (captureEmail handoff has no matching function-call output); reproduced on a second full run
  • cue-cli runtime framework-event validation could not be run because the executable is not installed and is unavailable from the configured PyPI/npm registries or visible LiveKit repositories

No changeset is included because livekit-agents-examples is private and excluded from the release workspace in verwalter.toml.

Source diff coverage

Source diff coverage

Source file Classification Target coverage
examples/drive_thru/database.py Adapted examples/src/drive-thru/database.ts: ported all three changed prompt rules into the target's independently worded COMMON_INSTRUCTIONS prompt: acknowledge then call, call before confirming completion, and report errors as unchanged state without self-retrying.

The source PR changed no tests or infrastructure files, so there are no omitted counterparts.

Source: livekit/agents#8902


Ported from livekit/agents#8902

Original PR description

Problem: The drive_thru agent's LLM (google/gemma-4-31b-it) sometimes writes "lemme get that added", then the order result as text, with no tool call; after a tool error it writes "lemme try that again... got it!" with no second call. The evals drive_thru job fails about one run in five because of this, most often in "Ordering tool fails" (17 failures from Nov 25 to Dec 2).

Fix: Three existing prompt rules are reworded: the acknowledgment is followed by the call, the call comes before saying the change is done, and a tool error means nothing changed and the customer is asked to try again instead of the agent retrying in text. The model and the scenarios stay the same.

Context for reviewing and coding agents

How the failure looks in CI

Every failing transcript has the same shape: the acknowledgment text, then the confirmation in the same reply, with no [call] line. In the error scenario the model writes the retry as text after [error] order_regular_item -> An internal error occurred. The judge and the final-order check in simulation.py both catch it, so the eval is correct and the agent is wrong.

Where the numbers came from

A one-step test called Gemma directly with three chat contexts rebuilt from failing CI transcripts: after the tool error, after the customer names the combo drink, and the first Big Mac turn. With 40 samples per context, the main prompt gave 3/120 replies with no tool call or a false claim, and this prompt gave 0/120. A simulation of the four flaky scenarios × 10 copies × 3 samples (120 runs) passed 111/120 on main and passed in full with this prompt.

Wordings rejected

Removing the acknowledgment sentence made the error case worse (2/20 false claims). "Confirm only after the tool result comes back" fixed the error case but left 2/20 combo replies with no call. "Nothing changed" alone still let the model narrate a retry (1/20), and "rather than retrying yourself" removed it.

Why not change the model

gemma-4-31b-it stays as the example's model, so the fix is in the prompt only.

@rosetta-livekit-bot
rosetta-livekit-bot Bot requested a review from a team as a code owner December 2, 2026 13:15
@rosetta-livekit-bot
rosetta-livekit-bot Bot requested a review from longcw December 2, 2026 13:15

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Devin Review: 2 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

@chenghao-mou
chenghao-mou enabled auto-merge (squash) December 2, 2026 13:26
@chenghao-mou
chenghao-mou merged commit 639e19c into main Dec 2, 2026
10 checks passed
@chenghao-mou
chenghao-mou deleted the motivate-sub-tarred branch December 2, 2026 13:26
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