Sequence Engine & Data Piping
Multi-step pipelines in a single turn — with native variable piping and smart retry.
Overview
The execute_sequence tool is the gateway's most powerful feature. It allows agents to batch multiple API calls into a single LLM turn, dramatically reducing token consumption and latency.
Data Piping Syntax
Results from each step are stored as aliases and can be referenced in subsequent steps:
| Syntax | Description | Example |
|---|---|---|
$stepN | Access result of step N (0-indexed) | $step0 |
$alias | Access result by custom alias | $my_repos |
$alias.field | Access a nested field | $step0.name |
$alias.deep.path | Deep nested access | $step0.owner.login |
$alias[N] | Array indexing | $step0[0] |
$alias[N].field | Array index + field access | $step0[0].id |
Error Handling Strategies
on_error | Behavior |
|---|---|
"stop" (default) | Halts the entire sequence on error. Subsequent steps are skipped. |
"continue" | Logs the error, stores it in the alias, and proceeds to the next step. |
Smart Retry
Steps can be configured to automatically retry on specific error types:
{
"action": "api_get_data",
"retry": 3,
"retryOn": ["RATE_LIMIT_EXCEEDED", "SERVER_ERROR"],
"parameters": {}
}The engine waits 1 second between retries (basic backoff).
Example: Multi-Step Pipeline
{
"actions": [
{
"action": "repos_repos_list-for-user",
"alias": "repos",
"parameters": {"username": "v3rm1ll1on", "_limit": 5}
},
{
"action": "repos_repos_get",
"alias": "detail",
"parameters": {"owner": "v3rm1ll1on", "repo": "$repos[0].name"}
}
],
"session_id": "my_task"
}In this example:
- Step 1 lists a user's repositories and stores the result under the alias
repos. - Step 2 references
$repos[0].name— the piping is resolved server-side before the second API call is sent.
Session Isolation
Each session_id maintains its own isolated memory bank. This allows parallel tasks to run without cross-contamination.
clear_session after completing a task to free up memory.Decoupled Telemetry
A critical design principle of the Sequence Engine is the separation of agent data and developer data:
- Agent Branch: The sequencer runs
ResponseSquisher.smart_truncate()on every step's return value. The agent receives only compact, cleaned data. - Telemetry Branch: Simultaneously, the sequencer sends the complete, untruncated raw data to the
DashboardMonitor. Developers see the actual HTTP payloads in the dashboard.
This protects the agent from context overflow while giving developers full visibility.