Testing in CI
The goldens as the gate before a deploy, in GitHub Actions, and what to run nightly.
Your goldens are the gate before production. Run them in CI on every pull request, and a red run stops the deploy. A second, scheduled job spends more: several models, spoken callers, and the drift of the judges over real calls.
How it works#
The CLI needs two things in CI: the project, and a key. It reads PINECALL_KEY and PINECALL_URL from the
environment and nothing else. PINECALL_URL defaults to https://cloud.pinecall.io, so on Pinecall Cloud
the key is enough.
Use a sandbox server token: make one in the console's Settings ▸ API keys, in the sandbox, and keep it
in the repository's secrets as PINECALL_KEY. It starts with pc_test_ and acts only in the sandbox, so
a test run never touches production's calls.
| Job | When | What it runs | Costs |
|---|---|---|---|
| Unit tests | every push | npm test |
nothing |
| Goldens | every pull request, before a deploy | pinecall test, pinecall docs eval, pinecall memory eval |
real model calls; embeddings |
| Nightly | weekday nights | every approved case, two models, pinecall remember, spoken personas, pinecall runs drift |
real calls |
pinecall test and pinecall simulate start nothing: they play against whoever holds the agent, and with
nobody holding it the run is refused with a 404. So the job holds it itself, with a pinecall start in the
background, the same command you run on your laptop: your tools run on the CI machine, against whatever
they reach. The gateway plays and judges the conversations.
The gate#
Make the token#
A sandbox server token, made on the sandbox's console the way
Run it on your own server shows. It is shown once, as
PINECALL_KEY=pc_test_….
Keep it in GitHub#
gh secret set PINECALL_KEY
Paste the value when asked. It never goes on a command line.
Add the workflow#
name: agent
on:
pull_request:
push:
branches: [main]
# The gateway runs one suite per agent at a time: queue, never overlap.
concurrency:
group: goldens
cancel-in-progress: false
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
PINECALL_KEY: ${{ secrets.PINECALL_KEY }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- run: npm ci
- name: unit tests
run: npm test
# test starts nothing: this job's own process holds the agent for the steps after it.
- name: hold the agent
run: |
npx pinecall start > start.log 2>&1 &
for i in $(seq 1 60); do grep -q "connected to" start.log && exit 0; sleep 1; done
cat start.log; exit 1
- name: goldens
run: npx pinecall test
- name: retrieval goldens
run: |
npx pinecall docs eval
npx pinecall memory eval
- name: keep what broke
if: failure()
uses: actions/upload-artifact@v4
with:
name: broken-goldens
path: .pinecall/evals/
hold the agent starts pinecall start in the background, on the job's sandbox token, and waits up to a
minute for the line it prints once the agent is registered (… connected to https://cloud.pinecall.io …).
It keeps holding the agent for the steps after it and stops with the job. On a failure, start.log says why.
npx pinecall fetches the CLI from npm: pinecall new does not add it to package.json, so write
npx pinecall@<version> to hold every run to one release. Each verb ends with one of two codes, and a step
fails on either:
| exit | means |
|---|---|
1 |
what it measures did not hold: a golden broke, a check failed, a judge answered broken |
2 |
it could not run, and measured nothing: a flag or a name that is wrong, no key, any refusal of the gateway (a run already going, a quota, a vendor with no key), the network down |
The retrieval goldens are optional. Leave out
docs evalwhen the agent reads no base, andmemory evalwhen the project has noagents/<name>/test/goldens/memory.json.
The artifact holds one file per broken golden, with the requests the model answered. Download it and read
asked before you change anything.
The nightly#
Pinecall schedules no run of its own: "the nightly" is a job you schedule. It is where the expensive
checks go. This one plays the goldens and every approved case (pinecall test plays both;
--dataset the cases alone), runs
the goldens under two models, the extraction cases, one spoken caller, and the drift of the judges on the
calls the sandbox took. The caller and the judges are the agent's roster and its list — rows written in
the console, or the files a class declares, which the checkout carries with the code:
name: nightly
on:
schedule:
- cron: "17 2 * * 1-5"
workflow_dispatch:
concurrency:
group: goldens
cancel-in-progress: false
jobs:
nightly:
runs-on: ubuntu-latest
timeout-minutes: 45
env:
PINECALL_KEY: ${{ secrets.PINECALL_KEY }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- run: npm ci
- name: hold the agent
run: |
npx pinecall start > start.log 2>&1 &
for i in $(seq 1 60); do grep -q "connected to" start.log && exit 0; sleep 1; done
cat start.log; exit 1
- name: the goldens and every approved case
run: npx pinecall test
- name: goldens, two models
if: always()
run: npx pinecall test --model haiku --model openai/gpt-4.1-mini
- name: what memory writes down
if: always()
run: npx pinecall remember
- name: a caller out loud
if: always()
run: npx pinecall simulate --persona in-a-hurry --voice --judge
- name: drift
if: always()
run: npx pinecall runs drift --agent front-desk --window 7d --baseline 30d --threshold 10
if: always() keeps a red matrix from hiding a judge that has been sliding for a week: the night fails on
any of them, and every step still runs.
To fail only when the baseline model breaks and report the second as a finding, run the two-model step with
--jsonand gate onrun.matrix.failures(Comparing models).
runs drift above reads the sandbox's calls. To watch production's, give a production server token to a
job of its own and add --prod.
CI's sandbox token has no corner of its own, so a run there reads the team's settings. A fix you saved only in your corner holds on your laptop and breaks here until
pinecall agent push … --team.