Skip to main content

Overview

The Agent interface defines how the orchestrator interacts with specific AI coding tools. Agent plugins know how to launch agents, detect their activity state, extract session information, and handle restoration. Plugin Slot: agent
Default Plugin: claude-code

Interface Definition

Properties

string
required
Plugin name identifier (e.g. "claude-code", "codex", "aider").
string
required
Process name to look for when checking if agent is running (e.g. "claude", "codex", "aider").
'inline' | 'post-launch'
How the initial prompt should be delivered:
  • "inline" (default): prompt included in launch command (e.g. -p flag)
  • "post-launch": prompt sent via runtime.sendMessage() after agent starts
Use "post-launch" for agents where inlining the prompt causes one-shot/exit behavior.

Methods

(config: AgentLaunchConfig) => string
required
Get the shell command to launch this agent.Parameters:
  • config - Launch configuration with session ID, project config, issue, prompt, model, permissions, system prompt
Returns: Shell command string
(config: AgentLaunchConfig) => Record<string, string>
required
Get environment variables for the agent process.Parameters:
  • config - Launch configuration
Returns: Key-value map of environment variables
(terminalOutput: string) => ActivityState
required
Deprecated: Detect agent activity from terminal output (hacky, use getActivityState() instead).Parameters:
  • terminalOutput - Recent terminal output from runtime
Returns: ActivityState
(session: Session, readyThresholdMs?: number) => Promise<ActivityDetection | null>
required
Get current activity state using agent-native mechanism (JSONL, SQLite, etc.). This is the preferred method.Parameters:
  • session - Session to check
  • readyThresholdMs - Milliseconds before “ready” becomes “idle” (default: 300000 = 5 min)
Returns: ActivityDetection with state and timestamp, or null if cannot determine
(handle: RuntimeHandle) => Promise<boolean>
required
Check if agent process is running given a runtime handle.Parameters:
  • handle - Runtime handle from session
Returns: true if process is running, false otherwise
(session: Session) => Promise<AgentSessionInfo | null>
required
Extract information from agent’s internal data (summary, cost, session ID).Parameters:
  • session - Session to extract info from
Returns: AgentSessionInfo or null if not available
(session: Session, project: ProjectConfig) => Promise<string | null>
Optional: Get a launch command that resumes a previous session.Parameters:
  • session - Session to restore
  • project - Project configuration
Returns: Command string or null if no previous session found (falls back to getLaunchCommand())
(session: Session) => Promise<void>
Optional: Run setup after agent is launched (e.g. configure MCP servers).Parameters:
  • session - Newly launched session
(workspacePath: string, config: WorkspaceHooksConfig) => Promise<void>
Optional: Set up agent-specific hooks/config in the workspace for automatic metadata updates.Called once per workspace during ao init/start and when creating new worktrees.Critical: The dashboard depends on metadata being auto-updated when agents run git/gh commands. Without this, PRs created by agents never show up.Parameters:
  • workspacePath - Path to workspace
  • config - Hooks configuration with data directory and optional session ID

AgentLaunchConfig

SessionId
required
Session identifier
ProjectConfig
required
Project configuration from orchestrator config
string
Issue ID if working on a specific issue
string
Initial prompt for the agent
'skip' | 'default'
Permission handling mode
string
Model to use (e.g. "claude-sonnet-4-20250514")
string
System prompt for orchestrator context (short prompts only). Passed via:
  • Claude Code: --append-system-prompt
  • Codex: --system-prompt or AGENTS.md
  • Aider: --system-prompt flag
string
Path to file containing system prompt. Preferred for long prompts (e.g. orchestrator prompts) to avoid shell truncation. Takes precedence over systemPrompt.

AgentSessionInfo

string | null
required
Agent’s auto-generated summary of what it’s working on
boolean
True when summary is a fallback (e.g. truncated first user message), not a real agent summary
string | null
required
Agent’s internal session ID for resume
CostEstimate
Cost estimate (tokens and USD)

ActivityDetection

ActivityState
required
Current activity state
Date
When activity was last observed (e.g. agent log file mtime)

WorkspaceHooksConfig

string
required
Data directory where session metadata files are stored
string
Optional session ID (may not be known at ao init time)

CostEstimate

Usage Examples

Implementing an Agent Plugin

Using Agent in Session Manager

Implementation Notes

Prompt Delivery

For agents where -p "prompt" causes immediate exit after completion:
  • Set promptDelivery: "post-launch"
  • Launch agent in interactive mode
  • Send prompt via runtime.sendMessage() after launch

Activity Detection

Prefer getActivityState() over detectActivity():
  • Uses agent-native mechanisms (JSONL logs, SQLite)
  • More reliable than terminal output parsing
  • Provides timestamps for staleness detection

Workspace Hooks

Critical for dashboard functionality:
  • Claude Code: write .claude/settings.json with PostToolUse hook
  • Hook updates metadata when agent runs git/gh commands
  • Without hooks, PRs created by agents won’t appear in dashboard

Built-in Plugins

  • claude-code - Claude Code (default)
  • codex - Codex
  • aider - Aider
  • opencode - OpenCode

See Also

  • Runtime - Runtime execution environment interface
  • Session - Session interface
  • Workspace - Workspace isolation interface