pinecallDocs
Key concepts / Goldens

Goldens

A conversation written down, with what must be true at the end, run under every model you name.

A golden is one conversation written down: the state it opens in, what the caller says turn by turn, what must happen right after each line, and what must be true when it ends. pinecall test plays it against a real model, under every model you name, and tells you which turn held and which broke.

What is a golden?#

A golden is a JSON file in agents/<agent>/test/goldens/, named after what it is about. A file holds one golden or a list of them. A golden with no name takes the file's name.

agents/clinica-norte/test/goldens/books-after-yes.json
{
  "state": { "stage": "book", "patient": { "name": "Marta Ruiz" } },
  "turns": [
    { "say": "That one works for me.",
      "then": [
        { "no_tool": "book" },
        { "reply": { "intent": "reads the slot back and asks for a yes before booking" } }
      ] },
    { "say": "Yes, please confirm it.",
      "then": [ { "tool": "book" }, { "reply": { "not": ["free of charge"] } } ] }
  ]
}

This golden opens the call already at the booking stage. After the first line the agent must not book and must read the slot back asking for a yes; after the second it must call book, and its reply must not say "free of charge".

The fields#

field what it is
name the golden's name in the report; the file's name when absent
state the state the call opens in, written over the class's own state before the first render
turns the conversation, in order; 40 at most. Each turn is a caller's line (say) or a fact your backend sends (event); a line may carry then, what must happen right after it
memory facts memory already holds about the caller. They answer recall for this call only, and nothing is written to memory
today YYYY-MM-DD, the day the model is told it is, so a golden that names a weekday reads the same next year
expect what must be true of the whole conversation at the end. Expectations reference has every step of then and every field of expect

The two other files in that folder, docs.json and memory.json, are goldens of another kind, for the index and for memory. pinecall test skips them; Testing knowledge & memory covers them.

How a golden is played#

pinecall test starts nothing: the run drives whoever holds the agent — your pinecall start, a colleague's, or a deployed app — and is refused with a 404 when nobody does. Each golden is one written call on the same session a real caller gets, on your org's provider keys:

  • the call opens with no greeting: a golden starts in the middle of a conversation;
  • its state rides the call's call.started, and your agent opens in it;
  • each line is played as LiveKit's own test run of a turn (AgentSession.run), and its then is checked on that run, step by step, in order;
  • each event turn is sent as your app's own call.event. An event your agent never declared is refused by name: that golden breaks at the turn (t2.event, the refusal as its reason) and the run plays the next one. An event turn takes no then: what the agent does with the fact is checked in the next line's turn;
  • the first step that breaks ends the golden: the turns after it are not played, and expect is not checked, because the conversation it describes never happened;
  • a line the model's vendor fails — an outage past its retries, a content filter's refusal — breaks that golden at that turn, reported as t<n>.model with what the vendor answered; the run plays the next golden, and the golden's call ends as error;
  • memory answers recall. search is the real index, because that is what the golden is asking about. A golden that gives memory to an agent that keeps no memory breaks on the check memory, with no call opened, and the run plays the next golden.

Run them#

Terminal
pinecall test                                            # every agent's goldens
pinecall test --agent sales                              # one agent's
pinecall test --agent clinica-norte agents/clinica-norte/test/goldens/books-*.json  # some files
pinecall test --agent clinica-norte --grep books --watch                          # again when a golden changes
pinecall test --model haiku --model openai/gpt-4.1-mini  # a column per model
pinecall test --json                                     # the run as one JSON document

Paths, --watch, --case and --version play one agent's goldens: in a project of several agents, name it with --agent. --watch runs again when a golden file changes; a change to the class is picked up by the pinecall start that holds the agent, which reloads on save.

The report is a matrix: one line per golden, the latency it was answered with, and under a golden that broke, the turn it broke at and the step that broke, with its reason and the call's id:

  ✗ books-after-yes
        turn 1 broke
        t1.no_tool:book  broken   the turn forbids book, and it ran
        log                       call_29d7c7b6cdd643de9c659984a0125c8c

The last line counts what held, the judge-model calls, the cost of the calls and how long it took. The verb exits 1 when any golden did not hold, so the same command gates CI.

With two models or more, the report adds the goldens the models disagree about. A disagreement is a finding: the answer is a fix in the class, never a softer golden. Comparing models covers it.

Said out loud#

pinecall test --voice plays the same goldens on a real spoken line: each caller line is synthesized in a voice the agent does not use, and the agent is dispatched to a worker as on a phone call. --background-noise <dB> puts a television behind the caller, and --packet-loss drops that share of the caller's packets, from 0 to 1. A spoken run builds the session from your agent's settings, so it refuses --model and a golden that sets today. A spoken line is not a test run, so a spoken run refuses a golden with an event turn or a then, and checks its expect alone. Spoken tests has more.

Limits#

at most
goldens in one run 200
models in one run 8
calls in one run (goldens × models) 200
turns in one golden 40
one run 15 minutes

A run stopped early (the agent's process went away, the org ran out of a quota, the deadline passed) keeps the goldens judged so far and says why.

Where goldens come from#

Three places, and each has its reason:

Source Lives in Use it for
written by hand agents/<agent>/test/goldens/ what the business wants, before a caller ever asks
a case your org, on Pinecall a real call a judge broke on, kept at hang-up; pinecall test plays it beside the goldens once approved (--dataset plays the cases alone)
a case pulled into the repository agents/<agent>/test/goldens/ a case whose fix is code: pinecall cases pull <name> puts it in the pull request

A golden that names your code (a stage, a tool, an event) belongs in the repository, so it changes in the same commit as the code it names. A case that only names words can stay a case.

To write any finished call down as a file without keeping it on Pinecall:

Terminal
pinecall runs promote call_29d7c7b6cdd643de9c659984a0125c8c

It writes the call's opening state, its caller lines and backend facts as turns, and an expect derived from its broken verdicts, to agents/<agent>/test/candidates/. Promote the call that broke: the judges that broke on it fill expect; one that held, or one a golden run broke by a step (the run's verdict, not a judge's), gives an empty expect, and what it must keep doing is yours to write — for a golden run's call, the golden it played says it. Read the file and edit it before moving it into goldens/: where it came from is not approval.

Next steps#