Skip to main content
Cue supports sophisticated automation patterns beyond simple trigger-prompt pairings. This guide covers the advanced features that enable complex multi-agent workflows.

Fan-Out

Fan-out sends a single trigger’s prompt to multiple target agents simultaneously. Use this when one event should kick off parallel work across several agents. How it works: Add a fan_out field with a list of agent names. When the trigger fires, Cue spawns a run against each target agent.
In this example, when build-agent finishes, Cue sends the same prompt to three different agents in parallel. Notes:
  • Each fan-out target runs independently - failures in one don’t affect others
  • All targets receive the same prompt with the same template variable values
  • Fan-out targets must be agent names visible in the Left Bar
  • Fan-out respects max_concurrent - if slots are full, excess runs are queued

Fan-In

Fan-in waits for multiple source agents to complete before firing a single trigger. Use this to coordinate work that depends on several agents finishing first. How it works: Set source_session to a list of agent names. Cue waits for all of them to complete before firing the subscription.
Behavior:
  • Cue tracks completions from each source agent independently
  • The subscription fires only when all listed sources have completed
  • If timeout_on_fail is 'continue', the subscription fires with partial data after the timeout
  • If timeout_on_fail is 'break' (default), the subscription is marked as timed out and does not fire
  • Completion tracking resets after the subscription fires

Filtering

Filters let you conditionally trigger subscriptions based on event payload data. All filter conditions are AND’d - every condition must pass for the subscription to fire.

Filter Syntax

Filters are key-value pairs where the key is a payload field name and the value is an expression:

Expression Types

Dot Notation

Access nested payload fields using dot notation:

Examples

Only trigger on TypeScript file changes:
Only trigger on non-draft PRs targeting main:
Only chain when the source agent succeeded:
Only chain from a specific subscription (when the source agent has multiple subscriptions):
The triggeredBy field contains the subscription name that triggered the completing run. It supports glob patterns (e.g., triggeredBy: "deploy-*"). See Selective Chaining for a full walkthrough. Trigger when there are 3 or more pending tasks:
Skip files in test directories:

Agent Chaining

Agent chaining connects multiple agents in a pipeline where each agent’s completion triggers the next. This is built on agent.completed events with optional filtering.

Simple Chain

Diamond Pattern

Combine fan-out and fan-in for complex workflows:

Template Variables

All prompts support {{VARIABLE}} syntax. Variables are replaced with event payload data before the prompt is sent to the agent.

Common Variables (All Events)

File Variables (file.changed, task.pending)

Task Variables (task.pending)

Agent Variables (agent.completed)

GitHub Variables (github.pull_request, github.issue)

Standard Variables

Cue prompts also have access to all standard Maestro template variables (like {{PROJECT_ROOT}}, {{TIMESTAMP}}, etc.) - the same variables available in Auto Run playbooks and system prompts.

Concurrency Control

Control how many Cue-triggered runs can execute simultaneously and how overflow events are handled.

max_concurrent

Limits parallel runs per agent. When all slots are occupied, new events are queued.
Range: 1-10. Default: 1 (serial execution). With max_concurrent: 1 (default), events are processed one at a time in order. This is the safest setting - it prevents agents from receiving overlapping prompts. Increase max_concurrent when your subscriptions are independent and don’t conflict with each other (e.g., reviewing different PRs, scanning different files).

queue_size

Controls how many events can wait when all concurrent slots are full.
Range: 0-10000. Default: 512 (generous buffer; absorbs bursty triggers without overflow toasts).
  • Events beyond the queue limit are dropped (and surfaced as a “Cue queue overflow” toast)
  • Set to 0 to disable queuing - events that can’t run immediately are discarded
  • The current queue depth is visible in the Cue Modal’s sessions table

Timeout

Prevents runaway agents from blocking the pipeline.
timeout_on_fail options:
  • break (default) - Timed-out runs are marked as failed. Downstream agent.completed subscriptions see the failure.
  • continue - Timed-out runs are stopped, but downstream subscriptions still fire with whatever data is available. Useful for fan-in patterns where you’d rather proceed with partial results than block the entire pipeline.

Sleep/Wake Reconciliation

Cue handles system sleep gracefully:
  • time.heartbeat subscriptions reconcile missed intervals on wake. If your machine sleeps through three intervals, Cue fires one catch-up event (not three).
  • File watchers (file.changed, task.pending) resume monitoring on wake. Changes that occurred during sleep may trigger events depending on the OS file system notification behavior.
  • GitHub pollers resume polling on wake. Any PRs/issues created during sleep are detected on the next poll.
The engine uses a heartbeat mechanism to detect sleep periods. This is transparent - no configuration needed.

Persistence

Cue persists its state in a local SQLite database:
  • Event journal - Records all events (completed, failed, timed out) for the Activity Log
  • GitHub seen tracking - Remembers which PRs/issues have already triggered events (30-day retention)
  • Heartbeat - Tracks engine uptime for sleep/wake detection
Events older than 7 days are automatically pruned to keep the database lean.