Overview
TheAgent 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: agentDefault Plugin:
claude-code
Interface Definition
Properties
Plugin name identifier (e.g.
"claude-code", "codex", "aider").Process name to look for when checking if agent is running (e.g.
"claude", "codex", "aider").How the initial prompt should be delivered:
"inline"(default): prompt included in launch command (e.g.-pflag)"post-launch": prompt sent viaruntime.sendMessage()after agent starts
"post-launch" for agents where inlining the prompt causes one-shot/exit behavior.Methods
Get the shell command to launch this agent.Parameters:
config- Launch configuration with session ID, project config, issue, prompt, model, permissions, system prompt
Get environment variables for the agent process.Parameters:
config- Launch configuration
Deprecated: Detect agent activity from terminal output (hacky, use
getActivityState() instead).Parameters:terminalOutput- Recent terminal output from runtime
getActivityState
(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 checkreadyThresholdMs- Milliseconds before “ready” becomes “idle” (default: 300000 = 5 min)
Check if agent process is running given a runtime handle.Parameters:
handle- Runtime handle from session
Extract information from agent’s internal data (summary, cost, session ID).Parameters:
session- Session to extract info from
Optional: Get a launch command that resumes a previous session.Parameters:
session- Session to restoreproject- Project configuration
getLaunchCommand())Optional: Run setup after agent is launched (e.g. configure MCP servers).Parameters:
session- Newly launched session
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 workspaceconfig- Hooks configuration with data directory and optional session ID
Related Types
AgentLaunchConfig
Session identifier
Project configuration from orchestrator config
Issue ID if working on a specific issue
Initial prompt for the agent
Permission handling mode
Model to use (e.g.
"claude-sonnet-4-20250514")System prompt for orchestrator context (short prompts only). Passed via:
- Claude Code:
--append-system-prompt - Codex:
--system-promptor AGENTS.md - Aider:
--system-promptflag
Path to file containing system prompt. Preferred for long prompts (e.g. orchestrator prompts) to avoid shell truncation. Takes precedence over
systemPrompt.AgentSessionInfo
Agent’s auto-generated summary of what it’s working on
True when summary is a fallback (e.g. truncated first user message), not a real agent summary
Agent’s internal session ID for resume
Cost estimate (tokens and USD)
ActivityDetection
Current activity state
When activity was last observed (e.g. agent log file mtime)
WorkspaceHooksConfig
Data directory where session metadata files are stored
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
PrefergetActivityState() 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.jsonwith PostToolUse hook - Hook updates metadata when agent runs
git/ghcommands - 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
