Skip to main content

Scenario Builder with the Bluejay API

This cookbook covers workflows. Workflows are a great way to test your agent across multiple conversation paths.

Scenario Structure

A workflow is a directed graph of agent and user turns.
  • Agent turns define what your agent should say or do. Simulations evaluate against this to make sure your agent said what it was supposed to.
  • User nodes let you define what our Digital Human says during a simulation.
Workflow graph: start node, alternating agent and user turns, an options branch with edges labeled by sourceHandle, and leaves. Each start-to-leaf walk becomes one Digital Human. Each unique path through your workflow creates one Digital Human to test that path.

Node Types

start

Every workflow has exactly one start node. It has no data requirements: just an id and type: "start".

single: one conversation turn

Single nodes represent one turn in the conversation, either from the agent or the user. The data.type field controls the turn’s behavior: The speaker field defaults to "agent" when omitted.

options: user branch point

Suppose you were testing a workflow where your agent says a phrase like “Press 1 for English or 2 for Spanish”, you would then want to test both cases where our Digital Human presses 1, and the other where it presses 2. You can do this by adding another option to a user node. Workflow graph: start node, alternating agent and user turns, an options branch with edges labeled by sourceHandle, and leaves. Each start-to-leaf walk becomes one Digital Human. Options nodes model a point where the user picks from multiple paths, such as pressing a key, saying a specific phrase, or staying silent. Each branch is defined in data.branch_options (minimum 2 entries). Options nodes are always user-only. Each branch option has:
  • id: a unique string used to match outgoing edges via sourceHandle
  • type: exact, silence, or dtmf (no contextual)
  • message / duration_ms / digits depending on the type
When an options node continues to another content node, the edge must set sourceHandle to the branch’s id so Bluejay knows which path was taken.
Workflows is currently for VOICE agents only. Linking a TEXT-mode agent returns a 400 error. TEXT support is coming soon.

Creating a Workflow

Simple Linear Workflow

A straightforward flow: the agent greets the customer, the customer states their issue, the agent resolves it.

Branching Workflow with an Options Node

This example models an IVR-style menu where the user either presses a DTMF key for customer support or says a phrase to reach billing. Each branch continues to a different agent response.
The sourceHandle on each edge must match the id of a branch_options entry on the options node. This is how Bluejay knows which branch a given edge continues.

Managing Workflows

List Workflows

Get a Workflow

Update a Workflow

The update is a partial PATCH-style PUT: only fields you include are changed. If you include agent_ids (even as [] or null), all existing agent links are replaced.

Delete a Workflow


Generating Digital Humans from a Workflow

Once your workflow is created, you can use it to automatically generate Digital Humans, one per unique path through the graph.
You can also pass several workflow IDs in the same request:

Validation Rules

Bluejay validates your graph when it contains content nodes. A graph with only a start node (or no nodes at all) is saved as a draft without validation, which is useful while you’re building. Once you add a single or options node, the following rules apply:
  1. At most one start node: having two or more start nodes is always rejected, even in draft mode
  2. No directed cycles: the graph must be acyclic
  3. No orphaned content nodes: every single or options node must be reachable from the start node via edges
  4. Single node rules
    • data.type is required (exact, contextual, silence, or dtmf)
    • exact and contextual: message must be non-empty
    • contextual: speaker must be "agent" (or omitted); not allowed for user turns
    • silence: duration_ms must be a finite number between 0 and 86,400,000
    • dtmf: digits must be non-empty, containing only 0-9, *, #, A-D (case-insensitive)
  5. Options node rules
    • At least 2 entries in branch_options
    • Speaker must be "user" or omitted
    • Each branch type must be exact, silence, or dtmf (not contextual)
    • Each branch needs a unique non-empty id

Best Practices

  • Keep branch IDs stable: branch_options[].id values are referenced by edge sourceHandle; changing them breaks existing edges