Skip to navigation

Build a routine

Create a routine, connect its steps, and pass data between them.

A routine is a flow of steps that runs in the background when a conversation ends, on a schedule, or when another system sends a webhook. To build one, choose a trigger, connect steps after it, and set what each step reads and where the run goes next.

Routines are in beta and not yet available in every workspace. To request access, contact your account manager.

Create a routine

1

Create the routine

Open Routines in the ElevenAgents sidebar and select New routine. New routines start with a Manual run trigger.

Routines page with the New routine button and the list of routines

2

Choose the trigger

Select the trigger to change its type, or keep Manual run while you build. See Triggers.

3

Add steps

Select Add step in the toolbar, or the + under a step to add one right after it, and choose a step type. Select a step to open its settings.

Step type menu opened from the + under a step on the canvas

The editor saves the draft as you work. Only test runs use the draft until you publish it.

You can also build a routine with Architect. Describe what it should do, and Architect writes the steps into the draft, runs tests, and publishes it with you. It asks for your approval before actions like placing real calls or publishing.

Pass data between steps

Each step lists the inputs it needs under Inputs. Set each one to a fixed value, or pick a field from the trigger, an earlier step, or a variable. For example, an HTTP request step named lookup_customer can take customer_id from the trigger, and a later step can read lookup_customer.body.tier from its response.

A step's inputs, with the picker of earlier step outputs and variables
open

Variables

Variables are named values that any step later in the run can read, such as a customer ID that several steps need. Add them in the routine’s Variables panel, with a type (string, number, or boolean) and a default. To fill a variable, select the {} button next to any trigger field or step output, then name a new variable or pick one the routine already has.

Variables panel with four string variables

Branch with conditions

A connection between two steps can carry a condition. After a step finishes, the run follows every connection whose condition holds, so two matching branches run in parallel.

ConnectionFollowed when
No conditionAlways.
ConditionIts expression holds, such as lookup_customer.body.tier equals vip. A value that isn’t set is null.
FallbackNone of the step’s other conditions hold, like an else. A step can have one fallback.

A connection's condition, lookup_customer.body.tier equals
vip

A branch with no matching connection ends there, and the run still succeeds. A step that several branches lead to runs once, after all of the branches that reach it have finished.

Two cases fail a run where branches meet: both branches set the same variable, or the step reads an output from a branch the run didn’t take.

Handle failures

A step fails when its retries run out, when it gets an error that isn’t retried (such as an HTTP 4xx response), or when one of its inputs can’t be resolved. By default, a failed step fails the whole run.

Add an error connection from a step to run cleanup when it fails, such as posting an alert. Steps on an error path can read the failure as error:

{
"message": "HTTP 404: {\"detail\": \"Customer not found\"}",
"step": "Look up customer",
"attempts": 1
}

A run whose step failed still ends as failed, even when an error connection handles it. Use error connections to notify or clean up, not to recover.

Each step’s Retry settings control how many attempts it makes, with exponential backoff between them. Outbound call steps never retry, so a retry can’t dial the same number twice.