Overview
Config as Code lets you define your Roark resources - agents, personas, simulation flows, and metric collectors - as YAML files in your own git repository, then deploy them with a single apply. Your config repo is the source of truth: Roark reconciles the live project to match what you submitted, creating what’s new, updating what changed, and removing what you deleted.Config as Code manages resource definitions. It does not run simulations or place calls; you trigger those as usual once the resources exist.
name for each resource. Roark derives a stable identity (configKey = <kind>/<name>) and resolves cross-references by name, so there are no UUIDs in your files and no state file to keep in sync.
How it works
You submit the full desired set of resources to a single endpoint. Roark:- Parses and validates every resource against the schema.
- Diffs the submitted set against the resources this project already manages via config.
- Reconciles: creates new resources, updates changed ones, and (unless you opt out) deletes config-managed resources you removed from the submission.
Always run
plan first to preview the diff, then apply.
Prerequisites
- A Roark API key with the
config:applypermission. Generate one from API Keys and confirm it carriesconfig:apply. - A git repository to hold your config files (any layout; Roark reads the files you submit).
The API key is scoped to a single project. Everything you apply lands in that project.
Repository layout
One file per resource, discriminated bykind. A conventional layout:
Resource kinds
Agent
Persona
The simulated caller. Self-contained (references nothing).Flow (improv)
An improvised simulation with a happy path and edge-case variants. References agents, a persona, and an environment by name.Flow (scripted)
A step-by-step conversation graph (branches, merges, DTMF, voicemail, scenario links). Each apply replaces the whole graph.Collector
Decides which metrics get collected on which conversations (the config form of a collector).- Metrics are referenced by their stable slug, not a UUID, and must be visible to the project and support the collector’s
modality. - Filters are condition groups: groups OR together, conditions within a group AND. An
AGENTcondition’skeyis a config-managed agent name (resolved on apply); every other type uses itskey/valueverbatim.
For the full field reference of every kind, see the Config DSL reference schema.
Deploying
Bundle your resources into a single JSON body and submit it. The body is{ "resources": [...], "prune": true }, where each entry is one resource in the same shape as its YAML.
1
Preview the changes
op of create, update, or delete, plus a summary:2
Apply
Once the plan looks right, run the same body against Each change comes back with a
apply:status (applied or failed) and, on success, the resource id.Apply semantics
- Identity is by name. Re-submitting an unchanged resource updates it in place; it never creates a duplicate. Renaming a resource is a delete of the old name plus a create of the new one.
- Cross-references resolve by name within the same submission (a flow’s
agents:/persona:, a collector’sAGENTfilter). The referenced resource must be in the bundle or already config-managed in the project. - Prune deletes what you removed. By default, config-managed resources absent from the submission are deleted so the project matches your repo exactly. To layer additive changes without deleting, send
"prune": false. - Prompts are code. Any prompt field takes an inline string or
file://relative/path.md, resolved relative to your config root and inlined before you submit. - Idempotent. Applying the same bundle twice converges to the same state.
Config-managed resources in the UI
A resource created by config is read-only in the dashboard and carries a “managed by config” badge. To change it, edit your config and re-apply. If you need to hand a resource back to manual UI editing, detach it (from the resource’s menu in the dashboard). Detaching clears its config ownership:- A later apply that still lists it will re-adopt it.
- A later apply that omits it will simply leave it alone (it is no longer config-managed, so prune won’t touch it).
Recommended workflow
- Keep your
roark/config in a git repo, reviewed via pull requests. - In CI, run
planon every PR and post the diff for review. - On merge to your main branch, run
apply.