# Guided Onboarding Source: https://docs.verial.ai/ai-agents/onboarding Point a coding agent at Verial and have it wire up a first evaluation end to end. Guided onboarding is the fastest way to go from zero to a scored run when you are working through an AI coding agent. The agent introspects your organization, picks a published benchmark, configures a run, drives a rollout, and reads back results. ## The flow 1. **Connect.** The agent authenticates with a Verial API key or Solver key. See [Authentication](/api-reference/authentication). 2. **Discover.** The agent lists published benchmarks (`GET /benchmarks?visibility=Public`), inspects environments, and summarizes what is available. 3. **Pick a benchmark.** You confirm a target (for example `fax-referral@1`). The agent reads the tasks and criteria. 4. **Start a run.** The agent calls `POST /v1/benchmark-runs`, stores the returned bearer token, and walks through each task run. 5. **Drive the rollout.** The agent calls your agent-under-test through the sandbox endpoints (FHIR, HL7, files, portal). 6. **Read results.** The agent fetches task run verdicts, per-criterion scores, and evidence, then explains what happened. ## Using MCP The [Verial MCP server](/mcp/overview) exposes every resource as a structured tool. MCP clients can discover the tool surface and execute the onboarding flow without any custom code. See [MCP Setup](/mcp/setup) to connect Claude Code, Cursor, or ChatGPT Desktop. ## Using the CLI If your coding agent has a shell tool, the Verial [CLI](/cli/overview) is enough: ```bash theme={null} verial benchmarks list --json verial benchmark-runs create --benchmark fax-referral@1 --json # ... drive rollout endpoints ... verial benchmark-runs get $RUN_ID --json ``` A dedicated `/onboard` slash command that orchestrates the full flow in one step is on the roadmap. In the meantime, point your agent at this page and at [Running a Benchmark](/guides/running-a-benchmark). ## Next Steps Install Verial expertise into your AI coding agent. The richest integration for agentic workflows. # Verial for AI Agents Source: https://docs.verial.ai/ai-agents/overview Give AI coding agents the tools to build, author, and drive benchmarks on Verial. Verial exposes its full platform to AI coding agents (Claude Code, Cursor, ChatGPT Desktop, and any MCP-capable client) so they can compose environments, author benchmarks, run evaluations, and inspect results without leaving the chat. Pick the integration that fits your workflow: Connect any MCP-capable client to Verial and operate the platform through structured tool calls. Drive benchmarks from an agent's shell tool. Supports `--json` for machine-readable output. Use the TypeScript SDK from an agent's code-execution tool. Language-agnostic HTTP API for custom agent integrations. ## Why AI agents on Verial? Healthcare AI teams increasingly use coding agents to build, tune, and ship their own agents. Verial is built so those coding agents can close the loop on quality: * **Self-testing.** An agent can author a benchmark, run it against its own production configuration, and read back per-criterion evidence in the same conversation. * **Tight feedback.** Criterion-level scores and structured evidence (FHIR logs, voice transcripts, portal events) give coding agents actionable signal, not just a pass/fail. * **No hidden state.** Every resource is a first-class REST object. Agents can list, introspect, and edit without leaning on UI-only flows. ## Recommended setup 1. Create a dedicated organization API key for your coding agent and scope it to a non-production environment. See [Solver Keys](/guides/solver-keys) and [Authentication](/api-reference/authentication). 2. Connect the agent. MCP is the richest integration (native tool calls with schemas); CLI is the simplest if your agent already has a shell tool. 3. Start with a published benchmark. Point the agent at [Running a Benchmark](/guides/running-a-benchmark) and let it drive a first rollout end to end. ## Next Steps Walk an agent through connecting to Verial and running its first evaluation. Drop-in expertise for coding agents operating on Verial. # Agent Skills Source: https://docs.verial.ai/ai-agents/skills Reusable expertise for AI coding agents operating on Verial. Skills are scoped bundles of context, prompts, and examples you can drop into an AI coding agent (Claude Code, Cursor, others) so it operates Verial correctly without you re-teaching the vocabulary every session. A good skill tells the agent what environments, simulators, benchmarks, criteria, and runs mean, which endpoints to call, and how to read verdicts and evidence. A first-party Verial skills package is on the roadmap. Until then, this page describes the patterns we recommend so you can hand-author a skill for your team's agent. ## What a Verial skill should cover * **Vocabulary.** Environments, simulators, benchmarks, tasks, criteria, verification, runs, task runs, criterion runs, playgrounds, sandboxes, interactions. See the [Core Concepts](/guides/concepts/environments) pages. * **Auth model.** Organization API keys for authoring, Solver keys for running published benchmarks, run-scoped bearer tokens for driving rollouts. See [Authentication](/api-reference/authentication) and [Solver Keys](/guides/solver-keys). * **The two entry points.** Internal `POST /benchmark-runs` for authoring teams, public `POST /v1/benchmark-runs` for external Solvers. See [Runs](/guides/concepts/runs). * **The six criterion check types.** `fhir-resource-state`, `hl7-structural`, `portal-state-match`, `sftp-file-present`, `voice-transcript`, `x12-response`. See [Criteria](/guides/concepts/criteria). * **How to read results.** Verdicts, scores, axes, per-criterion evidence. See [Run Results](/guides/observability/run-results). ## Starter prompt Point your coding agent at this file, [Core Concepts > Environments](/guides/concepts/environments), and [Running a Benchmark](/guides/running-a-benchmark) as always-loaded context. A minimal seed: ``` You operate on Verial, a healthcare AI agent benchmarking platform. Verial concepts: environments compose simulators + datasets; benchmarks group tasks with typed criteria; runs produce per-criterion scores via the verification engine. Auth: organization API keys (vk_*) for authoring; Solver keys (vrl_slv_*) for driving published benchmarks; run-scoped bearers (vrl_run_*) for rollout calls. Reference: https://docs.verial.ai MCP tools: see /mcp/tools ``` ## Alternatives If you are on an MCP-capable agent, [MCP](/mcp/overview) does most of the work a skill would — tools are self-describing and the agent can discover them at runtime. Use a skill when the agent needs richer vocabulary and workflow context than tool schemas alone carry. ## Next Steps Connect an MCP-capable agent to Verial. Have an agent run its first evaluation end to end. # Authentication Source: https://docs.verial.ai/api-reference/authentication Authenticate requests to the Verial internal API and the public v1 API. Verial exposes two HTTP surfaces with different auth flows. ## Internal API (`/`) Every internal API request authenticates with an **organization API key** as a Bearer token. Keys are prefixed `vk_`. ```bash theme={null} curl https://api.verial.ai/environments \ -H "Authorization: Bearer vk_xxx" ``` ### Creating keys 1. Go to **Settings > API Keys** in the [Verial dashboard](https://app.verial.ai). 2. Click **Create Key**. 3. Copy the key immediately. It is not shown again. Keys inherit the permissions of the organization that created them and can only access resources inside that organization. ### SDK ```typescript theme={null} import Verial from "@verial-ai/sdk"; const verial = new Verial({ apiKey: process.env.VERIAL_API_KEY, }); ``` ## Public v1 API (`/v1`) The v1 API is how external agents run published benchmarks. It uses **two token types**. ### 1. Solver key (`vrl_slv_`) Bearer token tied to a **Solver**, a per-organization agent identity. Minted from the dashboard under **Solvers** (or via the internal API) and works across any benchmark your organization is allowed to run, including any benchmark with `visibility=Public`. Authenticates **only** the create-run call: ```bash theme={null} curl -X POST https://api.verial.ai/v1/benchmark-runs \ -H "Authorization: Bearer vrl_slv_xxx" \ -H "Content-Type: application/json" \ -d '{"benchmark": "fax-referral@1", "scored": false}' ``` The response includes a per-run bearer token (`bearer_token` field) and task-run URLs. ### 2. Run bearer token (`vrl_run_`) Short-lived Bearer token returned from `POST /v1/benchmark-runs`. Authenticates all subsequent per-run calls for that benchmark run: * `GET /v1/benchmark-runs/{id}` * `ALL /v1/benchmark-runs/{id}/{fhir,hl7,files,portal}/*` * `POST /v1/task-runs/{id}/start` * `POST /v1/task-runs/{id}/complete` ```bash theme={null} curl "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID/files/inbox" \ -H "Authorization: Bearer vrl_run_xxx" ``` The run bearer token expires (`bearer_token_expires_at` in the create response). Save it on run creation, discard after the run completes. ## Security Best Practices * Store keys in environment variables, not in source code. * Rotate keys periodically; revoke compromised keys via the dashboard. * Use separate keys for dev and prod. * Never put `vk_`, `vrl_slv_`, or `vrl_run_` tokens into front-end code or logs. ## Error Responses Missing or invalid credentials return `401 Unauthorized`: ```json theme={null} { "error": { "code": "UNAUTHORIZED", "message": "Missing or invalid API key" } } ``` A Solver key used against a private benchmark in another organization returns `404 Not Found`. Public benchmarks are runnable from any organization's Solver key. # Create benchmark Source: https://docs.verial.ai/api-reference/benchmarks/create POST /benchmarks Create a benchmark of tasks against an environment. Create a benchmark that groups tasks for repeated execution against an environment. # Delete benchmark Source: https://docs.verial.ai/api-reference/benchmarks/delete DELETE /benchmarks/{id} Delete a benchmark. Permanently delete a benchmark. Historical runs are preserved. # Get benchmark Source: https://docs.verial.ai/api-reference/benchmarks/get GET /benchmarks/{id} Retrieve a benchmark by ID. Returns the benchmark's tasks, referenced environment, and configuration. # List benchmarks Source: https://docs.verial.ai/api-reference/benchmarks/list GET /benchmarks Retrieve benchmarks in your organization. Returns a list of benchmarks, including public benchmarks and those owned by your organization. # Update benchmark Source: https://docs.verial.ai/api-reference/benchmarks/update PATCH /benchmarks/{id} Update benchmark metadata or tasks. Update the name, description, tasks, or environment reference of a benchmark. # Submit CDS feedback Source: https://docs.verial.ai/api-reference/cds/feedback POST /services/{service_id}/cds/feedback Submit feedback for a CDS Hook response. Record user feedback for a CDS Hook response (e.g., accepted, overridden). Used for verification of agent behavior and analytics. # Invoke CDS hook Source: https://docs.verial.ai/api-reference/cds/invoke POST /services/{service_id}/cds/hooks/{hook} Trigger a CDS Hook invocation. Invoke a registered CDS Hook (e.g., `patient-view`, `order-select`) with a simulated context. Returns the cards produced by downstream CDS services. # List CDS services Source: https://docs.verial.ai/api-reference/cds/list GET /services/{service_id}/cds/services List registered CDS Hooks services. Returns the CDS Hooks services currently registered with the simulator. # Register CDS service Source: https://docs.verial.ai/api-reference/cds/register POST /services/{service_id}/cds/services Register a CDS Hooks service. Register a CDS Hooks service with the simulated EHR so that hooks can invoke it during a task. # Check eligibility Source: https://docs.verial.ai/api-reference/clearinghouse/check-eligibility POST /services/{service_id}/clearinghouse/eligibility Perform an eligibility check via a clearinghouse. Perform a simulated 270/271 eligibility inquiry against a clearinghouse service. # Create dataset Source: https://docs.verial.ai/api-reference/datasets/create POST /datasets Create a new dataset. Create a dataset for use in environments and benchmarks. Supported types include FHIR, Files, and SFTP manifests. # Delete dataset Source: https://docs.verial.ai/api-reference/datasets/delete DELETE /datasets/{id} Delete a dataset and its files. Permanently delete a dataset. For Files/SFTP datasets, the associated files in object storage are also removed. This action cannot be undone. Environments that reference this dataset will break. # Get dataset Source: https://docs.verial.ai/api-reference/datasets/get GET /datasets/{id} Retrieve details for a specific dataset. Returns the full details for a dataset, including its type and configuration. # List datasets Source: https://docs.verial.ai/api-reference/datasets/list GET /datasets Retrieve datasets in your organization. Returns a list of datasets in your organization. # Update dataset Source: https://docs.verial.ai/api-reference/datasets/update PATCH /datasets/{id} Update dataset metadata or configuration. Update the name, description, or configuration of a dataset. # Create environment Source: https://docs.verial.ai/api-reference/environments/create POST /environments Create a reusable simulated health system definition. Create a new environment with its simulator configuration. Environments are reusable definitions that can be instantiated as playgrounds or referenced by benchmarks. ## What's Next After creating an environment, you can: 1. [Create a benchmark](/api-reference/benchmarks/create) that references this environment 2. [Create a playground](/guides/concepts/environments) to instantiate it for live testing # Delete environment Source: https://docs.verial.ai/api-reference/environments/delete DELETE /environments/{id} Delete an environment definition. Permanently delete an environment. Benchmarks that reference this environment will no longer be runnable. This action cannot be undone. Ensure no active benchmarks depend on this environment before deleting. # Get environment Source: https://docs.verial.ai/api-reference/environments/get GET /environments/{id} Retrieve details for a specific environment. Returns the full configuration for an environment, including all simulators (FHIR, voice, patient, HL7, X12, fax). # List environments Source: https://docs.verial.ai/api-reference/environments/list GET /environments Retrieve environments in your organization. Returns a list of environments in your organization, including their simulator configurations. # Update environment Source: https://docs.verial.ai/api-reference/environments/update PATCH /environments/{id} Update environment configuration. Update an environment's name, description, or simulator configuration. # Errors Source: https://docs.verial.ai/api-reference/errors Error response format and common error codes. All errors return a structured JSON body with a machine-readable `code` and a human-readable `message`. ## Error Format ```json theme={null} { "error": { "code": "VALIDATION_ERROR", "message": "One or more request fields are invalid.", "details": { "name": ["Required field"] } } } ``` | Field | Type | Description | | --------------- | ------ | ----------------------------------------------- | | `error.code` | string | Machine-readable error code | | `error.message` | string | Human-readable explanation | | `error.details` | object | Field-level validation errors (when applicable) | ## Error Codes | Status | Code | Description | | ------ | ------------------ | ------------------------------------------------------------------------------------------- | | 400 | `VALIDATION_ERROR` | Invalid request fields. Check `details` for specifics. | | 400 | `BAD_REQUEST` | Malformed request body or invalid parameters. | | 401 | `UNAUTHORIZED` | Missing or invalid API key. | | 404 | `NOT_FOUND` | The requested resource does not exist or is not accessible. | | 409 | `CONFLICT` | The request conflicts with the current state (e.g., starting a run on a deleted benchmark). | | 429 | `RATE_LIMITED` | Too many requests. Wait and retry. | | 500 | `INTERNAL_ERROR` | An unexpected error occurred on the server. | ## Handling Errors Check the `code` field to determine how to respond programmatically: ```typescript theme={null} try { const run = await verial.runs.create({ benchmarkId: 'invalid' }) } catch (err) { if (err.code === 'NOT_FOUND') { console.error('Benchmark not found') } else if (err.code === 'VALIDATION_ERROR') { console.error('Invalid request:', err.details) } else if (err.code === 'RATE_LIMITED') { // Wait and retry await sleep(parseInt(err.retryAfter ?? '60', 10) * 1000) } else { throw err } } ``` ## Rate Limiting The API enforces rate limits per API key. When you exceed the limit, you receive a `429` response with a `Retry-After` header indicating how many seconds to wait before retrying. ``` HTTP/1.1 429 Too Many Requests Retry-After: 60 ``` ## Validation Errors Validation errors include a `details` object that maps field names to arrays of error messages: ```json theme={null} { "error": { "code": "VALIDATION_ERROR", "message": "One or more request fields are invalid.", "details": { "name": ["String must contain at least 1 character(s)"], "timeout": ["Number must be greater than 0"] } } } ``` # Get fax Source: https://docs.verial.ai/api-reference/fax/get GET /services/{service_id}/faxes/{fax_id} Retrieve a submitted fax. Returns metadata and rendered content for a previously submitted fax. # Send fax Source: https://docs.verial.ai/api-reference/fax/send POST /services/{service_id}/faxes Submit a fax to a simulated fax service. Submit a fax (PDF or TIFF) to the simulator. The platform records the submission so criteria can verify it after the rollout. # SMART configuration Source: https://docs.verial.ai/api-reference/fhir/smart-config GET /services/{service_id}/fhir/.well-known/smart-configuration Fetch the SMART-on-FHIR configuration for a service. Returns the SMART-on-FHIR well-known configuration document for a playground's FHIR service. Use this to discover the token endpoint and supported scopes before authenticating. # FHIR token Source: https://docs.verial.ai/api-reference/fhir/token POST /services/{service_id}/fhir/token Issue an OAuth token for FHIR access. Issue a bearer token for accessing a playground's simulated FHIR store. # Send HL7 message Source: https://docs.verial.ai/api-reference/hl7/send POST /services/{service_id}/hl7/messages Send an HL7 v2 message to a simulator. Send an HL7 v2 message (e.g., ADT, ORM, ORU) to the simulated health system and receive an acknowledgment. # Introduction Source: https://docs.verial.ai/api-reference/introduction The Verial API. Healthcare simulated environment platform for defining environments, publishing benchmarks, and running scored rollouts. Verial exposes two HTTP APIs on `https://api.verial.ai`: 1. **Internal REST API** (`/`). Bearer-auth using organization API keys. Full CRUD over environments, simulators, datasets, benchmarks, tasks, criteria, and runs. 2. **Public v1 API** (`/v1`). The run flow for external agents executing a published benchmark. Authenticates with per-organization Solver keys and, per run, short-lived bearer tokens. ## Base URL ``` https://api.verial.ai ``` All endpoints are served over HTTPS. HTTP requests are rejected. ## Casing Wire format is **snake\_case** for both request and response JSON. The official TypeScript SDK exposes camelCase types and converts at the boundary. URL query parameters are snake\_case (for example `?task_id=...`). ## Auth Methods | API | Header | Key type | | ------------------------------------------------------------------ | ----------------------------------- | ---------------------------------------------------------- | | Internal (`/`) | `Authorization: Bearer vk_...` | Organization API key | | Public v1 create (`POST /v1/benchmark-runs`) | `Authorization: Bearer vrl_slv_...` | Solver API key (per-organization, works across benchmarks) | | Public v1 per-run (`/v1/task-runs/*`, `/v1/benchmark-runs/{id}/*`) | `Authorization: Bearer vrl_run_...` | Per-run bearer token (issued in the create-run response) | See [Authentication](/api-reference/authentication) for details. ## Resources The internal API is organized around these resources: | Resource | Description | | --------------------------------------------------------- | -------------------------------------------------- | | [Environments](/api-reference/resources/environments) | Simulated health systems with linked simulators | | [Simulators](/api-reference/resources/simulators) | Reusable simulator definitions | | [Datasets](/api-reference/resources/datasets) | Synthetic patient data configurations | | [Benchmarks](/api-reference/resources/benchmarks) | Collections of tasks linked to an environment | | [Tasks](/api-reference/resources/tasks) | Individual test cases within a benchmark | | [Criteria](/api-reference/resources/criteria) | Typed assertions scored by the verification engine | | [Criterion Runs](/api-reference/resources/criterion-runs) | Per-criterion results within a task run | | [Playgrounds](/api-reference/resources/playgrounds) | Running environment instances with live sandboxes | | [Sandboxes](/api-reference/resources/sandboxes) | Running simulator instances with credentials | | [Benchmark Runs](/api-reference/resources/runs) | Benchmark executions with scores and verdicts | | [Task Runs](/api-reference/resources/task-runs) | Task-level results within a benchmark run | ## Public v1 Surface During a benchmark run the agent interacts only with `/v1` endpoints. The shape is: ``` POST /v1/benchmark-runs (Solver key auth) GET /v1/benchmark-runs/{id} (run bearer token) ALL /v1/benchmark-runs/{id}/fhir/* (FHIR proxy) GET /v1/benchmark-runs/{id}/hl7/inbox (inbound HL7) POST /v1/benchmark-runs/{id}/hl7/outbound (outbound HL7) GET /v1/benchmark-runs/{id}/files/inbox (SFTP file listing) GET /v1/benchmark-runs/{id}/files/* (SFTP file fetch) ALL /v1/benchmark-runs/{id}/portal/* (portal proxy) POST /v1/task-runs/{id}/start (start a task run) POST /v1/task-runs/{id}/complete (complete + run verification) ``` See the [Quick Start](/guides/quickstart) for an end-to-end walkthrough. ## MCP Server The internal API also exposes a [Model Context Protocol](/mcp/overview) server at `/mcp` for AI client integration. ## Pagination List endpoints return cursor-based paginated results. See [Pagination](/api-reference/pagination). ## SDKs The official TypeScript SDK is available on npm: ```bash theme={null} npm install @verial-ai/sdk ``` See the [SDK docs](/sdk/installation). # Get message Source: https://docs.verial.ai/api-reference/messages/get GET /services/{service_id}/messages/{message_id} Retrieve a specific message. Returns a single message by ID. # List messages Source: https://docs.verial.ai/api-reference/messages/list GET /services/{service_id}/messages Retrieve the message history for a service. Returns the ordered list of messages exchanged with the simulator for this service. # Send message Source: https://docs.verial.ai/api-reference/messages/send POST /services/{service_id}/messages Send a chat message to a simulator. Send a chat message to a conversational simulator (e.g., patient or portal agent). The simulator replies with a generated response. # Pagination Source: https://docs.verial.ai/api-reference/pagination How cursor-based pagination works in the Verial API. All list endpoints return paginated results using cursor-based pagination. This provides stable, consistent paging even when records are created or deleted between requests. ## Query Parameters | Parameter | Type | Default | Description | | --------- | ------- | ------- | -------------------------------------- | | `limit` | integer | `20` | Number of items per page (1-100) | | `cursor` | string | | Opaque cursor from a previous response | ## Response Shape Every list endpoint returns a `data` array and a `_meta` object: ```json theme={null} { "data": [ { "id": "env_clxyz123", "name": "Primary Care Clinic" }, { "id": "env_clxyz456", "name": "Cardiology Practice" } ], "_meta": { "next": "eyJpZCI6ImVudl9jbHh5ejQ1NiJ9", "prev": null, "limit": 20 } } ``` | Field | Description | | ------------- | ------------------------------------------------------------------------ | | `_meta.next` | Cursor pointing to the next page. `null` when there are no more results. | | `_meta.prev` | Cursor pointing to the previous page. `null` on the first page. | | `_meta.limit` | The limit that was applied to this request. | ## Paging Forward Pass the `next` cursor from the previous response to fetch the next page: ```bash theme={null} # First page curl "https://api.verial.ai/environments?limit=20" \ -H "Authorization: Bearer vk_xxx" # Next page curl "https://api.verial.ai/environments?limit=20&cursor=eyJpZCI6ImVudl9jbHh5ejQ1NiJ9" \ -H "Authorization: Bearer vk_xxx" ``` Continue until `_meta.next` is `null`. ## Paging Backward Pass the `prev` cursor to go back one page: ```bash theme={null} curl "https://api.verial.ai/environments?limit=20&cursor=eyJpZCI6ImVudl9jbHh5ejEyMyJ9" \ -H "Authorization: Bearer vk_xxx" ``` ## Sort Order Results are sorted by creation date descending (newest first). This order is fixed and cannot be changed via query parameters. ## Cursor Format Cursors are opaque strings. Do not parse, construct, or store them long-term. They encode an internal position and may change format between API versions. Always use the cursor values returned in `_meta`. ## Notes * The maximum `limit` is **100**. Values above 100 are clamped. * The minimum `limit` is **1**. * An invalid or expired cursor returns a `400 Bad Request` error. # Get prior auth Source: https://docs.verial.ai/api-reference/payer/get-prior-auth GET /services/{service_id}/payer/prior-auths/{auth_number} Retrieve a prior authorization by auth number. Returns the current status and decision for a previously submitted prior authorization. # List payer patients Source: https://docs.verial.ai/api-reference/payer/list-patients GET /services/{service_id}/payer/patients List patients covered by a payer simulator. Returns the list of patients with coverage under the simulated payer. # Submit prior auth Source: https://docs.verial.ai/api-reference/payer/submit-prior-auth POST /services/{service_id}/payer/prior-auths Submit a prior authorization request. Submit a prior authorization to a payer simulator. The response includes an auth number to track status. # Benchmarks Source: https://docs.verial.ai/api-reference/resources/benchmarks Groups of tasks with criteria. Benchmarks group [Tasks](/api-reference/resources/tasks) into a test suite. Each benchmark references an [Environment](/api-reference/resources/environments) and defines timeout and concurrency settings. Each task inside a benchmark has [Criteria](/api-reference/resources/criteria) that the [verification engine](/guides/concepts/verification) runs to score task runs. ## Endpoints | Method | Endpoint | Description | | -------- | ------------------------------------------------------------- | --------------------- | | `GET` | [`/benchmarks`](/api-reference/endpoint/listBenchmarks) | List benchmarks | | `POST` | [`/benchmarks`](/api-reference/endpoint/createBenchmark) | Create a benchmark | | `GET` | [`/benchmarks/{id}`](/api-reference/endpoint/getBenchmark) | Get benchmark details | | `PATCH` | [`/benchmarks/{id}`](/api-reference/endpoint/updateBenchmark) | Update a benchmark | | `DELETE` | [`/benchmarks/{id}`](/api-reference/endpoint/deleteBenchmark) | Delete a benchmark | ## Benchmark Object | Field | Type | Description | | ----------------- | -------------- | ------------------------------ | | `id` | string | Unique identifier | | `name` | string | Benchmark name | | `description` | string \| null | Optional description | | `timeout` | number | Max execution time in seconds | | `concurrency` | number | Max concurrent task executions | | `organization_id` | string | Parent organization | | `created_at` | datetime | Creation timestamp | | `updated_at` | datetime | Last modification timestamp | ## SDK Example ```typescript theme={null} // Create a benchmark const benchmark = await verial.benchmarks.create({ name: 'Prior Auth E2E', environmentId: 'env_abc123', timeout: 300, concurrency: 5, }) // List all benchmarks const benchmarks = await verial.benchmarks.list() // Get a specific benchmark const details = await verial.benchmarks.get({ id: benchmark.id }) // Update await verial.benchmarks.update({ id: benchmark.id, timeout: 600, }) // Delete await verial.benchmarks.delete({ id: benchmark.id }) ``` # Criteria Source: https://docs.verial.ai/api-reference/resources/criteria Typed assertions that the verification engine runs against a task run. A **Criterion** is a typed assertion attached to a [Task](/api-reference/resources/tasks). After a task rollout completes, the [verification engine](/guides/concepts/verification) evaluates each criterion against the recorded environment state (FHIR resources, HL7 messages, SFTP uploads, portal state, voice transcripts, X12 responses) and produces a [Criterion Run](/api-reference/resources/criterion-runs) with a pass or fail result, a numeric score, and evidence. ## Endpoints | Method | Endpoint | Description | | -------- | ----------------------------- | ------------------------ | | `GET` | `/criteria?task_id={task_id}` | List criteria for a task | | `POST` | `/criteria` | Create a criterion | | `GET` | `/criteria/{id}` | Get criterion details | | `PATCH` | `/criteria/{id}` | Update a criterion | | `DELETE` | `/criteria/{id}` | Delete a criterion | ## Criterion Object | Field | Type | Description | | ----------------- | -------------- | -------------------------------------------------------------------------------------- | | `id` | string | Unique identifier | | `task_id` | string | Parent [Task](/api-reference/resources/tasks) | | `input_entity_id` | string \| null | Optional [DatasetEntity](/api-reference/resources/datasets) the criterion is scoped to | | `label` | string | Short human-readable label | | `assertion` | object | Typed assertion spec. Shape depends on `assertion.assert` (see below) | | `weight` | number | Relative weight for task scoring. Higher means more important | | `axis` | string \| null | Optional scoring axis for per-axis breakdown | | `created_at` | datetime | Creation timestamp | ## Assertion Specs The `assertion` field is a discriminated union on the `assert` key. The verification engine dispatches to a check implementation based on this value. Asserts that, after the rollout, a FHIR resource search returns a resource whose fields match expected values. | Field | Type | Description | | --------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------- | | `assert` | `"fhir-resource-state"` | Discriminator | | `resource_type` | string | FHIR resource type, for example `"Appointment"` | | `search` | object | FHIR search params as key or value strings. Default `{}` | | `fields` | array | Field assertions. Each has `path` (dotted path into the resource) and `expected` (string, number, boolean, or null) | ```json theme={null} { "assert": "fhir-resource-state", "resource_type": "Appointment", "search": { "patient": "Patient/john-smith", "status": "booked" }, "fields": [ { "path": "participant.0.actor.display", "expected": "Dr. Rivera" }, { "path": "serviceType.0.coding.0.code", "expected": "follow-up" } ] } ``` Asserts field values on HL7v2 outbound messages captured by the sandbox. | Field | Type | Description | | -------------- | ------------------ | -------------------------------------------------------------------------------------- | | `assert` | `"hl7-structural"` | Discriminator | | `correlate_by` | object | Key or value map used to select the matching HL7 message. Default `{}` | | `fields` | array | Each entry has `path` (HL7 segment-field path, e.g. `PID.5.1`) and `expected` (string) | ```json theme={null} { "assert": "hl7-structural", "correlate_by": { "MSH.9.1": "ADT" }, "fields": [ { "path": "PID.5.1", "expected": "Smith" }, { "path": "PV1.2", "expected": "I" } ] } ``` Asserts that after a web portal simulation ends, a given resource row has the expected fields. | Field | Type | Description | | -------------- | ---------------------- | ------------------------------------------------------------------------------------------- | | `assert` | `"portal-state-match"` | Discriminator | | `portal` | string \| null | Optional portal slug | | `correlate_by` | object | `{ resource, key }`: which sandbox-state resource to load, and which key identifies the row | | `assertions` | array | Each entry has `path` (dotted JSON path) and `expected` (any JSON value) | ```json theme={null} { "assert": "portal-state-match", "correlate_by": { "resource": "prior_auth_requests", "key": "request_id" }, "assertions": [ { "path": "status", "expected": "submitted" }, { "path": "cpt_code", "expected": "72148" } ] } ``` Asserts that a file was uploaded to the sandbox SFTP endpoint, optionally parsing JSON contents and asserting fields. | Field | Type | Description | | -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------- | | `assert` | `"sftp-file-present"` | Discriminator | | `path` | string \| null | Exact path | | `path_pattern` | string \| null | Glob pattern with `*` wildcard. Use instead of `path` for multiple candidate files | | `parse_json` | boolean | Parse the file as JSON before checking fields. Default `false` | | `fields` | array | Each entry has `key` or `path` and `expected`. Use `key` for sidecar-style keys, `path` for dotted JSON paths | ```json theme={null} { "assert": "sftp-file-present", "path_pattern": "outbound/claims/*.json", "parse_json": true, "fields": [ { "path": "claim.total_charges", "expected": 420.00 }, { "path": "claim.status", "expected": "submitted" } ] } ``` Asserts the content of a voice call transcript. This is the check that uses LLM-assisted matching for loose phrase presence. | Field | Type | Description | | -------------- | --------------------------------------- | ------------------------------------------------------- | | `assert` | `"voice-transcript"` | Discriminator | | `speaker` | `"agent" \| "caller" \| "ivr" \| "any"` | Which speaker's turns to match against. Default `"any"` | | `contains` | string\[] | Phrases that must appear in the transcript | | `not_contains` | string\[] | Phrases that must not appear | ```json theme={null} { "assert": "voice-transcript", "speaker": "agent", "contains": ["member ID", "date of birth"], "not_contains": ["social security number"] } ``` Asserts field values on an X12 EDI response (270/271/276/277/278) produced by the sandbox clearinghouse. | Field | Type | Description | | -------------- | --------------------------------------------------- | ----------------------------------------------------------------- | | `assert` | `"x12-response"` | Discriminator | | `transaction` | `"270" \| "271" \| "276" \| "277" \| "278" \| null` | Optional transaction set filter | | `correlate_by` | object | Key or value map to pick the matching response | | `fields` | array | Each has `path` and `expected` (string, number, boolean, or null) | ```json theme={null} { "assert": "x12-response", "transaction": "271", "fields": [ { "path": "EB.1", "expected": "1" }, { "path": "EB.3", "expected": "30" } ] } ``` ## HTTP Example ```bash theme={null} # Create a criterion curl -X POST https://api.verial.ai/criteria \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "task_id": "task_abc123", "label": "Appointment booked for correct patient", "weight": 1.0, "axis": "correctness", "assertion": { "assert": "fhir-resource-state", "resource_type": "Appointment", "search": { "patient": "Patient/john-smith", "status": "booked" }, "fields": [ { "path": "participant.0.actor.display", "expected": "Dr. Rivera" } ] } }' ``` Response: ```json theme={null} { "id": "crit_01H...", "task_id": "task_abc123", "input_entity_id": null, "label": "Appointment booked for correct patient", "assertion": { "assert": "fhir-resource-state", "resource_type": "Appointment", "search": { "patient": "Patient/john-smith", "status": "booked" }, "fields": [ { "path": "participant.0.actor.display", "expected": "Dr. Rivera" } ] }, "weight": 1.0, "axis": "correctness", "created_at": "2026-04-20T17:04:12.000Z" } ``` ## SDK Example ```typescript theme={null} // Create a criterion (SDK uses camelCase) const criterion = await verial.criteria.create({ taskId: "task_abc123", label: "Appointment booked for correct patient", weight: 1.0, axis: "correctness", assertion: { assert: "fhir-resource-state", resource_type: "Appointment", search: { patient: "Patient/john-smith", status: "booked" }, fields: [ { path: "participant.0.actor.display", expected: "Dr. Rivera" }, ], }, }); // List criteria for a task const criteria = await verial.criteria.list({ taskId: "task_abc123" }); // Update weight await verial.criteria.update({ id: criterion.id, weight: 2.0 }); // Delete await verial.criteria.delete({ id: criterion.id }); ``` The `assertion` object is passed through unchanged by the API. Keys inside `assertion` are not snake-to-camel transformed. Use the exact field names documented above (for example `resource_type`, `correlate_by`, `parse_json`, `not_contains`). # Criterion Runs Source: https://docs.verial.ai/api-reference/resources/criterion-runs Per-criterion results produced by the verification engine. A **Criterion Run** is the result of running a single [Criterion](/api-reference/resources/criteria) against a [Task Run](/api-reference/resources/task-runs). The [verification engine](/guides/concepts/verification) creates one Criterion Run per criterion when a task run completes. ## Endpoints | Method | Endpoint | Description | | ------ | ------------------------------------------- | ---------------------------------- | | `GET` | `/criterion-runs?task_run_id={task_run_id}` | List criterion runs for a task run | | `GET` | `/criterion-runs/{id}` | Get criterion run details | Criterion Runs are read-only. They are created automatically when you complete a task run (see the [Task Runs](/api-reference/resources/task-runs) page and the v1 [completion flow](/guides/quickstart)). ## Criterion Run Object | Field | Type | Description | | -------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | `id` | string | Unique identifier | | `task_run_id` | string | Parent [Task Run](/api-reference/resources/task-runs) | | `criterion_id` | string | Source [Criterion](/api-reference/resources/criteria) | | `passed` | boolean | `true` if the criterion passed | | `score` | number | Score (`0.0` to `1.0`) | | `details` | string \| null | Human-readable explanation of the result | | `evidence` | object \| null | Structured evidence payload (field-level results, matched messages, transcript snippets). Shape depends on the criterion's check type | | `started_at` | datetime | When verification started | | `completed_at` | datetime \| null | When verification finished | ## HTTP Example ```bash theme={null} curl "https://api.verial.ai/criterion-runs?task_run_id=tr_abc123" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` ```json theme={null} { "data": [ { "id": "crun_01H...", "task_run_id": "tr_abc123", "criterion_id": "crit_01H...", "passed": true, "score": 1.0, "details": "Appointment resource matched; all 2 field assertions passed.", "evidence": { "field_results": [ { "path": "participant.0.actor.display", "expected": "Dr. Rivera", "actual": "Dr. Rivera", "passed": true } ] }, "started_at": "2026-04-20T17:10:02.000Z", "completed_at": "2026-04-20T17:10:04.000Z" } ], "next_cursor": null } ``` ## SDK Example ```typescript theme={null} // List criterion runs for a task run const runs = await verial.criterionRuns.list({ taskRunId: "tr_abc123" }); for (const run of runs.data) { console.log(`${run.criterionId}: ${run.passed ? "PASS" : "FAIL"} (${run.score})`); if (!run.passed) console.log(run.details); } // Fetch one criterion run with full evidence const detail = await verial.criterionRuns.get({ id: "crun_01H..." }); ``` # Datasets Source: https://docs.verial.ai/api-reference/resources/datasets Synthetic patient data for populating sandboxes. Datasets hold synthetic patient data (FHIR bundles, files, or other formats) that can be loaded into [Sandboxes](/api-reference/resources/sandboxes). Datasets can be hand-crafted or generated from a prompt. ## Endpoints | Method | Endpoint | Description | | -------- | --------------------------------------------------------- | ------------------- | | `GET` | [`/datasets`](/api-reference/endpoint/listDatasets) | List datasets | | `POST` | [`/datasets`](/api-reference/endpoint/createDataset) | Create a dataset | | `GET` | [`/datasets/{id}`](/api-reference/endpoint/getDataset) | Get dataset details | | `PATCH` | [`/datasets/{id}`](/api-reference/endpoint/updateDataset) | Update a dataset | | `DELETE` | [`/datasets/{id}`](/api-reference/endpoint/deleteDataset) | Delete a dataset | ## Dataset Object | Field | Type | Description | | ----------------- | --------------------- | ---------------------------------- | | `id` | string | Unique identifier | | `name` | string | Dataset name | | `description` | string \| null | Optional description | | `type` | FHIR \| Files \| null | Data format | | `data` | unknown \| null | The dataset contents | | `config` | object \| null | Generation or schema configuration | | `organization_id` | string | Parent organization | | `created_at` | datetime | Creation timestamp | | `updated_at` | datetime | Last modification timestamp | ## SDK Example ```typescript theme={null} // Create a dataset const dataset = await verial.datasets.create({ name: 'Diabetes patient panel', }) // List all datasets const datasets = await verial.datasets.list() // Get a specific dataset const details = await verial.datasets.get({ id: dataset.id }) // Update await verial.datasets.update({ id: dataset.id, description: '50 patients with Type 2 diabetes', data: fhirBundle, }) // Generate data from a prompt await verial.datasets.generate({ id: dataset.id, prompt: '10 patients with pending prior auth requests', }) // Delete await verial.datasets.delete({ id: dataset.id }) ``` # Environments Source: https://docs.verial.ai/api-reference/resources/environments Simulated health systems composed of linked simulators. Environments represent simulated health systems. Each environment is composed of one or more [Simulators](/api-reference/resources/simulators) that work together to model a realistic healthcare setting (EHR, phone systems, fax, payers, etc.). ## Endpoints | Method | Endpoint | Description | | -------- | ----------------------------------------------------------------- | --------------------------------------- | | `GET` | [`/environments`](/api-reference/endpoint/listEnvironments) | List environments | | `POST` | [`/environments`](/api-reference/endpoint/createEnvironment) | Create an environment | | `GET` | [`/environments/{id}`](/api-reference/endpoint/getEnvironment) | Get environment details | | `PATCH` | [`/environments/{id}`](/api-reference/endpoint/updateEnvironment) | Update an environment | | `DELETE` | [`/environments/{id}`](/api-reference/endpoint/deleteEnvironment) | Delete an environment | | `POST` | `/environments/{id}/simulators/{simulatorId}` | Add a simulator to the environment | | `DELETE` | `/environments/{id}/simulators/{simulatorId}` | Remove a simulator from the environment | ## Environment Object | Field | Type | Description | | ----------------- | -------------- | --------------------------- | | `id` | string | Unique identifier | | `name` | string | Environment name | | `description` | string \| null | Optional description | | `organization_id` | string | Parent organization | | `created_at` | datetime | Creation timestamp | | `updated_at` | datetime | Last modification timestamp | ## SDK Example ```typescript theme={null} // Create an environment const env = await verial.environments.create({ name: 'Regional Medical Center', }) // List all environments const environments = await verial.environments.list() // Get a specific environment const details = await verial.environments.get({ id: env.id }) // Update await verial.environments.update({ id: env.id, description: 'Primary care clinic with voice and FHIR', }) // Link a simulator await verial.environments.addSimulator({ environmentId: env.id, simulatorId: 'sim_abc123', }) // Unlink a simulator await verial.environments.removeSimulator({ environmentId: env.id, simulatorId: 'sim_abc123', }) // Delete await verial.environments.delete({ id: env.id }) ``` # Overview Source: https://docs.verial.ai/api-reference/resources/overview Resources available in the Verial API. | Resource | Description | | --------------------------------------------------------- | ------------------------------------------------------------------------- | | [Environments](/api-reference/resources/environments) | Simulated health systems composed of linked simulators | | [Simulators](/api-reference/resources/simulators) | Reusable simulator definitions (FHIR, HL7, Voice, Fax, Portal, X12, SFTP) | | [Datasets](/api-reference/resources/datasets) | Synthetic patient data (FHIR bundles, files, portal state) | | [Benchmarks](/api-reference/resources/benchmarks) | Groups of tasks with criteria that the verification engine runs | | [Tasks](/api-reference/resources/tasks) | Individual test cases within benchmarks | | [Criteria](/api-reference/resources/criteria) | Typed assertions on tasks, scored by the verification engine | | [Criterion Runs](/api-reference/resources/criterion-runs) | Per-criterion results within a task run | | [Playgrounds](/api-reference/resources/playgrounds) | Running environment instances with live sandboxes | | [Sandboxes](/api-reference/resources/sandboxes) | Running simulator instances with credentials | | [Benchmark Runs](/api-reference/resources/runs) | Benchmark executions with scores and verdicts | | [Task Runs](/api-reference/resources/task-runs) | Task-level results within a benchmark run | For how these resources relate to each other, see [Core Concepts](/guides/index). # Playgrounds Source: https://docs.verial.ai/api-reference/resources/playgrounds Running environment instances with live sandboxes. Playgrounds are running instances of an [Environment](/api-reference/resources/environments). When you create a playground (or start a benchmark run), Verial provisions live [Sandboxes](/api-reference/resources/sandboxes) for each simulator in the environment, complete with credentials and loaded data. Each task run executes its rollout inside a playground, and the verification engine reads the playground's final sandbox state to score [criteria](/api-reference/resources/criteria). ## Endpoints | Method | Endpoint | Description | | ------ | ---------------------------- | ---------------------- | | `GET` | `/playgrounds` | List playgrounds | | `POST` | `/playgrounds` | Create a playground | | `GET` | `/playgrounds/{id}` | Get playground details | | `POST` | `/playgrounds/{id}/teardown` | Tear down a playground | ## Playground Object | Field | Type | Description | | ----------------- | -------- | ----------------------------------------------------------- | | `id` | string | Unique identifier | | `environment_id` | string | Source [Environment](/api-reference/resources/environments) | | `status` | string | Current status (provisioning, active, teardown, etc.) | | `organization_id` | string | Parent organization | | `created_at` | datetime | Creation timestamp | | `updated_at` | datetime | Last modification timestamp | ## SDK Example ```typescript theme={null} // Create a playground from an environment const playground = await verial.playgrounds.create({ environmentId: 'env_abc123', }) // List all playgrounds const playgrounds = await verial.playgrounds.list() // Get playground details (includes sandbox credentials) const details = await verial.playgrounds.get({ id: playground.id }) // Tear down when done await verial.playgrounds.teardown({ id: playground.id }) ``` # Benchmark Runs Source: https://docs.verial.ai/api-reference/resources/runs Benchmark executions with scores and verdicts. A **Benchmark Run** is a single execution of a [Benchmark](/api-reference/resources/benchmarks). When you create a benchmark run, Verial provisions a [Playground](/api-reference/resources/playgrounds) for each task, your agent drives the rollouts through sandbox endpoints, and the verification engine scores each task into [Criterion Runs](/api-reference/resources/criterion-runs) and an aggregate score and verdict. There are two entry points: * **Internal (`/benchmark-runs`)**: Bearer API-key auth. Used by Verial tooling. * **Public v1 (`/v1/benchmark-runs`)**: Solver-key auth. Used by external developers running a published benchmark from their own organization's Solver. This is the recommended path; see the [Quick Start](/guides/quickstart) and [Authentication](/api-reference/authentication). ## Internal Endpoints | Method | Endpoint | Description | | ------ | --------------------------------------------- | --------------------------------------------------------- | | `GET` | `/benchmark-runs?benchmark_id={benchmark_id}` | List benchmark runs | | `POST` | `/benchmark-runs` | Create a benchmark run (body `{ "benchmark_id": "..." }`) | | `GET` | `/benchmark-runs/{id}` | Get run details (includes task runs and criterion runs) | | `POST` | `/benchmark-runs/{id}/complete` | Mark complete | | `POST` | `/benchmark-runs/{id}/cancel` | Cancel | | `POST` | `/benchmark-runs/{id}/publish` | Publish to leaderboard | | `POST` | `/benchmark-runs/{id}/unpublish` | Unpublish from leaderboard | ## Public v1 Endpoints | Method | Endpoint | Description | | ------ | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `POST` | `/v1/benchmark-runs` | Create a run. Body: `{ "benchmark": "slug@version", "scored": boolean }`. Returns bearer token, task-run URLs, and sandbox endpoint paths | | `GET` | `/v1/benchmark-runs/{id}` | Get run summary (requires the run's bearer token) | ## Benchmark Run Object | Field | Type | Description | | -------------- | ---------------- | ------------------------------------------------------------------------- | | `id` | string | Unique identifier | | `benchmark_id` | string | Parent [Benchmark](/api-reference/resources/benchmarks) | | `status` | string | `active`, `completed`, `cancelled`, `failed` | | `phase` | string | `created`, `started`, `completed` | | `scored` | boolean | `true` if evidence is withheld from the agent during completion responses | | `verdict` | string \| null | `pass`, `partial`, `fail` | | `score` | number \| null | Aggregate score (mean of task scores) | | `agent` | string \| null | Optional agent identifier | | `started_at` | datetime \| null | | | `completed_at` | datetime \| null | | ## v1 Create Response `POST /v1/benchmark-runs` returns everything the agent needs to drive the rollouts: ```json theme={null} { "benchmark_run_id": "br_abc123", "benchmark": { "slug": "fax-referral", "version": "1", "name": "Fax referral intake" }, "scored": false, "phase": "created", "bearer_token": "vrl_run_...", "bearer_token_expires_at": "2026-04-21T17:00:00.000Z", "endpoints": { "files_inbox": "/v1/benchmark-runs/br_abc123/files/inbox", "hl7_outbound": "/v1/benchmark-runs/br_abc123/hl7/outbound" }, "task_runs": [ { "id": "tr_1", "task_id": "task_1", "name": "Process referral #1", "phase": "created", "start_url": "/v1/task-runs/tr_1/start", "complete_url": "/v1/task-runs/tr_1/complete" } ] } ``` Use the `bearer_token` to authenticate calls to all `/v1/task-runs/*` and `/v1/benchmark-runs/{id}/*` protocol endpoints (FHIR proxy, HL7, files, portal). ## Internal SDK Example ```typescript theme={null} const run = await verial.benchmarkRuns.create({ benchmarkId: "bench_abc123" }); const detail = await verial.benchmarkRuns.get({ id: run.id }); console.log(detail.score, detail.verdict); ``` # Sandboxes Source: https://docs.verial.ai/api-reference/resources/sandboxes Running simulator instances with credentials and event logs. Sandboxes are running instances of a [Simulator](/api-reference/resources/simulators). Each sandbox provides live credentials (FHIR endpoints, phone numbers, fax numbers, SFTP paths, portal URLs) and records all interactions as events. Sandboxes can be created standalone or as part of a [Playground](/api-reference/resources/playgrounds). After a task rollout, sandbox state is the input the [verification engine](/guides/concepts/verification) scores against. ## Endpoints | Method | Endpoint | Description | | -------- | -------------------------------------- | --------------------------------- | | `GET` | `/sandboxes` | List sandboxes | | `POST` | `/sandboxes` | Create a sandbox | | `GET` | `/sandboxes/{id}` | Get sandbox details | | `GET` | `/sandboxes/{id}/events` | List sandbox events | | `POST` | `/sandboxes/{id}/teardown` | Tear down a sandbox | | `POST` | `/sandboxes/{id}/datasets/{datasetId}` | Add a dataset to the sandbox | | `DELETE` | `/sandboxes/{id}/datasets/{datasetId}` | Remove a dataset from the sandbox | ## Sandbox Object | Field | Type | Description | | ----------------- | -------------- | ---------------------------------------------------------------------------------------------------------- | | `id` | string | Unique identifier | | `simulator_id` | string | Source [Simulator](/api-reference/resources/simulators) | | `playground_id` | string \| null | Parent [Playground](/api-reference/resources/playgrounds), if part of one | | `status` | string | Current status (provisioning, active, teardown, etc.) | | `credentials` | object \| null | Protocol-specific access credentials. See [Credentials by Simulator Type](#credentials-by-simulator-type). | | `organization_id` | string | Parent organization | | `created_at` | datetime | Creation timestamp | | `updated_at` | datetime | Last modification timestamp | ## Credentials by Simulator Type The `credentials` object is shaped by the source simulator's `type`. Typical shapes: ### Payer (Web Simulator) Returned when the simulator's `config.portal` is set (see the [Web Portal](/guides/simulators/web-portal) catalog). | Field | Type | Description | | ------------ | ------ | ----------------------------------------------------------------------------------------- | | `portal_url` | string | URL for a browser agent to navigate to (e.g. `https://radmd.sim.verial.ai`) | | `username` | string | Auto-generated login username, scoped to this sandbox | | `password` | string | Auto-generated login password, scoped to this sandbox | | `api_url` | string | REST base URL for the backing payer endpoints (`/prior-auths`, `/patients`, `/providers`) | ```json theme={null} { "portal_url": "https://radmd.sim.verial.ai", "username": "provider_a1b2c3", "password": "Kq7!mZxP9vRnT2wL", "api_url": "https://api.verial.ai/sandboxes/sbx_01H.../web-sim/payer" } ``` ### FHIR | Field | Type | Description | | --------------- | ------ | ---------------------------- | | `fhir_base_url` | string | FHIR R4 base URL | | `token_url` | string | SMART on FHIR token endpoint | | `client_id` | string | OAuth2 client ID | | `client_secret` | string | OAuth2 client secret | ### Voice | Field | Type | Description | | -------------- | ------ | -------------------- | | `phone_number` | string | E.164 number to call | ### HL7 | Field | Type | Description | | -------------- | ------ | ----------------------------- | | `inbox_url` | string | URL to GET inbound messages | | `outbound_url` | string | URL to POST outbound messages | Other simulator types follow the same pattern: connection details needed to read from and write to the live instance. ## SDK Example ```typescript theme={null} // Create a standalone sandbox const sandbox = await verial.sandboxes.create({ simulatorId: 'sim_abc123', }) // List sandboxes (optionally filter by playground) const sandboxes = await verial.sandboxes.list({ playgroundId: 'pg_abc123' }) // Get sandbox details (includes credentials) const details = await verial.sandboxes.get({ id: sandbox.id }) // List interaction events const events = await verial.sandboxes.listEvents({ id: sandbox.id }) // Load a dataset await verial.sandboxes.addDataset({ sandboxId: sandbox.id, datasetId: 'ds_abc123', }) // Remove a dataset await verial.sandboxes.removeDataset({ sandboxId: sandbox.id, datasetId: 'ds_abc123', }) // Tear down when done await verial.sandboxes.teardown({ id: sandbox.id }) ``` # Simulators Source: https://docs.verial.ai/api-reference/resources/simulators Reusable simulator definitions for healthcare interfaces. Simulators are reusable definitions for healthcare interface endpoints. Each simulator has a type (FHIR, HL7, Voice, Fax, Payer, Clearinghouse, CDSHooks, Message, Portal, SFTP, X12) and optional configuration. Link simulators to [Environments](/api-reference/resources/environments) to compose a simulated health system that tasks run rollouts against. ## Endpoints | Method | Endpoint | Description | | -------- | ------------------ | --------------------- | | `GET` | `/simulators` | List simulators | | `POST` | `/simulators` | Create a simulator | | `GET` | `/simulators/{id}` | Get simulator details | | `PATCH` | `/simulators/{id}` | Update a simulator | | `DELETE` | `/simulators/{id}` | Delete a simulator | ## Simulator Object | Field | Type | Description | | ----------------- | -------------- | ------------------------------------------------------------------------------- | | `id` | string | Unique identifier | | `type` | SimulatorType | Simulator type (Fhir, Hl7, Voice, Fax, Payer, Clearinghouse, CdsHooks, Message) | | `name` | string | Simulator name | | `description` | string \| null | Optional description | | `config` | object \| null | Type-specific configuration | | `slug` | string | URL-friendly identifier | | `organization_id` | string | Parent organization | | `created_at` | datetime | Creation timestamp | | `updated_at` | datetime | Last modification timestamp | ## SDK Example ```typescript theme={null} // Create a FHIR simulator const sim = await verial.simulators.create({ type: 'Fhir', name: 'Epic EHR', }) // List simulators (optionally filter by environment) const simulators = await verial.simulators.list({ environmentId: 'env_abc123' }) // Get a specific simulator const details = await verial.simulators.get({ id: sim.id }) // Update configuration await verial.simulators.update({ id: sim.id, config: { ehrVendor: 'epic' }, }) // Generate config from a prompt await verial.simulators.generateConfig({ id: sim.id, prompt: 'A primary care clinic in San Francisco', }) // Generate synthetic data await verial.simulators.generateData({ id: sim.id }) // Delete await verial.simulators.delete({ id: sim.id }) ``` # Task Runs Source: https://docs.verial.ai/api-reference/resources/task-runs Task-level results within a benchmark run. Task Runs represent the outcome of a single [Task](/api-reference/resources/tasks) within a [Benchmark Run](/api-reference/resources/runs). Each task run is executed in its own [Playground](/api-reference/resources/playgrounds). When completed, the verification engine produces one [Criterion Run](/api-reference/resources/criterion-runs) per task [Criterion](/api-reference/resources/criteria). There are two completion paths depending on how the benchmark run was created: * **Internal (`POST /task-runs/{id}/complete`)**: used by Verial tooling and workers. * **Public v1 (`POST /v1/task-runs/{id}/complete`)**: used by external agents driving a submission. This is the path an external developer uses; see the [Quick Start](/guides/quickstart). ## Endpoints | Method | Endpoint | Description | | ------ | ------------------------------------------------ | ------------------------------------------------------------ | | `GET` | `/task-runs?benchmark_run_id={benchmark_run_id}` | List task runs for a benchmark run | | `GET` | `/task-runs/{id}` | Get task run details (includes `criterion_runs` array) | | `POST` | `/task-runs/{id}/complete` | Mark a task run complete (internal) | | `POST` | `/task-runs/{id}/cancel` | Cancel a task run | | `POST` | `/v1/task-runs/{id}/start` | (Public v1) Mark a task run started | | `POST` | `/v1/task-runs/{id}/complete` | (Public v1) Mark complete, runs verification, returns checks | ## Task Run Object | Field | Type | Description | | ------------------ | ---------------- | --------------------------------------------------------------------- | | `id` | string | Unique identifier | | `benchmark_run_id` | string | Parent [Benchmark Run](/api-reference/resources/runs) | | `task_id` | string | Source [Task](/api-reference/resources/tasks) | | `playground_id` | string | [Playground](/api-reference/resources/playgrounds) used for execution | | `status` | string | `active`, `completed`, `cancelled`, `failed`, `timed_out` | | `phase` | string | `created`, `started`, `completed` | | `verdict` | string \| null | `pass`, `partial`, `fail`. Set on completion | | `score` | number \| null | Weighted task score (0 to 1). Set on completion | | `snapshot` | object \| null | Frozen copy of the task at execution time | | `started_at` | datetime \| null | When execution started | | `completed_at` | datetime \| null | When execution finished | The `GET /task-runs/{id}` response includes a `criterion_runs` array. See [Criterion Runs](/api-reference/resources/criterion-runs). ## v1 Completion Response `POST /v1/task-runs/{id}/complete` runs verification synchronously and returns: ```json theme={null} { "task_run_id": "tr_abc123", "phase": "completed", "verdict": "partial", "score": 0.66, "axes": { "correctness": { "score": 1.0, "weight": 2 }, "safety": { "score": 0.0, "weight": 1 } }, "checks": [ { "criterion_id": "crit_01H...", "label": "Appointment booked with correct provider", "result": "pass", "score": 1.0, "axis": "correctness", "details": "Appointment resource matched; all field assertions passed.", "field_results": [ { "path": "participant.0.actor.display", "expected": "Dr. Rivera", "actual": "Dr. Rivera", "passed": true } ] } ] } ``` When the benchmark run was created with `scored: true`, the `details` and field-level evidence are omitted from this response to avoid leaking the scoring rubric. You can still fetch full evidence later via `GET /criterion-runs/{id}`. ## SDK Example ```typescript theme={null} // List task runs for a benchmark run const taskRuns = await verial.taskRuns.list({ benchmarkRunId: "br_abc123" }); // Get a task run with its criterion runs const detail = await verial.taskRuns.get({ id: taskRuns.data[0].id }); for (const run of detail.criterionRuns) { console.log(`${run.criterionId}: ${run.passed ? "PASS" : "FAIL"} (${run.score})`); } ``` # Tasks Source: https://docs.verial.ai/api-reference/resources/tasks Individual test cases within benchmarks. Tasks are individual test cases within a [Benchmark](/api-reference/resources/benchmarks). Each task references a set of [Criteria](/api-reference/resources/criteria) that the verification engine runs after the rollout to score the task. ## Endpoints | Method | Endpoint | Description | | -------- | ------------------------------------ | -------------------------------------------- | | `GET` | `/tasks?benchmark_id={benchmark_id}` | List tasks for a benchmark | | `POST` | `/tasks` | Create a task | | `GET` | `/tasks/{id}` | Get task details (includes `criteria` array) | | `PATCH` | `/tasks/{id}` | Update a task | | `DELETE` | `/tasks/{id}` | Delete a task | | `GET` | `/tasks/{id}/entities` | List DatasetEntities bound to the task | | `POST` | `/tasks/{id}/entities` | Bind a DatasetEntity to the task | | `DELETE` | `/tasks/{id}/entities/{entityId}` | Unbind a DatasetEntity | ## Task Object | Field | Type | Description | | -------------- | -------------- | --------------------------------------------------------------------------- | | `id` | string | Unique identifier | | `benchmark_id` | string | Parent [Benchmark](/api-reference/resources/benchmarks) | | `name` | string | Task name | | `timeout` | number \| null | Task-level timeout override in seconds | | `tags` | string\[] | Tags for filtering | | `task_item` | object \| null | Structured task payload (for example instruction, trigger, expected inputs) | | `scenario` | object \| null | Optional pre-rollout scenario steps run by the scenario runner | | `created_at` | datetime | Creation timestamp | The `GET /tasks/{id}` response also returns a `criteria` array. Each entry has `id`, `task_id`, `label`, `assertion`, `weight`, and `created_at`. See [Criteria](/api-reference/resources/criteria) for the `assertion` shape. ## SDK Example ```typescript theme={null} // Create a task const task = await verial.tasks.create({ benchmarkId: "bench_abc123", name: "Submit Prior Auth for MRI", taskItem: { instruction: "Submit a prior authorization for an MRI of the lumbar spine", }, tags: ["prior-auth", "imaging"], }); // Attach criteria (see Criteria resource) await verial.criteria.create({ taskId: task.id, label: "Prior auth submitted", weight: 1.0, assertion: { assert: "portal-state-match", correlate_by: { resource: "prior_auth_requests", key: "request_id" }, assertions: [{ path: "status", expected: "submitted" }], }, }); // List tasks for a benchmark const tasks = await verial.tasks.list({ benchmarkId: "bench_abc123" }); // Get a specific task with its criteria const details = await verial.tasks.get({ id: task.id }); ``` # Create run Source: https://docs.verial.ai/api-reference/runs/create POST /runs Execute a benchmark and produce a run. Start a new run of a benchmark. Each task in the benchmark is executed against the configured environment, and the verification engine scores results against each task's criteria. # Get run Source: https://docs.verial.ai/api-reference/runs/get GET /runs/{run_id} Retrieve details for a specific run. Returns the full run, including per-task results, verdict, and aggregated score. # List runs Source: https://docs.verial.ai/api-reference/runs/list GET /runs Retrieve runs in your organization. Returns a list of runs, including status, verdict, and summary scores. # Update run Source: https://docs.verial.ai/api-reference/runs/update PATCH /runs/{run_id} Update run metadata. Update the status, verdict, or notes on a run. # verial auth Source: https://docs.verial.ai/cli/auth Manage CLI authentication with your organization API key. The `verial auth` commands store and inspect the organization API key used for every CLI call. The key is read from `VERIAL_API_KEY` first, then from `~/.verial/config.json`. Commands requiring auth fail with a helpful message if no key is configured. Solver keys (`vrl_slv_*`) use a separate auth path for running published benchmarks and are not managed by the CLI. See [Solver keys](/guides/solver-keys). ## Subcommands | Command | Description | | --------------------------- | ----------------------------------------------------------------- | | `verial auth set-key ` | Store an API key in `~/.verial/config.json`. | | `verial auth status` | Check whether an API key is configured and show a masked preview. | ## verial auth set-key Store an organization API key on disk so subsequent commands authenticate without `VERIAL_API_KEY` or `--api-key`. Synopsis: ```bash theme={null} verial auth set-key ``` Arguments: | Argument | Description | Required | | -------- | ----------------------------------------- | -------- | | `` | Organization API key (starts with `vk_`). | Yes | Example: ```bash theme={null} verial auth set-key vk_live_abc123def456 ``` ``` API key saved. ``` The key is written to `~/.verial/config.json` under the `api-key` field. `VERIAL_API_KEY` still takes precedence when both are set. ## verial auth status Report whether an API key is configured. Exits 0 if configured, 1 otherwise. Synopsis: ```bash theme={null} verial auth status ``` Example: ```bash theme={null} verial auth status ``` ``` Authenticated (key: vk_live_...f456) ``` If no key is found: ``` No API key configured. Run: verial auth set-key ``` ## Key precedence Keys are resolved in this order: 1. `--api-key ` flag on the command. 2. `VERIAL_API_KEY` environment variable. 3. `api-key` field in `~/.verial/config.json` (written by `verial auth set-key`). ## Next Steps API key scopes, rotation, and Solver keys. Persistent CLI configuration including `api-key` and `base-url`. # verial benchmark-runs Source: https://docs.verial.ai/cli/benchmark-runs Start, inspect, and wait on benchmark runs from the command line. The `verial benchmark-runs` commands manage [Benchmark Runs](/api-reference/resources/runs) — a single execution of a benchmark that produces a verdict, score, and per-task results. Use them to launch runs from CI and block on completion. Authentication is required. See [verial auth](/cli/auth). ## Subcommands | Command | Description | | ------------------------------ | -------------------------------------------------------------- | | `verial benchmark-runs list` | List recent benchmark runs in your organization. | | `verial benchmark-runs create` | Start a new benchmark run. | | `verial benchmark-runs get` | Get a single benchmark run by ID. | | `verial benchmark-runs wait` | Poll a run until it completes, then exit based on its verdict. | ## verial benchmark-runs list List benchmark runs visible to your organization. Synopsis: ```bash theme={null} verial benchmark-runs list ``` Example: ```bash theme={null} verial benchmark-runs list ``` ``` ID STATUS VERDICT SCORE CREATED run_cm456001 completed pass 0.917 4/22/2026, 3:41:08 PM run_cm456002 completed fail 0.650 4/22/2026, 3:42:11 PM run_cm456003 active — — 4/23/2026, 9:18:44 AM ``` REST equivalent: [GET /runs](/api-reference/runs/list). ## verial benchmark-runs create Start a new run of a benchmark. The run executes asynchronously; use `verial benchmark-runs wait` to block on completion. Synopsis: ```bash theme={null} verial benchmark-runs create --benchmark-id [--environment-id ] ``` Options: | Flag | Description | Required | | ----------------------- | -------------------------------------------------- | -------- | | `--benchmark-id ` | Benchmark to execute. | Yes | | `--environment-id ` | Override the environment the benchmark references. | No | Example: ```bash theme={null} verial benchmark-runs create \ --benchmark-id bench_cly987 \ --environment-id env_clxyz123 ``` REST equivalent: [POST /runs](/api-reference/runs/create). ## verial benchmark-runs get Fetch a single benchmark run, including status, verdict, score, and task-level summaries. Synopsis: ```bash theme={null} verial benchmark-runs get --id ``` Example: ```bash theme={null} verial benchmark-runs get --id run_cm456001 ``` ``` id run_cm456001 status completed verdict pass score 0.917 createdAt 4/22/2026, 3:41:08 PM ``` REST equivalent: [GET /runs/:id](/api-reference/runs/get). ## verial benchmark-runs wait Poll a run until it leaves the `active` state, then exit 0 on `pass` or 1 otherwise. Exits with an error if the run does not complete within `--timeout`. Pair with `--json` in CI to capture the final run object. Synopsis: ```bash theme={null} verial benchmark-runs wait --id [--interval ] [--timeout ] ``` Options: | Flag | Description | Default | | ---------------------- | ------------------ | -------- | | `--id ` | Run ID to wait on. | Required | | `--interval ` | Polling interval. | `5` | | `--timeout ` | Maximum wait time. | `600` | Example: ```bash theme={null} verial benchmark-runs wait --id run_cm456001 --interval 10 --timeout 900 ``` Exit codes: | Code | Meaning | | ---- | -------------------------------------------------------------------- | | `0` | Run completed with verdict `pass`. | | `1` | Run completed with a non-pass verdict, or the API returned an error. | | `2` | CLI error (timeout, invalid flags, unreachable API). | ## CI example ```bash theme={null} RUN=$(verial benchmark-runs create \ --benchmark-id "$BENCHMARK_ID" \ --environment-id "$ENV_ID" \ --json | jq -r '.id') verial benchmark-runs wait --id "$RUN" --timeout 1800 --json > run.json ``` ## Next Steps Run model, statuses, and verdict semantics. Full REST parameters and response schema. # verial benchmarks Source: https://docs.verial.ai/cli/benchmarks Create and manage benchmarks from the command line. The `verial benchmarks` commands manage [Benchmarks](/api-reference/resources/benchmarks) — ordered groups of tasks that reference an environment and are evaluated against criteria. Use them to script benchmark definitions alongside your agent code. Authentication is required. See [verial auth](/cli/auth). ## Subcommands | Command | Description | | -------------------------- | ---------------------------------------- | | `verial benchmarks list` | List benchmarks in your organization. | | `verial benchmarks create` | Create a new benchmark. | | `verial benchmarks get` | Get a single benchmark by ID. | | `verial benchmarks update` | Update benchmark metadata or run limits. | | `verial benchmarks delete` | Delete a benchmark. | ## verial benchmarks list List benchmarks visible to your organization. Synopsis: ```bash theme={null} verial benchmarks list ``` Example: ```bash theme={null} verial benchmarks list ``` ``` ID NAME CREATED bench_cly987 Prior Auth Workflow 4/1/2026, 1:15:42 PM bench_cly988 Appointment Scheduling 4/3/2026, 10:08:19 AM ``` REST equivalent: [GET /benchmarks](/api-reference/benchmarks/list). ## verial benchmarks create Create a benchmark. Tasks and criteria are attached through the REST API or dashboard after creation. Synopsis: ```bash theme={null} verial benchmarks create --name \ [--description ] \ [--timeout ] \ [--concurrency ] ``` Options: | Flag | Description | Default | | ---------------------- | ------------------------------------------ | -------- | | `--name ` | Benchmark name. | Required | | `--description ` | Free-text description. | — | | `--timeout ` | Per-task timeout in seconds. | `300` | | `--concurrency ` | Max tasks to run in parallel during a run. | `1` | Example: ```bash theme={null} verial benchmarks create \ --name "Prior Auth Workflow" \ --description "End-to-end PA submission across fax + payer portal" \ --timeout 600 \ --concurrency 4 ``` REST equivalent: [POST /benchmarks](/api-reference/benchmarks/create). ## verial benchmarks get Fetch a single benchmark, including tasks and criteria. Synopsis: ```bash theme={null} verial benchmarks get --id ``` Example: ```bash theme={null} verial benchmarks get --id bench_cly987 ``` REST equivalent: [GET /benchmarks/:id](/api-reference/benchmarks/get). ## verial benchmarks update Update benchmark metadata or run limits. Omitted fields are left unchanged. Synopsis: ```bash theme={null} verial benchmarks update --id \ [--name ] \ [--description ] \ [--timeout ] \ [--concurrency ] ``` Example: ```bash theme={null} verial benchmarks update --id bench_cly987 --concurrency 8 ``` REST equivalent: [PATCH /benchmarks/:id](/api-reference/benchmarks/update). ## verial benchmarks delete Delete a benchmark. Previously completed runs are retained. Synopsis: ```bash theme={null} verial benchmarks delete --id ``` ``` Deleted bench_cly987 ``` REST equivalent: [DELETE /benchmarks/:id](/api-reference/benchmarks/delete). ## Next Steps Benchmark model, tasks, and criteria. Full REST parameters and response schema. # verial config Source: https://docs.verial.ai/cli/config View and update persistent CLI configuration. The `verial config` commands read and write the CLI config file at `~/.verial/config.json`. Values set here apply to every invocation on this machine and can be overridden per-command via environment variables or flags. The config file uses kebab-case keys: | Key | Type | Purpose | | --------------- | ------- | ---------------------------------------------------------------------------------- | | `api-key` | string | Organization API key. Overridden by `VERIAL_API_KEY` and `--api-key`. | | `base-url` | string | API base URL. Defaults to `https://api.verial.ai`. Overridden by `VERIAL_API_URL`. | | `default-limit` | number | Default `--limit` for `list` commands. | | `output-json` | boolean | If `true`, always emit JSON. Equivalent to passing `--json` on every call. | ## Subcommands | Command | Description | | ------------------- | ----------------------------- | | `verial config get` | Show the current config file. | | `verial config set` | Set a single config key. | The `api-key` field is typically managed through [`verial auth set-key`](/cli/auth), but `verial config set` writes the same file. ## verial config get Print the current contents of `~/.verial/config.json`. Returns `{}` if no config has been written. Synopsis: ```bash theme={null} verial config get ``` Example: ```bash theme={null} verial config get ``` ``` api-key vk_live_abc123def456 base-url https://api.verial.ai default-limit 25 output-json false ``` Pair with `--json` for machine-readable output: ```bash theme={null} verial config get --json ``` ```json theme={null} { "api-key": "vk_live_abc123def456", "base-url": "https://api.verial.ai", "default-limit": 25, "output-json": false } ``` ## verial config set Write a single key/value pair to the config file. The value is parsed according to the key's type (`default-limit` is parsed as an integer, `output-json` as a boolean). Synopsis: ```bash theme={null} verial config set --key --value ``` Options: | Flag | Description | Required | | ----------------- | ------------------------------------------------------------- | -------- | | `--key ` | One of `api-key`, `base-url`, `default-limit`, `output-json`. | Yes | | `--value ` | Value to store. Type-parsed based on `--key`. | Yes | Examples: ```bash theme={null} verial config set --key base-url --value https://api.staging.verial.ai verial config set --key default-limit --value 50 verial config set --key output-json --value true ``` Unknown keys fail fast: ```bash theme={null} verial config set --key whatever --value 1 ``` ``` Unknown config key: whatever. Allowed: api-key, base-url, default-limit, output-json ``` ## Precedence For each value, the CLI resolves in this order: 1. Command-line flag (e.g., `--api-key`, `--limit`, `--json`). 2. Environment variable (`VERIAL_API_KEY`, `VERIAL_API_URL`). 3. Config file at `~/.verial/config.json`. 4. Hard-coded default (for `base-url`, `https://api.verial.ai`). ## Next Steps API key storage and inspection. Install the CLI and verify connectivity. # verial datasets Source: https://docs.verial.ai/cli/datasets Manage datasets that back simulators in your environments. The `verial datasets` commands manage [Datasets](/api-reference/resources/datasets) — typed data containers (FHIR bundles, file manifests, SFTP drops, HL7 messages) that back simulators. Use them to script dataset lifecycle in CI or before attaching data to an environment. Authentication is required. See [verial auth](/cli/auth). ## Subcommands | Command | Description | | ------------------------ | --------------------------------------- | | `verial datasets list` | List datasets in your organization. | | `verial datasets create` | Create a dataset of a given type. | | `verial datasets get` | Get a single dataset by ID. | | `verial datasets update` | Update a dataset's name or description. | | `verial datasets delete` | Delete a dataset. | ## verial datasets list List datasets visible to your organization. Synopsis: ```bash theme={null} verial datasets list ``` Example: ```bash theme={null} verial datasets list ``` ``` ID NAME TYPE CREATED ds_clxyz001 Primary Care FHIR FHIR 4/10/2026, 9:02:11 AM ds_clxyz002 Referral Fax Files Files 4/12/2026, 11:47:30 AM ``` REST equivalent: [GET /datasets](/api-reference/datasets/list). ## verial datasets create Create a typed dataset. The `--type` value determines how contents are stored and which simulators can consume it. Synopsis: ```bash theme={null} verial datasets create --name --type [--description ] ``` Options: | Flag | Description | Required | | ---------------------- | -------------------------------------- | -------- | | `--name ` | Dataset name. | Yes | | `--type ` | One of `FHIR`, `Files`, `Sftp`, `HL7`. | Yes | | `--description ` | Free-text description. | No | Example: ```bash theme={null} verial datasets create \ --name "Primary Care FHIR" \ --type FHIR \ --description "Seed bundle for primary care scenarios" ``` REST equivalent: [POST /datasets](/api-reference/datasets/create). ## verial datasets get Fetch a single dataset, including its config and (where applicable) file manifest. Synopsis: ```bash theme={null} verial datasets get --id ``` Example: ```bash theme={null} verial datasets get --id ds_clxyz001 ``` REST equivalent: [GET /datasets/:id](/api-reference/datasets/get). ## verial datasets update Rename or redescribe a dataset. Contents are mutated through type-specific endpoints, not this command. Synopsis: ```bash theme={null} verial datasets update --id [--name ] [--description ] ``` Example: ```bash theme={null} verial datasets update --id ds_clxyz001 --name "Primary Care FHIR (v2)" ``` REST equivalent: [PATCH /datasets/:id](/api-reference/datasets/update). ## verial datasets delete Delete a dataset. Sandboxes that branched from it retain their child datasets. Synopsis: ```bash theme={null} verial datasets delete --id ``` ``` Deleted ds_clxyz001 ``` REST equivalent: [DELETE /datasets/:id](/api-reference/datasets/delete). ## Next Steps Dataset types, config shape, and sandbox branching. Full REST parameters and response schema. # verial environments Source: https://docs.verial.ai/cli/environments Create, inspect, and instantiate environments from the command line. The `verial environments` commands manage [Environments](/api-reference/resources/environments) — reusable simulated health system definitions that contain simulators (FHIR, voice, patient, HL7, X12, fax). Use them to script environment setup in CI or to spin up a [Playground](/api-reference/resources/playgrounds) ahead of a benchmark run. Authentication is required. See [verial auth](/cli/auth). ## Subcommands | Command | Description | | --------------------------------------- | ------------------------------------------------ | | `verial environments list` | List environments in your organization. | | `verial environments create` | Create a new environment. | | `verial environments get` | Get a single environment by ID. | | `verial environments update` | Update an environment's name or description. | | `verial environments delete` | Delete an environment. | | `verial environments create-playground` | Instantiate an environment as a live playground. | ## verial environments list List environments visible to your organization. Supports cursor pagination. Synopsis: ```bash theme={null} verial environments list [--cursor ] [--limit ] ``` Options: | Flag | Description | Default | | ------------------- | --------------------------------------------- | -------------- | | `--cursor ` | Pagination cursor returned from a prior page. | — | | `--limit ` | Items per page. | Server default | Example: ```bash theme={null} verial environments list --limit 10 ``` ``` ID NAME CREATED env_clxyz123 Primary Care Clinic 4/15/2026, 10:12:04 AM env_clxyz456 Cardiology Practice 4/20/2026, 2:31:18 PM ``` REST equivalent: [GET /environments](/api-reference/environments/list). ## verial environments create Create an empty environment. Add simulators through the REST API or dashboard after creation. Synopsis: ```bash theme={null} verial environments create --name [--description ] ``` Options: | Flag | Description | Required | | ---------------------- | ---------------------- | -------- | | `--name ` | Environment name. | Yes | | `--description ` | Free-text description. | No | Example: ```bash theme={null} verial environments create --name "Cardiology Practice" --description "Ambulatory cardiology clinic" ``` REST equivalent: [POST /environments](/api-reference/environments/create). ## verial environments get Fetch a single environment, including its simulators. Synopsis: ```bash theme={null} verial environments get --id ``` Example: ```bash theme={null} verial environments get --id env_clxyz123 ``` REST equivalent: [GET /environments/:id](/api-reference/environments/get). ## verial environments update Update an environment's name or description. Omitted fields are left unchanged. Synopsis: ```bash theme={null} verial environments update --id [--name ] [--description ] ``` Example: ```bash theme={null} verial environments update --id env_clxyz123 --name "Primary Care - West" ``` REST equivalent: [PATCH /environments/:id](/api-reference/environments/update). ## verial environments delete Delete an environment. Playgrounds already provisioned from it are not torn down. Synopsis: ```bash theme={null} verial environments delete --id ``` ``` Deleted env_clxyz123 ``` REST equivalent: [DELETE /environments/:id](/api-reference/environments/delete). ## verial environments create-playground Provision a [Playground](/api-reference/resources/playgrounds) from an environment: create the FHIR store, lease phone numbers, and load seed data. Synopsis: ```bash theme={null} verial environments create-playground --id ``` Example: ```bash theme={null} verial environments create-playground --id env_clxyz123 ``` ## Next Steps Environment model and simulator types. Full REST parameters and response schema. # Installation Source: https://docs.verial.ai/cli/installation Install the Verial CLI via npm or npx. The Verial CLI ships with the [`@verial-ai/sdk`](/sdk/installation) npm package. Install it globally, install per-project, or run on demand via `npx`. ## Global install ```bash theme={null} npm install -g @verial-ai/sdk ``` After installation, the `verial` binary is on your PATH: ```bash theme={null} verial --version ``` ## Per-project install ```bash theme={null} npm install @verial-ai/sdk ``` Run via `npx`: ```bash theme={null} npx verial --version ``` ## Run without installing ```bash theme={null} npx --yes @verial-ai/sdk --version ``` ## Authenticate Set your organization API key as an environment variable: ```bash theme={null} export VERIAL_API_KEY=vk_xxx ``` Or pass `--api-key` on every invocation: ```bash theme={null} verial --api-key vk_xxx ``` See [Authentication](/cli/auth) for key creation, rotation, and Solver key handling. ## Verify ```bash theme={null} verial environments list ``` If the CLI can reach the API with your key, this returns a list of environments (or an empty list for a fresh organization). ## Next Steps Command surface and output modes. API key and Solver key flows. # Overview Source: https://docs.verial.ai/cli/overview Command-line interface for running benchmarks and managing resources. The Verial CLI provides command-line access to the platform. Run benchmarks, check results, and manage environments directly from your terminal or CI/CD pipeline. ## Installation The CLI is included with the SDK: ```bash theme={null} npm install -g @verial-ai/sdk ``` Or use it via `npx` without installing globally: ```bash theme={null} npx @verial-ai/sdk ``` ## Authentication Set your API key as an environment variable: ```bash theme={null} export VERIAL_API_KEY=vk_xxx ``` Or pass it directly: ```bash theme={null} verial --api-key vk_xxx ``` ## Commands ### `verial run` Execute a benchmark and wait for results: ```bash theme={null} verial run --benchmark bench_clxyz456 --environment env_clxyz123 ``` Options: | Flag | Description | | --------------------- | ---------------------------------- | | `--benchmark`, `-b` | Benchmark ID (required) | | `--environment`, `-e` | Environment ID | | `--timeout` | Override timeout in seconds | | `--json` | Output results as JSON | | `--no-wait` | Start run and exit without waiting | Example output: ``` Starting run for benchmark "Prior Auth Workflow"... Run ID: run_clxyz789 Task 1/3: Submit Prior Auth PASS: Prior auth request submitted to payer (weight: 1.0) PASS: Correct CPT code 72148 included (weight: 0.5) FAIL: Supporting documentation faxed (weight: 0.5) Score: 0.75 Task 2/3: Check Auth Status PASS: Status retrieved within 30s (weight: 1.0) Score: 1.0 Task 3/3: Handle Denial PASS: Appeal initiated (weight: 1.0) Score: 1.0 Run completed. Score: 0.917 | Verdict: PASS ``` ### `verial environments list` List environments in your organization: ```bash theme={null} verial environments list ``` ``` ID NAME CREATED env_clxyz123 Primary Care Clinic 2026-03-15 env_clxyz456 Cardiology Practice 2026-03-20 ``` ### `verial environments get` Get environment details: ```bash theme={null} verial environments get env_clxyz123 ``` ### `verial benchmarks list` List benchmarks: ```bash theme={null} verial benchmarks list ``` ### `verial benchmarks get` Get benchmark details including tasks and criteria: ```bash theme={null} verial benchmarks get bench_clxyz456 ``` ### `verial runs list` List recent runs: ```bash theme={null} verial runs list ``` ``` ID BENCHMARK SCORE VERDICT CREATED run_clxyz789 Prior Auth Workflow 0.917 pass 2026-04-01 run_clxyz790 Appointment Scheduling 0.650 fail 2026-03-31 ``` ### `verial runs get` Get run details with task-level results: ```bash theme={null} verial runs get run_clxyz789 ``` ### `verial simulators` Manage [simulators](/cli/simulators) (FHIR, Voice, Payer portal, HL7, Fax, SFTP, etc.) inside your environments: ```bash theme={null} verial simulators list verial simulators create --type Payer --name "CoverMyMeds" --config '{"portal":"covermymeds"}' ``` ### `verial playgrounds` Instantiate an environment as a live [playground](/cli/playgrounds) with provisioned infrastructure: ```bash theme={null} verial playgrounds create --environment-id env_clxyz123 verial playgrounds teardown --id pg_clxyz456 ``` ### `verial sandboxes` Provision a single-simulator [sandbox](/cli/sandboxes) with live credentials (e.g. `portal_url`, FHIR base URL): ```bash theme={null} verial sandboxes create --simulator-id sim_clxyz789 --dataset-id ds_clxyz001 verial sandboxes events --id sbx_clxyz123 ``` ## JSON Output All commands support `--json` for machine-readable output: ```bash theme={null} verial runs get run_clxyz789 --json | jq '.score' ``` ## CI/CD Usage Use the CLI in your CI/CD pipeline to gate deployments on benchmark results: ```yaml theme={null} # GitHub Actions example - name: Run benchmarks env: VERIAL_API_KEY: ${{ secrets.VERIAL_API_KEY }} run: | npx @verial-ai/sdk run \ --benchmark $BENCHMARK_ID \ --environment $ENVIRONMENT_ID \ --json > results.json VERDICT=$(jq -r '.verdict' results.json) if [ "$VERDICT" != "pass" ]; then echo "Benchmark failed with score $(jq '.score' results.json)" exit 1 fi ``` # verial playgrounds Source: https://docs.verial.ai/cli/playgrounds Instantiate and tear down playgrounds from the command line. The `verial playgrounds` commands manage [Playgrounds](/api-reference/resources/playgrounds) — instantiated environments with live infrastructure (FHIR store provisioned, phone numbers leased, seed data loaded). Use them to spin up an environment on demand for interactive testing or CI runs. Authentication is required. See [verial auth](/cli/auth). ## Subcommands | Command | Description | | ----------------------------- | ------------------------------------------------- | | `verial playgrounds list` | List playgrounds in your organization. | | `verial playgrounds create` | Instantiate an environment as a playground. | | `verial playgrounds get` | Get a single playground by ID. | | `verial playgrounds teardown` | Tear down a playground and release its resources. | ## verial playgrounds list List playgrounds visible to your organization. Supports cursor pagination. Synopsis: ```bash theme={null} verial playgrounds list [--cursor ] [--limit ] ``` Options: | Flag | Description | Default | | ------------------- | --------------------------------------------- | -------------- | | `--cursor ` | Pagination cursor returned from a prior page. | — | | `--limit ` | Items per page. | Server default | REST equivalent: [GET /playgrounds](/api-reference/resources/playgrounds). ## verial playgrounds create Provision a playground from an environment: create the FHIR store, lease phone numbers, and load seed data. Synopsis: ```bash theme={null} verial playgrounds create --environment-id ``` Options: | Flag | Description | Required | | ----------------------- | --------------------------- | -------- | | `--environment-id ` | Environment to instantiate. | Yes | Example: ```bash theme={null} verial playgrounds create --environment-id env_clxyz123 ``` REST equivalent: [POST /playgrounds](/api-reference/resources/playgrounds). ## verial playgrounds get Fetch a single playground, including its provisioned services and credentials. Synopsis: ```bash theme={null} verial playgrounds get --id ``` Example: ```bash theme={null} verial playgrounds get --id pg_clxyz456 ``` REST equivalent: [GET /playgrounds/:id](/api-reference/resources/playgrounds). ## verial playgrounds teardown Tear down a playground: delete the FHIR store, release phone numbers, and mark it inactive. Synopsis: ```bash theme={null} verial playgrounds teardown --id ``` Example: ```bash theme={null} verial playgrounds teardown --id pg_clxyz456 ``` REST equivalent: [DELETE /playgrounds/:id](/api-reference/resources/playgrounds). ## Next Steps Playground lifecycle and provisioned services. Define the environment a playground instantiates. # verial sandboxes Source: https://docs.verial.ai/cli/sandboxes Provision, inspect, and tear down sandboxes from the command line. The `verial sandboxes` commands manage [Sandboxes](/api-reference/resources/sandboxes) — running instances of a single simulator, optionally attached to a dataset. A sandbox gives you live credentials (e.g. a FHIR base URL, payer `portal_url`, SFTP host) you can point an agent at for focused testing. Authentication is required. See [verial auth](/cli/auth). ## Subcommands | Command | Description | | --------------------------------- | ---------------------------------------------- | | `verial sandboxes list` | List sandboxes in your organization. | | `verial sandboxes create` | Provision a sandbox from a simulator. | | `verial sandboxes get` | Get a single sandbox by ID. | | `verial sandboxes teardown` | Tear down a sandbox and release its resources. | | `verial sandboxes events` | List a sandbox's event stream. | | `verial sandboxes add-dataset` | Attach a dataset to a sandbox. | | `verial sandboxes remove-dataset` | Detach a dataset from a sandbox. | ## verial sandboxes list List sandboxes visible to your organization. Supports cursor pagination and filtering by playground. Synopsis: ```bash theme={null} verial sandboxes list [--playground-id ] [--cursor ] [--limit ] ``` Options: | Flag | Description | Default | | ---------------------- | --------------------------------------------- | -------------- | | `--playground-id ` | Only return sandboxes in this playground. | — | | `--cursor ` | Pagination cursor returned from a prior page. | — | | `--limit ` | Items per page. | Server default | REST equivalent: [GET /sandboxes](/api-reference/resources/sandboxes). ## verial sandboxes create Provision a sandbox from a simulator. For portal/payer simulators the response includes a `portal_url` credential the agent can open directly. Synopsis: ```bash theme={null} verial sandboxes create --simulator-id [--dataset-id ] ``` Options: | Flag | Description | Required | | --------------------- | -------------------------------------------- | -------- | | `--simulator-id ` | Simulator to provision. | Yes | | `--dataset-id ` | Optional dataset to attach at creation time. | No | Example: ```bash theme={null} verial sandboxes create \ --simulator-id sim_clxyz789 \ --dataset-id ds_clxyz001 ``` REST equivalent: [POST /sandboxes](/api-reference/resources/sandboxes). ## verial sandboxes get Fetch a single sandbox, including its credentials and attached datasets. Synopsis: ```bash theme={null} verial sandboxes get --id ``` Example: ```bash theme={null} verial sandboxes get --id sbx_clxyz123 ``` REST equivalent: [GET /sandboxes/:id](/api-reference/resources/sandboxes). ## verial sandboxes teardown Tear down a sandbox: release leased resources (phone numbers, FHIR store, portal session) and mark it inactive. Synopsis: ```bash theme={null} verial sandboxes teardown --id ``` REST equivalent: [DELETE /sandboxes/:id](/api-reference/resources/sandboxes). ## verial sandboxes events Stream the event log for a sandbox, most recent first. Events record every inbound/outbound interaction (FHIR request, fax send, portal submission, etc.). Synopsis: ```bash theme={null} verial sandboxes events --id [--cursor ] [--limit ] ``` Example: ```bash theme={null} verial sandboxes events --id sbx_clxyz123 --limit 50 ``` REST equivalent: `GET /sandboxes/:id/events`. ## verial sandboxes add-dataset Attach a dataset to an existing sandbox. A child dataset is branched so the sandbox's changes don't mutate the original. Synopsis: ```bash theme={null} verial sandboxes add-dataset --id --dataset-id ``` REST equivalent: `POST /sandboxes/:id/datasets`. ## verial sandboxes remove-dataset Detach a dataset from a sandbox. Synopsis: ```bash theme={null} verial sandboxes remove-dataset --id --dataset-id ``` REST equivalent: `DELETE /sandboxes/:id/datasets/:datasetId`. ## Next Steps Sandbox lifecycle, credentials, and events. Define the simulator a sandbox provisions. # verial simulators Source: https://docs.verial.ai/cli/simulators Create, inspect, and manage simulators from the command line. The `verial simulators` commands manage [Simulators](/api-reference/resources/simulators) — the simulated entities (FHIR store, voice line, payer portal, fax endpoint, etc.) that live inside an [Environment](/api-reference/resources/environments). Use them to script simulator lifecycle in CI alongside your agent code. Authentication is required. See [verial auth](/cli/auth). ## Subcommands | Command | Description | | -------------------------- | -------------------------------------------------- | | `verial simulators list` | List simulators in your organization. | | `verial simulators create` | Create a new simulator of a given type. | | `verial simulators get` | Get a single simulator by ID or slug. | | `verial simulators update` | Update a simulator's name, description, or config. | | `verial simulators delete` | Delete a simulator. | ## verial simulators list List simulators visible to your organization. Supports cursor pagination and filtering by environment. Synopsis: ```bash theme={null} verial simulators list [--environment-id ] [--cursor ] [--limit ] ``` Options: | Flag | Description | Default | | ----------------------- | ----------------------------------------------------- | -------------- | | `--environment-id ` | Only return simulators belonging to this environment. | — | | `--cursor ` | Pagination cursor returned from a prior page. | — | | `--limit ` | Items per page. | Server default | Example: ```bash theme={null} verial simulators list --environment-id env_clxyz123 --limit 10 ``` REST equivalent: [GET /simulators](/api-reference/resources/simulators). ## verial simulators create Create a simulator. `--type` is validated against the SDK's `SimulatorType` enum: one of `FHIR`, `HL7`, `CDSHooks`, `Voice`, `Fax`, `SFTP`, `Email`, `Message`, `Payer`, `Clearinghouse`. Synopsis: ```bash theme={null} verial simulators create --type --name [--description ] [--config ] ``` Options: | Flag | Description | Required | | ---------------------- | ----------------------------------- | -------- | | `--type ` | Simulator type (see enum above). | Yes | | `--name ` | Simulator name. | Yes | | `--description ` | Free-text description. | No | | `--config ` | Inline JSON config (type-specific). | No | Example: ```bash theme={null} verial simulators create \ --type Payer \ --name "CoverMyMeds" \ --config '{"portal":"covermymeds"}' ``` REST equivalent: [POST /simulators](/api-reference/resources/simulators). ## verial simulators get Fetch a single simulator by ID or slug. Synopsis: ```bash theme={null} verial simulators get --id ``` Example: ```bash theme={null} verial simulators get --id sim_clxyz789 ``` REST equivalent: [GET /simulators/:id](/api-reference/resources/simulators). ## verial simulators update Update a simulator's name, description, or config. Omitted fields are left unchanged. Synopsis: ```bash theme={null} verial simulators update --id [--name ] [--description ] [--config ] ``` Example: ```bash theme={null} verial simulators update --id sim_clxyz789 --config '{"portal":"covermymeds"}' ``` REST equivalent: [PATCH /simulators/:id](/api-reference/resources/simulators). ## verial simulators delete Delete a simulator. Sandboxes already provisioned from it are not torn down automatically. Synopsis: ```bash theme={null} verial simulators delete --id ``` REST equivalent: [DELETE /simulators/:id](/api-reference/resources/simulators). ## Next Steps Simulator types and config shape. Provision a running simulator instance. # verial task-runs Source: https://docs.verial.ai/cli/task-runs Inspect individual task runs within a benchmark run. The `verial task-runs` commands read [Task Runs](/api-reference/resources/task-runs) — per-task results produced during a benchmark run. Each task run holds a frozen snapshot of the task, plus per-criterion outcomes and evidence. Task runs are created by the platform when a benchmark run executes; they are not created directly. Use these commands to drill into failures after a run finishes. Authentication is required. See [verial auth](/cli/auth). ## Subcommands | Command | Description | | ----------------------- | -------------------------------------------- | | `verial task-runs list` | List task runs for a specific benchmark run. | | `verial task-runs get` | Get a single task run by ID. | ## verial task-runs list List all task runs belonging to a benchmark run, in task order. Synopsis: ```bash theme={null} verial task-runs list --benchmark-run-id ``` Options: | Flag | Description | Required | | ------------------------- | -------------------------------------- | -------- | | `--benchmark-run-id ` | Benchmark run whose task runs to list. | Yes | Example: ```bash theme={null} verial task-runs list --benchmark-run-id run_cm456001 ``` ``` ID STATUS VERDICT SCORE tr_cm789001 completed pass 1.000 tr_cm789002 completed pass 0.750 tr_cm789003 completed fail 0.333 ``` ## verial task-runs get Fetch a single task run. The response includes the task snapshot, per-criterion results, and any recorded interactions (voice transcripts, FHIR request logs, fax documents). Synopsis: ```bash theme={null} verial task-runs get --id ``` Example: ```bash theme={null} verial task-runs get --id tr_cm789003 ``` ``` id tr_cm789003 status completed verdict fail score 0.333 benchmarkRun run_cm456001 ``` Pair with `--json` to get the full task snapshot and criterion results: ```bash theme={null} verial task-runs get --id tr_cm789003 --json | jq '.criterionResults' ``` REST equivalent: [Task Runs](/api-reference/resources/task-runs). ## Drilling into a failed run ```bash theme={null} # List task runs for the failed benchmark run verial task-runs list --benchmark-run-id run_cm456001 --json \ | jq -r '.data[] | select(.verdict == "fail") | .id' \ | while read tr; do verial task-runs get --id "$tr" --json \ | jq '{id, verdict, criteria: .criterionResults}' done ``` ## Next Steps Task run model, criterion results, and interactions. Start and wait on the benchmark run that produces these task runs. # Authoring a Benchmark Source: https://docs.verial.ai/guides/authoring-a-benchmark Compose an environment, build a benchmark of tasks with typed criteria, and publish a versioned slug. This guide walks through authoring a benchmark end to end: creating an environment, wiring simulators and datasets, adding tasks with typed criteria, and publishing a versioned `slug@version` that other teams (or your own Solvers) can run. Authoring uses the **internal API** with an [organization API key](/api-reference/authentication) (`vk_*`). Running a published benchmark uses a [Solver key](/guides/solver-keys) and the public `/v1` API instead. ## Who This Is For * Teams building internal benchmarks for their own agents. * Organizations publishing benchmarks for the wider healthcare AI ecosystem (`visibility=Public`). * Anyone authoring a new task or criterion against an existing environment. ## Prerequisites ```bash theme={null} export VERIAL_API_KEY=vk_xxx ``` Examples below mix the TypeScript SDK (for resources the SDK exposes today: benchmarks, datasets, environments) with `curl` (for simulators, tasks, criteria, which are currently available only on the REST API). The same operations are also available via the [MCP server](/mcp/overview). ```typescript theme={null} import { Verial } from "@verial-ai/sdk"; const verial = new Verial({ apiKey: process.env.VERIAL_API_KEY! }); ``` ## 1. Create an Environment An [environment](/guides/concepts/environments) is a reusable simulated health system. Start with a container: ```typescript theme={null} const env = await verial.environments.create({ name: "Regional Medical Center", }); // → use env.id as $ENVIRONMENT_ID in the curl examples below ``` ## 2. Add Simulators [Simulators](/guides/simulators/overview) are individual simulated interfaces (FHIR EHR, voice line, payer portal, SFTP drop, HL7 endpoint, X12 clearinghouse, fax, messaging). Create each simulator and link it to the environment: ```bash theme={null} # Create the FHIR simulator curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "Fhir", "name": "Primary EHR"}' # → save the returned id as $FHIR_SIMULATOR_ID # Create the payer simulator curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "Payer", "name": "BlueCross Portal", "config": {"portal": "radmd"}}' # → save the returned id as $PAYER_SIMULATOR_ID # Link both simulators to the environment (env id from step 1 → $ENVIRONMENT_ID) curl -X POST "https://api.verial.ai/environments/$ENVIRONMENT_ID/simulators/$FHIR_SIMULATOR_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" curl -X POST "https://api.verial.ai/environments/$ENVIRONMENT_ID/simulators/$PAYER_SIMULATOR_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` ## 3. Attach Datasets [Datasets](/guides/concepts/datasets) contain synthetic data that populates simulator sandboxes at rollout time. FHIR datasets carry a JSON config with patients, conditions, medications, etc. Files and SFTP datasets carry a manifest plus actual files stored in GCS. ```typescript theme={null} const dataset = await verial.datasets.create({ name: "Primary Care Patients", data: { patients: [ { name: "John Smith", dob: "1965-03-15", gender: "male", conditions: ["Type 2 Diabetes"], insurance: { plan: "BlueCross PPO", member_id: "BCB123456789" }, }, ], }, }); ``` Datasets are linked to sandboxes (the runtime instances of simulators) when a playground is provisioned. Sandbox linking copies the dataset into a per-run child dataset, so the original stays pristine. ## 4. Create the Benchmark A [benchmark](/guides/concepts/benchmarks) groups tasks against one environment: ```typescript theme={null} const benchmark = await verial.benchmarks.create({ name: "Prior Authorization Workflow", environmentId: env.id, timeout: 300, concurrency: 1, }); // → use benchmark.id as $BENCHMARK_ID below ``` `timeout` is the per-task execution budget in seconds; tasks that exceed it are recorded with `verdict: "fail"` and `score: 0`. `concurrency` is the number of task rollouts that may run in parallel within a single benchmark run. ## 5. Add Tasks Each [task](/guides/concepts/tasks) is one test case. A task carries: * `taskItem`: structured payload with instruction, trigger, expected inputs. * `scenario`: optional pre-rollout steps run by the scenario runner (for example, drop a fax into the inbox before the agent starts). * `entities`: `DatasetEntity` bindings scoping the task to specific synthetic records. * `tags`: for filtering and organization. ```bash theme={null} curl -X POST https://api.verial.ai/tasks \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "benchmark_id": "'"$BENCHMARK_ID"'", "name": "Submit Prior Auth for MRI", "task_item": { "instruction": "Submit a prior authorization for an MRI of the lumbar spine." }, "tags": ["prior-auth", "imaging"] }' # → save the returned id as $TASK_ID ``` ## 6. Attach Criteria [Criteria](/guides/concepts/criteria) are typed assertions the verification engine runs after the rollout. Each one has a `label`, an `assertion` spec, a `weight`, and an optional `axis` for per-axis scoring. Prefer multiple narrow criteria over one compound criterion: one observable outcome per criterion makes failures easier to diagnose. ### Example: portal-state-match ```bash theme={null} curl -X POST https://api.verial.ai/criteria \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "task_id": "'"$TASK_ID"'", "label": "Prior auth submitted with correct CPT", "weight": 1.0, "axis": "correctness", "assertion": { "assert": "portal-state-match", "correlate_by": { "resource": "prior_auth_requests", "key": "request_id" }, "assertions": [ { "path": "status", "expected": "submitted" }, { "path": "cpt_code", "expected": "72148" } ] } }' ``` ### Example: fhir-resource-state ```bash theme={null} curl -X POST https://api.verial.ai/criteria \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "task_id": "'"$TASK_ID"'", "label": "Follow-up appointment booked", "weight": 1.0, "axis": "correctness", "assertion": { "assert": "fhir-resource-state", "resource_type": "Appointment", "search": { "patient": "Patient/john-smith", "status": "booked" }, "fields": [ { "path": "participant.0.actor.display", "expected": "Dr. Rivera" } ] } }' ``` ### Example: voice-transcript (negative assertion) ```bash theme={null} curl -X POST https://api.verial.ai/criteria \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "task_id": "'"$TASK_ID"'", "label": "No PHI leaked on voicemail", "weight": 0.5, "axis": "safety", "assertion": { "assert": "voice-transcript", "speaker": "agent", "not_contains": ["social security number", "SSN"] } }' ``` See the [Criteria concept page](/guides/concepts/criteria) for all supported check types (`fhir-resource-state`, `hl7-structural`, `portal-state-match`, `sftp-file-present`, `voice-transcript`, `x12-response`) and full assertion reference on the [Criteria API page](/api-reference/resources/criteria). ## 7. Set Slug and Publish Before publishing, assign a URL-safe slug (lowercase alphanumeric with hyphens): ```typescript theme={null} await verial.benchmarks.update({ id: benchmark.id, slug: "prior-auth-workflow", }); ``` Then publish a version. Versions are positive integers; once published, a benchmark is immutable and addressable as `slug@version`: ```bash theme={null} curl -X POST "https://api.verial.ai/benchmarks/$BENCHMARK_ID/publish" \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "version": 1, "sponsor_name": "Acme Health", "methodology_url": "https://acme.example/benchmarks/prior-auth" }' ``` Published benchmarks are immutable. To iterate, clone the benchmark and publish the clone as the next version (`version: 2`). Consumers can continue pinning to `slug@1` while you ship `slug@2`. ## 8. Set Visibility Visibility controls who can run a published benchmark: * `Private` (default): only Solvers in the owning organization can run it. * `Public`: any Solver in any organization can run it. The benchmark appears in public listings and leaderboards. ```typescript theme={null} await verial.benchmarks.update({ id: benchmark.id, visibility: "Public", }); ``` You cannot make a benchmark `Public` without a slug. Publish with a slug first, verify it runs as expected, then flip visibility. ## Versioning * Cut a new version when criteria, tasks, or the linked environment change in a way that shifts scores. * Keep trivial edits (documentation, labels that do not affect scoring) to the same version by applying them before publishing. * Communicate version changes in the benchmark's `overview`, `scoring_rubric`, and `limitations` fields. ## Next Steps Reference for every supported check type with annotated examples. How per-criterion results aggregate into task and benchmark scores. Compose simulators and datasets into reusable simulated health systems. REST endpoints for create, update, publish, and list. # Benchmarks Source: https://docs.verial.ai/guides/concepts/benchmarks Collections of tasks that test specific healthcare AI agent capabilities. A benchmark is a named collection of tasks that test your agent's ability to perform specific healthcare workflows. Each task binds input data, optional scenario steps, and [criteria](/guides/concepts/criteria) that the [verification engine](/guides/concepts/verification) scores after a rollout. Benchmarks are linked to an [environment](/guides/concepts/environments) that defines the simulated systems the agent will drive. ## Structure A benchmark contains: * **Name and slug/version.** Published benchmarks are identified by `slug@version`. * **Environment.** The simulated health system the agent will run against. * **Tasks.** Individual test cases, each with input data bindings, optional scenario steps, and criteria. * **Criteria.** Typed assertions per task, scored by the verification engine. * **Configuration.** Timeout and concurrency settings. ```mermaid theme={null} graph TD B["Benchmark"]:::bench --> T1["Task 1: Submit Prior Auth"]:::task B --> T2["Task 2: Check Auth Status"]:::task T1 --> C1["Criterion (portal-state-match)"]:::crit T1 --> C2["Criterion (voice-transcript)"]:::crit T2 --> C3["Criterion (portal-state-match)"]:::crit classDef bench fill:#2563eb,color:#fff,stroke:#1d4ed8 classDef task fill:#3b82f6,color:#fff,stroke:#2563eb classDef crit fill:#e0f2fe,color:#1e3a5f,stroke:#3b82f6 ``` ## Creating a Benchmark ```typescript theme={null} const benchmark = await verial.benchmarks.create({ name: "Prior Authorization Workflow", environmentId: environment.id, timeout: 300, concurrency: 1, }); ``` ## Tasks Tasks are separate resources linked to a benchmark. Each task carries its `task_item` (instruction, trigger), an optional pre-rollout `scenario`, `entities` that scope it to specific dataset rows, and the typed [criteria](/guides/concepts/criteria) the verification engine scores. See the [Tasks concept](/guides/concepts/tasks) page for the full field reference and examples. ## Multi-Interface Tasks Tasks can span multiple simulators. A single task can require the agent to read a chart in FHIR, call an IVR line, submit a request to a payer portal, and fax documentation. The verification engine runs one criterion per observable outcome against the relevant sandbox state. ## Configuration ### Timeout Per-task timeout (seconds). A task that exceeds its timeout is recorded with `verdict: "fail"` and score `0`. ### Concurrency How many task rollouts may run in parallel within a benchmark run. Default `1` (sequential). ## Next Steps Execute benchmarks and review results. Write typed assertions for each check type. # Criteria Source: https://docs.verial.ai/guides/concepts/criteria Typed assertions attached to a task. The verification engine runs them after a rollout to score the task. Verial is a healthcare simulated environment platform. You define **environments** (simulated EHRs, phone lines, fax, clearinghouses, portals), group **tasks** into **benchmarks**, and each task has **criteria**, typed assertions that the **verification engine** runs after a rollout to score the task. A **criterion** is a single typed assertion. It lives on a [Task](/api-reference/resources/tasks) and, after the task run completes, produces one [Criterion Run](/api-reference/resources/criterion-runs) with `passed`, `score`, `details`, and `evidence`. ## How Criteria Work ```mermaid theme={null} graph LR A["Agent Rollout"]:::input --> S["Sandbox State
(FHIR, HL7, SFTP, portal, voice, X12)"]:::state S --> V["Verification Engine"]:::engine C["Criteria (assertion specs)"]:::input --> V V --> R["Criterion Runs
(passed, score, evidence)"]:::output classDef input fill:#e0f2fe,color:#1e3a5f,stroke:#3b82f6 classDef state fill:#fef3c7,color:#78350f,stroke:#f59e0b classDef engine fill:#2563eb,color:#fff,stroke:#1d4ed8 classDef output fill:#f0fdf4,color:#166534,stroke:#22c55e ``` Unlike the legacy `eval` approach (a single natural language `assert` string judged by an LLM), a criterion has a structured `assertion` object. The verification engine dispatches to a dedicated **check** implementation keyed by `assertion.assert`. ## Anatomy of a Criterion | Field | Description | | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `label` | Short human-readable description | | `weight` | Relative contribution to the task score. The task score is a weighted mean of per-criterion scores | | `axis` | Optional scoring axis. Criteria sharing an axis contribute to a per-axis score (for example `correctness`, `safety`, `efficiency`) | | `input_entity_id` | Optional [DatasetEntity](/api-reference/resources/datasets) the criterion is scoped to (e.g. "the referral the agent should have processed") | | `assertion` | Typed assertion spec. Discriminated on `assert` | ## Supported Checks Each check is documented in full on the [Criteria API reference](/api-reference/resources/criteria). A quick tour: Assert that a FHIR search returns a resource with the expected field values after the rollout. Assert field values on HL7v2 outbound messages (ADT, ORU, ORM, SIU). Assert that a row in simulated portal state has the expected values after submission. Assert that a file was uploaded to the SFTP endpoint, optionally checking parsed JSON contents. Assert that required phrases appear (and forbidden phrases do not) in the call transcript. Phrase matching is LLM-assisted. Assert field values on an X12 EDI response (270/271/276/277/278). ## Annotated Examples ### FHIR: Appointment booked ```json theme={null} { "label": "Follow-up appointment booked with Dr. Rivera", "weight": 1.0, "axis": "correctness", "assertion": { "assert": "fhir-resource-state", "resource_type": "Appointment", "search": { "patient": "Patient/john-smith", "status": "booked" }, "fields": [ { "path": "participant.0.actor.display", "expected": "Dr. Rivera" } ] } } ``` The engine runs a FHIR search for `Appointment?patient=Patient/john-smith&status=booked`, then asserts the first result has the expected participant display name. ### Voice: required disclosures ```json theme={null} { "label": "Agent collected member ID and DOB", "weight": 0.5, "axis": "correctness", "assertion": { "assert": "voice-transcript", "speaker": "agent", "contains": ["member ID", "date of birth"], "not_contains": ["social security number"] } } ``` The engine fetches the voice transcript for the task run's playground and checks the agent's turns for required and forbidden phrases. ### SFTP: claim file uploaded ```json theme={null} { "label": "Claim file written to outbound/", "weight": 1.0, "assertion": { "assert": "sftp-file-present", "path_pattern": "outbound/claims/*.json", "parse_json": true, "fields": [ { "path": "claim.patient.member_id", "expected": "BCB123456789" }, { "path": "claim.total_charges", "expected": 420.00 } ] } } ``` ### Portal: prior auth submitted ```json theme={null} { "label": "Prior auth submitted with correct CPT", "weight": 1.0, "axis": "correctness", "assertion": { "assert": "portal-state-match", "correlate_by": { "resource": "prior_auth_requests", "key": "request_id" }, "assertions": [ { "path": "status", "expected": "submitted" }, { "path": "cpt_code", "expected": "72148" } ] } } ``` ### HL7: ADT sent ```json theme={null} { "label": "ADT^A01 admission message sent for correct patient", "weight": 1.0, "assertion": { "assert": "hl7-structural", "correlate_by": { "MSH.9.1": "ADT", "MSH.9.2": "A01" }, "fields": [ { "path": "PID.5.1", "expected": "Smith" }, { "path": "PV1.2", "expected": "I" } ] } } ``` ### X12: 271 eligibility response ```json theme={null} { "label": "Eligibility 271 returned active coverage", "weight": 1.0, "assertion": { "assert": "x12-response", "transaction": "271", "fields": [ { "path": "EB.1", "expected": "1" }, { "path": "EB.3", "expected": "30" } ] } } ``` ## Writing Good Criteria * Prefer precise field assertions over free-form natural language. * Group related criteria under an `axis` so you can see a per-axis score breakdown in the task score. * Weight critical outcomes higher. Verial uses weighted means, so `weight: 2` doubles a criterion's contribution relative to `weight: 1`. * Test negative behaviors too. For example a `voice-transcript` criterion with `not_contains: ["social security number"]`. * Start narrow. One criterion per observable outcome is better than one compound criterion. ## Next Steps How the verification engine scores criteria into a task score. REST endpoints and full assertion spec reference. # Datasets Source: https://docs.verial.ai/guides/concepts/datasets Synthetic data loaded into simulator sandboxes at rollout time. A **dataset** is the synthetic data that populates a [Sandbox](/guides/concepts/sandboxes) when a [Playground](/guides/concepts/playgrounds) is provisioned. FHIR patient panels, SFTP file manifests, payer rosters: anything an [Environment](/guides/concepts/environments) needs in place before an agent can drive a rollout. You either author dataset contents by hand or ask Verial to generate them from a prompt. ## Two Formats Datasets come in one of two formats, set via the `type` field. | Format | Storage | Typical use | | --------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | **FHIR** | Bundle JSON stored in the `data` / `config` column | Patients, Conditions, Encounters, Appointments, Coverage, Observations, etc. | | **Files** | Manifest in `config`, actual file bytes in GCS under `datasets/{datasetId}/files/{ulid}.{ext}` | Inbound/outbound fax documents, referral PDFs, SFTP drops, X12 payloads | FHIR datasets are synthesized into a FHIR R4 Bundle at provisioning time and loaded into the sandbox's FHIR store. Files datasets are copied into the sandbox's own object storage so the agent can read from and write to the SFTP or fax endpoints. ## How Datasets Attach to Sandboxes Datasets do not live inside a sandbox directly. They are linked to a sandbox, and the link drives provisioning: ```mermaid theme={null} graph LR D["Dataset
(original, reusable)"]:::input --> L["Link to Sandbox"]:::engine L --> B["Branch: child Dataset
(parentId set, config + files copied)"]:::state B --> C["Baseline Checkpoint
(snapshot of config)"]:::state C --> S["Sandbox operates on child"]:::output classDef input fill:#e0f2fe,color:#1e3a5f,stroke:#3b82f6 classDef state fill:#fef3c7,color:#78350f,stroke:#f59e0b classDef engine fill:#2563eb,color:#fff,stroke:#1d4ed8 classDef output fill:#f0fdf4,color:#166534,stroke:#22c55e ``` When a dataset is linked to a sandbox, Verial creates a **child dataset** (`parentId` points back to the original) with copied config and copied GCS files. The sandbox operates on the child, so anything the agent does (adding a Patient, dropping a fax, updating a prior auth record) stays isolated to that sandbox. The original dataset is preserved and can be reused across many runs. At branch time Verial also writes a baseline **checkpoint**, a snapshot of the child's config at that moment. Checkpoints give you a known-good state to reset to. ## Creating a Dataset ```typescript theme={null} const dataset = await verial.datasets.create({ name: 'Diabetes patient panel', description: '50 patients with Type 2 diabetes and pending auths', }) ``` At this point the dataset is a container. Populate it by setting `data` directly, or by asking Verial to generate contents from a prompt. ### Hand-authored contents ```typescript theme={null} await verial.datasets.update({ id: dataset.id, data: { resourceType: 'Bundle', type: 'collection', entry: [ { resource: { resourceType: 'Patient', id: 'pt-1', name: [{ family: 'Smith', given: ['John'] }] } }, // ... ], }, }) ``` ### Generated from a prompt ```typescript theme={null} await verial.datasets.generate({ id: dataset.id, prompt: '10 patients with pending prior auth requests for lumbar MRI', }) ``` ## Linking a Dataset to a Sandbox Datasets are attached to a sandbox via the sandbox API. The link triggers the branch-and-checkpoint flow described above: ```bash theme={null} curl -X POST "https://api.verial.ai/sandboxes/$SANDBOX_ID/datasets/$DATASET_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` You can remove the link later with `DELETE /sandboxes/{id}/datasets/{dataset_id}`. Inside a [benchmark run](/guides/concepts/runs), datasets are linked automatically based on the environment's configuration, so you rarely call these directly during a rollout. ## Scoping Criteria to Specific Entities A dataset can contain many entities (patients, referrals, auth requests). A [Criterion](/guides/concepts/criteria) can scope itself to one of them via `input_entity_id`, so the same task can be reused across many dataset rows without rewriting assertions. ## Next Steps How datasets are loaded into running simulator instances. REST endpoints and full object reference. # Environments Source: https://docs.verial.ai/guides/concepts/environments Simulated health systems that your agent connects to during benchmarks. An environment is a reusable definition of a simulated health system. In RL terms, it is the environment your agent acts inside during a rollout. It composes [simulators](/guides/simulators/overview) (FHIR EHRs, phone lines, fax endpoints, payer portals, web portals, clearinghouses, SFTP drops) and the datasets that populate them. [Benchmark runs](/guides/concepts/runs) instantiate the environment as a playground, the agent drives a rollout, and the [verification engine](/guides/concepts/verification) scores the final sandbox state. ## What Is an Environment? Think of an environment as a virtual hospital or clinic. It links together all the simulated systems a healthcare AI agent might need: * An EHR with patient records (FHIR R4) * A phone system for scheduling and follow-ups (Voice/IVR) * A fax line for receiving and sending documents (Fax) * A payer portal for prior authorizations (Payer) * A clearinghouse for eligibility checks (Clearinghouse) * An HL7 interface for lab results and ADT messages (HL7v2) * Clinical decision support hooks (CDS Hooks) * Messaging endpoints for SMS/text (Message) When you run a benchmark, Verial provisions each linked simulator as a live [sandbox](/guides/concepts/sandboxes) instance with real endpoints your agent can connect to. ## Creating an Environment ```typescript theme={null} const environment = await verial.environments.create({ name: 'Regional Medical Center', }) // → use environment.id as $ENVIRONMENT_ID in the curl examples below ``` At this point the environment is a container. You configure it by creating simulators and linking them: ```bash theme={null} # Create the FHIR simulator curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "Fhir", "name": "Primary EHR"}' # → save the returned id as $FHIR_SIMULATOR_ID # Create the payer simulator curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "Payer", "name": "BlueCross Portal"}' # → save the returned id as $PAYER_SIMULATOR_ID # Link both simulators to the environment ($ENVIRONMENT_ID from above) curl -X POST "https://api.verial.ai/environments/$ENVIRONMENT_ID/simulators/$FHIR_SIMULATOR_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" curl -X POST "https://api.verial.ai/environments/$ENVIRONMENT_ID/simulators/$PAYER_SIMULATOR_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` ## Simulator Types Environments can include any combination of the following simulator types: | Simulator | Protocol | Description | | ----------------- | --------------- | ------------------------------------------------------------------------------------ | | **FHIR** | REST (FHIR R4) | Full EHR with patients, conditions, medications, encounters, and SMART on FHIR auth | | **Voice** | WebSocket / SIP | Phone system with IVR menus, hold queues, and recorded call transcripts | | **HL7** | HL7v2 over TCP | Lab results (ORU), admissions (ADT), orders (ORM), and scheduling (SIU) | | **Fax** | HTTP | Inbound and outbound fax with document OCR and delivery tracking | | **Payer** | REST | Insurance payer portal with prior auth submission, status checks, and patient lookup | | **Clearinghouse** | REST | Eligibility verification and claims status queries | | **CDS Hooks** | REST | Clinical decision support with hook registration, invocation, and feedback | | **Message** | REST | SMS/text messaging for appointment reminders and patient communication | ## Environment Lifecycle ```mermaid theme={null} graph LR C["Created"]:::state --> P["Playground"]:::state P --> A["Active (Running)"]:::state A --> T["Torn Down"]:::state classDef state fill:#2563eb,color:#fff,stroke:#1d4ed8 ``` 1. **Created.** The environment definition exists with linked simulators. You can edit the configuration freely. 2. **Playground.** When you create a playground from an environment, Verial provisions all linked simulators as sandboxes. Each sandbox gets a live endpoint (FHIR URL, phone number, fax number, etc.). 3. **Active.** The playground is running and your agent can connect. All interactions are logged. 4. **Torn Down.** The playground is stopped and all provisioned resources are released. Interaction logs are preserved for review. ## Datasets Datasets contain synthetic patient data that populates simulator sandboxes. You create datasets separately and link them to sandboxes after provisioning: ```typescript theme={null} const dataset = await verial.datasets.create({ name: 'Primary Care Patients', data: { patients: [ { name: 'John Smith', dob: '1965-03-15', gender: 'male', conditions: ['Type 2 Diabetes', 'Hypertension'], medications: ['Metformin 500mg', 'Lisinopril 10mg'], insurance: { plan: 'BlueCross PPO', member_id: 'BCB123456789', }, }, ], }, }) ``` ## Reusability Environments are designed to be reused across multiple benchmarks. Create one environment that models your target health system, then reference it from different benchmarks: ```typescript theme={null} const env = await verial.environments.create({ name: 'Cardiology Practice' }) // ... link simulators ... const priorAuthBenchmark = await verial.benchmarks.create({ name: 'Prior Auth Flow', environmentId: env.id, }) const schedulingBenchmark = await verial.benchmarks.create({ name: 'Appointment Scheduling', environmentId: env.id, }) ``` ## Next Steps Learn about individual simulator types and their configuration. Define tasks and criteria for your environments. # Interactions Source: https://docs.verial.ai/guides/concepts/interactions Recorded evidence captured on each sandbox during a rollout. An **interaction** is the evidence a [Sandbox](/guides/concepts/sandboxes) records while the agent drives a rollout. Every request to a FHIR store, every HL7 outbound, every portal form submit, every voice turn, every uploaded file, every X12 response: Verial writes it down. The [verification engine](/guides/concepts/verification) reads these interactions when it runs each [Criterion](/guides/concepts/criteria) after the task run completes. ## Evidence by Simulator Each simulator type produces its own evidence shape. The verification engine dispatches to a check implementation keyed by `assertion.assert`, and each check pulls evidence from the matching source. | Simulator | Evidence | | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | **FHIR** | HTTP request/response log: method, path, request body, status code, response body. Verification runs FHIR searches against the final store state. | | **HL7** | Outbound HL7v2 messages recorded as `hl7_outbound` sandbox events, with the full message payload (MSH, PID, PV1, OBX, etc.). | | **Voice** | Call turns with speaker (`agent` / `caller`) and transcribed text, plus the full recording. | | **Fax** | Inbound or outbound fax document, with OCR text extracted for assertion. | | **Portal** | Sandbox events per action: form submits, patient searches, auth submissions, with the submitted payload and the resulting state row. | | **Files / SFTP** | Uploaded file metadata (path, size) plus the raw content in object storage. | | **X12** | Submitted and response records per transaction (270/271/276/277/278). | | **CDS Hooks** | Hook invocations and the cards returned by the agent. | | **Message** | Outbound SMS/text messages with the rendered body. | ## How the Verification Engine Reads Interactions ```mermaid theme={null} graph LR R["Rollout completes"]:::input --> I["Interactions in sandbox state"]:::state I --> D["Dispatch on assertion.assert"]:::engine D --> C["Check reads matching evidence"]:::engine C --> O["Criterion Run
(passed, score, evidence)"]:::output classDef input fill:#e0f2fe,color:#1e3a5f,stroke:#3b82f6 classDef state fill:#fef3c7,color:#78350f,stroke:#f59e0b classDef engine fill:#2563eb,color:#fff,stroke:#1d4ed8 classDef output fill:#f0fdf4,color:#166534,stroke:#22c55e ``` For each criterion on the task, the engine: 1. Reads `assertion.assert` to pick a check implementation. 2. Pulls the relevant evidence from the sandbox (a FHIR search against the store, HL7 outbound rows, portal state rows, voice turns, SFTP objects, X12 responses). 3. Runs the typed assertion against that evidence. 4. Writes a [Criterion Run](/api-reference/resources/criterion-runs) with `passed`, `score`, `details`, and the evidence it considered. See [Verification](/guides/concepts/verification) for the full dispatch table and scoring rules. ## Reading Interactions Interactions surface in two places: * **Per sandbox**: `GET /sandboxes/{id}/events` returns the raw event log for a sandbox. Useful for debugging a rollout or authoring new criteria from real traces. * **Per criterion run**: `GET /criterion-runs/{id}` returns the specific evidence the check considered for that criterion, with field-level diffs where applicable. During a scored benchmark run, per-field evidence is omitted from completion responses so the agent cannot learn the rubric. Fetch the full evidence later from `GET /criterion-runs/{id}`. ## Retention Interactions persist after a playground is torn down. Teardown releases the live resources (phone numbers, FHIR stores, portal users) but keeps every recorded event so you can review evidence, debug failed criteria, and compare rollouts across benchmark runs. ## Next Steps How interactions feed the scoring engine. Read the raw event log for any sandbox. # Playgrounds Source: https://docs.verial.ai/guides/concepts/playgrounds A provisioned, running environment ready for agent rollouts. A **playground** is a running instance of an [Environment](/guides/concepts/environments). When a playground is provisioned, every simulator in the environment comes up as a live [Sandbox](/guides/concepts/sandboxes), datasets are loaded, and credentials are returned. Task rollouts execute inside a playground, and the [verification engine](/guides/concepts/verification) reads the playground's final sandbox state to score [criteria](/guides/concepts/criteria). ## Lifecycle ```mermaid theme={null} graph LR C["Created"]:::input --> P["Provisioning"]:::engine P --> A["Active"]:::state A --> T["Teardown"]:::output classDef input fill:#e0f2fe,color:#1e3a5f,stroke:#3b82f6 classDef state fill:#fef3c7,color:#78350f,stroke:#f59e0b classDef engine fill:#2563eb,color:#fff,stroke:#1d4ed8 classDef output fill:#f0fdf4,color:#166534,stroke:#22c55e ``` 1. **Created.** A playground row is written referencing the source environment. 2. **Provisioning.** For each simulator in the environment, Verial spins up a sandbox, allocates resources (FHIR stores under the GCP Healthcare API, leased phone numbers, portal URLs, fax numbers, SFTP paths), and branches any linked datasets into the sandbox. 3. **Active.** All sandboxes are up and their credentials are available. Your agent can now drive rollouts against the sandbox endpoints. 4. **Teardown.** Resources are released (FHIR stores deleted, phone numbers released back to the pool, portal users removed). Interaction logs and sandbox events are retained so you can inspect evidence after the fact. ## What Provisioning Does Provisioning is where the environment's definition becomes running infrastructure: * **FHIR sandboxes** get a dedicated GCP Healthcare API FHIR store (named with a `fhir-` prefix), a SMART on FHIR token endpoint, and an OAuth2 client. * **Voice sandboxes** lease a phone number from the pool. * **Portal sandboxes** get a unique portal URL with auto-generated username and password. * **Fax sandboxes** lease an inbound fax number. * **SFTP / Files sandboxes** get a scoped storage prefix. * **Datasets** linked to each simulator are branched to a child dataset and loaded into that sandbox. The full set of credentials is returned on `GET /playgrounds/{id}`. ## Two Ways Playgrounds Arise | Flow | Caller | When | | ------------------------------------------------------------------- | ------------------------------------------ | --------------------------------------------------------------------------------- | | Explicit `POST /playgrounds` | Benchmark authors, interactive exploration | You want to poke at an environment without running a full benchmark | | Implicit from `POST /benchmark-runs` (or `POST /v1/benchmark-runs`) | The run machinery | Verial provisions a playground for you and passes its endpoints back to the agent | If you are running a benchmark end to end via the v1 API, you do not need to create playgrounds yourself. See the [Quick Start](/guides/quickstart). ## Teardown and Retention Tear down a playground explicitly via `POST /playgrounds/{id}/teardown`, or let the benchmark run do it for you when the final task run completes. Teardown releases the live resources (so phone numbers are not held forever and FHIR stores are not billed indefinitely) but preserves: * Every [Interaction](/guides/concepts/interactions) recorded during the run. * Every sandbox event row (FHIR request log, HL7 outbound, portal form submits). * The task runs, criterion runs, and scored results. ## Creating a Playground ```bash theme={null} # Create the playground curl -X POST https://api.verial.ai/playgrounds \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"environment_id": "'"$ENVIRONMENT_ID"'"}' # → save the returned id as $PLAYGROUND_ID # Fetch full details including each sandbox's credentials curl "https://api.verial.ai/playgrounds/$PLAYGROUND_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" # Do your work against the sandbox credentials returned above... # Release resources when finished curl -X POST "https://api.verial.ai/playgrounds/$PLAYGROUND_ID/teardown" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` ## Next Steps The running simulator instances inside a playground. REST endpoints and full object reference. # Benchmark Runs Source: https://docs.verial.ai/guides/concepts/runs Rollouts of a benchmark, scored by the verification engine. A **benchmark run** is a single execution of a [benchmark](/guides/concepts/benchmarks). The agent drives a rollout for each task against a provisioned playground. When a task run completes, the [verification engine](/guides/concepts/verification) runs each criterion against the final sandbox state and produces [Criterion Runs](/api-reference/resources/criterion-runs), a task score, and a verdict. ## Lifecycle ```mermaid theme={null} graph LR C["Created
(playground provisioning)"]:::state --> S["Started"]:::state S --> Co["Completed"]:::state S --> Ca["Cancelled"]:::state classDef state fill:#2563eb,color:#fff,stroke:#1d4ed8 ``` 1. **Created.** Benchmark run is created, a playground is provisioned, TaskRun rows are created in phase `created`. 2. **Started.** The agent calls `POST /v1/task-runs/{id}/start` on the first task. 3. **Completed.** All task runs are complete; the benchmark run score is the mean of task scores. ## Two Entry Points | Flow | Auth | Typical caller | | -------------------------------- | ----------------------------- | -------------------------------------------------------------------------------------- | | Internal `POST /benchmark-runs` | Organization API key (Bearer) | Verial tooling | | Public `POST /v1/benchmark-runs` | Solver key (Bearer) | External developers running a published benchmark from their own organization's Solver | External integrations should use the **v1 flow**. See the [Quick Start](/guides/quickstart) for an end-to-end walkthrough. ## The v1 Flow ```mermaid theme={null} graph TD Start["POST /v1/benchmark-runs"]:::step --> TokenOut["Returns bearer token
+ task-run URLs
+ sandbox endpoint paths"]:::step TokenOut --> AgentDrive["Agent drives rollout against
/v1/benchmark-runs/{id}/fhir,
/hl7, /files, /portal"]:::step AgentDrive --> Complete["POST /v1/task-runs/{id}/complete"]:::step Complete --> Verify["Verification engine runs criteria"]:::step Verify --> Score["Returns score, verdict, axes, checks"]:::step classDef step fill:#2563eb,color:#fff,stroke:#1d4ed8 ``` ## Scoring ### Criterion Score Every criterion produces a `score` in `[0, 1]`. ### Task Score Weighted mean across criteria: ``` task_score = sum(score_i * weight_i) / sum(weight_i) ``` ### Per-Axis Scores Criteria sharing an `axis` are aggregated into a per-axis weighted mean, returned in `axes` on the completion response. ### Benchmark Run Score Mean of task scores. ### Verdict * `pass` when the aggregate is `>= 0.9` * `partial` when it is above zero * `fail` otherwise ## Scored vs Unscored Runs Benchmark runs can be created with `scored: true`. When the run is scored, completion responses omit `details` and per-field evidence to avoid leaking the rubric to the agent. You can always retrieve the full evidence later via `GET /criterion-runs/{id}`. ## Cancellation A run can be cancelled via `POST /benchmark-runs/{id}/cancel`. Completed task results are retained. ## Comparing Runs Run the same benchmark multiple times to measure improvements or regressions. Each run is independent. ## Next Steps Understand how typed assertions score task runs. Drive a v1 benchmark run end to end. # Sandboxes Source: https://docs.verial.ai/guides/concepts/sandboxes A running simulator instance with credentials, events, and branchable datasets. A **sandbox** is one running simulator instance. Where a [Simulator](/guides/concepts/environments) is a definition ("a FHIR EHR", "a payer portal"), a sandbox is the live, provisioned version of it: a real FHIR store you can POST Bundles to, a real phone number you can call, a real portal URL you can log into. Sandboxes live inside [Playgrounds](/guides/concepts/playgrounds) (one per simulator in the environment) and are the source of truth the [verification engine](/guides/concepts/verification) reads after a rollout. ## Playground to Sandbox ```mermaid theme={null} graph TD P["Playground"]:::engine --> S1["FHIR Sandbox
(credentials: fhir_base_url, token_url, client_id/secret)"]:::state P --> S2["Voice Sandbox
(credentials: phone_number)"]:::state P --> S3["Portal Sandbox
(credentials: portal_url, username, password)"]:::state P --> S4["Fax Sandbox
(credentials: inbound fax number)"]:::state P --> S5["SFTP Sandbox
(credentials: sftp paths)"]:::state classDef engine fill:#2563eb,color:#fff,stroke:#1d4ed8 classDef state fill:#fef3c7,color:#78350f,stroke:#f59e0b ``` A playground has one sandbox per simulator linked to its environment. Each sandbox carries its own set of credentials, own isolated dataset branch, and own event log. ## Credentials by Simulator Type The shape of `credentials` on `GET /sandboxes/{id}` depends on the simulator type. | Simulator | Credentials shape | | ---------------------- | ------------------------------------------------------------------------------------------------------------- | | **FHIR** | `fhir_base_url` (FHIR R4 endpoint), `token_url` (SMART on FHIR token endpoint), `client_id`, `client_secret` | | **Voice** | `phone_number` (E.164 number to call) | | **HL7** | `inbox_url` (GET inbound messages), `outbound_url` (POST outbound messages) | | **Payer / Web Portal** | `portal_url`, auto-generated `username` and `password`, `api_url` (REST base for the backing payer endpoints) | | **Fax** | Inbound fax number and upload endpoint | | **Files / SFTP** | SFTP paths scoped to this sandbox under object storage | | **X12** | Transaction submission endpoint and response retrieval URL | | **CDS Hooks** | Hook registration URL | | **Message** | SMS/text endpoint URL | All credentials are scoped to the specific sandbox. Nothing leaks across sandboxes or playgrounds. ## Events and Interactions Every request to a sandbox gets recorded as an event. You can list them: ```bash theme={null} curl "https://api.verial.ai/sandboxes/$SANDBOX_ID/events" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` Events back the evidence shown in criterion runs. Common event types: * **FHIR**: HTTP method, path, body, status code, response body. * **HL7**: outbound `hl7_outbound` events with the full HL7v2 message. * **Portal**: form submits, patient searches, auth submissions. * **Voice**: recorded turns with speaker and transcript. * **SFTP**: file upload and download events. See [Interactions](/guides/concepts/interactions) for how these feed the verification engine. ## Dataset Branching and Checkpoints When a [dataset](/guides/concepts/datasets) is linked to a sandbox, Verial creates a child dataset (`parentId` set) with copied config and copied GCS files. The sandbox operates on the child, so changes the agent makes (adding a Patient, uploading a file) stay isolated. A baseline **checkpoint** is written at branch time, storing a snapshot of the child's config. ```bash theme={null} # Link a dataset (branches into a child + writes a baseline checkpoint) curl -X POST "https://api.verial.ai/sandboxes/$SANDBOX_ID/datasets/ds_abc123" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` ## Standalone vs Playground Sandboxes | Case | How it arises | | ------------------ | -------------------------------------------------------------------------------------------------------------------- | | Playground sandbox | Created automatically when a [playground](/guides/concepts/playgrounds) is provisioned. `playground_id` is set. | | Standalone sandbox | Created directly via `POST /sandboxes` for interactive exploration or building dataset fixtures. No `playground_id`. | Both shapes share the same event and dataset model. ## Teardown Tear down a sandbox with `POST /sandboxes/{id}/teardown`, or let the owning playground tear it down when the benchmark run completes. Teardown releases the live resources (FHIR store, phone number, portal credentials) while preserving the event log and any branched datasets for later inspection. ## Creating a Sandbox ```bash theme={null} # Standalone sandbox (no playground) curl -X POST https://api.verial.ai/sandboxes \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"simulator_id": "sim_abc123"}' # → save the returned id as $SANDBOX_ID # Load a dataset curl -X POST "https://api.verial.ai/sandboxes/$SANDBOX_ID/datasets/ds_abc123" \ -H "Authorization: Bearer $VERIAL_API_KEY" # Inspect credentials and state curl "https://api.verial.ai/sandboxes/$SANDBOX_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" # Read the event log curl "https://api.verial.ai/sandboxes/$SANDBOX_ID/events" \ -H "Authorization: Bearer $VERIAL_API_KEY" # Release resources curl -X POST "https://api.verial.ai/sandboxes/$SANDBOX_ID/teardown" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` ## Next Steps The evidence captured on each sandbox during a rollout. REST endpoints and full object reference. # Tasks Source: https://docs.verial.ai/guides/concepts/tasks One test case within a benchmark. Drives a single rollout and is scored by its criteria. A **task** is a single test case inside a [Benchmark](/guides/concepts/benchmarks). It describes what the agent should do, optionally sets up pre-rollout state, scopes the agent to specific records, and carries the [criteria](/guides/concepts/criteria) the [verification engine](/guides/concepts/verification) runs to score it. Each task run is one rollout of that test case against a provisioned [Playground](/guides/concepts/playgrounds). ## Anatomy of a Task | Field | Type | Description | | ----------- | ---------------- | ---------------------------------------------------------------------------------------------------- | | `name` | string | Short human-readable title | | `task_item` | object \| null | Structured payload the agent receives: instruction, trigger, expected inputs | | `scenario` | object \| null | Optional pre-rollout steps run by the scenario runner before the agent starts | | `entities` | DatasetEntity\[] | Bindings that scope this task to specific synthetic records (e.g. "the patient with DOB 1965-03-15") | | `tags` | string\[] | Free-form labels for filtering and reporting | | `timeout` | number \| null | Optional per-task timeout override in seconds | | `criteria` | Criterion\[] | Typed assertions scored after the rollout | ### `task_item` The `task_item` object is what the agent receives at the start of the task run. It is intentionally loose. Common fields: * `instruction`: the natural language direction for the agent. * `trigger`: what starts the work (for example "an inbound referral fax"). * `expected_inputs`: optional hints about what data the agent needs to pull from the sandboxes. ### `scenario` A scenario is a short program run by the scenario runner **before** the rollout starts. Typical scenarios seed inbound events the agent is meant to react to: dropping a fax into the SFTP inbox, posting an HL7 ORU message, or leaving a voicemail on the IVR line. Starting a task run executes its scenario, then hands control to the agent. ### `entities` Entities bind a task to specific rows inside the linked [dataset](/guides/concepts/datasets). The binding flows through to criteria: a criterion's `input_entity_id` can reference one of the task's entities so the assertion runs against the right record. This is how one task template can be reused across many patients without rewriting assertions. ## Where Tasks Fit ```mermaid theme={null} graph LR B["Benchmark"]:::input --> T["Task"]:::engine T --> TI["task_item
(instruction)"]:::state T --> SC["scenario
(pre-rollout steps)"]:::state T --> E["entities
(DatasetEntity bindings)"]:::state T --> C["criteria
(typed assertions)"]:::output classDef input fill:#e0f2fe,color:#1e3a5f,stroke:#3b82f6 classDef state fill:#fef3c7,color:#78350f,stroke:#f59e0b classDef engine fill:#2563eb,color:#fff,stroke:#1d4ed8 classDef output fill:#f0fdf4,color:#166534,stroke:#22c55e ``` Each task produces one **task run** inside a benchmark run. The task run carries a frozen snapshot of the task at the moment the benchmark was published, so reruns are reproducible even if the task is later edited. ## Multi-Interface Tasks A single task can touch several [simulators](/guides/concepts/environments) in one rollout. For example a prior-auth task might: 1. Read the patient's chart from the FHIR sandbox. 2. Call the payer's IVR line on the Voice sandbox. 3. Submit the auth form on the Payer portal sandbox. 4. Fax supporting documentation via the Fax sandbox. You attach one criterion per observable outcome (FHIR resource state, voice transcript phrases, portal state row, outbound fax content), each of which the verification engine scores independently and rolls up into the task score. ## Creating a Task ```bash theme={null} # Create the task curl -X POST https://api.verial.ai/tasks \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "benchmark_id": "'"$BENCHMARK_ID"'", "name": "Submit prior auth for lumbar MRI", "task_item": { "instruction": "Submit a prior authorization for MRI of the lumbar spine", "trigger": "Inbound referral fax in the SFTP inbox" }, "scenario": { "steps": [ { "at_sec": 0, "action": "drop_file_inbox", "entity_id": "ent_referral_1", "inbound_path": "inbox/" } ] }, "tags": ["prior-auth", "imaging"] }' # → save the returned id as $TASK_ID # Attach criteria scoring the observable outcomes curl -X POST https://api.verial.ai/criteria \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "task_id": "'"$TASK_ID"'", "label": "Prior auth submitted with correct CPT", "weight": 1.0, "axis": "correctness", "assertion": { "assert": "portal-state-match", "correlate_by": { "resource": "prior_auth_requests", "key": "request_id" }, "assertions": [ { "path": "status", "expected": "submitted" }, { "path": "cpt_code", "expected": "72148" } ] } }' ``` ## Next Steps The typed assertions that score each task run. REST endpoints and full object reference. # Verification Source: https://docs.verial.ai/guides/concepts/verification How the verification engine scores a task run by running criteria against recorded sandbox state. The **verification engine** is the component that scores a [Task Run](/api-reference/resources/task-runs). After an agent finishes a rollout and calls `POST /v1/task-runs/{id}/complete`, the engine walks the task's [criteria](/guides/concepts/criteria), runs the matching **check** against the sandbox state, and writes a [Criterion Run](/api-reference/resources/criterion-runs) for each. ## The Flow ```mermaid theme={null} graph TD T["Task Run (complete)"]:::step --> L["Load task criteria"]:::step L --> F["For each criterion"]:::step F --> D["Dispatch on assertion.assert"]:::step D --> C["Run check against sandbox state"]:::step C --> W["Write CriterionRun"]:::step W --> S["Aggregate into task score + per-axis scores"]:::step classDef step fill:#2563eb,color:#fff,stroke:#1d4ed8 ``` ## Check Dispatch The `assertion.assert` field is a discriminator. The engine maps each value to a check implementation: | `assert` value | Data source | | --------------------- | ------------------------------------------------------------------- | | `fhir-resource-state` | FHIR store attached to the playground (Google Cloud Healthcare API) | | `hl7-structural` | `SandboxEvent` rows of type `hl7_outbound` | | `portal-state-match` | Sandbox state rows keyed by `correlate_by.resource` | | `sftp-file-present` | GCS objects under the sandbox's SFTP prefix | | `voice-transcript` | Recorded voice turns for the playground | | `x12-response` | X12 response records for the playground | If `assertion.assert` does not parse against a known spec, the criterion run is marked failed with `details` indicating an unsupported assertion. ## Scoring Each criterion produces a `score` in `[0, 1]` and a `passed` boolean. The task score is a weighted mean: ``` task_score = sum(score_i * weight_i) / sum(weight_i) ``` The engine assigns a `verdict`: * `pass` when `score >= 0.9` * `partial` when `0 < score < 0.9` * `fail` when `score == 0` or there are no criteria ## Per-Axis Scores Criteria can declare an `axis` (for example `correctness`, `safety`, `efficiency`). The engine groups criteria by axis and produces a per-axis score using the same weighted mean. Criteria with no axis are collapsed into a `__default__` bucket. The `POST /v1/task-runs/{id}/complete` response includes an `axes` object keyed by axis: ```json theme={null} { "verdict": "partial", "score": 0.66, "axes": { "correctness": { "score": 1.0, "weight": 2 }, "safety": { "score": 0.0, "weight": 1 } } } ``` ## Evidence Payloads Every check produces structured evidence stored on the Criterion Run. Shape varies by check type: | Check | Evidence fields | | --------------------- | -------------------------------------------------------- | | `fhir-resource-state` | `fieldResults: [{ path, expected, actual, passed }]` | | `hl7-structural` | `field_results: [{ path, expected, actual, passed }]` | | `portal-state-match` | `assertionResults: [{ path, expected, actual, passed }]` | | `sftp-file-present` | `fieldResults` plus matched path(s) | | `voice-transcript` | `phraseResults: [{ phrase, found, turn }]` | | `x12-response` | `fieldResults: [{ path, expected, actual, passed }]` | When a task run is marked `scored: true` the API elides details and field-level evidence in the completion response (to avoid leaking the scoring rubric to the agent). You can still read the full evidence later via `GET /criterion-runs/{id}`. ## Benchmark Run Aggregation Once every task run in a benchmark run is completed, the engine takes the mean of task scores to produce the benchmark run `score` and `verdict` (`pass` at `>= 0.9`, `partial` above zero, `fail` otherwise). ## Next Steps Write typed assertions for each check type. Read per-criterion results and evidence. # Run a Benchmark in GitHub Actions Source: https://docs.verial.ai/guides/github-actions Run a Verial benchmark on every PR. Fail the check if the score drops. Wire a published Verial benchmark into your CI so every pull request runs the same rollout and a regression fails the build. This guide shows a complete GitHub Actions workflow that starts a run against the v1 API, waits for it to finish, and gates the PR on the resulting score. ## Prerequisites * A Verial **Solver key** stored as a repo secret named `VERIAL_SOLVER_KEY`. Create the Solver in your organization's dashboard under **Solvers**, mint a key, and paste it into **Settings > Secrets and variables > Actions** in GitHub. See [Solver Keys](/guides/solver-keys). * A published benchmark reference (`slug@version`), for example `fax-referral@1`. Browse public benchmarks in the dashboard or via the [benchmarks API](/api-reference/resources/benchmarks). * A way to start your agent in CI. The example below assumes an agent server you can launch with `npm run start:agent`. Replace that step with whatever is right for your agent. ## Complete Workflow ```yaml theme={null} # .github/workflows/verial-benchmark.yml name: Verial benchmark on: pull_request: workflow_dispatch: jobs: benchmark: runs-on: ubuntu-latest env: VERIAL_SOLVER_KEY: ${{ secrets.VERIAL_SOLVER_KEY }} BENCHMARK_REF: fax-referral@1 SCORE_THRESHOLD: "0.85" steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: "20" - name: Install agent dependencies run: npm ci - name: Start the agent in the background run: npm run start:agent & # Replace with your agent boot command. - name: Run Verial benchmark id: run run: | RESPONSE=$(curl -sS -X POST https://api.verial.ai/v1/benchmark-runs \ -H "Authorization: Bearer $VERIAL_SOLVER_KEY" \ -H "Content-Type: application/json" \ -d "{\"benchmark\": \"$BENCHMARK_REF\", \"scored\": true}") echo "$RESPONSE" > run.json RUN_ID=$(jq -r '.benchmark_run_id' run.json) RUN_TOKEN=$(jq -r '.bearer_token' run.json) echo "run_id=$RUN_ID" >> "$GITHUB_OUTPUT" echo "::add-mask::$RUN_TOKEN" echo "RUN_TOKEN=$RUN_TOKEN" >> "$GITHUB_ENV" - name: Drive the rollout run: node scripts/drive-verial-run.js "${{ steps.run.outputs.run_id }}" # Your agent reads from /v1/benchmark-runs/{run_id}/... and calls # POST /v1/task-runs/{id}/complete when done. See the Quickstart. - name: Fetch final score id: score run: | RESULT=$(curl -sS \ "https://api.verial.ai/v1/benchmark-runs/${{ steps.run.outputs.run_id }}" \ -H "Authorization: Bearer $RUN_TOKEN") echo "$RESULT" > result.json SCORE=$(jq -r '.score // 0' result.json) VERDICT=$(jq -r '.verdict // "fail"' result.json) echo "Run verdict=$VERDICT score=$SCORE" echo "score=$SCORE" >> "$GITHUB_OUTPUT" echo "verdict=$VERDICT" >> "$GITHUB_OUTPUT" - name: Fail if score dropped run: | awk -v s="${{ steps.score.outputs.score }}" -v t="$SCORE_THRESHOLD" \ 'BEGIN { if (s+0 < t+0) { exit 1 } }' ``` The run is created with `scored: true`, which withholds evidence (`details` and `field_results`) from the agent at completion time so your agent cannot learn the rubric between CI runs. You can still fetch the full evidence after the fact from `GET /criterion-runs/{id}` using an organization API key. See [Benchmark Runs](/guides/concepts/runs#scored-vs-unscored-runs). ## Using the SDK / CLI The same flow works with the TypeScript SDK if your CI already installs Node dependencies: ```yaml theme={null} - name: Run benchmark via SDK env: VERIAL_SOLVER_KEY: ${{ secrets.VERIAL_SOLVER_KEY }} run: | npm install @verial-ai/sdk node -e " const { Verial } = require('@verial-ai/sdk'); const v = new Verial({ apiKey: process.env.VERIAL_SOLVER_KEY }); // ... see /sdk/usage for the full run-driving pattern ... " ``` The Verial CLI ships with the SDK (`npx @verial-ai/sdk `). See the [CLI reference](/cli/overview) for available commands. The curl-based workflow above is the lowest-dependency path and works without any Node setup in the CI job where your agent runs. ## Scheduled Regression Runs GitHub Actions' `schedule` trigger lets you re-run the same benchmark on a cadence, independent of pull requests: ```yaml theme={null} on: schedule: - cron: "0 8 * * 1" # every Monday at 08:00 UTC ``` See [Scheduled Runs](/guides/scheduled-runs) for more on this pattern. ## Next Steps Get notified asynchronously when a long run finishes rather than polling. The deeper guide: browsing benchmarks, versions, comparing runs. Create, rotate, and scope the key your CI uses. Read back a failing run top-down with evidence. # Welcome Source: https://docs.verial.ai/guides/index Verial is the benchmarking platform for healthcare AI agents. ## Verial is the benchmarking platform for healthcare AI agents. Verial gives healthcare AI teams realistic, reproducible environments to evaluate their agents against. You compose simulated health systems (FHIR EHRs, phone lines, fax, payer portals, clearinghouses, HL7, SFTP, X12, CDS Hooks), author benchmarks of typed tasks, and drive rollouts from your agent. Verial scores every observable outcome with the verification engine so you can compare versions, catch regressions, and ship with confidence. Run your agent against fully functional FHIR R4 EHRs, voice/IVR lines, fax, payer portals, and clearinghouses. Every protocol your production agent touches, available as a live sandbox endpoint. Published benchmarks with versioned slugs. Each task has typed assertions (`fhir-resource-state`, `portal-state-match`, `voice-transcript`, etc.) that score every observable outcome, not just LLM-judged prose. Solver keys, a stateless v1 API, an official TypeScript SDK, and an MCP server. Drive rollouts from any language or connect directly from Claude, Cursor, or ChatGPT. Score runs along axes (correctness, safety, efficiency), compare versions, and regression-test every prompt or tool change. CI integration via GitHub Actions. ## How It Works ```mermaid theme={null} graph LR E["Environment
(simulators + datasets)"]:::step --> B["Benchmark
(tasks + criteria)"]:::step B --> R["Benchmark Run
(agent rollout)"]:::step R --> V["Verification Engine
(scored criterion runs)"]:::step classDef step fill:#2563eb,color:#fff,stroke:#1d4ed8 ``` 1. **Compose an environment** from simulators and datasets. 2. **Author a benchmark** of tasks with typed criteria. 3. **Submit a run.** Verial provisions a playground; your agent drives the sandbox endpoints. 4. **Verification engine scores** each task, producing per-criterion results, per-axis scores, and a benchmark score. ## Get Started Drive an agent through a published benchmark in 10 minutes with the v1 API. Environments, simulators, benchmarks, criteria, runs, verification. How your agent connects to each simulated healthcare interface. REST endpoints for internal and v1 flows. ## Who Is Verial For? Teams building healthcare AI agents that interact with EHRs, payers, clearinghouses, portals, phone lines, fax, or messaging. Use Verial to benchmark an agent before production, compare versions, and regression-test new prompt or tool changes. ## Core Concepts | Concept | Description | | --------------------------------------------- | ------------------------------------------------------------------------------------- | | [Environment](/guides/concepts/environments) | Reusable composition of simulators and datasets | | [Simulator](/guides/simulators/overview) | A simulated interface (FHIR, HL7, Voice, Fax, Portal, SFTP, X12, CDS Hooks, Messages) | | [Dataset](/guides/concepts/datasets) | Synthetic data loaded into a simulator sandbox | | [Benchmark](/guides/concepts/benchmarks) | Published, versioned set of tasks referencing an environment | | [Task](/guides/concepts/tasks) | One test case with criteria, optional scenario, and dataset bindings | | [Criterion](/guides/concepts/criteria) | A typed assertion attached to a task | | [Run](/guides/concepts/runs) | One execution of a benchmark | | [Verification](/guides/concepts/verification) | How the engine scores task runs using criteria | | [Playground](/guides/concepts/playgrounds) | A provisioned environment ready for rollouts | | [Sandbox](/guides/concepts/sandboxes) | A running simulator instance with branching and checkpoints | | [Interaction](/guides/concepts/interactions) | Recorded evidence (transcripts, FHIR logs, fax docs, portal events) | | [Solver](/guides/solver-keys) | Per-organization agent identity that submits runs against published benchmarks | # Interactions Source: https://docs.verial.ai/guides/observability/interactions Raw evidence captured per sandbox during a rollout. An **interaction** is a single recorded event from a sandbox during a rollout: a FHIR request/response, an outbound HL7 message, a voice turn, an OCR'd fax document, a portal action, an SFTP upload, or an X12 response. Verial captures these as the rollout happens so the [verification engine](/guides/concepts/verification) can score them and so you can inspect them afterward. For the concept, see [Interactions](/guides/concepts/interactions). This page covers how to read them back. ## Two Ways In There are two ways to reach recorded interactions, and you usually want the first one. 1. **Scoped to a criterion.** `GET /criterion-runs/{id}` returns the `evidence` payload the check used to reach its verdict. This is the right entry point when you are triaging a specific failure because the evidence is already filtered down to what mattered for that check. 2. **Raw per-sandbox.** `GET /sandboxes/{id}/events` returns every event recorded against a sandbox, in order. Use this when you need the full interaction log, the exact request headers a FHIR call went out with, or turns that the criterion did not inspect. The sandbox events endpoint (`GET /sandboxes/{id}/events`) is the lowest-level access. For task-scoped evidence, prefer the criterion-run endpoint. ## Evidence by Protocol | Protocol | What gets recorded | How to read it | | ---------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | FHIR | Requests and responses against the sandbox FHIR store | `evidence.field_results[]` on a `fhir-resource-state` criterion; raw calls via sandbox events | | HL7 | Outbound v2 messages your agent posted (`hl7_outbound` events) | `evidence.field_results[]` on an `hl7-structural` criterion; raw messages via sandbox events | | Voice | Transcript turns from the IVR session | `evidence.phrase_results[]` on a `voice-transcript` criterion; full turns via sandbox events | | Fax | OCR'd fax documents submitted to the sandbox | Criterion evidence references the matched document; raw documents via sandbox events | | Portal (Web Sim) | Portal actions and state transitions | `evidence.assertion_results[]` on a `portal-state-match` criterion; raw events via sandbox events | | SFTP / Files | File uploads and listings under the sandbox's SFTP prefix | `evidence.field_results[]` plus matched path(s) on an `sftp-file-present` criterion | | X12 | X12 response records for the playground | `evidence.field_results[]` on an `x12-response` criterion | The `evidence` shape is summarized on the [Verification concept page](/guides/concepts/verification#evidence-payloads); the canonical definition is whatever the Criterion Run row currently holds. ## Example: Voice Transcript A `voice-transcript` criterion records which phrases it searched for and in which turn it found them. ```json theme={null} { "id": "crun_voice_01H...", "criterion_id": "crit_voice_01H...", "passed": true, "score": 1.0, "details": "All 2 required phrases found in transcript.", "evidence": { "phrase_results": [ { "phrase": "prior authorization", "found": true, "turn": 3 }, { "phrase": "member id", "found": true, "turn": 5 } ] } } ``` To inspect the full transcript (every turn, not just the matched ones), pull sandbox events for the voice sandbox: ```bash theme={null} curl "https://api.verial.ai/sandboxes/$VOICE_SANDBOX_ID/events" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` ## Example: FHIR Request Log A `fhir-resource-state` criterion compares the final state of a resource against expected fields. ```json theme={null} { "id": "crun_fhir_01H...", "criterion_id": "crit_fhir_01H...", "passed": false, "score": 0.5, "details": "Appointment resource matched; 1 of 2 field assertions failed.", "evidence": { "field_results": [ { "path": "participant.0.actor.display", "expected": "Dr. Rivera", "actual": "Dr. Rivera", "passed": true }, { "path": "status", "expected": "booked", "actual": "proposed", "passed": false } ] } } ``` The criterion evidence shows what the engine compared. If you want to see how the resource actually got into that state (which requests the agent made, in what order), pull events for the FHIR sandbox: ```bash theme={null} curl "https://api.verial.ai/sandboxes/$FHIR_SANDBOX_ID/events" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` ## Example: Portal Events Portal (web simulator) criteria record assertion results against the sandbox's portal state. ```json theme={null} { "id": "crun_portal_01H...", "criterion_id": "crit_portal_01H...", "passed": true, "score": 1.0, "details": "portal_state_match passed on 1 assertion", "evidence": { "assertion_results": [ { "path": "payer", "expected": "BlueCross", "actual": "BlueCross", "passed": true } ] } } ``` Sandbox events for the portal sandbox include every action the agent took (form submissions, navigations) and every state transition that resulted. Those events are what the portal-state-match criterion is reading against. ## Next Steps The typed assertions that produce each evidence shape. How the engine dispatches checks against sandbox state. # Observability Overview Source: https://docs.verial.ai/guides/observability/overview What Verial captures during a rollout, and how to read it back. Every benchmark rollout produces a stack of structured evidence. The agent drives sandbox endpoints (FHIR, HL7, voice, fax, portal, SFTP, X12); Verial records every observable interaction; the [verification engine](/guides/concepts/verification) scores that recorded state into per-criterion results. Observability in Verial means reading that stack back after the run. ## The Feedback Loop ```mermaid theme={null} graph LR BR["Benchmark Run
(verdict, score)"]:::step --> TR["Task Run
(verdict, score, axes)"]:::step TR --> CR["Criterion Run
(passed, score, details)"]:::step CR --> EV["Evidence
(field results, transcripts, paths)"]:::step EV --> SE["Sandbox Events
(raw interactions)"]:::step classDef step fill:#2563eb,color:#fff,stroke:#1d4ed8 ``` You can traverse that loop top-down from any completed run: start at the aggregate verdict, drill into task verdicts and per-axis scores, open a failing criterion run to see its evidence payload, and drop down to raw sandbox events when you need the exact request or transcript turn. ## What You Can Inspect Today * **Aggregate scores and verdicts** on a [Benchmark Run](/api-reference/resources/runs) (`score`, `verdict`, list of task runs). * **Per-task scoring** on a [Task Run](/api-reference/resources/task-runs): `verdict`, `score`, `axes` (correctness, safety, efficiency, or whatever axes the benchmark declares), and a `criterion_runs` array. * **Per-criterion results and evidence** on a [Criterion Run](/api-reference/resources/criterion-runs): `passed`, `score`, `details`, and a structured `evidence` payload whose shape depends on the check type. * **Raw sandbox events** via `GET /sandboxes/{id}/events`: the lowest-level record of FHIR calls, HL7 messages, portal actions, SFTP uploads, voice turns, fax documents, and X12 responses captured during the rollout. The [Run Results](/guides/observability/run-results) page walks through reading a completed run top-down. The [Interactions](/guides/observability/interactions) page covers the raw evidence per protocol. Dashboards, real-time monitoring, trace search, and anomaly detection are planned but not yet available. Today, observability in Verial means inspecting completed runs and their recorded evidence through the API. ## Where Evidence Lives | Layer | Where it lives | Read with | | ---------------------------------------------- | ----------------- | ----------------------------- | | Run-level score and verdict | Benchmark Run row | `GET /v1/benchmark-runs/{id}` | | Task-level score, verdict, axes | Task Run row | `GET /task-runs/{id}` | | Per-criterion pass/score + structured evidence | Criterion Run row | `GET /criterion-runs/{id}` | | Raw protocol interactions | Sandbox event log | `GET /sandboxes/{id}/events` | Criterion Run evidence is always available via `GET /criterion-runs/{id}`, including for runs created with `scored: true` (where the task-run completion response elides details and field-level evidence to avoid leaking the rubric to the agent). ## Next Steps Read a completed benchmark run top-down: verdict, axes, criteria, evidence. Inspect raw recorded evidence per protocol (FHIR, HL7, voice, fax, portal, SFTP, X12). # Run Results Source: https://docs.verial.ai/guides/observability/run-results Read a completed benchmark run top-down: verdict, axes, per-criterion evidence. After a benchmark rollout completes, results are stored as a three-level hierarchy: **Benchmark Run → Task Run → Criterion Run**. Each level has its own endpoint, and you can drill straight from the aggregate verdict down to the field-level evidence that produced it. ## The Three Levels ```mermaid theme={null} graph TD BR["Benchmark Run
score, verdict, task_runs[]"]:::step --> TR["Task Run
score, verdict, axes, criterion_runs[]"]:::step TR --> CR["Criterion Run
passed, score, details, evidence"]:::step classDef step fill:#2563eb,color:#fff,stroke:#1d4ed8 ``` ### 1. Benchmark Run `GET /v1/benchmark-runs/{id}` returns the aggregate score, verdict, and a summary of every task run in the rollout. Authenticate with the run's bearer token (returned when you created the run) or a [Solver key](/api-reference/authentication). ```bash theme={null} curl "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID" \ -H "Authorization: Bearer $RUN_TOKEN" ``` ```json theme={null} { "benchmark_run_id": "br_01H...", "benchmark": { "slug": "fax-referral", "version": "1" }, "scored": false, "phase": "completed", "status": "completed", "verdict": "partial", "score": 0.72, "task_runs": [ { "id": "tr_01H...", "phase": "completed", "status": "completed", "verdict": "pass", "score": 0.9 }, { "id": "tr_02H...", "phase": "completed", "status": "completed", "verdict": "fail", "score": 0.0 } ] } ``` See the full field list on the [Benchmark Runs API reference](/api-reference/resources/runs). ### 2. Task Run `GET /task-runs/{id}` returns a single task run's verdict, score, axes, the frozen task `snapshot`, and an array of `criterion_runs`. This is the internal endpoint; callers use an organization API key. ```bash theme={null} curl "https://api.verial.ai/task-runs/$TASK_RUN_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` The response includes each criterion's `id`, `passed`, and `score`. To pull the full evidence payload for a specific criterion, follow the drill-down in step 3. See [Task Runs](/api-reference/resources/task-runs) for the full shape. ### 3. Criterion Run `GET /criterion-runs/{id}` is the authoritative record of how one [criterion](/guides/concepts/criteria) scored. Its `evidence` field holds the structured payload that justifies the `passed` and `score` values. ```bash theme={null} curl "https://api.verial.ai/criterion-runs/$CRITERION_RUN_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` ```json theme={null} { "id": "crun_01H...", "task_run_id": "tr_01H...", "criterion_id": "crit_01H...", "passed": true, "score": 1.0, "details": "Appointment resource matched; all 2 field assertions passed.", "evidence": { "field_results": [ { "path": "participant.0.actor.display", "expected": "Dr. Rivera", "actual": "Dr. Rivera", "passed": true } ] }, "started_at": "2026-04-20T17:10:02.000Z", "completed_at": "2026-04-20T17:10:04.000Z" } ``` The `evidence` shape depends on the criterion's check type. The [Verification concept page](/guides/concepts/verification#evidence-payloads) lists every shape. ## Scoring Every level applies the same arithmetic. * **Criterion score.** A number in `[0, 1]` returned by the check. * **Task score.** Weighted mean of the task's criterion scores: `sum(score_i * weight_i) / sum(weight_i)`. * **Axes.** Criteria that declare an `axis` (for example `correctness`, `safety`, `efficiency`) are grouped into per-axis weighted means and returned in the `axes` object. * **Benchmark run score.** Mean of task scores. **Verdict** is assigned at each level from the score: * `pass` when the score is `>= 0.9` * `partial` when it is above zero and below that threshold * `fail` when the score is zero or there are no criteria ## Scored vs Unscored Runs When a run is created with `scored: true`, the `POST /v1/task-runs/{id}/complete` response omits `details` and per-field evidence to avoid leaking the rubric to the agent. ```json theme={null} { "task_run_id": "tr_01H...", "phase": "completed", "verdict": "partial", "score": 0.66, "axes": { "correctness": { "score": 1.0, "weight": 2 } }, "checks": [ { "criterion_id": "crit_01H...", "label": "Appointment booked", "result": "pass", "score": 1.0, "axis": "correctness" } ] } ``` Full evidence is still written to the Criterion Run row. Fetch it later via `GET /criterion-runs/{id}` (as shown above) with an organization API key. ## Drill-Down Example A typical triage flow: start at the benchmark run, pick a failing task run, list its criterion runs, open the one you care about. ```bash theme={null} # 1. Read the benchmark run summary curl "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID" \ -H "Authorization: Bearer $RUN_TOKEN" # 2. List task runs for the benchmark run (internal) curl "https://api.verial.ai/task-runs?benchmark_run_id=$BENCHMARK_RUN_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" # 3. List criterion runs for a failing task run curl "https://api.verial.ai/criterion-runs?task_run_id=$TASK_RUN_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" # 4. Read a single criterion run with full evidence curl "https://api.verial.ai/criterion-runs/$CRITERION_RUN_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` ## Next Steps Read the raw evidence captured per protocol during a rollout. How the engine dispatches checks and builds the evidence payloads. # Quick Start Source: https://docs.verial.ai/guides/quickstart Run a published benchmark against your agent in 10 minutes using the v1 API. This walkthrough drives an external agent through a published Verial benchmark using the public `/v1` API. By the end you will have created a benchmark run, driven a task rollout, completed it, and read back per-criterion scores. ## Prerequisites * A Verial **Solver key**. Create a Solver in your organization's dashboard under **Solvers** and mint a key. Solver keys are Bearer tokens prefixed `vrl_slv_` and work across any benchmark your organization can run (your own benchmarks and any benchmark with `visibility=Public`). * The benchmark's reference: `slug@version` (for example `fax-referral@1`). * An HTTP client. Examples below use `curl`. ```bash theme={null} export VERIAL_SOLVER_KEY=vrl_slv_xxx export BENCHMARK_REF=fax-referral@1 ``` ## 1. Start a Benchmark Run `POST /v1/benchmark-runs` creates the run, provisions a playground (FHIR stores, leased phone numbers, portal state, SFTP drop, etc.), and returns a per-run bearer token plus URLs for driving each task run. ```bash theme={null} curl -X POST https://api.verial.ai/v1/benchmark-runs \ -H "Authorization: Bearer $VERIAL_SOLVER_KEY" \ -H "Content-Type: application/json" \ -d "{\"benchmark\": \"$BENCHMARK_REF\", \"scored\": false}" ``` Response (truncated): ```json theme={null} { "benchmark_run_id": "br_01H...", "benchmark": { "slug": "fax-referral", "version": "1", "name": "Fax referral intake" }, "scored": false, "phase": "created", "bearer_token": "vrl_run_...", "bearer_token_expires_at": "2026-04-21T17:00:00.000Z", "endpoints": { "files_inbox": "/v1/benchmark-runs/br_01H.../files/inbox", "hl7_outbound": "/v1/benchmark-runs/br_01H.../hl7/outbound" }, "task_runs": [ { "id": "tr_01H...", "task_id": "task_01H...", "name": "Process referral #1", "phase": "created", "start_url": "/v1/task-runs/tr_01H.../start", "complete_url": "/v1/task-runs/tr_01H.../complete" } ] } ``` Save `bearer_token`. All subsequent calls in this run authenticate with it as a Bearer token. ```bash theme={null} export RUN_TOKEN=vrl_run_... export BENCHMARK_RUN_ID=br_01H... export TASK_RUN_ID=tr_01H... ``` ## 2. Start the First Task Run Only one task run can be in phase `started` at a time per benchmark run. Start it explicitly: ```bash theme={null} curl -X POST "https://api.verial.ai/v1/task-runs/$TASK_RUN_ID/start" \ -H "Authorization: Bearer $RUN_TOKEN" ``` Starting a task run may execute its `scenario` (for example seeding an inbound fax into the SFTP inbox that your agent is expected to process). ## 3. Drive the Rollout Your agent now reads inputs from sandbox endpoints and writes its outputs back. All endpoints live under `/v1/benchmark-runs/{benchmark_run_id}/` and authenticate with the run bearer token. | Simulator | Endpoint pattern | | ------------ | ------------------------------------------------------------------------------------ | | FHIR | `ALL /v1/benchmark-runs/{id}/fhir/*` (transparent proxy to the sandbox FHIR store) | | HL7 | `GET /v1/benchmark-runs/{id}/hl7/inbox`, `POST /v1/benchmark-runs/{id}/hl7/outbound` | | Files (SFTP) | `GET /v1/benchmark-runs/{id}/files/inbox`, `GET /v1/benchmark-runs/{id}/files/*` | | Portal | `ALL /v1/benchmark-runs/{id}/portal/*` | Example: pull files from the sandbox inbox. ```bash theme={null} curl "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID/files/inbox" \ -H "Authorization: Bearer $RUN_TOKEN" ``` Example: send an HL7v2 ADT message as the agent's output. ```bash theme={null} curl -X POST "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID/hl7/outbound" \ -H "Authorization: Bearer $RUN_TOKEN" \ -H "Content-Type: application/json" \ -d '{"message": "MSH|^~\\&|...|ADT^A01|..."}' ``` Example: query the FHIR store. ```bash theme={null} curl "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID/fhir/Patient?identifier=BCB123456789" \ -H "Authorization: Bearer $RUN_TOKEN" ``` ## 4. Complete the Task Run When your agent has finished, tell Verial. The verification engine runs every [criterion](/guides/concepts/criteria) attached to the task against the final sandbox state and returns scores. ```bash theme={null} curl -X POST "https://api.verial.ai/v1/task-runs/$TASK_RUN_ID/complete" \ -H "Authorization: Bearer $RUN_TOKEN" ``` Response: ```json theme={null} { "task_run_id": "tr_01H...", "phase": "completed", "verdict": "partial", "score": 0.66, "axes": { "correctness": { "score": 1.0, "weight": 2 }, "safety": { "score": 0.0, "weight": 1 } }, "checks": [ { "criterion_id": "crit_01H...", "label": "Referral recorded with correct payer", "result": "pass", "score": 1.0, "axis": "correctness", "details": "portal_state_match passed on 1 assertion", "field_results": [ { "path": "payer", "expected": "BlueCross", "actual": "BlueCross", "passed": true } ] }, { "criterion_id": "crit_01H...", "label": "No PHI in outbound fax cover sheet", "result": "fail", "score": 0.0, "axis": "safety" } ] } ``` If you created the run with `scored: true`, `details` and `field_results` are omitted so the agent cannot learn the rubric from the response. Fetch the full evidence later via the internal `GET /criterion-runs/{id}` endpoint. ## 5. Run the Remaining Tasks Repeat steps 2 through 4 for each `task_run` in the response from step 1. The benchmark run finalizes automatically when the last task run completes. ## 6. Read the Final Benchmark Run ```bash theme={null} curl "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID" \ -H "Authorization: Bearer $RUN_TOKEN" ``` ```json theme={null} { "benchmark_run_id": "br_01H...", "benchmark": { "slug": "fax-referral", "version": "1", "name": "Fax referral intake" }, "scored": false, "phase": "completed", "status": "completed", "verdict": "partial", "score": 0.72, "task_runs": [ { "id": "tr_01H...", "phase": "completed", "status": "completed", "verdict": "pass", "score": 0.9 } ] } ``` ## Authoring a Benchmark If you are authoring a benchmark (rather than running one), use the internal API with an organization API key to: 1. Create an [Environment](/api-reference/resources/environments) and attach [Simulators](/api-reference/resources/simulators). 2. Create a [Benchmark](/api-reference/resources/benchmarks) referencing the environment. 3. Create [Tasks](/api-reference/resources/tasks) and attach [Criteria](/api-reference/resources/criteria) for each. 4. `POST /benchmarks/{id}/publish` to publish a slug\@version. 5. Set `visibility=Public` if you want other organizations' Solvers to run it, or keep it `Private` and share with your own Solvers. See the [Criteria concept page](/guides/concepts/criteria) for the six supported check types and the assertion specs they accept. ## Next Steps The full list of typed assertions the verification engine runs. Full endpoint reference for internal and v1 flows. Compose simulators into a reusable simulated environment. How task runs are scored after the rollout. # Web Simulator Quickstart Source: https://docs.verial.ai/guides/quickstart-web-sim Spin up a RadMD web portal sandbox and log in from a browser. By the end of this walkthrough you will have a live RadMD sandbox, a username and password minted for it, and a Playwright script that logs in and lands on the authenticated dashboard. No environment or benchmark required. ## Prerequisites * An organization API key. Create one in your organization's dashboard under **API Keys**. Keys are prefixed `vrl_` and sent as `Authorization: Bearer `. * Node.js 20+ (for the Playwright example). Python users can adapt the snippet to `playwright` for Python. ```bash theme={null} export VERIAL_API_KEY=vrl_xxx ``` ## 1. Create a Web Simulator Create a simulator with `type: "Payer"` and pick a portal slug from the [catalog](/guides/simulators/web-portal#portal-catalog) (`radmd` or `covermymeds`). ```bash theme={null} curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "Payer", "name": "RadMD Sandbox", "config": { "portal": "radmd", "default_determination": { "status": "approved" } } }' ``` Response: ```json theme={null} { "id": "sim_01H...", "type": "Payer", "name": "RadMD Sandbox", "config": { "portal": "radmd", "default_determination": { "status": "approved" } }, "created_at": "2026-04-23T17:00:00.000Z" } ``` ```bash theme={null} export SIMULATOR_ID=sim_01H... ``` ## 2. Create a Sandbox Provision a live instance from the simulator. Verial mints a fresh username + password bound to this sandbox. ```bash theme={null} curl -X POST https://api.verial.ai/sandboxes \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d "{ \"simulator_id\": \"$SIMULATOR_ID\" }" ``` ## 3. Read the Credentials Fetch the sandbox to pull the portal URL and login. ```bash theme={null} curl "https://api.verial.ai/sandboxes/$SANDBOX_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` Response (truncated): ```json theme={null} { "id": "sbx_01H...", "simulator_id": "sim_01H...", "status": "active", "credentials": { "portal_url": "https://radmd.sim.verial.ai", "username": "provider_a1b2c3", "password": "Kq7!mZxP9vRnT2wL", "api_url": "https://api.verial.ai/sandboxes/sbx_01H.../web-sim/payer" } } ``` ```bash theme={null} export SANDBOX_ID=sbx_01H... export PORTAL_URL=https://radmd.sim.verial.ai export PORTAL_USERNAME=provider_a1b2c3 export PORTAL_PASSWORD='Kq7!mZxP9vRnT2wL' ``` ## 4. Log In with Playwright ```bash theme={null} npm install playwright npx playwright install chromium ``` ```typescript theme={null} // login.ts import { chromium } from 'playwright' const portalUrl = process.env.PORTAL_URL! const username = process.env.PORTAL_USERNAME! const password = process.env.PORTAL_PASSWORD! const browser = await chromium.launch({ headless: false }) const page = await browser.newPage() await page.goto(portalUrl) await page.getByLabel(/username/i).fill(username) await page.getByLabel(/password/i).fill(password) await page.getByRole('button', { name: /sign ?in|log ?in/i }).click() await page.waitForURL((url) => !url.pathname.endsWith('/login')) console.log('logged in, url:', page.url()) // await browser.close() ``` Run it: ```bash theme={null} npx tsx login.ts ``` The page will land on the portal's authenticated landing route. From here your agent can drive the rest of the workflow (patient search, prior auth submission, etc.) using the same DOM selectors as the real vendor portal. ## 5. Verify State via the API Any action taken in the browser updates sandbox state. Read it back through the REST API at the `api_url` from step 3, using your organization API key: ```bash theme={null} curl "$API_URL/patients?name=Smith" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` ## 6. Tear Down ```bash theme={null} curl -X POST "https://api.verial.ai/sandboxes/$SANDBOX_ID/teardown" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` The username and password are invalidated immediately; interaction events persist. ## Next Steps The supported portals and their config options. Compose web simulators into scored benchmarks. # Running a Benchmark Source: https://docs.verial.ai/guides/running-a-benchmark Browse published benchmarks, drive your agent through a rollout, and compare runs over time. This guide is for teams running published Verial benchmarks against their own agent. If you are authoring a benchmark instead, see [Authoring a Benchmark](/guides/authoring-a-benchmark). ## Find a Benchmark to Run Published benchmarks have a `slug` and an integer `version`. The reference passed to `POST /v1/benchmark-runs` is `slug@version` (for example `fax-referral@1`). Your Solver can run: * Any benchmark in its own organization. * Any benchmark marked `visibility=Public`. List benchmarks visible to your organization with an [organization API key](/api-reference/authentication): ```bash theme={null} curl "https://api.verial.ai/benchmarks" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` The list endpoint supports `cursor` and `limit` for pagination. Filter by `published` status and `visibility` client-side on the returned rows (each benchmark carries `published: boolean` and `visibility: "Public" | "Private"`). Public benchmarks are discoverable and runnable by any organization's Solver. Private benchmarks (the default) are only runnable by Solvers in the owning organization. ### Picking a Version A benchmark version is an immutable snapshot. Publishing `version: 2` leaves `version: 1` addressable forever so old runs remain reproducible. Pin your CI and production monitoring to a specific version and bump deliberately. ## Set Up a Solver You run benchmarks as a **Solver**, a per-organization agent identity that hosts Solver keys (`vrl_slv_*`). Each Solver represents one agent (name, description, agent version). See [Solver Keys](/guides/solver-keys) for the full setup and key lifecycle. ```bash theme={null} export VERIAL_SOLVER_KEY=vrl_slv_xxx export BENCHMARK_REF=fax-referral@1 ``` ## Drive a Run The end-to-end flow is covered step by step in the [Quick Start](/guides/quickstart). In summary: 1. **`POST /v1/benchmark-runs`** with your Solver key returns a run-scoped bearer token, a list of task-run URLs, and the base URLs for each sandbox endpoint (FHIR, HL7, files, portal). 2. For each task, **`POST /v1/task-runs/{id}/start`**, then drive the sandbox endpoints with the run-scoped bearer token. 3. **`POST /v1/task-runs/{id}/complete`** when your agent is done. The verification engine runs every criterion against the final sandbox state and returns per-criterion scores. 4. The benchmark run finalizes automatically when the last task run completes. Read it with **`GET /v1/benchmark-runs/{id}`**. Only one task run can be in phase `started` at a time per benchmark run. Start the next task explicitly after completing the previous one. ## Read the Results The completion response for a task run and the final benchmark run both carry: * `verdict`: `pass` if the aggregate score is `>= 0.9`, `fail` if the score is `0`, otherwise `partial`. * `score`: weighted mean across criteria (task level) or mean of task scores (benchmark level). Range `[0, 1]`. * `axes`: per-axis scores when criteria declare an `axis` like `correctness`, `safety`, or `efficiency`. * `checks` (task level): one entry per criterion with `criterion_id`, `label`, `result` (`pass` / `fail`), `score`, and `axis`. Drill into a single criterion for full evidence: ```bash theme={null} curl "https://api.verial.ai/criterion-runs/$CRITERION_RUN_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` See [Run Results](/guides/observability/run-results) for the full traversal, and [Interactions](/guides/observability/interactions) for the raw protocol evidence (FHIR calls, HL7 messages, voice transcripts, fax documents). ## Scored vs Unscored Runs Pass `scored: true` when creating the run and Verial withholds `details` and per-field evidence from the completion response. The agent still gets `pass` / `fail` per criterion and the aggregate score, but cannot learn the rubric. Use `scored: true` for: * CI regression gates (your agent must not memorize assertions between runs). * Leaderboard submissions. * Any run whose numbers you want to compare across agent versions. Use `scored: false` (the default) for interactive development where you want the full evidence payload inline. Full evidence is always retrievable from `GET /criterion-runs/{id}` with an organization API key. ## Comparing Runs Each benchmark run is independent. Run the same benchmark `N` times and compare the distribution of scores across runs to catch regressions or measure improvements. A useful pattern: * Run `scored: true` on every pull request (see [GitHub Actions](/guides/github-actions)). * Store the run IDs and scores in your CI artifacts. * Plot score over time per agent version to watch for drift from upstream model or tool changes. The benchmark run object carries `score`, `verdict`, `started_at`, `completed_at`, and `agent` (an optional identifier you pass when creating the run). That is usually enough to build a simple regression dashboard on top. ## Troubleshooting **Task run timeout.** If the task run exceeds the benchmark's configured `timeout`, it is recorded with `verdict: "fail"` and `score: 0`, and the benchmark run continues with the next task. Tune the benchmark timeout at authoring time. **Partial verdict.** A task or benchmark run with `verdict: "partial"` scored above zero but below the `pass` threshold. Read the `checks` array and the per-axis scores to see which criteria passed and which failed. **Single-active-task-run limit.** The v1 flow allows only one task run in phase `started` at a time. If your agent tries to start a second task run before completing the first, the request is rejected. Start tasks sequentially unless the benchmark explicitly sets `concurrency > 1`. **Run bearer token expiry.** The run-scoped bearer token (`vrl_run_*`) returned by `POST /v1/benchmark-runs` expires. Persist it in memory for the lifetime of the rollout and discard it once the run completes. See `bearer_token_expires_at` on the create response. ## Next Steps End-to-end walkthrough with curl, start to finish. Create, rotate, and understand the scope of a Solver key. Read a completed run top-down with full evidence. Wire a benchmark into CI and gate pull requests on the score. # Scheduled Runs Source: https://docs.verial.ai/guides/scheduled-runs Re-run a benchmark on a cadence to catch regressions from upstream model or tool changes. Scheduled runs let a team re-execute the same benchmark on a fixed cadence (daily, weekly) without any human trigger. That is how you catch regressions caused by upstream changes, like a model provider shipping a new point release or a tool dependency changing behavior, that would otherwise only surface the next time a human happened to run the benchmark. Native scheduled runs are on the roadmap. In the meantime, use any cron-based workflow runner (GitHub Actions, Cloud Scheduler, Temporal, BullMQ, etc.) to call `POST /v1/benchmark-runs` on a cadence with your Solver key. ## Interim: GitHub Actions GitHub Actions exposes a `schedule` trigger that uses cron syntax. Reuse the workflow from [Run a Benchmark in GitHub Actions](/guides/github-actions) and add a `schedule` trigger alongside `pull_request`: ```yaml theme={null} on: pull_request: workflow_dispatch: schedule: - cron: "0 8 * * 1" # every Monday at 08:00 UTC ``` Every scheduled run goes through the same code path as a pull-request run, so the score, verdict, and evidence are directly comparable across cadences. Pair the scheduled run with a [webhook](/guides/webhooks) subscription on `benchmark_run.completed` to page the on-call when the score drops below threshold. ## Planned Behavior The planned native feature will let you, from the dashboard or API: * Pin a Solver, benchmark `slug@version`, and cadence (daily / weekly / cron). * Automatically compare each scheduled run to the previous run and surface regressions. * Optionally hold the run for manual review instead of auto-completing. Until that ships, the cron + webhook pattern above covers the same shape of workflow. ## Next Steps Get paged when a scheduled run completes with a dropped score. The current recommended way to schedule Verial runs. # CDS Hooks Source: https://docs.verial.ai/guides/simulators/cds-hooks Clinical Decision Support Hooks registration, invocation, and feedback. The CDS Hooks simulator stands in for the EHR side of the [CDS Hooks](https://cds-hooks.hl7.org/) specification. It lets you register a CDS service, invoke hooks with a simulated clinical context (`patient-view`, `order-select`, `medication-prescribe`, etc.), and record user feedback on the cards that come back. Use it to benchmark agents that either *consume* CDS cards surfaced in a provider workflow or *produce* cards as a CDS service reacting to EHR activity. ## How your agent connects The CDS sandbox exposes a CDS Hooks-style surface on the direct-service path. Register CDS services via discovery, invoke hooks, and submit feedback; all traffic is recorded as interaction evidence and correlates with the sandbox's FHIR resources. CDS Hooks endpoints are not currently mounted on the run-scoped `/v1/benchmark-runs/{id}/cds/*` surface. During a benchmark run, resolve the CDS sandbox from the `sandboxes` list on the run response and call the direct `/sandboxes/{id}/cds/*` endpoints with an organization API key. ## Endpoints | Method | Endpoint | Description | | ------ | ------------------------------------------ | ------------------------------------------------------------------------------------------------------ | | `POST` | `/sandboxes/{sandbox_id}/cds/services` | Register CDS services by pointing to a discovery URL | | `GET` | `/sandboxes/{sandbox_id}/cds/services` | List CDS services currently registered with the sandbox | | `POST` | `/sandboxes/{sandbox_id}/cds/hooks/{hook}` | Fire a hook (e.g. `patient-view`, `order-select`) with a simulated context; returns the cards produced | | `POST` | `/sandboxes/{sandbox_id}/cds/feedback` | Record user feedback on a CDS card (accepted, overridden, ignored) | See [Register CDS service](/api-reference/cds/register), [List CDS services](/api-reference/cds/list), [Invoke CDS hook](/api-reference/cds/invoke), and [Submit CDS feedback](/api-reference/cds/feedback). ## Driving the rollout Register CDS services by pointing at a discovery URL (CDS Hooks publishes a `/cds-services` endpoint per vendor): ```bash theme={null} curl -X POST "https://api.verial.ai/sandboxes/$CDS_SANDBOX_ID/cds/services" \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "discovery_url": "https://cds.example.com/cds-services" }' ``` Fire a hook (body fields are flat, snake\_case): ```bash theme={null} curl -X POST "https://api.verial.ai/sandboxes/$CDS_SANDBOX_ID/cds/hooks/patient-view" \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "patient_id": "patient-123", "user_id": "Practitioner/rivera", "encounter_id": "encounter-456" }' ``` Record feedback on a card the agent decided to act on: ```bash theme={null} curl -X POST "https://api.verial.ai/sandboxes/$CDS_SANDBOX_ID/cds/feedback" \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "service_id": "drug-interaction-check", "card_uuid": "card_01H...", "outcome": "accepted", "accepted_suggestions": ["suggestion-1"] }' ``` ## Configuration At create time you configure the hooks the sandbox will advertise and, optionally, canned cards the sandbox will return when a hook is invoked. ```bash theme={null} curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "CdsHooks", "name": "EHR CDS Surface", "config": { "hooks": ["patient-view", "order-select", "medication-prescribe"] } }' ``` ## Verification There is no dedicated CDS Hooks check type in the current criterion catalog. CDS evidence is scored in two ways: * **Interaction evidence.** Every service registration, hook invocation, and feedback submission is logged as an interaction. The request context, returned cards, and feedback outcomes are attached to criterion-run evidence. * **Cross-simulator criteria.** When a CDS card leads to a change in FHIR (for example the agent accepts a `create-medication` suggestion), use `fhir-resource-state` on the resulting resource to score the outcome. When it leads to a portal action, use `portal-state-match`. ## Next Steps CDS context objects reference FHIR resources; pair this simulator with a FHIR simulator. Direct-access CDS Hooks endpoints for authoring. The assertions the verification engine currently supports. Lifecycle, provisioning, and configuration patterns. # Fax Source: https://docs.verial.ai/guides/simulators/fax Simulated fax numbers for inbound and outbound documents with OCR evidence. The fax simulator stands in for a healthcare fax line: the workhorse of referral intake, prior-auth cover sheets, and records exchange. Each sandbox gets a fax number your agent can send documents to (PDF or TIFF), and the simulator can also deliver inbound faxes into the sandbox's inbox. Every submitted document is OCR'd and preserved as interaction evidence. ## How your agent connects The fax sandbox's `credentials` payload includes a `fax_number` your agent sends documents to. Your agent submits faxes via `POST /sandboxes/{sandbox_id}/faxes` on the direct-service surface and can retrieve metadata plus rendered content via `GET /sandboxes/{sandbox_id}/faxes/{fax_id}`. Inbound faxes seeded by task scenarios are recorded as sandbox events. The fax simulator is not currently mounted on the run-scoped `/v1/benchmark-runs/{id}/fax/*` surface. During a benchmark run, resolve the fax sandbox from the `sandboxes` list on the run response and call the direct `/sandboxes/{id}/faxes` endpoints with an organization API key. ## Endpoints | Method | Endpoint | Description | | ------ | ---------------------------------------- | ------------------------------------------------ | | `POST` | `/sandboxes/{sandbox_id}/faxes` | Submit a fax to the simulated fax line | | `GET` | `/sandboxes/{sandbox_id}/faxes/{fax_id}` | Retrieve metadata for a previously submitted fax | See [Send fax](/api-reference/fax/send) and [Get fax](/api-reference/fax/get) for the full request/response reference. ## Driving the rollout Send a fax (for example a referral response): ```bash theme={null} curl -X POST "https://api.verial.ai/sandboxes/$FAX_SANDBOX_ID/faxes" \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "patient_id": "patient-123", "to_number": "+15555551234", "document_type": "referral", "content_reference": "doc-ref-abc" }' ``` Retrieve a submission: ```bash theme={null} curl "https://api.verial.ai/sandboxes/$FAX_SANDBOX_ID/faxes/fax_01H..." \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` The response includes delivery status, OCR'd text, and references to the rendered pages. ## Configuration The fax simulator has no required configuration at create time. Inbound fax documents are typically seeded by the dataset or by task scenarios that drop faxes into the inbox before a task run starts. ```bash theme={null} curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "Fax", "name": "Referral Fax Line"}' ``` For tasks that expect a specific document shape (e.g. a cover sheet with header fields), Verial can render documents from a `DocumentSpec` description. See the generic document rendering helper in `services/pdf.ts` (title, header fields, sections) for how the platform constructs inbound faxes. ## Verification There is no dedicated fax check type in the current criterion catalog. Fax evidence is scored in two ways: * **Interaction evidence.** Every fax submitted or received is logged as an interaction. OCR'd text is attached as evidence you can inspect on a criterion run or through the interaction log. * **Cross-simulator criteria.** If the fax's contents are expected to flow into another system (for example the agent transcribes a referral fax and posts a FHIR ServiceRequest), the `fhir-resource-state` criterion on that downstream resource is what scores correctness. Dedicated fax-content assertions (regex on OCR, field extraction) are on the roadmap. Until then, route fax content to another simulator your criterion can read. ## Next Steps The assertions the verification engine currently supports. Direct-access fax endpoints for authoring. For structured document drops, prefer the SFTP simulator with `sftp-file-present`. Lifecycle, provisioning, and configuration patterns. # FHIR Source: https://docs.verial.ai/guides/simulators/fhir A fully functional FHIR R4 EHR backed by GCP Healthcare API, with SMART on FHIR auth. The FHIR simulator is a fully functional FHIR R4 server backed by Google Cloud Healthcare API. It stands in for an EHR like Epic, Cerner, or Athena. Your agent authenticates with SMART on FHIR client credentials, reads and writes resources (Patient, Condition, MedicationRequest, Encounter, Observation, Appointment, DiagnosticReport, AllergyIntolerance, Procedure, and more), and the verification engine reads the final store to score `fhir-resource-state` criteria. ## How your agent connects When a benchmark run is created, the response includes the FHIR sandbox's base URL under `endpoints.fhir` (or equivalent). All FHIR traffic is proxied through `/v1/benchmark-runs/{benchmark_run_id}/fhir/*` and authenticated with the run-scoped bearer token. During playground authoring, the sandbox also exposes direct endpoints at `/services/{service_id}/fhir/*` for local testing. Under the hood the sandbox is a dedicated FHIR store (one per playground) seeded with the linked dataset's patients, conditions, medications, encounters, and related resources. ## Endpoints | Method | Endpoint | Description | | ------ | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | `ALL` | `/v1/benchmark-runs/{id}/fhir/*` | Transparent proxy to the sandbox FHIR store (search, read, create, update, transaction bundles). Authenticated by the run-scoped bearer token. | The v1 proxy handles authentication for you, so you do not need to fetch a separate SMART token to call FHIR endpoints during a benchmark run. During playground authoring, the direct service at `/services/{service_id}/fhir/*` also exposes SMART on FHIR discovery and token issuance at `/services/{service_id}/fhir/.well-known/smart-configuration` and `/services/{service_id}/fhir/token`. See the [SMART configuration](/api-reference/fhir/smart-config) and [FHIR token](/api-reference/fhir/token) reference pages. ## Driving the rollout Use the proxied FHIR endpoints with the run token. Search for a patient: ```bash theme={null} curl "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID/fhir/Patient?identifier=BCB123456789" \ -H "Authorization: Bearer $RUN_TOKEN" ``` Create an appointment: ```bash theme={null} curl -X POST "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID/fhir/Appointment" \ -H "Authorization: Bearer $RUN_TOKEN" \ -H "Content-Type: application/fhir+json" \ -d '{ "resourceType": "Appointment", "status": "booked", "participant": [ { "actor": { "reference": "Patient/john-smith" }, "status": "accepted" }, { "actor": { "display": "Dr. Rivera" }, "status": "accepted" } ] }' ``` ## Configuration The FHIR simulator accepts minimal configuration at create time. The interesting shape of the simulator comes from the [FHIR dataset](/guides/concepts/datasets) linked to it, which defines the patients, encounters, and clinical history that get seeded into the store. ```bash theme={null} curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "Fhir", "name": "Primary EHR"}' ``` To seed the simulator with realistic clinical data, create a [FHIR dataset](/guides/concepts/datasets) and link it via the sandbox: `POST /sandboxes/{id}/datasets/{dataset_id}`. ## Verification The `fhir-resource-state` check reads the FHIR store after the rollout and asserts that a search returns resources with expected field values. See the [Criteria concept page](/guides/concepts/criteria#fhir-appointment-booked) for the full spec. ```json theme={null} { "label": "Follow-up appointment booked with Dr. Rivera", "weight": 1.0, "axis": "correctness", "assertion": { "assert": "fhir-resource-state", "resource_type": "Appointment", "search": { "patient": "Patient/john-smith", "status": "booked" }, "fields": [ { "path": "participant.0.actor.display", "expected": "Dr. Rivera" } ] } } ``` ## Next Steps The full list of typed assertions the verification engine supports. How simulators compose into environments and provision into sandboxes. SMART configuration, token issuance, and FHIR request shapes. Seed realistic patient data into the FHIR store. # Files (SFTP) Source: https://docs.verial.ai/guides/simulators/files-sftp SFTP-style file drops for batch intake and outbound deliveries. The Files simulator stands in for the SFTP drops that payers, clearinghouses, and health information exchanges use to exchange batched documents: claim files, 837/835 batches, lab result packets, referral PDFs, eligibility rosters. Your agent reads inbound files out of an inbox and writes outbound files to a delivery path. The verification engine scores `sftp-file-present` criteria against the final file tree. ## How your agent connects The Files sandbox is exposed over HTTP under the benchmark-run path. All reads and writes happen through `/v1/benchmark-runs/{id}/files/*`. The sandbox is seeded by the linked [Files dataset](/guides/concepts/datasets), which stores the actual files in GCS under `datasets/{datasetId}/files/`. When the sandbox is branched from the dataset, a copy of the files is made available to the sandbox. ## Endpoints | Method | Endpoint | Description | | ------ | -------------------------------------- | ----------------------------------------- | | `GET` | `/v1/benchmark-runs/{id}/files/inbox` | List files in the sandbox inbox | | `GET` | `/v1/benchmark-runs/{id}/files/{path}` | Download a specific file by relative path | Paths mirror the directory layout a real SFTP drop would have, for example `inbox/referrals/`, `outbound/claims/`, `archive/`. The run-scoped v1 files surface is read-only today. Writing outbound files from the agent (PUT/DELETE) is not yet wired on `/v1/benchmark-runs/{id}/files/*`. When the rollout needs to stage a file for a criterion to read, use a scenario step like `drop_file_inbox` to seed content before the agent starts. ## Driving the rollout List the inbox: ```bash theme={null} curl "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID/files/inbox" \ -H "Authorization: Bearer $RUN_TOKEN" ``` Download a specific file: ```bash theme={null} curl "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID/files/inbox/referrals/2026-04-23-referral.pdf" \ -H "Authorization: Bearer $RUN_TOKEN" \ --output referral.pdf ``` ## Configuration The Files simulator is configured by its linked dataset's manifest. The dataset's manifest describes the initial file tree; at provisioning time, the sandbox branches a copy of the dataset's files so mutations made during the rollout don't affect the original. ```bash theme={null} curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "Sftp", "name": "Payer SFTP Drop"}' ``` The accompanying dataset defines the directory layout and seeded contents. See [Datasets](/guides/concepts/datasets) for the manifest shape. ## Verification The `sftp-file-present` check asserts that at least one file matches a glob pattern in the final file tree, optionally parsing it as JSON and asserting on field values. ```json theme={null} { "label": "Claim file written to outbound/", "weight": 1.0, "assertion": { "assert": "sftp-file-present", "path_pattern": "outbound/claims/*.json", "parse_json": true, "fields": [ { "path": "claim.patient.member_id", "expected": "BCB123456789" }, { "path": "claim.total_charges", "expected": 420.00 } ] } } ``` See the [Criteria concept page](/guides/concepts/criteria#sftp-claim-file-uploaded) for the full assertion spec. ## Next Steps Full reference for `sftp-file-present` assertions. How file manifests seed the Files sandbox. Lifecycle, provisioning, and configuration patterns. File-system branching and checkpoints. # HL7 Source: https://docs.verial.ai/guides/simulators/hl7 HL7v2 messaging for ADT, ORU, ORM, and SIU feeds. The HL7 simulator accepts and produces HL7 v2 messages, the legacy messaging standard that still powers most hospital interfaces for patient movement, lab results, orders, and scheduling. Your agent reads inbound HL7 messages out of a sandbox inbox and writes outbound messages back, and the verification engine scores the outbound traffic with `hl7-structural` criteria. ## How your agent connects The HL7 sandbox exposes a message inbox (pre-seeded with any messages the task scenario set up) and an outbound endpoint for messages your agent emits. Both are reached via HTTP under the benchmark-run path and authenticated with the run-scoped bearer token. The payload is the raw HL7v2 pipe-delimited message as a string. Supported message types: * **ADT** (Admit/Discharge/Transfer) for patient movement * **ORU** (Observation Result) for lab results * **ORM** (Order Message) for orders * **SIU** (Scheduling Information Unsolicited) for appointment scheduling ## Endpoints | Method | Endpoint | Description | | ------ | -------------------------------------- | ----------------------------------------------------- | | `GET` | `/v1/benchmark-runs/{id}/hl7/inbox` | Read inbound HL7 messages seeded by the task scenario | | `POST` | `/v1/benchmark-runs/{id}/hl7/outbound` | Submit an outbound HL7 message; returns an HL7 ACK | During authoring, the same semantics are exposed at `/services/{service_id}/hl7/messages` (see [Send HL7 message](/api-reference/hl7/send)). ## Driving the rollout Fetch the inbox: ```bash theme={null} curl "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID/hl7/inbox" \ -H "Authorization: Bearer $RUN_TOKEN" ``` Send an ADT^A01 admission message: ```bash theme={null} curl -X POST "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID/hl7/outbound" \ -H "Authorization: Bearer $RUN_TOKEN" \ -H "Content-Type: application/json" \ -d '{"payload": "MSH|^~\\&|VERIAL|AGENT|EHR|FACILITY|20260423||ADT^A01|12345|P|2.5\rPID|1||12345^^^MRN||Smith^John||19650315|M\rPV1|1|I|ICU^101^A"}' ``` The response contains an HL7 ACK (`MSA|AA|12345`) when the message is accepted. Rejected messages return `MSA|AE` or `MSA|AR` with a reason. ## Configuration The HL7 simulator has no required configuration at create time. Inbound traffic is driven by the dataset or by task scenarios that seed messages into the inbox before a task run starts. ```bash theme={null} curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "Hl7", "name": "Lab Feed"}' ``` ## Verification The `hl7-structural` check parses each outbound HL7 message, correlates by MSH fields or trigger event, and asserts on segment values by path. ```json theme={null} { "label": "ADT^A01 admission message sent for correct patient", "weight": 1.0, "assertion": { "assert": "hl7-structural", "correlate_by": { "MSH.9.1": "ADT", "MSH.9.2": "A01" }, "fields": [ { "path": "PID.5.1", "expected": "Smith" }, { "path": "PV1.2", "expected": "I" } ] } } ``` See the [Criteria concept page](/guides/concepts/criteria#hl7-adt-sent) for more examples and the full assertion spec. ## Next Steps Pair HL7 ADT flows with a FHIR EHR for end-to-end admission testing. Full reference for `hl7-structural` assertions. Direct-access HL7 send endpoint for authoring. Lifecycle, provisioning, and configuration patterns. # Messages Source: https://docs.verial.ai/guides/simulators/messages Conversational messaging with patient personas or portal chat agents. The Messages simulator stands in for conversational messaging endpoints in healthcare: SMS appointment reminders, patient-facing chat, portal inbox messages, follow-up outreach. Your agent sends messages to the simulator, the simulator replies as the configured persona (a patient, a front-desk agent, a nurse line), and the full exchange is captured as interaction evidence. ## How your agent connects Every message exchange is mediated by HTTP on the direct-service surface. The simulator is stateful per sandbox: earlier messages are available via the list endpoint, and each send records the outbound message for later evidence. The Message simulator is not currently mounted on the run-scoped `/v1/benchmark-runs/{id}/messages/*` surface. During a benchmark run, resolve the Message sandbox from the `sandboxes` list on the run response and call the direct `/sandboxes/{id}/messages` endpoints with an organization API key. ## Endpoints | Method | Endpoint | Description | | ------ | ----------------------------------------------- | -------------------------------------------------------------------------------------- | | `POST` | `/sandboxes/{sandbox_id}/messages` | Send a message (SMS or email) to a patient | | `GET` | `/sandboxes/{sandbox_id}/messages` | List messages for this sandbox (optional `patient_id`, `channel`, `direction` filters) | | `GET` | `/sandboxes/{sandbox_id}/messages/{message_id}` | Retrieve a specific message | See [Send message](/api-reference/messages/send), [List messages](/api-reference/messages/list), and [Get message](/api-reference/messages/get). ## Driving the rollout Send an outbound message (direct-service path): ```bash theme={null} curl -X POST "https://api.verial.ai/sandboxes/$MESSAGE_SANDBOX_ID/messages" \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "channel": "sms", "patient_id": "patient-123", "body": "Hi John, this is a reminder of your follow-up appointment on Friday at 10am. Reply YES to confirm." }' ``` Response (single message record): ```json theme={null} { "id": "msg_01H...", "channel": "sms", "patient_id": "patient-123", "direction": "outbound", "status": "delivered", "to": "+15551234567", "body": "Hi John, ...", "sent_at": "2026-04-23T17:00:00.000Z", "delivered_at": "2026-04-23T17:00:00.000Z" } ``` List the conversation so far: ```bash theme={null} curl "https://api.verial.ai/sandboxes/$MESSAGE_SANDBOX_ID/messages?patient_id=patient-123" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` ## Configuration At create time you configure the persona the simulator should speak as and any scripted behavior (required disclosures, topics the persona will or won't discuss). ```bash theme={null} curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d @- <<'JSON' { "type": "Message", "name": "Patient Reminder Line", "config": { "persona": { "role": "patient", "name": "John Smith", "traits": ["hard_of_hearing", "prefers_text_messages"] }, "constraints": [ "Will only confirm appointment if the agent correctly references the provider name." ] } } JSON ``` ## Verification There is no dedicated messages check type in the current criterion catalog. Messaging evidence is scored in two ways: * **Interaction evidence.** Every message sent and received is logged as an interaction. The full conversation is attached to criterion-run evidence for review. * **Cross-simulator criteria.** If the messaging exchange is expected to produce downstream state (for example the patient confirms an appointment, which should appear as a confirmed FHIR Appointment), the `fhir-resource-state` or `portal-state-match` criterion on that downstream resource is what scores correctness. For transcript-style phrase assertions analogous to `voice-transcript`, prefer the voice simulator until a dedicated message-transcript check ships. ## Next Steps For voice-native conversations with `voice-transcript` assertions. Direct-access messaging endpoints for authoring. How message history and other evidence are recorded. Lifecycle, provisioning, and configuration patterns. # Simulators Source: https://docs.verial.ai/guides/simulators/overview Simulated healthcare interfaces your agent connects to. A simulator is a reusable definition of a simulated healthcare interface. Each simulator speaks one protocol (FHIR, HL7v2, X12, voice, fax, web portal, SFTP, messaging, CDS Hooks) and composes into an [environment](/guides/concepts/environments) alongside other simulators. When a [playground](/guides/concepts/playgrounds) is created or a [benchmark run](/guides/concepts/runs) starts, every linked simulator is provisioned as a live **sandbox** with real credentials. Your agent drives those sandboxes during the rollout, and the [verification engine](/guides/concepts/verification) reads the final sandbox state to score [criteria](/guides/concepts/criteria). ## Protocol matrix | Simulator | Protocol | Production equivalent | Agent connects via | Verification check | | --------------------------------------------- | ----------------------------- | ----------------------------------------- | ------------------------------------------------------- | -------------------------- | | [FHIR](/guides/simulators/fhir) | REST (FHIR R4) | Epic, Cerner, Athena EHR | `/v1/benchmark-runs/{id}/fhir/*` with SMART token | `fhir-resource-state` | | [HL7](/guides/simulators/hl7) | HL7v2 | Lab and ADT feeds | `/v1/benchmark-runs/{id}/hl7/inbox` and `/hl7/outbound` | `hl7-structural` | | [X12](/guides/simulators/x12) | X12 EDI (270/271/276/277/278) | Change Healthcare, Availity clearinghouse | Clearinghouse endpoints on the sandbox | `x12-response` | | [Voice](/guides/simulators/voice) | Phone / IVR | Member services phone line | Leased phone number | `voice-transcript` | | [Fax](/guides/simulators/fax) | Fax (PDF/TIFF) | Referral intake, prior auth cover sheets | Fax number on the sandbox, `POST /faxes` | Interaction evidence (OCR) | | [Web Portal](/guides/simulators/web-portal) | HTTPS UI + REST | RadMD, CoverMyMeds | Portal URL + username/password, `api_url` | `portal-state-match` | | [Files (SFTP)](/guides/simulators/files-sftp) | SFTP (files API) | Payer SFTP drop, claims batch | `/v1/benchmark-runs/{id}/files/*` | `sftp-file-present` | | [Messages](/guides/simulators/messages) | REST (SMS / chat) | Appointment reminders, patient outreach | `/messages` REST endpoints | Interaction evidence | | [CDS Hooks](/guides/simulators/cds-hooks) | REST (CDS Hooks 1.1) | EHR decision support surfaces | `/cds/*` endpoints on the sandbox | Interaction evidence | Each row's verification check is documented alongside its peers on the [Criteria](/guides/concepts/criteria) page. ## Lifecycle ```mermaid theme={null} graph LR S["Simulator
(created)"]:::state --> L["Linked to
Environment"]:::state L --> B["Sandbox
(provisioned on run)"]:::state B --> A["Agent drives
rollout"]:::state A --> T["Torn down
(evidence retained)"]:::state classDef state fill:#2563eb,color:#fff,stroke:#1d4ed8 ``` 1. **Create** the simulator once, configure it (e.g. portal flavor, IVR flow, determination rules). 2. **Link** it to one or more environments. Environments compose simulators plus [datasets](/guides/concepts/datasets). 3. **Provision** a sandbox when a playground is created or a benchmark run starts. The sandbox gets its own credentials, isolated state, and evidence stream. 4. **Drive** the sandbox from your agent using the `/v1/benchmark-runs/{id}/` endpoints (or the direct sandbox endpoints during authoring). 5. **Tear down** at the end of the run. The sandbox stops accepting traffic, but all recorded [interactions](/guides/concepts/interactions) remain for review and verification. ## Creating and linking Simulators are standalone resources that you link to environments. Configuration is set at create time and can be updated until the simulator is provisioned: ```bash theme={null} # Create the FHIR simulator curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "Fhir", "name": "Primary EHR"}' # → save the returned id as $FHIR_SIMULATOR_ID # Create the payer portal simulator curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "Payer", "name": "RadMD Sandbox", "config": { "portal": "radmd", "default_determination": { "status": "approved" } } }' # → save the returned id as $PORTAL_SIMULATOR_ID # Create the environment (environments are also available via the SDK as verial.environments.create) curl -X POST https://api.verial.ai/environments \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"name": "Regional Medical Center"}' # → save the returned id as $ENVIRONMENT_ID # Link the simulators to the environment curl -X POST "https://api.verial.ai/environments/$ENVIRONMENT_ID/simulators/$FHIR_SIMULATOR_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" curl -X POST "https://api.verial.ai/environments/$ENVIRONMENT_ID/simulators/$PORTAL_SIMULATOR_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` See the [Simulators API reference](/api-reference/resources/simulators) for the full list of supported types and config fields. ## Provisioning When a playground or benchmark run starts, Verial walks the environment's simulator list and provisions each one: * **Allocate resources.** FHIR stores are created in GCP Healthcare, phone numbers are leased from the voice pool, SFTP drops are initialized, portal logins are minted, CDS Hooks endpoints are registered. * **Load datasets.** Any datasets linked to the simulator are seeded into the fresh sandbox (patients into FHIR, files into SFTP, determination rules into the portal). * **Return credentials.** The benchmark-run response includes a `endpoints` map (for path-routed simulators) and, where applicable, each sandbox's `credentials` payload (phone numbers, portal URLs, usernames, fax numbers). * **Record interactions.** Every request to the sandbox is captured as evidence. Voice calls produce transcripts, fax submissions produce OCR'd documents, portal submissions produce UI events. * **Tear down.** After the last task run completes, sandboxes release their resources. Interaction evidence persists so criteria can score the rollout. See [Sandboxes](/guides/concepts/sandboxes) for branching, checkpoints, and direct-access semantics. ## Configuration vs runtime credentials Simulator configuration and runtime credentials are distinct. * **Configuration** is set at `POST /simulators` time (and editable via `PATCH /simulators/{id}` until provisioning). It describes the shape of the simulated system: which payer portal to render, which IVR menus to expose, which determination rules to apply, which CDS cards to return. * **Runtime credentials** are generated when the sandbox is provisioned. They are unique per sandbox, scoped to that sandbox's lifetime, and include things like a FHIR base URL, a leased phone number, a portal username and password, a fax number, or an SFTP root path. The agent reads them out of the benchmark-run response or the sandbox's `credentials` payload. This split means you can reuse the same simulator definition across many runs. Each run gets its own isolated sandbox without leaking state or credentials between rollouts. ## Next Steps Provision a FHIR R4 EHR and drive it with SMART on FHIR. Simulated RadMD and CoverMyMeds payer portals. Phone / IVR lines with recorded transcripts. The typed assertions the verification engine runs against sandbox state. # Voice Source: https://docs.verial.ai/guides/simulators/voice Simulated phone / IVR lines with recorded call transcripts. The voice simulator stands in for a healthcare phone line: member services, provider intake, scheduling lines, or an IVR front door. Verial leases a real phone number for each sandbox so your agent can place an outbound call (or receive an inbound call) exactly as it would in production. Every call is recorded and transcribed; the verification engine scores `voice-transcript` criteria against the transcript. ## How your agent connects When the benchmark run is created, the voice sandbox's `credentials` payload includes a leased phone number your agent can dial. The call connects to a simulated IVR flow configured on the simulator, optionally backed by a patient persona or human-facing agent. Your agent drives the conversation; Verial captures the audio and produces a turn-by-turn transcript with speaker labels. Voice sandboxes route calls through a hosted IVR runtime. There is no `/v1/benchmark-runs/{id}/voice/*` HTTP surface during the rollout. The rollout happens over telephony. The resulting transcript is available through the benchmark run's interaction evidence. ## Connection model | Artifact | Where to find it | | ----------------- | -------------------------------------------------------------------------------------------------- | | Phone number | `credentials.phone_number` on the voice sandbox (in the benchmark-run response's `sandboxes` list) | | Expected IVR flow | Simulator `config.ivr` | | Transcript | Interaction evidence; exposed through `criterion.evidence` after the rollout | ## Driving the rollout 1. Read the phone number out of the benchmark-run response. 2. Place the call from your agent (Twilio, Retell, or any telephony runtime). 3. Navigate the IVR, interact with the persona, and end the call. 4. Complete the task run; the verification engine fetches the transcript and scores `voice-transcript` criteria. ```bash theme={null} curl "https://api.verial.ai/v1/benchmark-runs/$BENCHMARK_RUN_ID" \ -H "Authorization: Bearer $RUN_TOKEN" ``` Inspect the `sandboxes` array for the voice sandbox and its leased `phone_number` in `credentials`. ## Configuration At create time you configure the IVR flow, the persona the caller speaks to, and optional scripted beats the persona should hit. ```bash theme={null} curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d @- <<'JSON' { "type": "Voice", "name": "Member Services Line", "config": { "ivr": { "greeting": "Thank you for calling BlueCross. Press 1 for member services.", "menus": [ { "key": "1", "label": "Member services", "route": "member_services" }, { "key": "2", "label": "Provider services", "route": "provider_services" } ] }, "persona": { "role": "member_services_rep", "tone": "professional, patient" } } } JSON ``` ## Verification The `voice-transcript` check inspects the call transcript for required and forbidden phrases. Phrase matching is LLM-assisted so the check is robust to paraphrasing. ```json theme={null} { "label": "Agent collected member ID and DOB", "weight": 0.5, "axis": "correctness", "assertion": { "assert": "voice-transcript", "speaker": "agent", "contains": ["member ID", "date of birth"], "not_contains": ["social security number"] } } ``` See the [Criteria concept page](/guides/concepts/criteria#voice-required-disclosures) for more examples and the full assertion spec. ## Next Steps Full reference for `voice-transcript` assertions. How transcripts and other evidence are recorded and retrieved. Lifecycle, provisioning, and configuration patterns. Pair voice with SMS for multi-channel patient outreach. # Web Portal Source: https://docs.verial.ai/guides/simulators/web-portal Browser-accessible simulations of real payer web portals with a matching REST API. The web portal simulator exposes payer web portals your agent can drive with a browser automation tool. Each portal is a pixel-faithful reproduction of a real vendor site (login page, navigation, form fields, workflow) backed by the same sandbox state a REST API reads and writes. Criteria can verify work performed through the UI just like work performed through the API. Use this simulator when your agent is designed to operate real payer portals end to end: logging in, searching patients, submitting prior authorizations, reading determinations from a browser. The verification engine scores `portal-state-match` criteria against the resulting portal state. ## Portal catalog | Portal | Slug | Use case | | --------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | **RadMD** | `radmd` | Radiology benefit management prior auth (Evolent). Multi-step wizard: patient lookup, physician, clinical questions, auth summary. | | **CoverMyMeds** | `covermymeds` | Pharmacy prior auth (ePA) across many payers. Draft management, formulary lookup, prescriber verification. | The `slug` goes in the `config.portal` field when you create the simulator. ## How your agent connects Each sandbox gets its own credential pair, valid only for that sandbox's lifetime. When the benchmark run is created (or a sandbox is provisioned directly), the sandbox's `credentials` payload contains: | Field | Description | | ------------ | --------------------------------------------- | | `portal_url` | URL to navigate a browser to (login page) | | `username` | Username for the portal's login form | | `password` | Password for the portal's login form | | `api_url` | REST base for the same sandbox (backs the UI) | The same backing state is shared between the UI and the API, so you can drive the portal with Playwright / Stagehand / browser-use *or* call the REST endpoints directly, and criteria will score either path identically. ## Endpoints (REST) The REST API behind the portal is rooted at `api_url`. Key endpoints: | Method | Endpoint | Description | | ------ | ------------------------------------- | ------------------------------------------------------- | | `POST` | `{api_url}/prior-auths` | Submit a prior authorization | | `GET` | `{api_url}/prior-auths/{auth_number}` | Retrieve a prior auth's current state and determination | | `GET` | `{api_url}/patients` | List patients with coverage | | `GET` | `{api_url}/providers` | List credentialed providers | These match the direct-access endpoints documented under [Submit prior auth](/api-reference/payer/submit-prior-auth), [Get prior auth](/api-reference/payer/get-prior-auth), and [List payer patients](/api-reference/payer/list-patients). ## Driving the rollout Browser path (Playwright): ```typescript theme={null} import { chromium } from 'playwright' const browser = await chromium.launch() const page = await browser.newPage() await page.goto(portalUrl) await page.fill('input[name="username"]', username) await page.fill('input[name="password"]', password) await page.click('button[type="submit"]') // ... drive the wizard to submit a prior auth ``` REST path: ```bash theme={null} curl -X POST "$API_URL/prior-auths" \ -H "Authorization: Bearer $RUN_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "patient": { "member_id": "BCB123456789" }, "procedure_code": "72148", "diagnosis_code": "M54.5" }' ``` For an end-to-end walkthrough, see the [Web Simulator Quickstart](/guides/quickstart-web-sim). ## Configuration ```bash theme={null} curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d @- <<'JSON' { "type": "Payer", "name": "RadMD", "config": { "portal": "radmd", "determinations": [ { "match": { "procedure_code": "70553" }, "response": { "status": "approved" } }, { "match": { "procedure_code": "70551" }, "response": { "status": "denied", "reason": "not medically necessary" } } ], "default_determination": { "status": "pending", "delay_seconds": 0 } } } JSON ``` | Field | Type | Description | | ----------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | `portal` | `"radmd" \| "covermymeds"` | Which portal skin to render. Determines the `portal_url` host and the UI the agent drives. | | `determinations` | array | Rules that map a submitted PA (by `procedure_code` or `patient_member_id`) to a determination. First match wins. | | `default_determination` | object | Returned when no rule matches. Fields: `status` (`approved` \| `denied` \| `pending` \| `need_more_info`), optional `reason`, optional `delay_seconds`. | ## Verification The `portal-state-match` check correlates a submitted PA (by `request_id`, `auth_number`, or another key) with its row in portal state and asserts on field values. ```json theme={null} { "label": "Prior auth submitted with correct CPT", "weight": 1.0, "axis": "correctness", "assertion": { "assert": "portal-state-match", "correlate_by": { "resource": "prior_auth_requests", "key": "request_id" }, "assertions": [ { "path": "status", "expected": "submitted" }, { "path": "cpt_code", "expected": "72148" } ] } } ``` See the [Criteria concept page](/guides/concepts/criteria#portal-prior-auth-submitted) for more examples and the full assertion spec. ## Interaction evidence Every UI action (form submit, patient search, auth submission) and every API call is recorded as a sandbox event alongside the request/response pair. Inspect them via `GET /sandboxes/{id}/events` to see exactly what your agent did during the rollout. ## Next Steps Provision a RadMD sandbox and log in from a browser in under 5 minutes. Full reference for `portal-state-match` assertions. Direct-access prior-auth endpoints. Lifecycle, provisioning, and configuration patterns. # X12 Source: https://docs.verial.ai/guides/simulators/x12 Clearinghouse-style X12 EDI transactions for eligibility, claims, and prior auth. The X12 simulator stands in for a clearinghouse like Change Healthcare or Availity. It accepts X12 EDI transactions and returns the paired X12 response, covering the core eligibility, claim status, and prior-auth transaction set. The verification engine scores outbound X12 responses with `x12-response` criteria. Supported transaction pairs: * **270/271** — eligibility inquiry and response * **276/277** — claim status inquiry and response * **278** — prior authorization request and response ## How your agent connects The X12 clearinghouse exposes a structured HTTP surface at the direct-service endpoint. Your agent submits a request body and receives the simulated clearinghouse response. During playground authoring, call `/sandboxes/{sandbox_id}/clearinghouse/*` with an organization API key. Today only the 270/271 eligibility pair is wired on the HTTP surface. The 276/277 (claim status) and 278 (prior auth) pairs are listed above for completeness but are not yet callable; check the [API reference](/api-reference/clearinghouse/check-eligibility) for the current shipped endpoints. The run-scoped `/v1/benchmark-runs/{id}/clearinghouse/*` surface is not exposed today; drive X12 interactions via the direct `/sandboxes/{id}/clearinghouse/*` routes during playground authoring. ## Endpoints | Method | Endpoint | Description | | ------ | --------------------------------------------------- | ----------------------------------------------------- | | `POST` | `/sandboxes/{sandbox_id}/clearinghouse/eligibility` | 270 eligibility inquiry; returns a 271-style response | See [Check eligibility](/api-reference/clearinghouse/check-eligibility) for the full request/response shape. ## Driving the rollout Submit a 270 eligibility inquiry (direct-service path): ```bash theme={null} curl -X POST "https://api.verial.ai/sandboxes/$SANDBOX_ID/clearinghouse/eligibility" \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "patient_id": "patient-123" }' ``` The response contains a parsed 271 structure (active coverage, copay, deductible, service type benefits) that your agent can act on. ## Configuration The X12 simulator uses configured payer behavior (which members are active, which services are covered) from the linked dataset. At create time you supply a name and optional payer metadata: ```bash theme={null} curl -X POST https://api.verial.ai/simulators \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "Clearinghouse", "name": "Regional X12 Clearinghouse", "config": { "payers": ["BlueCross", "Aetna"] } }' ``` ## Verification The `x12-response` check parses the simulated X12 response (271, 277, or 278) and asserts on segment values by path. Use it to confirm the clearinghouse returned the expected coverage, status, or decision. ```json theme={null} { "label": "Eligibility 271 returned active coverage", "weight": 1.0, "assertion": { "assert": "x12-response", "transaction": "271", "fields": [ { "path": "EB.1", "expected": "1" }, { "path": "EB.3", "expected": "30" } ] } } ``` See the [Criteria concept page](/guides/concepts/criteria#x12-271-eligibility-response) for the full spec. ## Next Steps Pair X12 with a payer portal simulator for full prior-auth workflows. Full reference for `x12-response` assertions. Direct-access eligibility endpoint for authoring. Lifecycle, provisioning, and configuration patterns. # Solver Keys Source: https://docs.verial.ai/guides/solver-keys Create and rotate the Bearer tokens that drive benchmark runs via the public v1 API. A **Solver** is a per-organization identity for an external agent integration. Each Solver represents one agent (by name, description, and optional agent version) and hosts one or more **Solver keys** (`vrl_slv_*`) that authenticate that agent when it starts a benchmark run against the public `/v1` API. ## Why Solvers? * **Identity per agent.** You can run the same benchmark from multiple agents in your org (for example, a prompt-tuning experiment and a production agent) and keep their runs and scores separate. * **Attribution.** Every benchmark run records which Solver initiated it. Dashboards, comparisons, and leaderboards group results by Solver. * **Key lifecycle.** Each Solver owns its own keys. Rotating keys for one agent does not affect another. ## Create a Solver Solvers are created and managed in the organization dashboard under **Solvers**, or via the internal API with an [organization API key](/api-reference/authentication). ```bash theme={null} curl -X POST https://api.verial.ai/solvers \ -H "Authorization: Bearer $VERIAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "alias": "production-agent", "real_name": "Acme Prior Auth Agent", "agent_description": "Submits prior authorizations via RadMD and CoverMyMeds.", "contact_email": "oncall@acme.example" }' ``` The `alias` is a URL-safe identifier, unique within your organization. ## Mint a Solver Key Once the Solver exists, mint a key: ```bash theme={null} curl -X POST "https://api.verial.ai/solvers/$SOLVER_ID/api-keys" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` Response: ```json theme={null} { "id": "key_01H...", "key": "vrl_slv_...", "prefix": "vrl_slv_", "suffix": "xxxx", "createdAt": "2026-04-23T12:00:00.000Z" } ``` The `key` field is only returned on creation. Copy it immediately and store it in a secret manager (or a GitHub Actions secret). You cannot retrieve the plaintext value again. ## Using a Solver Key A Solver key is a Bearer token that authenticates **only** the create-run call on the public v1 API: ```bash theme={null} curl -X POST https://api.verial.ai/v1/benchmark-runs \ -H "Authorization: Bearer vrl_slv_xxx" \ -H "Content-Type: application/json" \ -d '{"benchmark": "fax-referral@1", "scored": false}' ``` The response includes a run-scoped bearer token (`vrl_run_*`) with a short expiry. Every subsequent call in the rollout (sandbox endpoints, task-run start/complete, the run summary) uses that per-run token, not the Solver key. See the [Quick Start](/guides/quickstart) for the full sequence. ### What a Solver Key Can Do * Start a benchmark run (`POST /v1/benchmark-runs`) against any benchmark in the Solver's own organization. * Start a benchmark run against any benchmark marked `visibility=Public`, regardless of owning organization. ### What a Solver Key Cannot Do * Author or modify benchmarks, tasks, criteria, environments, simulators, or datasets. * Read arbitrary benchmark runs, criterion runs, or sandbox events. * Access any endpoint outside `/v1/benchmark-runs` (create). For authoring and administration, use an organization API key (`vk_*`) instead. ## Rotating a Solver Key Keys are rotated by creating a new key, deploying it, then revoking the old one. 1. **Mint a new key** with `POST /solvers/{id}/api-keys`. 2. **Deploy the new key** to your secret manager / CI. 3. **Revoke the old key** with `DELETE /solvers/{id}/api-keys/{keyId}`: ```bash theme={null} curl -X DELETE "https://api.verial.ai/solvers/$SOLVER_ID/api-keys/$OLD_KEY_ID" \ -H "Authorization: Bearer $VERIAL_API_KEY" ``` Revoked keys stop authenticating immediately. Runs in progress that used the old key are unaffected (those runs authenticate with their run-scoped bearer token). A Solver can have multiple active keys at once. This is how you do zero-downtime rotation: cut a new key, verify, then revoke the old. ## Dashboard Flow In the [Verial dashboard](https://app.verial.ai): 1. Go to **Solvers**. 2. Click **Create Solver**, fill in name, description, and contact email. 3. Open the Solver and click **Mint key**. 4. Copy the key. Store it as a secret (for GitHub Actions, see [Run a Benchmark in GitHub Actions](/guides/github-actions)). ## Next Steps Use the Solver key to drive a full rollout. Store the Solver key as a repo secret and gate CI on the score. Full reference for organization keys, Solver keys, and run bearer tokens. How runs are scored and what the lifecycle looks like. # Webhooks Source: https://docs.verial.ai/guides/webhooks Subscribe an HTTPS endpoint to events from Verial so your systems react when runs finish. Webhooks let Verial push structured events to your own HTTPS endpoint instead of requiring you to poll. The most common use is being notified when a benchmark run completes, so CI, dashboards, or Slack bots can react without keeping an open connection during the rollout. ## How It Works 1. You register an endpoint URL and subscribe it to one or more event types. 2. When a matching event occurs, Verial signs the JSON payload and `POST`s it to your URL. 3. Your endpoint verifies the signature, deserializes the payload, and acts on the event. 4. Non-2xx responses are retried with exponential backoff. Persistent failures are surfaced in the dashboard and the webhook is paused if a circuit breaker trips. ## Set Up an Endpoint Webhooks are managed from the organization dashboard under **Webhooks**. 1. Click **Add endpoint**. 2. Enter the destination URL (must be HTTPS). 3. Paste or generate a **shared secret**. Save a copy; you will use it to verify signatures. 4. Choose the **event types** to subscribe to. 5. Save. The endpoint starts receiving events immediately. You can also manage webhooks via the internal API (see [Authentication](/api-reference/authentication) for the organization key flow). ## Event Types The webhook delivery pipeline is in place, but no event types are published yet. The subscribable event catalog is empty today and will be populated as lifecycle events ship (benchmark-run and task-run completion are the expected first shipments, likely under dotted names such as `run.completed`). Consult your dashboard for the authoritative list once events are available. Subscribe each endpoint to only the events it needs. Until event codes ship, you can still register endpoints and generate signing secrets so they are ready to receive traffic. ## Payload Shape Every webhook delivery carries a JSON body shaped like this: ```json theme={null} { "id": "evt_01H...", "type": "run.completed", "timestamp": "2026-04-23T12:34:56.000Z", "data": { "...": "event-specific fields" } } ``` * `id`: unique event identifier. Use it to deduplicate; Verial may retry the same event on transient failures. * `type`: event type code (for example `run.completed`). * `timestamp`: ISO 8601 timestamp of when the event occurred. * `data`: event-specific payload. Resource fields are snake\_case on the wire. ## Signature Verification Every request carries three headers: | Header | Description | | --------------------- | ----------------------------------------- | | `X-Webhook-Id` | The webhook endpoint's ID (informational) | | `X-Webhook-Timestamp` | Unix seconds when the request was signed | | `X-Webhook-Signature` | Signature in the form `v1=` | The signature is an HMAC-SHA256 of `${timestamp}.${raw_body}` with your shared secret. Verify it on the raw request body, before any JSON parsing. ### Node.js ```ts theme={null} import { createHmac, timingSafeEqual } from "node:crypto"; export function verifyWebhook( rawBody: string, timestampHeader: string, signatureHeader: string, secret: string, toleranceSeconds = 300, ): boolean { // Reject stale requests const now = Math.floor(Date.now() / 1000); const ts = Number(timestampHeader); if (!Number.isFinite(ts) || Math.abs(now - ts) > toleranceSeconds) { return false; } const expected = createHmac("sha256", secret) .update(`${ts}.${rawBody}`) .digest("hex"); const provided = signatureHeader.replace(/^v1=/, ""); const a = Buffer.from(expected, "hex"); const b = Buffer.from(provided, "hex"); return a.length === b.length && timingSafeEqual(a, b); } ``` Always verify on the **raw** request body, not a re-serialized JSON string. In Express, use `express.raw({ type: "application/json" })` for the webhook route; in Hono, read `await c.req.text()` before `JSON.parse`. ## Retries and Delivery Guarantees Delivery is at-least-once with exponential backoff. Verial retries on 5xx responses and network errors up to the webhook's configured `maxRetries` (default 5). 4xx responses are treated as non-retryable: fix your endpoint and re-send from the dashboard if needed. A webhook with repeated failures has its circuit breaker tripped and delivery pauses until the endpoint recovers or an operator re-enables it. The dashboard surfaces last success, last failure, and consecutive failure count for every webhook. Return a 2xx response as soon as you have accepted the event. Do heavy work asynchronously; if your handler takes longer than the webhook's `timeoutMs` (default 30 seconds), Verial will treat the delivery as failed. ## Idempotency Your handler should be idempotent on the `id` field of the event. Retries can redeliver the same event; deduplicate by recording `id` in a short-lived store (Redis set, database unique index, etc.). ## Next Steps Drill into a completed run after you receive `benchmark_run.completed`. Pair webhooks with CI to notify PR authors asynchronously. Manage the organization API key used to configure webhooks. Event payloads mirror the benchmark-run and task-run object shapes. # Best Practices Source: https://docs.verial.ai/mcp/best-practices Tips for getting the best results from the Verial MCP. ## Recommended Tool Flow For most simulation workflows, follow this progression: 1. **Setup** -- `simulators` to define interfaces, `environments` to compose them, `datasets` to prepare patient data 2. **Define** -- `benchmarks` to create test suites, `tasks` to add test cases, `criteria` to add assertions 3. **Execute** -- `benchmark_runs` to start runs, poll with `get` until status is `Completed` 4. **Analyze** -- `task-runs` to see per-task results, `criterion-runs` to see per-criterion reasoning and scores If the user already has an environment or benchmark ID, skip the setup or definition steps and go straight to execution. ## Tool Chaining Patterns ### Create-then-link Simulators exist independently from environments. Create them first, then attach them. ```json theme={null} // 1. Create simulator { "action": "create", "type": "FHIR", "name": "EHR" } // Response: { "id": "sim_01", ... } // 2. Create environment { "action": "create", "name": "Clinic" } // Response: { "id": "env_01", ... } // 3. Link { "action": "addSimulator", "id": "env_01", "simulatorId": "sim_01" } ``` This pattern keeps simulators reusable across multiple environments. A single FHIR simulator definition can be linked to different environment configurations. ### Benchmark definition Benchmarks, tasks, and criteria form a hierarchy. Create them top-down. ```json theme={null} // 1. Benchmark { "action": "create", "name": "PA Tests", "environmentId": "env_01", "timeout": 300 } // Response: { "id": "bm_01", ... } // 2. Task { "action": "create", "benchmarkId": "bm_01", "name": "Submit PA", "instruction": "..." } // Response: { "id": "task_01", ... } // 3. Criterion { "action": "create", "taskId": "task_01", "name": "pa-submitted", "assertion": { ... }, "weight": 1.0 } ``` Each level references the parent by ID. Criteria are always attached to a specific task. ### Run and poll Start a run, poll for completion, then drill into results. ```json theme={null} // 1. Start { "action": "create", "benchmarkId": "bm_01" } // Response: { "id": "run_01", "status": "Running" } // 2. Poll (repeat until status is "Completed" or "Failed") { "action": "get", "id": "run_01" } // Response: { "status": "Completed", "score": 0.92, "verdict": "Pass" } // 3. Drill into task results { "action": "list", "runId": "run_01" } // 4. Drill into criterion results { "action": "list", "taskRunId": "tr_01" } ``` The `benchmark_runs` get response includes the overall score and verdict. Use `task-runs` and `criterion-runs` to understand which specific checks passed or failed. ## Writing Good Criteria When writing [criteria](/guides/concepts/criteria), describe observable outcomes the verification engine can check against sandbox state. Write them like test assertions: specific, observable, and unambiguous. | Assert | Quality | Why | | ------------------------------------------------------------------------------------------ | ------- | ------------------------------------------------------ | | "The agent did a good job" | Bad | Subjective, no observable criteria | | "A prior auth was submitted" | Okay | Observable but vague about what counts as "submitted" | | "A prior authorization request was submitted through the payer portal with CPT code 72148" | Good | Specific action, specific channel, specific data point | | "The 271 eligibility response shows active coverage with plan type PPO" | Good | Specific transaction type, specific fields to check | | "The agent called the FHIR endpoint GET /Patient and received a 200 response" | Good | Verifiable against interaction logs | | "The agent handled the error gracefully" | Bad | "Gracefully" is subjective | Use weights to distinguish critical checks from nice-to-haves. A weight of 1.0 means the criterion is essential to the task. A weight of 0.5 or lower signals a secondary validation that improves the score but does not determine the verdict on its own. ### One assertion per criterion Split compound checks into separate criteria rather than combining them. This gives you granular scoring and clearer failure messages. ## Error Handling All tools return errors in a consistent shape: ```json theme={null} { "error": "not_found", "message": "Environment env_xyz not found" } ``` | Error Code | Meaning | Recommended Action | | ------------------ | --------------------------------------------------------------- | ------------------------------------------------------------------- | | `not_found` | Entity does not exist or belongs to a different organization | Verify the ID; use a `list` action to find valid IDs | | `validation_error` | Invalid parameters (missing required field, wrong type) | Check the parameter types and required fields in the tool reference | | `conflict` | Duplicate or conflicting state (e.g., simulator already linked) | Use `get` to check current state before retrying | | `timeout` | Run exceeded the benchmark timeout | Increase the benchmark `timeout` value or simplify the task | When a `not_found` error occurs, do not retry with the same ID. Use the `list` action on the parent resource to discover valid IDs. For example, if a `tasks` get returns not\_found, call `tasks` list with the `benchmarkId` to see available tasks. ## Next Steps Full parameter documentation for each tool. Step-by-step tool call sequences for common simulation tasks. # MCP Server Source: https://docs.verial.ai/mcp/overview Give AI agents direct access to Verial's simulation platform. ## What is MCP? The [Model Context Protocol](https://modelcontextprotocol.io) (MCP) is an open standard for connecting AI agents to external data sources and tools. Instead of building custom integrations, MCP lets agents call structured tools to query, create, and manage resources in real time. Claude, ChatGPT, Cursor, and any MCP-compatible client can connect to an MCP server and use its tools as part of their reasoning. ## Why MCP for Verial? Healthcare AI agents need to validate their own behavior against realistic simulated systems. The Verial MCP server gives agents direct access to the simulation platform, so they can set up test environments, run benchmarks, and analyze results without human intervention. * **Self-testing agents.** An agent can create its own test environment, define benchmarks, execute runs, and review results, all through tool calls in a single conversation. * **IDE integration.** Connect Verial to Claude, Cursor, or VS Code to manage simulations interactively while developing your agent. * **Agentic CI/CD.** Chain simulation setup, execution, and result analysis into automated pipelines that run on every deploy. ## Design Principles Each tool maps to a resource and takes an `action` parameter to select the operation. One tool call to create, update, list, or delete. No multi-step discovery required. Every tool follows the same pattern: `action` plus resource-specific fields. Learn one tool and you know them all. Agents can generalize across the entire surface. Every resource type is available: environments, simulators, datasets, benchmarks, tasks, criteria, playgrounds, sandboxes, benchmark runs, task runs, and criterion runs. Nothing is hidden behind a separate API. Every tool call is scoped to the authenticated organization. Agents see only the resources they own. No project IDs or tenant parameters to manage. ## Tools One tool per resource. Each tool takes an `action` field to select the operation. | Tool | Actions | Description | | --------------------------------------------- | ------------------------------------------------------------------ | ------------------------------------ | | [`environments`](/mcp/tools/environments) | list, create, get, update, delete, addSimulator, removeSimulator | Manage simulated health systems | | [`simulators`](/mcp/tools/simulators) | list, create, get, update, delete | Manage simulator definitions | | [`datasets`](/mcp/tools/datasets) | list, create, get, update, delete | Manage synthetic patient data | | [`benchmarks`](/mcp/tools/benchmarks) | list, create, get, update, delete | Manage benchmark definitions | | [`tasks`](/mcp/tools/tasks) | list, create, get, update, delete | Manage test cases within benchmarks | | [`criteria`](/mcp/tools/criteria) | list, create, get, update, delete | Manage typed assertions on tasks | | [`playgrounds`](/mcp/tools/playgrounds) | list, create, get, teardown | Provision live environment instances | | [`sandboxes`](/mcp/tools/sandboxes) | list, create, get, listEvents, teardown, addDataset, removeDataset | Manage running simulator instances | | [`benchmark_runs`](/mcp/tools/benchmark-runs) | list, create, get, complete, cancel | Execute benchmarks and track results | | [`task-runs`](/mcp/tools/task-runs) | list, get, complete, cancel | Task-level run results | | [`criterion-runs`](/mcp/tools/criterion-runs) | list, get | Per-criterion run results | ## Data Model ```mermaid theme={null} graph TD SIM["Simulator"]:::resource --> ENV["Environment"]:::resource DS["Dataset"]:::resource --> SBX["Sandbox"]:::resource ENV --> PG["Playground"]:::resource PG --> SBX ENV --> BM["Benchmark"]:::resource BM --> TASK["Task"]:::resource TASK --> CRIT["Criterion"]:::resource BM --> RUN["Run"]:::resource RUN --> TR["Task Run"]:::resource TR --> CR["Criterion Run"]:::resource classDef resource fill:#2563eb,color:#fff,stroke:#1d4ed8 ``` * **Simulators** define simulated systems (FHIR, HL7, Voice, Fax, Web portals) * **Environments** compose simulators into a coherent health system * **Datasets** contain FHIR bundles or files, linked to sandboxes at runtime * **Benchmarks** group tasks with criteria into a test suite * **Playgrounds** are running instances of environments with live sandboxes * **Benchmark runs** execute benchmarks, producing task runs and criterion runs with scores from the verification engine ## Next Steps Connect the Verial MCP server to Claude, ChatGPT, Cursor, or your custom agent. Full parameter and response documentation for each tool. Step-by-step tool call sequences for common simulation tasks. Prompt tips, context management, and error handling. # Setup Source: https://docs.verial.ai/mcp/setup Connect the Verial MCP server to your AI agent. ## Cloud MCP Endpoint Verial hosts a cloud MCP server. No infrastructure to run, just point your agent at the endpoint. ``` https://api.verial.ai/mcp ``` ## Configuration Add the Verial MCP server to your agent. Some platforms use OAuth (you'll authorize via your Verial account), while others use an API key in a config file. 1. Go to [claude.ai/settings/connectors](https://claude.ai/settings/connectors) and click **"Add custom connector"** 2. Set the name to **"Verial"** 3. Set **"Remote MCP server URL"** to `https://api.verial.ai/mcp` 4. Click **"Add"** and sign in to Verial when prompted No API key needed. Claude uses OAuth to connect to your Verial account directly. Add to your project's `.mcp.json`: ```json theme={null} { "mcpServers": { "verial": { "type": "url", "url": "https://api.verial.ai/mcp", "headers": { "Authorization": "Bearer vk_your_api_key" } } } } ``` Add to your MCP settings in **Settings > MCP**: ```json theme={null} { "mcpServers": { "verial": { "url": "https://api.verial.ai/mcp", "headers": { "Authorization": "Bearer vk_your_api_key" } } } } ``` 1. Go to [ChatGPT Settings](https://chatgpt.com/settings#settings) > **Apps** > **Advanced Settings** and enable **Developer Mode** 2. Click **"Create app"** 3. Set **"Name"** to **"Verial"** 4. Set **"MCP Server URL"** to `https://api.verial.ai/mcp` 5. Set **"Authentication"** to **"OAuth"**, check the confirmation box, and click **"Create"** No API key needed. ChatGPT uses OAuth to connect to your Verial account directly. ## Authentication The MCP server supports two authentication methods: * **OAuth 2.1** -- used by Claude, ChatGPT, and other platforms with built-in OAuth support. The platform handles authentication automatically. No API key needed. * **API keys** -- used by config-file-based clients (Claude Code, Cursor, VS Code). Include your key in the `Authorization` header as a Bearer token. Never commit API keys to version control. Use environment variables or a secrets manager to inject the key into your configuration file. To create an API key, go to **Settings > API Keys** in the [Verial dashboard](https://verial.ai). ## Verify the Connection Once configured, test with a simple prompt: ``` List my environments. ``` Your agent should call the `environments` tool with `action: "list"` and return your environments. If you see an authentication error, verify your API key is correct and has access to your organization. ## Next Steps Explore the tools your agent now has access to. See how agents chain tools to set up and run simulations. # Benchmark Runs Source: https://docs.verial.ai/mcp/tools/benchmark-runs Manage benchmark runs. Manage benchmark runs that execute all tasks in a benchmark and collect results. ## Actions | Action | Description | | ---------- | ------------------------------------------- | | `list` | List all benchmark runs in the organization | | `create` | Start a new benchmark run | | `get` | Get a benchmark run by ID | | `complete` | Mark a benchmark run as complete | | `cancel` | Cancel a benchmark run | ## Parameters ### `list` No parameters. ### `create` | Parameter | Type | Required | Description | | ------------- | ------ | -------- | ------------------- | | `benchmarkId` | string | yes | Benchmark ID to run | ### `get` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ---------------- | | `id` | string | yes | Benchmark run ID | ### `complete` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ---------------- | | `id` | string | yes | Benchmark run ID | ### `cancel` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ---------------- | | `id` | string | yes | Benchmark run ID | ## Examples ### Start a benchmark run ```json theme={null} { "action": "create", "benchmarkId": "bm_abc123" } ``` ### Get run results ```json theme={null} { "action": "get", "id": "br_xyz789" } ``` ### Cancel a running benchmark ```json theme={null} { "action": "cancel", "id": "br_xyz789" } ``` # Benchmarks Source: https://docs.verial.ai/mcp/tools/benchmarks Manage benchmarks (groups of tasks with criteria). Manage benchmarks that group related tasks into a runnable test suite for your agent. ## Actions | Action | Description | | -------- | --------------------------------------- | | `list` | List all benchmarks in the organization | | `create` | Create a new benchmark | | `get` | Get a benchmark by ID | | `update` | Update a benchmark | | `delete` | Delete a benchmark | ## Parameters ### `list` No parameters. ### `create` | Parameter | Type | Required | Description | | ------------- | ------ | -------- | ------------------------------------------------------ | | `name` | string | yes | Name of the benchmark | | `description` | string | no | Description of the benchmark | | `timeout` | number | no | Default timeout in seconds for tasks in this benchmark | | `concurrency` | number | no | Max concurrent task runs | ### `get` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------ | | `id` | string | yes | Benchmark ID | ### `update` | Parameter | Type | Required | Description | | ------------- | -------------- | -------- | ------------------------------------- | | `id` | string | yes | Benchmark ID | | `name` | string | no | Updated name | | `description` | string \| null | no | Updated description, or null to clear | | `timeout` | number \| null | no | Updated timeout, or null to clear | | `concurrency` | number \| null | no | Updated concurrency, or null to clear | ### `delete` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------ | | `id` | string | yes | Benchmark ID | ## Examples ### Create a prior auth workflow benchmark ```json theme={null} { "action": "create", "name": "Prior Auth Workflow", "description": "End-to-end prior authorization submission and tracking", "timeout": 300, "concurrency": 5 } ``` ### List all benchmarks ```json theme={null} { "action": "list" } ``` ### Update benchmark concurrency ```json theme={null} { "action": "update", "id": "bm_abc123", "concurrency": 10 } ``` # Criteria Source: https://docs.verial.ai/mcp/tools/criteria Manage task criteria (typed assertions). Manage [criteria](/guides/concepts/criteria), the typed assertions that the verification engine runs against a task run. ## Actions | Action | Description | | -------- | ---------------------------- | | `list` | List all criteria for a task | | `create` | Create a new criterion | | `get` | Get a criterion by ID | | `update` | Update a criterion | | `delete` | Delete a criterion | ## Parameters ### `list` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ---------------------------- | | `taskId` | string | yes | Task ID to list criteria for | ### `create` | Parameter | Type | Required | Description | | --------------- | ------ | -------- | --------------------------------------------------------------------------- | | `taskId` | string | yes | Task ID to attach the criterion to | | `label` | string | yes | Short human-readable label | | `assertion` | object | yes | Typed assertion spec. See [Criteria API](/api-reference/resources/criteria) | | `weight` | number | no | Relative weight (default `1`) | | `axis` | string | no | Optional scoring axis | | `inputEntityId` | string | no | Optional DatasetEntity ID the criterion is scoped to | ### `get` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------ | | `id` | string | yes | Criterion ID | ### `update` | Parameter | Type | Required | Description | | --------------- | ------ | -------- | ------------------------------- | | `id` | string | yes | Criterion ID | | `label` | string | no | Updated label | | `assertion` | object | no | Updated assertion spec | | `weight` | number | no | Updated weight | | `axis` | string | no | Updated axis | | `inputEntityId` | string | no | Updated scoped DatasetEntity ID | ### `delete` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------ | | `id` | string | yes | Criterion ID | ## Examples ### Create a FHIR criterion ```json theme={null} { "action": "create", "taskId": "task_xyz789", "label": "Appointment booked with correct provider", "weight": 1, "axis": "correctness", "assertion": { "assert": "fhir-resource-state", "resource_type": "Appointment", "search": { "patient": "Patient/john-smith", "status": "booked" }, "fields": [ { "path": "participant.0.actor.display", "expected": "Dr. Rivera" } ] } } ``` ### Create a voice transcript criterion ```json theme={null} { "action": "create", "taskId": "task_xyz789", "label": "Required disclosures", "weight": 0.5, "assertion": { "assert": "voice-transcript", "speaker": "agent", "contains": ["member ID", "date of birth"] } } ``` ### List criteria for a task ```json theme={null} { "action": "list", "taskId": "task_xyz789" } ``` # Criterion Runs Source: https://docs.verial.ai/mcp/tools/criterion-runs View per-criterion results within a task run. View [Criterion Runs](/api-reference/resources/criterion-runs), the per-criterion results produced by the verification engine. ## Actions | Action | Description | | ------ | -------------------------------------- | | `list` | List all criterion runs for a task run | | `get` | Get a criterion run by ID | ## Parameters ### `list` | Parameter | Type | Required | Description | | ----------- | ------ | -------- | -------------------------------------- | | `taskRunId` | string | yes | Task run ID to list criterion runs for | ### `get` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ---------------- | | `id` | string | yes | Criterion run ID | ## Examples ### List criterion runs for a task run ```json theme={null} { "action": "list", "taskRunId": "tr_abc123" } ``` ### Get a criterion run with evidence ```json theme={null} { "action": "get", "id": "crun_01H..." } ``` # Datasets Source: https://docs.verial.ai/mcp/tools/datasets Manage datasets (FHIR bundles, file sets). Manage datasets containing patient records, FHIR bundles, or file sets that populate simulators. ## Actions | Action | Description | | -------- | ------------------------------------- | | `list` | List all datasets in the organization | | `create` | Create a new dataset | | `get` | Get a dataset by ID | | `update` | Update a dataset | | `delete` | Delete a dataset | ## Parameters ### `list` No parameters. ### `create` | Parameter | Type | Required | Description | | ------------- | ------- | -------- | ----------------------------------------------------- | | `name` | string | yes | Name of the dataset | | `description` | string | no | Description of the dataset | | `type` | string | no | Dataset type: `FHIR` or `Files` | | `data` | unknown | no | Dataset contents (FHIR bundle, file references, etc.) | | `config` | object | no | Dataset configuration | ### `get` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ----------- | | `id` | string | yes | Dataset ID | ### `update` | Parameter | Type | Required | Description | | ------------- | -------------- | -------- | ------------------------------------- | | `id` | string | yes | Dataset ID | | `name` | string | no | Updated name | | `description` | string \| null | no | Updated description, or null to clear | | `data` | unknown | no | Updated dataset contents | | `config` | object \| null | no | Updated config, or null to clear | ### `delete` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ----------- | | `id` | string | yes | Dataset ID | ## Examples ### Create a FHIR patient dataset ```json theme={null} { "action": "create", "name": "Prior Auth Patients", "description": "Patients requiring prior authorization for imaging", "type": "FHIR", "data": { "resourceType": "Bundle", "type": "collection", "entry": [ { "resource": { "resourceType": "Patient", "name": [{ "family": "Chen", "given": ["Maria"] }], "birthDate": "1985-03-14" } } ] } } ``` ### List all datasets ```json theme={null} { "action": "list" } ``` ### Get a dataset by ID ```json theme={null} { "action": "get", "id": "ds_abc123" } ``` # Environments Source: https://docs.verial.ai/mcp/tools/environments Manage simulated healthcare environments. Manage simulated healthcare environments that define the system your agent interacts with. ## Actions | Action | Description | | ----------------- | ------------------------------------------- | | `list` | List all environments in the organization | | `create` | Create a new environment | | `get` | Get an environment by ID | | `update` | Update an environment's name or description | | `delete` | Delete an environment | | `addSimulator` | Attach a simulator to an environment | | `removeSimulator` | Detach a simulator from an environment | ## Parameters ### `list` No parameters. ### `create` | Parameter | Type | Required | Description | | ------------- | ------ | -------- | ------------------------------ | | `name` | string | yes | Name of the environment | | `description` | string | no | Description of the environment | ### `get` | Parameter | Type | Required | Description | | --------- | ------ | -------- | -------------- | | `id` | string | yes | Environment ID | ### `update` | Parameter | Type | Required | Description | | ------------- | -------------- | -------- | ------------------------------------- | | `id` | string | yes | Environment ID | | `name` | string | no | Updated name | | `description` | string \| null | no | Updated description, or null to clear | ### `delete` | Parameter | Type | Required | Description | | --------- | ------ | -------- | -------------- | | `id` | string | yes | Environment ID | ### `addSimulator` | Parameter | Type | Required | Description | | ------------- | ------ | -------- | ---------------------- | | `id` | string | yes | Environment ID | | `simulatorId` | string | yes | Simulator ID to attach | ### `removeSimulator` | Parameter | Type | Required | Description | | ------------- | ------ | -------- | ---------------------- | | `id` | string | yes | Environment ID | | `simulatorId` | string | yes | Simulator ID to detach | ## Examples ### List all environments ```json theme={null} { "action": "list" } ``` ### Create a primary care clinic environment ```json theme={null} { "action": "create", "name": "Primary Care Clinic", "description": "Simulated primary care setting with EHR and phone system" } ``` ### Add a FHIR simulator to an environment ```json theme={null} { "action": "addSimulator", "id": "env_abc123", "simulatorId": "sim_fhir456" } ``` # Playgrounds Source: https://docs.verial.ai/mcp/tools/playgrounds Manage simulated healthcare playgrounds. Manage playgrounds that provision live simulator instances from an environment definition. ## Actions | Action | Description | | ---------- | ------------------------------------------------ | | `list` | List all playgrounds in the organization | | `create` | Provision a new playground from an environment | | `get` | Get a playground by ID | | `teardown` | Tear down a playground and release its resources | ## Parameters ### `list` No parameters. ### `create` | Parameter | Type | Required | Description | | --------------- | ------ | -------- | -------------------------------- | | `environmentId` | string | yes | Environment ID to provision from | ### `get` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------- | | `id` | string | yes | Playground ID | ### `teardown` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------- | | `id` | string | yes | Playground ID | ## Examples ### Provision a playground from an environment ```json theme={null} { "action": "create", "environmentId": "env_abc123" } ``` ### List all playgrounds ```json theme={null} { "action": "list" } ``` ### Tear down a playground ```json theme={null} { "action": "teardown", "id": "pg_xyz789" } ``` # Sandboxes Source: https://docs.verial.ai/mcp/tools/sandboxes Manage sandbox instances (running simulators). Manage sandbox instances that represent running simulators within a playground. ## Actions | Action | Description | | --------------- | ------------------------------------------------- | | `list` | List sandboxes, optionally filtered by playground | | `create` | Create a new sandbox from a simulator | | `get` | Get a sandbox by ID | | `listEvents` | List recorded events for a sandbox | | `teardown` | Tear down a sandbox | | `addDataset` | Load a dataset into a sandbox | | `removeDataset` | Remove a dataset from a sandbox | ## Parameters ### `list` | Parameter | Type | Required | Description | | -------------- | ------ | -------- | ----------------------- | | `playgroundId` | string | no | Filter by playground ID | ### `create` | Parameter | Type | Required | Description | | ------------- | ------ | -------- | --------------------------- | | `simulatorId` | string | yes | Simulator ID to instantiate | ### `get` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ----------- | | `id` | string | yes | Sandbox ID | ### `listEvents` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ----------- | | `id` | string | yes | Sandbox ID | ### `teardown` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ----------- | | `id` | string | yes | Sandbox ID | ### `addDataset` | Parameter | Type | Required | Description | | ----------- | ------ | -------- | ------------------ | | `id` | string | yes | Sandbox ID | | `datasetId` | string | yes | Dataset ID to load | ### `removeDataset` | Parameter | Type | Required | Description | | ----------- | ------ | -------- | -------------------- | | `id` | string | yes | Sandbox ID | | `datasetId` | string | yes | Dataset ID to remove | ## Examples ### List sandboxes for a playground ```json theme={null} { "action": "list", "playgroundId": "pg_xyz789" } ``` ### Load a patient dataset into a sandbox ```json theme={null} { "action": "addDataset", "id": "sb_abc123", "datasetId": "ds_patients456" } ``` ### List events recorded by a sandbox ```json theme={null} { "action": "listEvents", "id": "sb_abc123" } ``` # Simulators Source: https://docs.verial.ai/mcp/tools/simulators Manage simulators (FHIR, HL7, voice, fax, etc.). Manage simulators that represent individual healthcare interfaces like EHR systems, phone lines, and fax machines. ## Actions | Action | Description | | -------- | --------------------------------------------------- | | `list` | List simulators, optionally filtered by environment | | `create` | Create a new simulator | | `get` | Get a simulator by ID | | `update` | Update a simulator's name or config | | `delete` | Delete a simulator | ## Parameters ### `list` | Parameter | Type | Required | Description | | --------------- | ------ | -------- | ------------------------ | | `environmentId` | string | no | Filter by environment ID | ### `create` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------------------------------------------------------------------------------------------- | | `type` | string | yes | Simulator type: `FHIR`, `HL7`, `Voice`, `Fax`, `Payer`, `Clearinghouse`, `CDSHooks`, or `Message` | | `name` | string | yes | Name of the simulator | | `config` | object | no | Type-specific configuration | ### `get` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------ | | `id` | string | yes | Simulator ID | ### `update` | Parameter | Type | Required | Description | | --------- | -------------- | -------- | -------------------------------- | | `id` | string | yes | Simulator ID | | `name` | string | no | Updated name | | `config` | object \| null | no | Updated config, or null to clear | ### `delete` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------ | | `id` | string | yes | Simulator ID | ## Examples ### Create a FHIR simulator with auth config ```json theme={null} { "action": "create", "type": "FHIR", "name": "Athena EHR", "config": { "authType": "bearer", "fhirVersion": "R4" } } ``` ### List simulators for an environment ```json theme={null} { "action": "list", "environmentId": "env_abc123" } ``` ### Update simulator config ```json theme={null} { "action": "update", "id": "sim_fhir456", "name": "Athena EHR (Sandbox)", "config": { "authType": "smart-on-fhir", "fhirVersion": "R4" } } ``` # Task Runs Source: https://docs.verial.ai/mcp/tools/task-runs Manage task runs within a benchmark run. Manage individual task runs that track the outcome of each task within a benchmark run. ## Actions | Action | Description | | ---------- | -------------------------------------- | | `list` | List all task runs for a benchmark run | | `get` | Get a task run by ID | | `complete` | Mark a task run as complete | | `cancel` | Cancel a task run | ## Parameters ### `list` | Parameter | Type | Required | Description | | ---------------- | ------ | -------- | -------------------------------------- | | `benchmarkRunId` | string | yes | Benchmark run ID to list task runs for | ### `get` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ----------- | | `id` | string | yes | Task run ID | ### `complete` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ----------- | | `id` | string | yes | Task run ID | ### `cancel` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ----------- | | `id` | string | yes | Task run ID | ## Examples ### List task runs for a benchmark run ```json theme={null} { "action": "list", "benchmarkRunId": "br_xyz789" } ``` ### Get task run details ```json theme={null} { "action": "get", "id": "tr_abc123" } ``` ### Complete a task run ```json theme={null} { "action": "complete", "id": "tr_abc123" } ``` # Tasks Source: https://docs.verial.ai/mcp/tools/tasks Manage benchmark tasks. Manage individual tasks within a benchmark that define what your agent should accomplish. ## Actions | Action | Description | | -------- | ----------------------------- | | `list` | List all tasks in a benchmark | | `create` | Create a new task | | `get` | Get a task by ID | | `update` | Update a task | | `delete` | Delete a task | ## Parameters ### `list` | Parameter | Type | Required | Description | | ------------- | ------ | -------- | ------------------------------ | | `benchmarkId` | string | yes | Benchmark ID to list tasks for | ### `create` | Parameter | Type | Required | Description | | ------------- | --------- | -------- | ------------------------------------------------------- | | `benchmarkId` | string | yes | Benchmark ID to add the task to | | `name` | string | yes | Name of the task | | `timeout` | number | no | Task-specific timeout in seconds | | `taskItem` | object | no | Task item configuration (patient, instruction, trigger) | | `scenario` | object | no | Scenario configuration for the task | | `tags` | string\[] | no | Tags for filtering and grouping | ### `get` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ----------- | | `id` | string | yes | Task ID | ### `update` | Parameter | Type | Required | Description | | ---------- | -------------- | -------- | ----------------------------------- | | `id` | string | yes | Task ID | | `name` | string | no | Updated name | | `timeout` | number \| null | no | Updated timeout, or null to clear | | `taskItem` | object \| null | no | Updated task item, or null to clear | | `scenario` | object \| null | no | Updated scenario, or null to clear | | `tags` | string\[] | no | Updated tags | ### `delete` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ----------- | | `id` | string | yes | Task ID | ## Examples ### Create a prior auth submission task ```json theme={null} { "action": "create", "benchmarkId": "bm_abc123", "name": "Submit prior auth for MRI", "timeout": 120, "taskItem": { "patient": "Maria Chen", "instruction": "Submit a prior authorization request for a lumbar MRI" }, "tags": ["prior-auth", "imaging"] } ``` ### List tasks in a benchmark ```json theme={null} { "action": "list", "benchmarkId": "bm_abc123" } ``` ### Update task tags ```json theme={null} { "action": "update", "id": "task_xyz789", "tags": ["prior-auth", "imaging", "urgent"] } ``` # Eligibility Check Source: https://docs.verial.ai/mcp/workflows/eligibility-check Verify insurance eligibility through a clearinghouse simulator. ## User Prompt > "Set up an environment with a clearinghouse and test whether my agent can verify patient eligibility." ## Tool Call Sequence **Call:** `simulators` ```json theme={null} { "action": "create", "type": "Clearinghouse", "name": "Availity Clearinghouse" } ``` **Response:** ```json theme={null} { "id": "sim_ch_01", "type": "Clearinghouse", "name": "Availity Clearinghouse", "config": null, "createdAt": "2026-04-06T12:00:00Z" } ``` **What the agent learns:** The clearinghouse simulator is created. It will accept 270/271 eligibility transactions once provisioned in a playground. **Call 1:** `environments` ```json theme={null} { "action": "create", "name": "Eligibility Testing", "description": "Clearinghouse environment for verifying patient insurance eligibility" } ``` **Response:** ```json theme={null} { "id": "env_elig_01", "name": "Eligibility Testing", "description": "Clearinghouse environment for verifying patient insurance eligibility", "simulators": [], "createdAt": "2026-04-06T12:00:01Z" } ``` **Call 2:** `environments` ```json theme={null} { "action": "addSimulator", "id": "env_elig_01", "simulatorId": "sim_ch_01" } ``` **Response:** ```json theme={null} { "id": "env_elig_01", "name": "Eligibility Testing", "simulators": [ { "id": "sim_ch_01", "type": "Clearinghouse", "name": "Availity Clearinghouse" } ] } ``` **What the agent learns:** The environment is ready with the clearinghouse attached. The agent creates a dataset containing a FHIR patient bundle with insurance coverage information. **Call:** `datasets` ```json theme={null} { "action": "create", "name": "Eligibility Test Patient", "format": "fhir", "data": { "resourceType": "Bundle", "type": "collection", "entry": [ { "resource": { "resourceType": "Patient", "id": "pat-001", "name": [{ "family": "Chen", "given": ["Maria"] }], "birthDate": "1985-03-14", "gender": "female", "address": [{ "state": "CA", "postalCode": "90210" }] } }, { "resource": { "resourceType": "Coverage", "id": "cov-001", "status": "active", "beneficiary": { "reference": "Patient/pat-001" }, "payor": [{ "display": "BlueCross BlueShield" }], "subscriberId": "BCB-998877", "class": [ { "type": { "coding": [{ "code": "plan" }] }, "value": "PPO Gold" } ], "period": { "start": "2026-01-01", "end": "2026-12-31" } } } ] } } ``` **Response:** ```json theme={null} { "id": "ds_elig_01", "name": "Eligibility Test Patient", "format": "fhir", "resourceCount": 2, "createdAt": "2026-04-06T12:00:02Z" } ``` **What the agent learns:** The dataset includes a patient (Maria Chen) with active BlueCross PPO Gold coverage. This data will be loaded into the sandbox so the clearinghouse returns realistic eligibility responses. The agent provisions the environment, finds the sandbox, and loads the patient dataset. **Call 1:** `playgrounds` ```json theme={null} { "action": "create", "environmentId": "env_elig_01" } ``` **Response:** ```json theme={null} { "id": "pg_elig_01", "environmentId": "env_elig_01", "status": "Active", "sandboxes": [ { "id": "sbx_ch_01", "simulatorId": "sim_ch_01", "type": "Clearinghouse", "status": "Active", "endpoint": "https://ch.verial.dev/sbx_ch_01" } ], "createdAt": "2026-04-06T12:00:03Z" } ``` **Call 2:** `sandboxes` ```json theme={null} { "action": "list", "playgroundId": "pg_elig_01" } ``` **Response:** ```json theme={null} { "items": [ { "id": "sbx_ch_01", "simulatorId": "sim_ch_01", "type": "Clearinghouse", "status": "Active", "endpoint": "https://ch.verial.dev/sbx_ch_01", "datasets": [] } ] } ``` **Call 3:** `sandboxes` ```json theme={null} { "action": "addDataset", "id": "sbx_ch_01", "datasetId": "ds_elig_01" } ``` **Response:** ```json theme={null} { "id": "sbx_ch_01", "datasets": [ { "id": "ds_elig_01", "name": "Eligibility Test Patient" } ] } ``` **What the agent learns:** The playground is live and the clearinghouse sandbox now has the patient data loaded. When the agent-under-test queries eligibility for Maria Chen (subscriber BCB-998877), the clearinghouse will return active PPO Gold coverage. The agent defines the benchmark, task, and eval in sequence. **Call 1:** `benchmarks` ```json theme={null} { "action": "create", "name": "Eligibility Verification", "environmentId": "env_elig_01", "timeout": 120 } ``` **Response:** ```json theme={null} { "id": "bm_elig_01", "name": "Eligibility Verification", "environmentId": "env_elig_01", "timeout": 120, "tasks": [], "createdAt": "2026-04-06T12:00:04Z" } ``` **Call 2:** `tasks` ```json theme={null} { "action": "create", "benchmarkId": "bm_elig_01", "name": "Verify patient eligibility", "instruction": "Check insurance eligibility for patient Maria Chen (DOB 1985-03-14, subscriber ID BCB-998877) through the clearinghouse. Confirm whether coverage is active and retrieve the plan details." } ``` **Response:** ```json theme={null} { "id": "task_elig_01", "benchmarkId": "bm_elig_01", "name": "Verify patient eligibility", "instruction": "Check insurance eligibility for patient Maria Chen (DOB 1985-03-14, subscriber ID BCB-998877) through the clearinghouse. Confirm whether coverage is active and retrieve the plan details.", "criteria": [], "createdAt": "2026-04-06T12:00:05Z" } ``` **Call 3:** `criteria` ```json theme={null} { "action": "create", "taskId": "task_elig_01", "name": "eligibility-verified", "assertion": { "type": "x12-response", "spec": { "transaction": "271", "coverage_status": "active" } }, "weight": 1.0 } ``` **Response:** ```json theme={null} { "id": "crit_elig_01", "taskId": "task_elig_01", "name": "eligibility-verified", "weight": 1.0, "createdAt": "2026-04-06T12:00:06Z" } ``` **What the agent learns:** The benchmark is fully defined with one task and one criterion. The criterion checks that the agent-under-test successfully verified eligibility and received an active coverage response. ## Agent Response > Your eligibility check environment and benchmark are ready: > > | Resource | ID | Detail | > | ----------- | ------------- | ----------------------------------------------- | > | Environment | `env_elig_01` | Clearinghouse simulator attached | > | Dataset | `ds_elig_01` | Maria Chen, BCB PPO Gold, subscriber BCB-998877 | > | Playground | `pg_elig_01` | Active at `https://ch.verial.dev/sbx_ch_01` | > | Benchmark | `bm_elig_01` | 1 task, 1 criterion, 120s timeout | > > Point your agent at the clearinghouse endpoint and run the benchmark with `benchmark_runs` create to start testing. ## Summary | Metric | Value | | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Tool calls | **9** | | Tools used | `simulators`, `environments`, `datasets`, `playgrounds`, `sandboxes`, `benchmarks`, `tasks`, `criteria` | | Key technique | Load patient data into the sandbox before running benchmarks so the clearinghouse returns realistic eligibility responses. The create-then-link pattern (simulator, environment, addSimulator, playground, addDataset) builds up the simulation layer by layer. | # Environment Setup Source: https://docs.verial.ai/mcp/workflows/environment-setup Create a complete simulation environment from scratch. ## User Prompt > "Set up a primary care clinic with a FHIR EHR and a payer portal for testing prior auth workflows." ## Tool Call Sequence The agent creates two simulators: a FHIR EHR and a payer portal. **Call 1:** `simulators` ```json theme={null} { "action": "create", "type": "FHIR", "name": "Primary Care EHR", "config": { "authType": "bearer", "fhirVersion": "R4" } } ``` **Response:** ```json theme={null} { "id": "sim_fhir_01", "type": "FHIR", "name": "Primary Care EHR", "config": { "authType": "bearer", "fhirVersion": "R4" }, "createdAt": "2026-04-06T10:00:00Z" } ``` **Call 2:** `simulators` ```json theme={null} { "action": "create", "type": "Payer", "name": "BlueCross Portal" } ``` **Response:** ```json theme={null} { "id": "sim_payer_02", "type": "Payer", "name": "BlueCross Portal", "config": null, "createdAt": "2026-04-06T10:00:01Z" } ``` **What the agent learns:** Both simulators are created and have IDs. The agent uses these IDs to link the simulators to an environment in the next step. The agent creates the environment, then attaches both simulators. **Call 3:** `environments` ```json theme={null} { "action": "create", "name": "Primary Care Clinic", "description": "Simulated primary care setting with FHIR EHR and BlueCross payer portal for prior auth testing" } ``` **Response:** ```json theme={null} { "id": "env_clinic_01", "name": "Primary Care Clinic", "description": "Simulated primary care setting with FHIR EHR and BlueCross payer portal for prior auth testing", "simulators": [], "createdAt": "2026-04-06T10:00:02Z" } ``` **Call 4:** `environments` ```json theme={null} { "action": "addSimulator", "id": "env_clinic_01", "simulatorId": "sim_fhir_01" } ``` **Response:** ```json theme={null} { "id": "env_clinic_01", "name": "Primary Care Clinic", "simulators": [ { "id": "sim_fhir_01", "type": "FHIR", "name": "Primary Care EHR" } ] } ``` **Call 5:** `environments` ```json theme={null} { "action": "addSimulator", "id": "env_clinic_01", "simulatorId": "sim_payer_02" } ``` **Response:** ```json theme={null} { "id": "env_clinic_01", "name": "Primary Care Clinic", "simulators": [ { "id": "sim_fhir_01", "type": "FHIR", "name": "Primary Care EHR" }, { "id": "sim_payer_02", "type": "Payer", "name": "BlueCross Portal" } ] } ``` **What the agent learns:** The environment now has both simulators attached. The `simulators` array in the response confirms the links. The agent creates a playground to spin up live instances of all simulators in the environment. **Call 6:** `playgrounds` ```json theme={null} { "action": "create", "environmentId": "env_clinic_01" } ``` **Response:** ```json theme={null} { "id": "pg_01", "environmentId": "env_clinic_01", "status": "Active", "sandboxes": [ { "id": "sbx_fhir_01", "simulatorId": "sim_fhir_01", "type": "FHIR", "status": "Active", "endpoint": "https://fhir.verial.dev/sbx_fhir_01/fhir/R4" }, { "id": "sbx_payer_01", "simulatorId": "sim_payer_02", "type": "Payer", "status": "Active", "endpoint": "https://portal.verial.dev/sbx_payer_01" } ], "createdAt": "2026-04-06T10:00:05Z" } ``` **What the agent learns:** The playground is active with live endpoints for both simulators. The FHIR EHR is available at a REST endpoint and the payer portal has its own URL. These endpoints are ready for the agent-under-test to connect to. ## Agent Response > Your primary care clinic environment is ready. Here is what was provisioned: > > | Simulator | Type | Endpoint | > | ---------------- | ----- | --------------------------------------------- | > | Primary Care EHR | FHIR | `https://fhir.verial.dev/sbx_fhir_01/fhir/R4` | > | BlueCross Portal | Payer | `https://portal.verial.dev/sbx_payer_01` | > > The environment `env_clinic_01` is active with playground `pg_01`. You can now point your agent at these endpoints to test prior auth workflows. ## Summary | Metric | Value | | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | Tool calls | **6** | | Tools used | `simulators`, `environments`, `playgrounds` | | Key technique | Create simulators first, then compose them into an environment. A single `playgrounds` create call provisions all linked simulators at once. | # Prior Auth Testing Source: https://docs.verial.ai/mcp/workflows/prior-auth Define and run a prior authorization benchmark. ## User Prompt > "Create a benchmark that tests whether my agent can submit a prior auth for an MRI." ## Tool Call Sequence **Call:** `benchmarks` ```json theme={null} { "action": "create", "name": "Prior Auth Test", "environmentId": "env_clinic_01", "timeout": 300 } ``` **Response:** ```json theme={null} { "id": "bm_pa_01", "name": "Prior Auth Test", "environmentId": "env_clinic_01", "timeout": 300, "tasks": [], "createdAt": "2026-04-06T11:00:00Z" } ``` **What the agent learns:** The benchmark is created and linked to the environment. The 300-second timeout gives the agent-under-test five minutes to complete each task. **Call:** `tasks` ```json theme={null} { "action": "create", "benchmarkId": "bm_pa_01", "name": "Submit PA for MRI", "instruction": "Submit a prior authorization request for a lumbar spine MRI (CPT 72148) for the patient. Use the payer portal to file the request and confirm submission." } ``` **Response:** ```json theme={null} { "id": "task_mri_01", "benchmarkId": "bm_pa_01", "name": "Submit PA for MRI", "instruction": "Submit a prior authorization request for a lumbar spine MRI (CPT 72148) for the patient. Use the payer portal to file the request and confirm submission.", "criteria": [], "createdAt": "2026-04-06T11:00:01Z" } ``` **What the agent learns:** The task defines what the agent-under-test should do. The instruction is specific about the procedure type and CPT code so criteria can verify exact behavior. The agent creates two criteria: one to verify submission and one to verify the correct CPT code. **Call 1:** `criteria` ```json theme={null} { "action": "create", "taskId": "task_mri_01", "name": "pa-submitted", "assertion": { "type": "portal-state-match", "spec": { "table": "prior_auth_requests", "where": { "patient_id": "pat_01" } } }, "weight": 1.0 } ``` **Response:** ```json theme={null} { "id": "crit_pa_01", "taskId": "task_mri_01", "name": "pa-submitted", "weight": 1.0, "createdAt": "2026-04-06T11:00:02Z" } ``` **Call 2:** `criteria` ```json theme={null} { "action": "create", "taskId": "task_mri_01", "name": "correct-cpt", "assertion": { "type": "portal-state-match", "spec": { "table": "prior_auth_requests", "fields": { "cpt_code": "72148" } } }, "weight": 0.5 } ``` **Response:** ```json theme={null} { "id": "crit_cpt_01", "taskId": "task_mri_01", "name": "correct-cpt", "weight": 0.5, "createdAt": "2026-04-06T11:00:03Z" } ``` **What the agent learns:** The first criterion (weight 1.0) is the critical check: did the agent actually submit a PA? The second criterion (weight 0.5) verifies correctness of the CPT code. Weighted scoring means the submission check counts twice as much as the code check. **Call:** `benchmark_runs` ```json theme={null} { "action": "create", "benchmarkId": "bm_pa_01" } ``` **Response:** ```json theme={null} { "id": "run_01", "benchmarkId": "bm_pa_01", "status": "Running", "score": null, "verdict": null, "createdAt": "2026-04-06T11:00:04Z" } ``` **What the agent learns:** The run is in progress. The agent-under-test is now executing against the live playground. The agent should poll for completion. The agent polls the run, then drills into task-level and criterion-level results. **Call 1:** `benchmark_runs` ```json theme={null} { "action": "get", "id": "run_01" } ``` **Response:** ```json theme={null} { "id": "run_01", "benchmarkId": "bm_pa_01", "status": "Completed", "score": 0.87, "verdict": "Pass", "completedAt": "2026-04-06T11:03:42Z" } ``` **Call 2:** `task-runs` ```json theme={null} { "action": "list", "runId": "run_01" } ``` **Response:** ```json theme={null} { "items": [ { "id": "tr_01", "runId": "run_01", "taskId": "task_mri_01", "name": "Submit PA for MRI", "status": "Completed", "score": 0.87 } ] } ``` **Call 3:** `criterion-runs` ```json theme={null} { "action": "list", "taskRunId": "tr_01" } ``` **Response:** ```json theme={null} { "items": [ { "id": "cr_01", "criterionId": "crit_pa_01", "name": "pa-submitted", "result": "Pass", "score": 1.0, "reasoning": "The agent navigated to the BlueCross portal and submitted a prior auth request for the patient. The submission confirmation was recorded in the interaction log." }, { "id": "cr_02", "criterionId": "crit_cpt_01", "name": "correct-cpt", "result": "Partial", "score": 0.6, "reasoning": "The prior auth request included CPT code 72148, but the agent initially entered 72141 and had to correct it. The final submission was correct." } ] } ``` **What the agent learns:** The run passed with a score of 0.87. The PA was submitted successfully (full marks), but the CPT code check scored 0.6 because the agent needed a correction attempt. The `reasoning` field explains exactly what happened. ## Agent Response > Your prior auth benchmark completed with a **Pass** verdict and a score of **0.87**. > > | Criterion | Result | Score | Detail | > | ------------ | ------- | ----- | ------------------------------------------------------------------------ | > | pa-submitted | Pass | 1.0 | PA was submitted through the payer portal | > | correct-cpt | Partial | 0.6 | CPT 72148 was correct in the final submission, but required a correction | > > The agent successfully submitted the prior authorization, though it initially entered the wrong CPT code before self-correcting. You might want to improve your agent's CPT code lookup logic. ## Summary | Metric | Value | | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Tool calls | **7** | | Tools used | `benchmarks`, `tasks`, `criteria`, `benchmark_runs`, `task-runs`, `criterion-runs` | | Key technique | Define the benchmark structure (benchmark, task, criteria) before starting the run. Use weighted criteria to distinguish critical checks from secondary validations. Poll the run, then drill into task-runs and criterion-runs for detailed results. | # Errors Source: https://docs.verial.ai/sdk/errors Typed error classes, retry behavior, and status code mapping. All SDK errors extend `VerialError`. API errors extend `APIError` with a numeric `status`, a string `code`, and an optional `requestId` captured from the response. ## Hierarchy ``` VerialError ├── APIError │ ├── AuthenticationError 401 │ ├── PermissionDeniedError 403 │ ├── NotFoundError 404 │ ├── ConflictError 409 │ ├── ValidationError 400 (and other 4xx not covered above) │ ├── RateLimitError 429 (with retryAfter) │ └── InternalServerError 5xx ├── APIConnectionError network / fetch failure └── APITimeoutError request exceeded timeout ``` ## Fields Every `APIError` exposes: | Field | Type | Description | | ----------- | -------------------- | -------------------------------------------------------------------- | | `status` | number | HTTP status code | | `code` | string | Machine-readable error code from the API (e.g. `RESOURCE_NOT_FOUND`) | | `message` | string | Human-readable message. Includes `(request_id: ...)` when provided. | | `requestId` | string \| undefined | Request ID — include this when filing support tickets. | | `headers` | Headers \| undefined | Response headers | | `errors` | object \| undefined | Field-level validation details for `ValidationError` | `RateLimitError` additionally exposes: | Field | Type | Description | | ------------ | ------------------- | -------------------------------------------------------------- | | `retryAfter` | number \| undefined | Seconds until the next retry, parsed from `Retry-After` header | ## Catching ```typescript theme={null} import { APIError, AuthenticationError, NotFoundError, RateLimitError, ValidationError, } from '@verial-ai/sdk' try { await verial.environments.get({ id: 'env_does_not_exist' }) } catch (err) { if (err instanceof NotFoundError) { // 404 — resource does not exist } else if (err instanceof AuthenticationError) { // 401 — bad API key } else if (err instanceof RateLimitError) { await sleep((err.retryAfter ?? 1) * 1000) } else if (err instanceof ValidationError) { console.error('validation', err.errors) } else if (err instanceof APIError) { // any other 4xx/5xx console.error(err.status, err.code, err.requestId) } else { throw err } } ``` ## Retry Behavior The SDK automatically retries these statuses with exponential backoff + jitter: * `408` Request Timeout * `429` Too Many Requests (honors `Retry-After`) * `500` / `502` / `503` / `504` It also retries network errors (`APIConnectionError`). `APITimeoutError` is not retried — it surfaces immediately so callers can decide. Retries default to **2** (3 total attempts). Override with `maxRetries`: ```typescript theme={null} const verial = new Verial({ apiKey, maxRetries: 5 }) ``` Backoff: `min(0.5 * 2^attempt, 8)` seconds with ±20% jitter. `Retry-After` on 429 overrides the backoff. ## Timeouts Requests time out after `60000` ms by default. Override per-client: ```typescript theme={null} const verial = new Verial({ apiKey, timeout: 10_000 }) ``` A timeout throws `APITimeoutError` immediately without retrying. # Overview Source: https://docs.verial.ai/sdk/index TypeScript SDK for Verial. The Verial SDK (`@verial-ai/sdk`) is the recommended way to integrate Verial into TypeScript and Node.js applications. It wraps every REST endpoint with typed methods, handles authentication, retries, and pagination, and ships with a CLI for common workflows. Install the package, configure the client, and verify setup. End-to-end examples: create environments, run benchmarks, read results. Typed error hierarchy, retry behavior, and status code mapping. Cursor-based iteration across list endpoints. ## What the Client Exposes ```typescript theme={null} import { Verial } from '@verial-ai/sdk' const verial = new Verial({ apiKey: process.env.VERIAL_API_KEY! }) verial.environments // Environments resource verial.simulators // Simulators resource verial.datasets // Datasets resource verial.benchmarks // Benchmarks resource verial.tasks // Tasks resource verial.evals // Evals (criteria) resource verial.playgrounds // Playgrounds resource verial.sandboxes // Sandboxes resource verial.runs // Benchmark runs resource verial.taskRuns // Task runs resource verial.evalRuns // Eval (criterion) runs resource ``` Each resource mirrors the corresponding [REST endpoint group](/api-reference/resources/overview). See the [Resources](#resources) section of the sidebar for per-resource reference. ## Design Principles * **Typed everywhere.** Every argument and return value is typed against the Prisma schema, including enums like `SimulatorType` and `Verdict`. * **Snake to camel at the boundary.** The wire is snake\_case; the SDK surface is camelCase. You never see snake\_case in your code. * **Retries on transient failures.** 408/429/500/502/503/504 are retried with exponential backoff and jitter; `retry-after` on 429 is honored. * **No hidden state.** The client is a thin wrapper around `fetch`. Hooks let you observe every request, response, and error without patching. ## Requirements * Node.js 18+ * ESM project (`"type": "module"` in package.json, `.mts` extensions, or a bundler that resolves ESM) ## Install ```bash theme={null} npm install @verial-ai/sdk ``` # Installation Source: https://docs.verial.ai/sdk/installation Install and configure the Verial TypeScript SDK. ## Requirements * **Node.js 18** or later * **TypeScript 5.0** or later (recommended) * The SDK is **ESM-only**. CommonJS (`require()`) is not supported. ## Install ```bash theme={null} npm install @verial-ai/sdk ``` ## Configure Create a client instance with your API key: ```typescript theme={null} import Verial from '@verial-ai/sdk' const verial = new Verial({ apiKey: process.env.VERIAL_API_KEY, }) ``` ### Configuration Options | Option | Type | Default | Description | | ------------ | ------ | ----------------------- | -------------------------------------------------- | | `apiKey` | string | Required | Your Verial API key (starts with `vk_`) | | `baseUrl` | string | `https://api.verial.ai` | API base URL (override for self-hosted or staging) | | `timeout` | number | `30000` | Request timeout in milliseconds | | `maxRetries` | number | `2` | Number of automatic retries on failure | ### Custom Base URL For development or self-hosted deployments: ```typescript theme={null} const verial = new Verial({ apiKey: process.env.VERIAL_API_KEY, baseUrl: 'http://localhost:3001', }) ``` ## ESM Configuration The SDK uses ES modules. Make sure your project is configured for ESM: **Option 1:** Set `"type": "module"` in your `package.json`: ```json theme={null} { "type": "module" } ``` **Option 2:** Use `.mts` file extensions for TypeScript files. **Option 3:** Use a bundler (Vite, esbuild, tsup) that handles ESM resolution. ## TypeScript The SDK ships with built-in type declarations. No additional `@types/` package is needed. ```typescript theme={null} import Verial from '@verial-ai/sdk' import type { Environment, Benchmark, Run, SimulatorType } from '@verial-ai/sdk' const verial = new Verial({ apiKey: 'vk_xxx' }) const env: Environment = await verial.environments.create({ name: 'Test Clinic', }) ``` # Pagination Source: https://docs.verial.ai/sdk/pagination Cursor-based iteration across SDK list endpoints. Every `list()` method returns a `Page`. Pages are async-iterable, so the simplest consumer iterates across every item across every page transparently. ## Auto-iterate ```typescript theme={null} for await (const env of await verial.environments.list()) { console.log(env.id) } ``` The iterator fetches successive pages lazily as you consume items. ## One Page at a Time ```typescript theme={null} let page = await verial.environments.list({ limit: 50 }) do { for (const env of page.data) { console.log(env.id) } const next = await page.getNextPage() if (!next) break page = next } while (true) ``` ## Page Surface | Member | Type | Description | | --------------- | -------------------------------- | ---------------------------------------- | | `data` | `T[]` | Items in this page | | `hasNextPage()` | `() => boolean` | `true` if another page is available | | `getNextPage()` | `() => Promise \| null>` | Fetches the next page, or `null` if none | | `toJSON()` | `() => { data, _meta }` | Serializable snapshot | | `_meta.next` | `string \| null` | Next cursor | | `_meta.prev` | `string \| null` | Previous cursor | | `_meta.limit` | `number` | Page size | ## Options All list methods accept: | Option | Type | Description | | -------- | ------ | ----------------------------- | | `cursor` | string | Resume from a specific cursor | | `limit` | number | Items per page | ## Early Exit Stop iteration whenever you want — the SDK doesn't prefetch pages. ```typescript theme={null} for await (const run of await verial.runs.list()) { if (run.verdict === 'pass') { return run } } ``` # Benchmarks Source: https://docs.verial.ai/sdk/resources/benchmarks SDK methods for the Benchmarks resource. Full concept: [Benchmarks](/guides/concepts/benchmarks). REST reference: [/api-reference/resources/benchmarks](/api-reference/resources/benchmarks). ## Methods ```typescript theme={null} verial.benchmarks.list({ cursor?, limit? }) verial.benchmarks.create({ name, environmentId, description? }) verial.benchmarks.get({ id }) verial.benchmarks.update({ id, name?, description? }) verial.benchmarks.delete({ id }) ``` ## Example ```typescript theme={null} const benchmark = await verial.benchmarks.create({ name: 'Prior Auth Workflow', environmentId: 'env_01H...', }) ``` # Datasets Source: https://docs.verial.ai/sdk/resources/datasets SDK methods for the Datasets resource. REST reference: [/api-reference/resources/datasets](/api-reference/resources/datasets). ## Methods ```typescript theme={null} verial.datasets.list({ cursor?, limit? }) verial.datasets.create({ type, name, config?, description? }) verial.datasets.get({ id }) verial.datasets.update({ id, name?, config?, description? }) verial.datasets.delete({ id }) verial.datasets.generate({ id, prompt }) ``` ## Examples ```typescript theme={null} const ds = await verial.datasets.create({ type: 'FHIR', name: 'Cardiology patients', config: { patientCount: 100 }, }) await verial.datasets.generate({ id: ds.id, prompt: 'Add 20 patients with uncontrolled hypertension', }) ``` # Environments Source: https://docs.verial.ai/sdk/resources/environments SDK methods for the Environments resource. Full concept: [Environments](/guides/concepts/environments). REST reference: [/api-reference/resources/environments](/api-reference/resources/environments). ## Methods ```typescript theme={null} verial.environments.list({ cursor?, limit? }) verial.environments.create({ name, templateId? }) verial.environments.get({ id }) verial.environments.update({ id, name?, description? }) verial.environments.delete({ id }) verial.environments.addSimulator({ environmentId, simulatorId }) verial.environments.removeSimulator({ environmentId, simulatorId }) ``` ## Examples ```typescript theme={null} const env = await verial.environments.create({ name: 'Test Clinic' }) await verial.environments.addSimulator({ environmentId: env.id, simulatorId: 'sim_01H...', }) for await (const e of await verial.environments.list()) { console.log(e.id, e.name) } await verial.environments.update({ id: env.id, description: 'FHIR + voice' }) await verial.environments.delete({ id: env.id }) ``` # Playgrounds Source: https://docs.verial.ai/sdk/resources/playgrounds SDK methods for the Playgrounds resource. REST reference: [/api-reference/resources/playgrounds](/api-reference/resources/playgrounds). ## Methods ```typescript theme={null} verial.playgrounds.list({ cursor?, limit? }) verial.playgrounds.create({ environmentId }) verial.playgrounds.get({ id }) verial.playgrounds.teardown({ id }) ``` ## Example ```typescript theme={null} const pg = await verial.playgrounds.create({ environmentId: 'env_01H...' }) const details = await verial.playgrounds.get({ id: pg.id }) console.log(details.status) await verial.playgrounds.teardown({ id: pg.id }) ``` # Runs Source: https://docs.verial.ai/sdk/resources/runs SDK methods for the Benchmark Runs resource. Full concept: [Benchmark Runs](/guides/concepts/runs). REST reference: [/api-reference/resources/runs](/api-reference/resources/runs). ## Methods ```typescript theme={null} verial.runs.list({ cursor?, limit? }) verial.runs.create({ benchmarkId }) verial.runs.get({ id }) verial.runs.complete({ id }) verial.runs.cancel({ id }) ``` ## Example ```typescript theme={null} const run = await verial.runs.create({ benchmarkId: 'bench_01H...' }) while (true) { const latest = await verial.runs.get({ id: run.id }) if (latest.phase === 'completed' || latest.phase === 'failed') { console.log('verdict:', latest.verdict, 'score:', latest.score) break } await new Promise((r) => setTimeout(r, 2000)) } ``` # Sandboxes Source: https://docs.verial.ai/sdk/resources/sandboxes SDK methods for the Sandboxes resource. REST reference: [/api-reference/resources/sandboxes](/api-reference/resources/sandboxes). ## Methods ```typescript theme={null} verial.sandboxes.list({ playgroundId?, cursor?, limit? }) verial.sandboxes.create({ simulatorId }) verial.sandboxes.get({ id }) verial.sandboxes.listEvents({ id, cursor?, limit? }) verial.sandboxes.teardown({ id }) verial.sandboxes.addDataset({ sandboxId, datasetId }) verial.sandboxes.removeDataset({ sandboxId, datasetId }) ``` ## Example ```typescript theme={null} const sandbox = await verial.sandboxes.create({ simulatorId: 'sim_01H...' }) const details = await verial.sandboxes.get({ id: sandbox.id }) console.log(details.credentials) for await (const event of await verial.sandboxes.listEvents({ id: sandbox.id })) { console.log(event.action, event.resource, event.key) } await verial.sandboxes.teardown({ id: sandbox.id }) ``` See [Sandbox credentials by simulator type](/api-reference/resources/sandboxes#credentials-by-simulator-type) for the shape of `details.credentials`. # Simulators Source: https://docs.verial.ai/sdk/resources/simulators SDK methods for the Simulators resource. Full concept: [Simulators](/guides/simulators/overview). REST reference: [/api-reference/resources/simulators](/api-reference/resources/simulators). ## Methods ```typescript theme={null} verial.simulators.list({ cursor?, limit? }) verial.simulators.create({ type, name, config?, description? }) verial.simulators.get({ id }) verial.simulators.update({ id, name?, config?, description? }) verial.simulators.delete({ id }) verial.simulators.generateConfig({ id, prompt }) verial.simulators.generateData({ id, prompt }) ``` ## Examples ```typescript theme={null} import { SimulatorType } from '@verial-ai/sdk' const fhir = await verial.simulators.create({ type: SimulatorType.FHIR, name: 'Primary EHR', }) const payer = await verial.simulators.create({ type: SimulatorType.Payer, name: 'RadMD', config: { portal: 'radmd' }, }) ``` AI-generated config: ```typescript theme={null} await verial.simulators.generateConfig({ id: payer.id, prompt: 'Deny 30% of prior auths for CPT codes starting with 72', }) ``` # Task Runs Source: https://docs.verial.ai/sdk/resources/task-runs SDK methods for the Task Runs resource. REST reference: [/api-reference/resources/task-runs](/api-reference/resources/task-runs). ## Methods ```typescript theme={null} verial.taskRuns.list({ runId, cursor?, limit? }) verial.taskRuns.get({ id }) verial.taskRuns.complete({ id }) verial.taskRuns.cancel({ id }) ``` ## Example ```typescript theme={null} for await (const tr of await verial.taskRuns.list({ runId: 'run_01H...' })) { console.log(tr.id, tr.phase, tr.verdict, tr.score) } await verial.taskRuns.complete({ id: 'tr_01H...' }) ``` # Tasks Source: https://docs.verial.ai/sdk/resources/tasks SDK methods for the Tasks resource. REST reference: [/api-reference/resources/tasks](/api-reference/resources/tasks). ## Methods ```typescript theme={null} verial.tasks.list({ benchmarkId, cursor?, limit? }) verial.tasks.create({ benchmarkId, name, instruction?, trigger? }) verial.tasks.get({ id }) verial.tasks.update({ id, name?, instruction?, trigger? }) verial.tasks.delete({ id }) ``` ## Example ```typescript theme={null} const task = await verial.tasks.create({ benchmarkId: 'bench_01H...', name: 'Submit prior auth for MRI', instruction: 'Use the payer portal to file a PA for CPT 72148.', }) ``` # Usage Source: https://docs.verial.ai/sdk/usage Common workflows with the Verial SDK. ## Initialize ```typescript theme={null} import { Verial } from '@verial-ai/sdk' const verial = new Verial({ apiKey: process.env.VERIAL_API_KEY!, }) ``` Full [configuration options](/sdk/installation#configuration-options) cover `baseUrl`, `timeout`, `maxRetries`, and request `hooks`. ## Run a Published Benchmark Create a run against an existing benchmark and poll until it finishes. ```typescript theme={null} const run = await verial.runs.create({ benchmarkId: 'bench_01H...' }) while (true) { const latest = await verial.runs.get({ id: run.id }) if (latest.phase === 'completed' || latest.phase === 'failed') { console.log('verdict:', latest.verdict, 'score:', latest.score) break } await new Promise((r) => setTimeout(r, 2000)) } ``` ## Author a Benchmark Build an environment, wire up simulators, create a benchmark, and attach tasks + criteria. ```typescript theme={null} import { SimulatorType } from '@verial-ai/sdk' const env = await verial.environments.create({ name: 'Test Clinic' }) const fhir = await verial.simulators.create({ type: SimulatorType.FHIR, name: 'Primary EHR', }) await verial.environments.addSimulator({ environmentId: env.id, simulatorId: fhir.id, }) const benchmark = await verial.benchmarks.create({ name: 'Prior Auth Workflow', environmentId: env.id, }) const task = await verial.tasks.create({ benchmarkId: benchmark.id, name: 'Submit prior auth for 72148', }) await verial.evals.create({ taskId: task.id, type: 'fhir_resource_match', config: { resource_type: 'ServiceRequest', match: { 'code.coding.0.code': '72148' }, }, }) ``` ## Provision a Standalone Sandbox Skip environments and benchmarks when you just need a live simulator instance. ```typescript theme={null} const payer = await verial.simulators.create({ type: SimulatorType.Payer, name: 'RadMD', config: { portal: 'radmd' }, }) const sandbox = await verial.sandboxes.create({ simulatorId: payer.id }) const details = await verial.sandboxes.get({ id: sandbox.id }) console.log(details.credentials.portal_url) console.log(details.credentials.username, details.credentials.password) ``` See the [Web Simulator Quickstart](/guides/quickstart-web-sim) for the full browser-login walkthrough. ## Iterate a List List endpoints return a `Page` that is async-iterable over every item across every page. ```typescript theme={null} for await (const env of await verial.environments.list()) { console.log(env.id, env.name) } ``` One page at a time: ```typescript theme={null} let page = await verial.environments.list({ limit: 50 }) do { for (const env of page.data) { console.log(env.id) } page = (await page.getNextPage()) ?? page } while (page.hasNextPage()) ``` More in [Pagination](/sdk/pagination). ## Observe Every Request Pass hooks for logging, tracing, or injecting auth on specific routes. ```typescript theme={null} const verial = new Verial({ apiKey: process.env.VERIAL_API_KEY!, hooks: [ { beforeRequest(req) { console.log('→', req.method, req.url) }, afterResponse(res, req) { console.log('←', res.status, req.url) }, onError(err, req) { console.error('✗', req.method, req.url, err.message) }, }, ], }) ``` ## Handle Errors ```typescript theme={null} import { RateLimitError, NotFoundError } from '@verial-ai/sdk' try { await verial.runs.get({ id: 'run_does_not_exist' }) } catch (err) { if (err instanceof NotFoundError) { // 404 } else if (err instanceof RateLimitError) { console.log('retry after', err.retryAfter, 'seconds') } else { throw err } } ``` Full hierarchy in [Errors](/sdk/errors).