> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roark.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Welcome to Roark

> The quality platform for voice and chat AI

Roark is where voice and chat agents prove they're ready: **simulate** every failure mode before launch, **analyze** every production call once you're live, and score them all with metrics powered by **Roark Prism**, our purpose-built evaluation model.

> [card] [Simulation testing](https://docs.roark.ai/documentation/simulation-testing/overview.md)
>
> Break it in staging, not in production. Test agents with synthetic callers across flows, personas, accents, and edge cases before you ship.

> [card] [Post-call analysis](https://docs.roark.ai/documentation/observability/overview.md)
>
> Every production call scored, filed, and traced. Transcribed and measured against your metrics in real time.

> [card] [Human review](https://roark.ai/product/human-review)
>
> Label calls, set ground truth, and align every metric with your team's judgment.

> [card] [Autoimprove](https://docs.roark.ai/documentation/autoimprove/overview.md)
>
> From caught issue to drafted fix to proven deploy, with you in the loop.

***

## Your first simulation

The fastest way in is a few lines of code: define an agent and a simulation plan, apply them, and run it from the CLI. It's versioned in git, reusable in CI, and there are no UUIDs to wrangle.

```typescript roark.config.ts theme={"theme":{"light":"everforest-light","dark":"everforest-dark"}}
import { defineAgent, defineSimulationPlan, defineConfig } from '@roarkanalytics/sdk/lib/config';

const frontdesk = defineAgent({
  name: 'frontdesk',
  endpoints: [{ value: '+15551234567', direction: 'OUTGOING' }],
});

export default defineConfig({
  resources: [
    frontdesk,
    defineSimulationPlan({
      name: 'smoke-test',
      direction: 'OUTBOUND',
      agentEndpoints: [{ agent: 'frontdesk', value: '+15551234567' }],
      flows: [{ system: 'sf-screener-apple' }], // a built-in flow; swap for your own
      metrics: ['call_screening_handling_score'],
      maxDurationSeconds: 300,
    }),
  ],
});
```

```yaml roark/ (one file per resource) theme={"theme":{"light":"everforest-light","dark":"everforest-dark"}}
# agents/frontdesk.yaml
kind: agent
name: frontdesk
endpoints:
  - value: '+15551234567'
    direction: OUTGOING
---
# simulation-plans/smoke-test.yaml
kind: simulationPlan
name: smoke-test
direction: OUTBOUND
agentEndpoints:
  - agent: frontdesk
    value: '+15551234567'
flows:
  - system: sf-screener-apple
metrics:
  - call_screening_handling_score
maxDurationSeconds: 300
```

```bash theme={"theme":{"light":"everforest-light","dark":"everforest-dark"}}
export ROARK_API_BEARER_TOKEN="<key>"        # needs config:apply + simulation permissions
roark config apply roark.config.ts           # create the agent + plan (or `roark config apply ./roark` for YAML)
roark simulation run --data '{"planId":"<plan-id>"}' # run it (find the id with `roark simulation plan list`)
```

> [card] [Full walkthrough: Run a simulation](https://docs.roark.ai/documentation/config-as-code/run-a-simulation.md)
>
> Define, apply, run, read the pass/fail, and gate CI on it, step by step.

### Other ways to run one

Prefer to click through it, or drive the API imperatively? Each tab below also takes you from nothing to a running simulation, reusing a built-in persona and environment.

> [tab] Node SDK
>
> Copy, paste, run with [`@roarkanalytics/sdk`](https://docs.roark.ai/documentation/sdks/node-sdk):
>
> ```typescript theme={"theme":{"light":"everforest-light","dark":"everforest-dark"}}
> import Roark from '@roarkanalytics/sdk'
>
> const client = new Roark({ bearerToken: process.env.ROARK_API_BEARER_TOKEN })
>
> // An agent and how to reach it
> const agent = await client.agent.create({ name: 'Front Desk' })
> const endpoint = await client.agentEndpoint.create({
>   agentId: agent.data.id,
>   value: '+15551234567',
>   direction: 'INCOMING_AND_OUTGOING',
> })
>
> // Reuse a built-in persona and the "Quiet line" environment
> const personas = await client.simulationPersona.list({ limit: 50 })
> const envs = await client.simulationEnvironment.list({ limit: 50 })
> const quietLine = envs.data.find((e) => e.name === 'Quiet line')!
>
> // The conversation to test
> const flow = await client.customerFlow.create({
>   type: 'IMPROV',
>   title: 'Rebooking',
>   agentIds: [agent.data.id],
>   happyPath: {
>     title: 'Frustrated rebooking',
>     personaOverrideId: personas.data[0].id,
>     environmentId: quietLine.id,
>     prompt: 'You call to rebook a cleaning that was cancelled on you.',
>   },
>   agentExpectations: [{ prompt: 'Agent offers a concrete alternative appointment time' }],
> })
>
> // Run it
> const run = await client.simulation.run({
>   plan: {
>     direction: 'INBOUND',
>     maxSimulationDurationSeconds: 300,
>     agentEndpoints: [{ id: endpoint.data.id }],
>     flows: [{ id: flow.data.id, happyPath: true }],
>     metrics: [{ slug: 'task_completion' }],
>   },
> })
>
> console.log(run.data.simulationRunPlanJobId)
> ```
>
> Watch it in the dashboard, or poll `client.simulationRunPlanJob.getByID(run.data.simulationRunPlanJobId)`.

> [tab] Python SDK
>
> Same flow with [`roark_analytics`](https://docs.roark.ai/documentation/sdks/python-sdk):
>
> ```python theme={"theme":{"light":"everforest-light","dark":"everforest-dark"}}
> import os
> from roark_analytics import Roark
>
> client = Roark(bearer_token=os.environ["ROARK_API_BEARER_TOKEN"])
>
> # An agent and how to reach it
> agent = client.agent.create(name="Front Desk")
> endpoint = client.agent_endpoint.create(
>     agent_id=agent.data.id,
>     value="+15551234567",
>     direction="INCOMING_AND_OUTGOING",
> )
>
> # Reuse a built-in persona and the "Quiet line" environment
> personas = client.simulation_persona.list(limit=50)
> envs = client.simulation_environment.list(limit=50)
> quiet_line = next(e for e in envs.data if e.name == "Quiet line")
>
> # The conversation to test
> flow = client.customer_flow.create(
>     type="IMPROV",
>     title="Rebooking",
>     agent_ids=[agent.data.id],
>     happy_path={
>         "title": "Frustrated rebooking",
>         "personaOverrideId": personas.data[0].id,
>         "environmentId": quiet_line.id,
>         "prompt": "You call to rebook a cleaning that was cancelled on you.",
>     },
>     agent_expectations=[{"prompt": "Agent offers a concrete alternative appointment time"}],
> )
>
> # Run it
> run = client.simulation.run(
>     plan={
>         "direction": "INBOUND",
>         "maxSimulationDurationSeconds": 300,
>         "agentEndpoints": [{"id": endpoint.data.id}],
>         "flows": [{"id": flow.data.id, "happyPath": True}],
>         "metrics": [{"slug": "task_completion"}],
>     },
> )
>
> print(run.data.simulation_run_plan_job_id)
> ```

> [tab] CLI
>
> Drive the same steps from your terminal (install the [CLI](https://docs.roark.ai/documentation/sdks/cli.md) and set `ROARK_API_BEARER_TOKEN`). Commands print JSON, so pipe through `jq`:
>
> ```bash theme={"theme":{"light":"everforest-light","dark":"everforest-dark"}}
> AGENT_ID=$(roark agent create --name "Front Desk" | jq -r '.data.id')
>
> ENDPOINT_ID=$(roark agent endpoint create --agent-id "$AGENT_ID" \
>   --value "+15551234567" --direction INCOMING_AND_OUTGOING | jq -r '.data.id')
>
> PERSONA_ID=$(roark simulation persona list --limit 50 | jq -r '.data[0].id')
> ENV_ID=$(roark simulation environment list --limit 50 \
>   | jq -r '.data[] | select(.name=="Quiet line") | .id')
>
> FLOW_ID=$(roark customer-flow create --data "$(jq -nc \
>   --arg a "$AGENT_ID" --arg p "$PERSONA_ID" --arg e "$ENV_ID" '{
>     type:"IMPROV", title:"Rebooking", agentIds:[$a],
>     happyPath:{ title:"Frustrated rebooking", personaOverrideId:$p, environmentId:$e,
>       prompt:"You call to rebook a cleaning that was cancelled on you." }
>   }')" | jq -r '.data.id')
>
> roark simulation run --data "$(jq -nc --arg ep "$ENDPOINT_ID" --arg f "$FLOW_ID" '{
>   plan:{ direction:"INBOUND", maxSimulationDurationSeconds:300,
>     agentEndpoints:[{id:$ep}], flows:[{id:$f, happyPath:true}],
>     metrics:[{slug:"task_completion"}] }
> }')"
> ```

> [tab] Config as Code
>
> Keep your test suite in git as YAML and apply it with the [CLI](https://docs.roark.ai/documentation/sdks/cli.md):
>
> ```yaml roark/flows/rebooking.yaml theme={"theme":{"light":"everforest-light","dark":"everforest-dark"}}
> kind: flow
> type: improv
> name: rebooking
> agents: [frontdesk]
> happyPath:
>   persona: frustrated-caller
>   environment: Quiet line
>   prompt: You call to rebook a cleaning that was cancelled on you.
> expectations:
>   - Agent offers a concrete alternative appointment time
> ```
>
> ```bash theme={"theme":{"light":"everforest-light","dark":"everforest-dark"}}
> roark config apply ./roark
> ```
>
> Config defines your resources; launch a run from the CLI, an SDK, or the dashboard. Full example (agents + personas + flows) and how to run it in CI: **[Config as Code](https://docs.roark.ai/documentation/config-as-code/overview.md)** and **[CI/CD](https://docs.roark.ai/documentation/simulation-testing/ci-cd.md)**.

> [tab] Dashboard
>
> No code:
>
> 1. **Connect your agent** under [Agents](https://docs.roark.ai/documentation/integrations/overview.md) (Vapi, Retell, ElevenLabs, LiveKit, and more).
> 2. **Create a [customer flow](https://docs.roark.ai/documentation/simulation-testing/customer-flows.md)** for the conversation to test (pick a built-in [persona](https://docs.roark.ai/documentation/simulation-testing/personas.md)).
> 3. **New Run**: pick the agent, attach the flow, add pass/fail [checks](https://docs.roark.ai/documentation/metrics/thresholds.md), launch.
> 4. **Read the verdict** and per-conversation scores.

***

## Explore the docs

> [card] [Simulations](https://docs.roark.ai/documentation/simulation-testing/overview.md)
>
> Customer flows, personas, templates, plans, and schedules

> [card] [Config as Code](https://docs.roark.ai/documentation/config-as-code/overview.md)
>
> Define agents, personas, flows, metrics, collectors, and alerts as YAML in git

> [card] [Observability](https://docs.roark.ai/documentation/observability/overview.md)
>
> Call history, traces, reports, and dashboards

> [card] [Metrics](https://docs.roark.ai/documentation/metrics/overview.md)
>
> The metric library, Studio, collectors, and thresholds

> [card] [Integrations](https://docs.roark.ai/documentation/integrations/overview.md)
>
> Vapi, Retell, ElevenLabs, Leaping, LiveKit, and custom

> [card] [CLI](https://docs.roark.ai/documentation/sdks/cli.md)
>
> Drive Roark from your terminal and CI pipelines

> [card] [SDKs](https://docs.roark.ai/documentation/sdks/node-sdk.md)
>
> Node.js, Python, and MCP Server

> [card] [API Reference](https://docs.roark.ai/api-reference/introduction.md)
>
> REST API documentation


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.