Step-by-step Setup
Create your suite definition file

Add a .assaykit/suite.yaml file to your repo. This is the source of truth for your eval suite and is synced to AssayKit on every CI run.

.assaykit/suite.yaml
# Your eval suite definition — commit this to git
name: my-agent-eval
description: Quality checks for the v2 agent pipeline
threshold: 0.75

scenarios:
  - name: customer_greeting
    prompt: A customer says "I need help with my order".
    expected_output: The agent acknowledges the customer and offers order assistance.
    target_url: https://api.youragent.com/chat
    target_headers:
      Authorization: Bearer YOUR_AGENT_TOKEN
    request_body:
      model: gpt-4o

  - name: billing_refund_flow
    prompt: A customer asks for a refund of $49.99. Confirm the amount.
    expected_output: The agent echoes "$49.99" and initiates the refund flow.
    target_url: https://api.youragent.com/chat
    target_headers:
      Authorization: Bearer YOUR_AGENT_TOKEN
    request_body:
      model: gpt-4o
The import endpoint is idempotent — running assaykit push twice with the same suite name updates the existing suite in place. Only new scenarios are added; missing scenarios are removed. Your YAML file is the source of truth.
Add GitHub Secrets and Variables

Go to your repo Settings → Secrets and variables → Actions and add two entries:

Name Where Value
ASSAYKIT_API_KEY Secrets Your key from /app → API Keys. Treat it like a password.
SLACK_WEBHOOK_URL Secrets Optional. Incoming webhook URL from your Slack workspace.
ASSAYKIT_SUITE_ID Variables The numeric suite ID from the dashboard URL (e.g. /app?suite=42 → suite ID is 42). Use in workflow with ${{ vars.ASSAYKIT_SUITE_ID }}.
Create the workflow file

Add .github/workflows/assaykit.yml to your repo. This runs on every push to main and every PR targeting main.

.github/workflows/assaykit.yml
name: AssayKit Eval

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  assaykit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install AssayKit CLI
        run: npm install -g assaykit

      - name: Push suite to AssayKit
        run: npx assaykit push --file .assaykit/suite.yaml
        env:
          ASSAYKIT_API_KEY: ${{ secrets.ASSAYKIT_API_KEY }}
          ASSAYKIT_URL: https://assaykit.polsia.app

      - name: Run eval suite
        id: eval
        run: |
          npx assaykit run \\
            --suite ${{ vars.ASSAYKIT_SUITE_ID }} \\
            --api-key "${{ secrets.ASSAYKIT_API_KEY }}" \\
            --url https://assaykit.polsia.app \\
            --json > results.json
        env:
          ASSAYKIT_API_KEY: ${{ secrets.ASSAYKIT_API_KEY }}

      - name: Upload results artifact
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: assaykit-results
          path: results.json
          retention-days: 7

      - name: Notify on failure
        if: failure()
        run: |
          SLACK_WEBHOOK_URL="${{ secrets.SLACK_WEBHOOK_URL }}"
          if [ -n "$SLACK_WEBHOOK_URL" ]; then
            curl -s -X POST -H 'Content-type: application/json' \\\\
              --data '{"text":":warning: AssayKit regression detected in ${{ github.ref }}. Check the run results for details."}' \\\\
              "$SLACK_WEBHOOK_URL"
          fi
Two-phase approach: assaykit push syncs your suite definitions first, then assaykit run executes against the updated suite. This keeps your YAML file as the single source of truth — no manual suite management required.

Exit Code Behavior

The CLI exits with a deterministic code that GitHub Actions uses to gate your build. No need to parse output — just let the exit code do the work.

exit 0  All scenarios passed — no regressions detected
exit 1  One or more scenarios failed threshold — CI job fails
Regression detection: If any scenario's score falls below its threshold, the CLI exits 1 and the GitHub Actions job fails. A passing suite with 0 regressions exits 0 and the PR can be merged.
Drift regression (cohort baselines): If you use cohort baselines and a scenario drops more than 5 points below its baseline score, the run is also treated as a failure and exits 1. Set up cohort baselines in the dashboard.

Parsing JSON Output

The --json flag outputs machine-readable JSON to stdout. The CI step above saves it to results.json as an artifact. Here's what the structure looks like:

results.json — structure
{
  "ok": true,
  "run_id": 42,
  "status": "completed",
  "passed": 8,
  "failed": 0,
  "total": 8,
  "avg_score": 87,
  "all_passed": true,

  "drift": {                          // present if cohort baseline is active
    "baseline_id": 89,
    "scenarios_compared": 8,
    "regressions": [...],
    "has_regressions": false
  },

  "results": [
    {
      "scenario_id": 1,
      "name": "customer_greeting",
      "passed": true,
      "score": 91,
      "drift_score": 2.1,      // null if no baseline
      "latency_ms": 340,
      "error": null
    },
    {
      "scenario_id": 2,
      "name": "billing_refund_flow",
      "passed": false,            // below threshold
      "score": 64,
      "drift_score": -8.3,       // 8.3 pts below cohort baseline
      "error": null
    }
  ]
}

In a following step, you can parse this JSON to post a PR comment or post to Slack:

Parse results.json — post to Slack
# Extract pass/fail from the results artifact (GNU jq or Node.js)
PASSED=$(jq -r '.passed' results.json)
FAILED=$(jq -r '.failed' results.json)
AVG_SCORE=$(jq -r '.avg_score' results.json)
ALL_PASSED=$(jq -r '.all_passed' results.json)

echo "Passed: $PASSED / Failed: $FAILED / Avg: $AVG_SCORE"

# Pull regression detail if drift is present
REGRESSIONS=$(jq -r '.drift.regressions | length' results.json 2>/dev/null || echo "0")
echo "Cohort regressions: $REGRESSIONS"

# Show which scenarios failed (for the job log)
jq -r '.results[] | select(.passed == false) | "\\(.name): score \\(.score), drift \\(.drift_score)"' results.json

Complete Pipeline Flow

Here's the full sequence of what happens when the workflow runs:

Step Command What happens
Install npm install -g assaykit Pulls the latest AssayKit CLI into the runner. Runs once per workflow run.
Push npx assaykit push --file .assaykit/suite.yaml POSTs the YAML to https://assaykit.polsia.app/api/suites/import. Suite is created or updated. Exits 0 on success.
Run npx assaykit run --suite $ID --json Starts a run, polls until completed, writes JSON to stdout. Exits 0 if all passed, 1 if any failed.
Artifact actions/upload-artifact Saves results.json as a run artifact (viewable in GitHub UI for 7 days).
Notify if: failure() Runs only if the run step exited non-zero. Posts to Slack if SLACK_WEBHOOK_URL secret is set.

Slack Notifications

The workflow includes a step that fires on failure. It needs your Slack Incoming Webhook URL. Here's how to set it up:

  1. Go to api.slack.com/messaging/webhooks → Create New Webhook
  2. Select the channel to post to (e.g. #ci-alerts)
  3. Copy the webhook URL → add it as SLACK_WEBHOOK_URL in GitHub Secrets
Webhook alternative: You can also configure a webhook directly in the AssayKit dashboard (Webhooks tab). AssayKit will POST to your Slack endpoint on run failure events automatically — no extra step needed in your CI workflow.

CLI Reference
assaykit push
npx assaykit push --file .assaykit/suite.yaml
npx assaykit push --file ./suites/prod.yaml --base-url https://assaykit.polsia.app

# Environment variable alternative
export ASSAYKIT_API_KEY=ak_live_xxxx
export ASSAYKIT_URL=https://assaykit.polsia.app
npx assaykit push --file .assaykit/suite.yaml
FlagDescription
--filePath to the YAML or JSON suite definition file. Required.
--api-keyAPI key. Can also be set via ASSAYKIT_API_KEY env var.
--base-urlAssayKit API base URL. Default: https://assaykit.polsia.app.
assaykit run
npx assaykit run --suite 42 --json
npx assaykit run --suite 42 --api-key ak_live_xxxx --json
FlagDescription
--suiteSuite ID to run. Defaults to running all scenarios if omitted.
--api-keyAPI key. Can also be set via ASSAYKIT_API_KEY env var.
--urlAssayKit base URL. Default: https://assaykit.polsia.app.
--jsonMachine-readable JSON output. Strips progress indicators.
Polling: assaykit run polls /api/runs/:id every 2 seconds until the run completes (max 5 minutes). If your suite has more than ~100 scenarios, consider running subsets in parallel with different scenario_ids filters.