04

Automation & Ops

Run agents on a schedule, orchestrate them from the outside, and build zero-human-in-the-loop pipelines.

Scheduled Flows

Scheduled Flows let you run agent tasks on a cron-like schedule without any human trigger. Define a flow as a Markdown file with YAML frontmatter, register it with the CLI, and CAO's background daemon handles the rest.

Flow File (nightly-review.md)
---
name: nightly-review
schedule: "0 2 * * *"
agent_profile: code_supervisor
provider: claude_code
---

Review all PRs opened today and
summarize findings.
Plain English
 
Name this flow "nightly-review".
Run every day at 2:00 AM.
Use the code_supervisor profile.
Run inside Claude Code.
 
The body becomes the agent's task prompt.
 

The server's background daemon checks every 60 seconds for flows whose cron expression matches. Sessions are auto-named cao-flow-{name}.

CLI commands: cao schedule add FILE, cao schedule list, cao schedule run NAME, cao schedule enable/disable NAME, cao schedule remove NAME.

Flows can include a script step that runs first and outputs JSON. If it returns {"execute": false}, the flow is skipped for that cycle — useful for conditional execution based on external state.

The Ops MCP Server

CAO ships two MCP servers with very different purposes. Understanding which is which is essential for building integrations.

cao-mcp-server

Runs INSIDE agent sessions.

Provides tools like handoff, assign, and send_message so agents can orchestrate each other during a workflow.

The internal intercom system between coworkers.

cao-ops-mcp-server

Runs OUTSIDE — for external control.

Lets CI/CD pipelines, meta-agents, or scripts manage CAO itself: launch sessions, send messages, read output, shut things down.

The building's reception desk — controls who enters and exits.

Ops server tools:

  • list_profiles — discover available agent profiles
  • install_profile — install a profile by name or URL
  • launch_session — start a new CAO session
  • send_session_message — deliver a message to a running session
  • get_terminal_status — check if a terminal is idle, processing, etc.
  • get_terminal_output — read recent terminal output
  • read_session_output — read a terminal's captured output by session name
  • get_profile_details — get detailed information about a specific profile
  • list_sessions — list all active CAO sessions
  • get_session_info — get detailed info about a specific session
  • shutdown_session — gracefully stop a session

Fully Autonomous Operation

When an agent hits a permission prompt or asks for clarification, it enters WAITING_USER_ANSWER status. Normally a human would respond. But the answer_user_prompt tool lets another agent respond programmatically.

A supervisor (or another internal agent via the cao-mcp-server) calls answer_user_prompt(terminal_id, answer) to unblock the waiting worker — no human needed. Note: answer_user_prompt is available only through the internal cao-mcp-server, not the ops server. External scripts can send input to a waiting terminal via POST /terminals/{id}/input — the same generic endpoint used for all terminal input.

Zero-Human-in-the-Loop

Combine all three pieces for fully autonomous pipelines: Scheduled Flows trigger work on a cron, the Ops MCP Server lets external systems monitor and control sessions, and answer_user_prompt resolves any agent-to-human blocks automatically. The result: agents that run 24/7 without anyone watching.

Check Your Understanding

Which MCP server would a CI/CD pipeline use to launch a CAO session?

← Back to the fundamentals course