awslabs/cli-agent-orchestrator/cao-workflow
Claude Code and agent skill by awslabs/cli-agent-orchestrator
- community
Checking that the SKILL.md file is still in the repository.
Author and run CAO Python workflow scripts — multi-step, parameterized, fan-out
Install
npx vskill@latest install awslabs/cli-agent-orchestrator/cao-workflowSKILL.md
The same SKILL.md was published earlier as awslabs/cli-agent-orchestrator/cao-workflow.
CAO Workflows
A CAO workflow is a Python script you write, validate, and — only after asking the user — run through cao workflow run. Each script drives one or more agent steps through CAO's shared substrate, so you can fan work out across agents, collect their results, and resume a run that was interrupted.
Your job as an author ends at a validated script file on disk. Authoring does NOT run theworkflow. Never claim a workflow ran, or will run, when all you did was write it. Running is aseparate step the user must approve (see Lifecycle step c).
When to use
Reach for this skill when the user asks to build or run a multi-step or parameterized workflow — for example:
- "Analyze every file in
reports/and summarize the findings." - "Run a review pipeline: implement, then review, then verify."
- "Do the same batch job but with a different input directory each time."
If the work is a single one-off agent call, you don't need a workflow. Workflows earn their keep when there are multiple steps, fan-out, parameterization, or a need to resume.
The script API
Author scripts import from the cao_workflow package. This package runs only in the script subprocess and imports nothing from cli_agent_orchestrator.* — it talks to CAO over HTTP. Its public surface:
step(provider, agent, prompt, *, recovery, step_id=None, timeout=None, **opts) -> StepHandle—
run one agent step and declare what re-running it would mean. recovery is keyword-only with no default, so omitting it is a TypeError at the call. See "Declaring a recovery policy" below before you pick a value.
run_step(provider, agent, prompt, *, step_id=None, timeout=None, **opts) -> StepHandle—
the same call, declaring no policy. That is the only difference between the two. A recovery= passed to run_step lands in **opts; the server validates it, the shim does not — see below.
StepHandlehas five fields:.step_id,.terminal_id,.output,.status, and
.replayed. `.replayed` qualifies `.terminal_id`. When it is True the server returned a stored result and ran nothing, and .terminal_id is the ORIGINAL id — it names a terminal that no longer exists. That flag is the only thing standing between you and reading, writing to, or waiting on a dead id, so check it before you touch .terminal_id.
get_inputs() -> dict— the run's resolved inputs (see Parameterized workflows). Returns
{} when nothing was declared; never raises on absence.
emit_output(value)— print the run-levelCAO_WORKFLOW_OUTPUT:sentinel (the run's return).ShimError(andShimIdentityError,ShimTransportError,ShimHTTPError) — the failure
hierarchy step and run_step raise. Failures surface unchanged — the shim never retries. A structured HTTP error with a non-empty string detail.kind prints as run-step returned HTTP <status> (<kind>): <message> (without the message suffix when absent); an unstructured error keeps the original run-step returned HTTP <status> text.
Declaring a recovery policy
recovery= is the author's claim about the step, and nothing more. CAO has no mechanism to prove what a step does to the outside world, so it cannot and does not verify the claim. A recovery policy DECLARES what re-running this step would mean; it never grants permission.
The three values, all of which are statements you are making, not protections you are getting:
| Value | What you are asserting | |
|---|---|---|
"idempotent" | re-running this step has the same effect as running it once | |
"reconcile" | re-running it needs a reconciliation step first (deferred — today CAO treats it exactly like idempotent) | |
"manual" | do not decide this one without me — halt and ask |
`"idempotent"` grants nothing and protects nothing. It does not make a step safe to re-run; it tells the resume gate that you believe it already is — and wherever the gate would otherwise stop and ask a human, it re-executes the step on your word instead. Declare it on a step that charges a card, sends mail, or files a ticket and CAO will charge the card again, exactly as instructed. If you cannot show the step is safe to repeat, "manual" is the honest declaration.
Omitting a policy is a fourth, distinct state — it is never silently read as "manual". Use run_step for it deliberately: an undeclared step still replays (replay executes nothing), but where the alternative is re-execution it halts for a human.
`recovery=` on `run_step` is checked late, not never. run_step has no recovery parameter, so the value rides **opts to the server, which stores it, lets the resume gate honour it, and rejects an unknown value with a `422` — the route types that field as the closed policy enum. What run_step lacks is step()'s client-side check, which refuses a bad value before any HTTP attempt; on run_step a typo instead fails that step mid-run. Neither surface has its value checked by validate (the linter sees the keyword, not its contents), which is why validate reports the run_step form as unenforced-recovery-policy. Use step() to declare, and run_step only to declare nothing.
Lifecycle
The whole sequence, in order: describe → author → validate → present plan → approve → run → observe. No step may be skipped — validate is mandatory, approval is a human act, and you must ask before running.
Python is the format. You are never asked to choose between YAML and Python, and you must never ask the user to: workflows you author are Python, full stop. (YAML workflows still run — they predate this — but nothing new is generated in YAML.)
a. AUTHOR
Create the spec through CAO, not by writing the file yourself.
Both return the path and a content_hash — keep the hash, because cao workflow update / workflow_update require it to prove you edited the version you last read.
The workflow is run by its stem (<name>), so the name must be a bare stem — no path separators, no directory prefix.
Going through create rather than writing into ~/.aws/cli-agent-orchestrator/workflows/ yourself is what gets you three checks that only exist on that path: the write is contained and size-capped, validate-then-index is atomic with it, and a same-stem cross-tier collision is refused before anything is written. That last one matters more than it sounds: a raw write of <name>.py beside an existing <name>.yaml succeeds, and then every attempt to run or inspect <name> fails with a tier collision — a file that is unreachable the moment it lands.
b. VALIDATE (mandatory gate)
You can lint a draft that does not exist on disk yet, which is the cheapest order — validate, revise, then create:
create and update lint server-side too and refuse to write a spec with a blocking error, so validating first saves a round trip rather than replacing a check.
Fix every finding before proceeding — the lint findings are load-bearing, not style nits:
- `import cli_agent_orchestrator` is banned. The script runs in a separate subprocess and
must reach CAO only over HTTP (the cao_workflow shim). Importing the server package breaks that boundary.
- `random` / `time` / `datetime` / `uuid` warnings. Resume **re-executes the script
top-to-bottom** and replays journaled step results. Any nondeterministic value computed at the top level will differ on replay and raise ReplayDivergenceError. Keep the script deterministic: derive IDs from inputs, not from the clock or an RNG.
- `missing-recovery-policy` is a blocking ERROR. A
step()call with norecovery=
keyword fails validation — the signature requires one and so does the linter. Two related warnings fire without blocking: unverifiable-recovery-policy (a step() call passing **kwargs, so the linter cannot see whether a policy is in there) and unenforced-recovery-policy (a recovery= on run_step, which is honoured at resume and validated by the server with a 422, but is not checked client-side before it is sent). See "Declaring a recovery policy" above.
c. ASK the user — NEVER auto-run
The script tier executes generated Python. Never run a workflow without the user's explicit approval. Present the validated file and ask before doing anything in steps d–e.
Ask before step d, not after it: step d learns the plan identifier by attempting the run, and if that plan already happens to be approved the attempt does not stop — it executes.
d. PRESENT THE PLAN and get it APPROVED
The first run of a new or changed workflow is refused, by design. A plan identifier is computed at run start from everything that affects execution, so it does not exist until you try to run — the refusal is how you learn it.
Attempt the run. If it is refused, the response tells you which of two things happened, as a field — read the field, never the sentence:
class / kind | What happened | What to do | |
|---|---|---|---|
approval_required | this plan has no approval yet | present the plan_id to the user and stop | |
plan_identity_unavailable | CAO could not compute a plan identifier for the working directory | there is nothing to approve; follow message, retrying only when it says so, otherwise tell the user |
On approval_required, show the user the identifier and the one command that grants it:
Then stop and wait. Do not retry the run, do not poll for the approval to appear, and do not look for a tool that grants one — there deliberately isn't one. An agent that could approve the plan it just wrote would make the check decorative in exactly the case it exists for. Approving is a human act at a human's terminal.
Once approved, run again and it proceeds. Approval binds the script, its inputs, the working directory's state and the installed agent profile set: change any of them and the next run needs its own approval. Editing or installing ANY agent profile changes the plan_id of every plan, not just the plans that name it. Edits to CAO memory, to managed .env values a profile references, to installed skills or to plugin MCP servers do not change the plan_id, so a later run of the same plan uses them without asking again. Tell the user whenever you change any of these.
This pause is not a defect, and it does not fail FR-10. The requirement's failure condition isasking the user to choose a format — which never happens, since Python is the format. A humanapproving what is about to execute on their machine is the requirement working.
e. RUN with an explicit, pre-announced run-id
Announce the run-id before you start so the user can cancel it: "Starting run kb-1 — cancel with cao workflow cancel kb-1."
Choose the invocation by how the run is triggered, because the two paths have very different client-side ceilings:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cao-workflow/SKILL.md
Popularity
- Repository stars
- 1,127
- Repository forks
- 240
- 7-day trend score
- 35
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/awslabs/cli-agent-orchestrator/cao-workflow)