Skip to main content

What is Bluejay as Code?

Bluejay as Code lets you manage your agent configuration as version-controlled files in your codebase. This is Bluejay’s equivalent of Terraform. Pull your current setup to export it as a JSON payload, edit it like source code, then push to apply changes — Bluejay creates or updates each entity as needed.

How to Use Bluejay as Code

The flow is pull → edit → push. You pull your simulation as a JSON payload, edit it locally like any other source file, and push it back to apply the changes. The example below uses a healthcare front desk scheduling agent for Cedar Park Family Medicine.
1

Pull your configuration

Send a GET request to the Bluejay as Code endpoint with your simulation ID. Bluejay returns a single JSON payload containing the agent, the simulation, every Digital Human, and every custom metric attached to it.
The pull endpoint also accepts three other root types if you’d rather anchor your bundle on something else: GET /v1/bluejay-as-code/agent/{id}, /digital-human/{id}, or /custom-metric/{id}. Each one walks the same graph and returns the same payload shape — pick whichever entity is most natural for your workflow. The rest of this guide uses the simulation root because it’s the most common.
2

Inspect the file you pulled

simulation.json is the full state of your simulation. Pulled this way, it contains exactly one agent and one simulation; Digital Humans and custom metrics are arrays of any size. A hand-built payload you push can include more than one agent or simulation.Every entity carries a bluejay_as_code_id — a UUID that Bluejay populates on pull. When you add a new entity locally, generate a fresh UUID once and commit it alongside the rest of the entity’s fields.A simulation has no field of its own for its owning agent. With one agent in the bundle, as below, Bluejay assigns it automatically. With more than one, list the simulation’s bluejay_as_code_id in the owning agent’s simulations array instead.
Each entity in the payload accepts the same fields as the corresponding API resource. For example, Digital Humans take the same arguments as POST /v1/create-digital-human — including success_criteria, traits, voice, and so on.
simulation.json
3

Edit the payload

Edit fields in place to update existing entities, append new objects to add coverage, or remove entries from digital_humans or custom_metrics to detach them on the next push.
You generate the bluejay_as_code_id for new objects yourself. Bluejay only populates UUIDs on pull — anything you add locally needs an ID you create (for example with uuidgen or uuid.uuid4()). Commit it to the file so future pushes recognize the same object.
For example, add a Digital Human that simulates an urgent-symptom call so you can verify the agent’s escalation behavior. Append the new entity to the digital_humans array:
simulation.json
And tighten the agent’s system_prompt to handle that path explicitly:
simulation.json
Coverage isn’t limited to one-off calls. To exercise a multi-call flow with the same caller, add a Digital Human with a journey_steps array. Each step is one call, run in order:
simulation.json
Bluejay auto-tags this Digital Human "Customer Journey" and runs the steps in order, each call gated on the one before. step numbers must be unique and contiguous from 1, and every step needs an intent (success_criteria is optional).Some Digital Humans simulate a call reaching voicemail instead of a person. Set tag to voicemail-custom for a greeting you write yourself, or voicemail-ai-generated for one Bluejay generates:
simulation.json
For voicemail-ai-generated, drop message and set speaks_first_config.mode to "ai_generated". A voicemail Digital Human doesn’t need description (intent) or success_criteria — the tag and speaks_first_config cover its purpose instead, same as journey_steps does for a journey.
4

Push your changes

Send the edited file back with a POST. Bluejay reconciles each entity by bluejay_as_code_id:
  • Create: a UUID Bluejay has not seen before becomes a new entity.
  • Update: a known UUID with edited fields updates the existing entity.
  • Release: a Digital Human or custom metric whose UUID is missing from the payload is unlinked from the simulation. The object itself still exists in Bluejay and can be reused or attached to other simulations; deleting it from the file removes the association, not the entity.
The response lists every action taken so you can confirm the reconciliation matches your diff.
response
The push endpoint is a single POST /v1/bluejay-as-code regardless of which root type you pulled from — the payload itself describes everything Bluejay needs to reconcile. On success, the response includes the resolved simulation_id for the simulation in the bundle so you can deep-link straight into the UI.

Endpoints

Pull

Export a simulation’s full config as a payload.

Push

Apply a payload — create or update each entity.

Full Example