Skip to main content

Why run ArkSim in CI?

Agents break in non-obvious ways. A prompt tweak, a model upgrade, or a dependency change can silently degrade helpfulness, introduce false information, or cause goal failures — without triggering any unit test. Running ArkSim on every pull request turns quality regression into a CI signal:

Choose your approach


Approach 1: pytest with a custom agent

Your agent is a Python class that subclasses BaseAgent. ArkSim loads it in-process — no HTTP server needed. The pytest test runs simulation and evaluation directly and asserts scores.

How it works

Setup

1

Subclass BaseAgent

Your agent class must implement two methods:
If you already have an existing agent, wrap it in a thin adapter:
2

Copy the pytest templates

Download the GitHub Actions example:
Copy the pytest workflow and test template into your repo:
Create a conftest.py in your tests/ directory so pytest can resolve your agent and metrics modules:
3

Create your scenarios

Create tests/arksim/scenarios.json with test cases representative of your agent’s real usage:
See Build Scenarios for the schema, and examples/bank-insurance for a full example.
4

Customize the test file

Open tests/test_agent_quality.py and update:
  • Import your agent class (replace from my_agent import MyAgent)
  • Import your custom metrics if needed (replace from my_metrics import ...), or remove the custom metrics block entirely to use built-in metrics only
  • Set NUMERIC_THRESHOLDS and QUALITATIVE_FAILURE_LABELS to match your quality bar
  • Adjust num_convos_per_scenario, max_turns, and num_workers as needed
5

Add GitHub secret

In your repo → Settings → Secrets and variables → Actions:
6

Push

The workflow triggers automatically on every push to main and on every PR. A failing assertion fails the job.

Approach 2: HTTP server

Your agent runs as an HTTP server exposing an OpenAI-compatible chat completions endpoint. ArkSim calls it over HTTP during CI — works with any language or framework.

How it works

The CLI exits non-zero if any threshold is not met, which fails the job.

Setup

1

Get the workflow template

Download the GitHub Actions example:
Copy the workflow template into your repo:
2

Create your ArkSim config

Create arksim/config.yaml in your repo. Point the endpoint at the port where your agent server will listen:
See Evaluation for all configuration options and the full list of available metrics.
If your agent’s requirements.txt conflicts with ArkSim’s dependencies, install them in separate virtual environments so they don’t interfere:
3

Create your scenarios

Create arksim/scenarios.json with test cases representative of your agent’s real usage. See Build Scenarios for the schema, and examples/bank-insurance for a full example.
4

Add custom metrics (optional)

If you have custom metrics, add them to arksim/custom_metrics/ and reference them in your arksim/config.yaml. See Custom Metrics for the schema.
5

Customize the workflow

Open .github/workflows/arksim.yml and update the two TODO sections:Start agent server — replace with your framework’s startup command:
Wait for agent — update the health-check URL if your server uses a different route:
6

Add GitHub secrets

In your repo → Settings → Secrets and variables → Actions:
7

Push

The workflow triggers automatically on every push to main and on every PR. The job passes or fails based on your configured thresholds.

Quality gates

Configure pass/fail thresholds in your config or test file. If any gate is not met the job fails.

Per-metric thresholds

Fail if any conversation’s per-metric score falls below the minimum. Built-in turn-level metrics use a 1–5 scale; goal_completion and overall_score use 0–1:

Qualitative failure labels

Fail if any evaluated turn returns one of these labels:
See Threshold Gates for the full reference on all three gate types.

Viewing the evaluation report

After every run — pass or fail — two artifacts are uploaded so you can inspect results regardless of outcome.
  1. Open the workflow run in GitHub Actions.
  2. Scroll to Artifacts at the bottom.
  3. Download arksim-html-report → unzip → open final_report.html in your browser.
  4. Download arksim-full-results for the raw simulation and evaluation JSONs (useful for programmatic analysis or diffing metric trends across runs).
The HTML report shows metric averages, per-conversation scores, and the top failure patterns, giving you enough context to know exactly what to fix.