Core Principle
Push, not pull. Spawn agents, walk away, get notified when your judgment is needed. The orchestrator operates as a stateless system with no database — using flat metadata files and JSONL event logs for persistence. This design ensures backwards compatibility and simplicity.The 8 Plugin Slots
Agent Orchestrator’s architecture is defined by 8 plugin slots. Each slot represents a specific responsibility, and every plugin must implement the interface defined inpackages/core/src/types.ts.
All plugin interfaces are defined in a single source of truth:
packages/core/src/types.ts| Slot | Interface | Purpose | Default Plugin |
|---|---|---|---|
| Runtime | Runtime | Where sessions execute (environment) | tmux |
| Agent | Agent | AI coding tool adapter | claude-code |
| Workspace | Workspace | Code isolation mechanism | worktree |
| Tracker | Tracker | Issue/task tracking | github |
| SCM | SCM | Source control + PR/CI/reviews | github |
| Notifier | Notifier | Push notifications to humans | desktop |
| Terminal | Terminal | Human interaction UI | iterm2 |
| Lifecycle | (core) | State machine + reaction engine | (not pluggable) |
Runtime Plugin
Determines WHERE and HOW agent sessions execute. Examples include:- tmux (default) — Local terminal sessions
- docker — Containerized environments
- process — Direct child processes
- k8s — Kubernetes pods for cloud-scale orchestration
- Create and destroy session environments
- Send messages to running agents
- Capture session output
- Check if sessions are alive
- Provide attachment info for Terminal plugin
Agent Plugin
Adapter for specific AI coding tools. The plugin knows how to:- Launch the agent with proper configuration
- Detect agent activity (active, ready, idle, blocked)
- Extract session information (summary, cost, session ID)
- Resume previous sessions
- Set up workspace hooks for automatic metadata updates
- claude-code — Anthropic’s Claude Code
- codex — OpenAI Codex
- aider — Aider AI pair programmer
- opencode — OpenCode agent
Workspace Plugin
Manages code isolation — how each session gets its own copy of the repository.- worktree (default) — Git worktrees for shared history
- clone — Full repository clones for complete isolation
- Create isolated workspaces per session
- Automatic branch management
- Post-creation hooks (symlinks, dependency installation)
- Workspace restoration for crashed sessions
Tracker Plugin
Integrates with issue tracking systems to:- Fetch issue details and descriptions
- Generate branch names from issue IDs
- Create prompts for agents based on issue context
- Check issue completion status
- Update issue state (optional)
- github — GitHub Issues
- linear — Linear issue tracker
SCM Plugin
Manages the entire PR lifecycle:- Detect PRs created by agents
- Track PR state (open, merged, closed)
- Monitor CI check results
- Fetch code reviews and review comments
- Determine merge readiness
- Execute merge operations
- github — GitHub pull requests
Notifier Plugin
The primary interface between orchestrator and human. Delivers push notifications when:- Agent needs input or gets stuck
- PR is approved and ready to merge
- CI failures can’t be auto-fixed
- Review comments require human judgment
- desktop — Native OS notifications
- slack — Slack messages
- composio — Composio platform integration
- webhook — Custom HTTP webhooks
Terminal Plugin
Manages how humans view and interact with running sessions:- Open sessions in IDE tabs
- Launch browser windows to web terminals
- Attach to tmux/docker sessions
- Open all sessions for a project at once
- iterm2 — iTerm2 integration (macOS)
- web — Browser-based terminal
Lifecycle Manager
Not pluggable. The core state machine that:- Polls all sessions periodically
- Detects state transitions (working → pr_open → ci_failed → etc.)
- Emits events on transitions
- Triggers automatic reactions
- Escalates to human notification when auto-handling fails
Component Interaction Flow
~/.agent-orchestrator/{hash}-{project}/sessions/{session-id}working → pr_openci.failing eventci-failed.auto: true, Runtime sends CI logs to agent via messageEvent-Driven Architecture
The system is driven by events rather than continuous polling:Event Types
Session Lifecycle:session.spawned— New session createdsession.working— Agent is actively workingsession.stuck— Agent inactive for threshold periodsession.needs_input— Agent waiting for user responsesession.killed— Session terminated
pr.created— Agent opened a pull requestpr.updated— PR was updated with new commitspr.merged— PR was mergedpr.closed— PR was closed without merging
ci.passing— All CI checks passedci.failing— One or more CI checks failedci.fix_sent— Auto-fix sent to agentci.fix_failed— Auto-fix attempts exhausted
review.pending— PR awaiting reviewreview.approved— PR approved by reviewerreview.changes_requested— Reviewer requested changesreview.comments_sent— Review comments forwarded to agent
merge.ready— PR approved with passing CImerge.conflicts— Merge conflicts detectedmerge.completed— PR successfully merged
Event Priority Levels
Events are classified by priority for notification routing:- urgent — Agent stuck, needs input, or errored (immediate attention)
- action — PR approved and ready, or merge completed (human decision needed)
- warning — CI failure, changes requested, merge conflicts (may auto-resolve)
- info — Progress updates, summaries (FYI only)
Lifecycle State Machine
Sessions progress through defined states:killed— Session terminatedmerged— PR merged successfullydone— Work completedterminated— Force-stoppedcleanup— Being cleaned uperrored— Fatal error occurred
needs_input— Agent waiting for responsestuck— Agent inactive beyond threshold
Directory Structure
The architecture enforces convention over configuration:The hash is derived from the config file location, ensuring multiple orchestrator instances never collide.
Design Principles
1. Convention Over Configuration
All paths are auto-derived. No need to configure:- Data directories
- Worktree locations
- Session namespaces
2. Single Source of Truth
- Config:
agent-orchestrator.yamlin repo - Runtime data:
~/.agent-orchestrator/on disk - Plugin interfaces:
packages/core/src/types.ts
3. Zero Path Configuration
Paths are computed from:- Config file location (for hash)
- Project path (from config)
- Session ID (auto-generated)
4. Global Uniqueness
Hash-based namespacing prevents collisions:- Multiple config checkouts don’t conflict
- Projects from same config share hash prefix
- Tmux session names are globally unique
5. Stateless Orchestrator
No database required:- Flat metadata files (
key=valueformat) - JSONL event log for history
- Plugins determine live state on demand
6. Plugin Interfaces
Every plugin is a pure implementation:- Imports interface from
@composio/ao-core - Exports
PluginModule<T>withsatisfies - No framework lock-in
7. Security First
- Always use
execFile, neverexec(prevent shell injection) - Validate all external input (API, CLI, files)
- No interpolation of user input into shell commands
- Timeouts on all external commands
Plugin Development Pattern
Every plugin follows this structure:Always use inline
satisfies PluginModule<T> — this provides compile-time type checking and prevents interface mismatches.Next Steps
Sessions
Learn about session lifecycle and state management
Plugins
Explore the plugin system in detail
Workflows
See how typical workflows operate end-to-end
