Skip to main content
Reactions are the core automation mechanism in Agent Orchestrator. They define how the system responds to events like CI failures, review comments, and agent state changes—automatically handling routine issues without human intervention.

Reaction System Overview

When an event occurs (e.g., CI fails, review requested), the orchestrator:
1

Check Reaction Config

Looks up the reaction configuration for the event type
2

Auto-Handle

If auto: true, performs the configured action automatically
3

Escalate

If retries exhausted or timeout reached, escalates to human notification
Push, not pull. The human never needs to check on agents—the orchestrator notifies when judgment is required. Source: packages/core/src/lifecycle-manager.ts:422-498

Built-in Reactions

Agent Orchestrator includes 8 built-in reactions with sensible defaults:

ci-failed

Triggered when CI checks fail on a PR.
boolean
default:"true"
Enable automatic handling
enum
default:"send-to-agent"
What to do when CI fails:
  • send-to-agent — Send failure info to agent to fix
  • notify — Immediately notify human
number
default:"2"
How many times to let the agent retry before escalating
number
Escalate to human after this many failures

changes-requested

Triggered when a reviewer requests changes.
string
Time-based escalation. Supports: 10m, 1h, 30m
The agent automatically fetches review comments and attempts to address them. Only escalates to human if it can’t resolve within the time limit.

bugbot-comments

Triggered when automated review tools (linters, security scanners) leave comments.
Detects bot comments from common tools:
  • GitHub Actions annotations
  • ESLint reporters
  • Security scanners
  • Coverage reporters

merge-conflicts

Triggered when the PR branch has merge conflicts with the base branch.
The agent will attempt to rebase and resolve conflicts. Complex conflicts may require human intervention.

approved-and-green

Triggered when PR is approved by reviewers AND CI passes.
Auto-merge is disabled by default for safety. Enable only if you have:
  • Comprehensive CI/CD tests
  • Required code review approval
  • High confidence in agent code quality
To enable auto-merge:
See Auto-Merge Configuration below for details.

agent-stuck

Triggered when agent shows no activity for a duration.
string
default:"10m"
Duration of inactivity before considering agent “stuck”
Sends urgent notification to human to investigate.

agent-needs-input

Triggered when agent asks a question or hits a permission prompt.
Examples:
  • “Should I proceed with this refactoring?”
  • Permission prompt for file operations
  • Confirmation needed for destructive changes

agent-exited

Triggered when agent process exits unexpectedly.
Causes:
  • Agent crashed
  • Out of memory
  • Unhandled error
  • Manual termination

all-complete

Triggered when all spawned agents finish their work.
boolean
default:"true"
Include summary of all sessions in the notification
Source: packages/core/src/config.ts:215-278

Reaction Configuration Schema

All reactions support these fields:
boolean
required
Enable automatic handling. If false, the reaction is disabled.
enum
required
What action to take:
  • send-to-agent — Send message to agent to handle
  • notify — Send notification to human
  • auto-merge — Automatically merge the PR (only for approved-and-green)
string
Custom message to send to agent (for send-to-agent action) or human (for notify action).
enum
Notification priority level:
  • urgent — Critical issues requiring immediate attention
  • action — Action required but not urgent
  • warning — Something to be aware of
  • info — Informational only
Controls which notifiers receive the message (see Notification Routing).
number
How many times to retry send-to-agent before escalating to human.
number | string
Escalation condition:
  • Number: Escalate after this many failures (e.g., 2 = after 2 failed attempts)
  • String: Escalate after this duration (e.g., 30m, 1h)
string
Duration threshold for time-based triggers (e.g., agent-stuck).Examples: 10m, 30m, 1h
boolean
Include summary of all sessions in the notification (for all-complete).
Source: packages/core/src/types.ts:763-788

Global Reaction Configuration

Define default reaction behavior for all projects:

Per-Project Reaction Overrides

Override global reactions for specific projects:
Per-project reactions merge with global reactions. You only need to specify the fields you want to override.

Auto-Merge Configuration

Auto-merge is the most aggressive automation option. Use with caution.

Requirements for Auto-Merge

Before enabling auto-merge, ensure:
1

Comprehensive CI

Your CI pipeline includes:
  • Unit tests
  • Integration tests
  • Linting
  • Type checking
  • Security scanning
2

Required Approvals

GitHub branch protection requires:
  • At least one approval
  • Passing CI checks
  • Up-to-date branch
3

Agent Trust

You’ve validated agent quality on several PRs manually first.

Enable Auto-Merge Globally

Enable Auto-Merge per Project

Disable Auto-Merge (Default)

With auto-merge disabled, you’ll receive an “action” priority notification when PRs are ready, and merge them manually. Source: examples/auto-merge.yaml

Escalation Rules

Escalation determines when to notify a human after automatic handling fails.

Retry-Based Escalation

Escalate after a number of failed attempts:
Flow:
  1. CI fails → agent attempts fix #1
  2. Still failing → agent attempts fix #2
  3. Still failing → agent attempts fix #3
  4. Still failing → escalate to human (urgent notification)

Time-Based Escalation

Escalate after a duration:
Flow:
  1. Review comments received → agent starts addressing
  2. Timer starts (30 minutes)
  3. If agent resolves within 30m → no escalation
  4. If unresolved after 30m → escalate to human (urgent notification)

Mixed Escalation

Combine both approaches:

Custom Reaction Messages

Override default messages:
Custom messages for notifications:
Messages support template variables like {{prUrl}}, {{sessionId}}, {{projectId}}.

Disabling Reactions

Disable a reaction by setting auto: false:
When disabled, the orchestrator immediately notifies humans instead of attempting automatic handling.

Testing Reactions

Test your reaction configuration:
Monitor logs to see reaction behavior:

Complete Example

A production-ready reaction configuration:

Next Steps

Notifications

Configure how reactions notify you via Slack, Discord, etc.

Projects

Set up per-project reaction overrides