In CI
silk's exit codes mean something:
| Code | Meaning |
|---|---|
| 0 | every scenario passed |
| 1 | a scenario failed, a --max-cost-usd cap was hit, or compare --max-regression found a regression |
| 2 | usage error or an invalid suite |
| 3 | an agent run itself failed (could not start, timed out, no result) or the report could not be written |
So a job can be as small as:
silk run suites/my-mcp.silk.yaml --trials 3 --max-cost-usd 5 --output run
silk compare baseline-run run --max-regression 0.1
- Cap the spend.
--max-cost-usdstops a run once the reported cost passes the cap. Only Claude reports a cost. - Keep the baseline. Store
results.jsonfrom a known-good run (an artifact or a committed file) and compare against it. - Secrets are environment variables. The suite names them (
env:MCP_TOKEN); give them to the job from your CI's secret store. silk never prints them. - Runs spend real calls and need a logged-in agent CLI or an API key. That is why silk's own CI never runs them: its tests use a fake agent. Run live checks on a schedule or on demand rather than on every push.
JUnit. --junit results.xml on run or grade writes the results as JUnit XML, which GitHub, GitLab, Jenkins and most test
reporters read. Each scenario is a test case (with several trials, one per trial, named id (trial n); each arm is its own test
suite). A failed check, a failed outcome: command or a rubric criterion that failed is a failure whose text lists every problem
with the judge's quoted evidence. A criterion the judge ruled unknown is a failure too, as it does not pass. A run that produced no
answer (could not start, timed out) is an error. The agent's tool calls, usage and final answer go in system-out.
GitHub Actions. When GITHUB_ACTIONS=true, silk needs no flag: it prints an ::error annotation for each failed scenario (with the
suite file as the annotation's file, when it is inside GITHUB_WORKSPACE) and appends the markdown report to the job's step summary
(GITHUB_STEP_SUMMARY), cut at GitHub's size limit with a note. GitHub shows at most ten annotations per step; the step summary has every
failure. Neither output holds a secret: the report never does.
On GitHub, the action does the install, the run and the upload in one step. The same thing by hand:
This runs a suite on demand and weekly, writes JUnit and the run folder, and uploads both. It was linted with zizmor, whose only finding is its low-severity
notice about installing a package outside a lockfile (the npm install, which is pinned to a version), and it has not been run: the
first run in your repository is the check.
name: silk
# Real agent runs spend real calls, so this runs on demand and on a schedule, not on every push.
on:
workflow_dispatch:
schedule:
- cron: "17 5 * * 1"
permissions:
contents: read
jobs:
evaluate:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
# The agent under test and the judge's default backend are both the claude CLI.
- name: Install the agent and silk
run: |
npm install --global @anthropic-ai/[email protected]
dotnet tool install --global Nullean.Silk.Cli --version 0.2.0
echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
# In GitHub Actions silk needs no flag for annotations and the step summary: it detects GITHUB_ACTIONS.
- name: Run the suite
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
MCP_TOKEN: ${{ secrets.MCP_TOKEN }}
run: silk run suites/my-mcp.silk.yaml --trials 3 --max-cost-usd 5 --junit results.xml --output run
# JUnit goes to a reporter of your choice; the folder holds report.md and every transcript.
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
if: always()
with:
name: silk-results
path: |
results.xml
run
retention-days: 14
- v7.0.1
- a suite names secrets as env:MCP_TOKEN; silk never prints them
- v7.0.2
- Secrets:
ANTHROPIC_API_KEYis what theclaudeCLI and silk's default judge (claude -p) log in with in CI. Give the job only the secrets the suite names withenv:. - Annotations and the summary need no step: silk emits them because
GITHUB_ACTIONS=true. - A JUnit reporter turns
results.xmlinto a check run or a pull request comment; pick the action you already trust and pin it by commit SHA. silk only writes the file. - Pin the versions of the agent CLI and of silk: an eval result is only comparable to another run of the same versions.
Install the tool in a job with dotnet tool install -g Nullean.Silk.Cli (--junit and the GitHub Actions output need 0.1.0 or later).