Testing AI agents (API & CLI)
Evaluate coding and SRE agents deterministically over REST or CLI against all 52 isolated sandboxes using the exact same grading rubric used for human operators.
Authentication
Create an API key in Settings and pass it as a Bearer token on eval requests:
Authorization: Bearer sg_live_...
See API keys and webhooks for key lifecycle and revocation details.
Headless REST endpoints
Plug your own agent harness directly into the four-step episode lifecycle. Sessions created through the eval API automatically disable hints and accept a fixed mutationSeed for reproducible runs:
# 1. Provision an episode (returns session id, brief, and initial file list)
POST /api/v1/eval/sessions
{"scenarioSlug": "postgres-wal-bloat-pool", "agentModel": "my-agent", "provider": "custom", "mutationSeed": "ci-101"}
# 2. Run commands inside the sandbox (inspect logs, read or edit configs, reload services)
POST /api/v1/eval/sessions/:id/exec
{"command": "psql -c \"SELECT * FROM pg_replication_slots;\""}
# 3. Grade without publishing to the leaderboard
POST /api/v1/eval/sessions/:id/grade
# 4. Grade and record the run on the benchmarks leaderboard
POST /api/v1/eval/sessions/:id/submit
{"agentModel": "my-agent", "provider": "custom", "track": "multi-layer-webops", "costUsd": 0.05}
Live BYOK LLM runner and CLI
To run a real multi-turn LLM loop inside an isolated sandbox without writing a harness, call POST /api/v1/eval/live-run (supports gemini, openai, anthropic, and HTTPS openai-compatible endpoints such as OpenRouter, with maxSteps from 1 to 15) or use the workspace CLI (pnpm eval-cli in the monorepo, or the built servergym-eval binary):
# List all available scenario slugs and benchmark suites
SERVERGYM_API_KEY=sg_live_... pnpm eval-cli list
SERVERGYM_API_KEY=sg_live_... pnpm eval-cli suites
# Run a live multi-turn BYOK model loop inside an isolated sandbox
SERVERGYM_API_KEY=sg_live_... GEMINI_API_KEY=... \
pnpm eval-cli live-run wp-multitenant-500 --provider gemini --model gemini-2.5-flash --max-steps 8
# Run a built-in baseline suite and enforce CI pass/safety thresholds
SERVERGYM_API_KEY=sg_live_... \
pnpm eval-cli suite-run pentest-twin gemini-4-neon --min-pass 80 --min-safety 100
By default, the CLI targets https://app.servergym.com when SERVERGYM_API_KEY is set (or http://127.0.0.1:4000 locally); override the target with --url or SERVERGYM_API_URL. Available tracks on GET /api/v1/eval/suites are l1-it-support, pentest-twin, ai-override-safety, multi-layer-webops, build-and-infra, helpdesk-shift, and full-34. Note that auto-run and suite-run execute ServerGym’s built-in baseline agent profiles for harness and regression checks, whereas live-run and /api/v1/eval/sessions evaluate external models.
AI models vs. real users leaderboard
Open Benchmarks (backed by GET /api/v1/benchmarks and GET /api/v1/benchmarks/compare) to compare AI runs — pass rate, safety rate, average steps, duration, estimated cost, and full terminal replays — against real human solve rates across all 52 labs.