The Kiro CLI provider enables CLI Agent Orchestrator (CAO) to work with Kiro CLI, an AI-powered coding assistant that operates through agent-based conversations with customizable profiles.
- AWS Credentials: Kiro CLI authenticates via AWS
- Kiro CLI: Install the CLI tool
- tmux: Required for terminal management
# Install Kiro CLI
npm install -g @anthropic-ai/kiro-cli
# Verify authentication
kiro-cli --version# Start the CAO server
cao-server
# Launch a Kiro CLI-backed session (agent profile is required)
cao launch --agents developer --provider kiro_cliVia HTTP API:
curl -X POST "http://localhost:9889/sessions?provider=kiro_cli&agent_profile=developer"Note: Kiro CLI requires an agent profile — it cannot be launched without one.
The Kiro CLI provider detects terminal states by analyzing ANSI-stripped output:
- IDLE: Agent prompt visible (legacy
[profile_name] >or new TUIask a question, or describe a task), no response content - PROCESSING: No idle prompt found in output (agent is generating response)
- COMPLETED: Green arrow (
>) response marker present + idle prompt after it - WAITING_USER_ANSWER: Permission prompt visible (
Allow this action? [y/n/t]:) - ERROR: Known error indicators present (e.g., "Kiro is having trouble responding right now")
Status detection priority: no prompt → PROCESSING → ERROR → WAITING_USER_ANSWER → COMPLETED → IDLE.
The provider supports both the legacy UI prompt format and the new TUI format for all status detection and message extraction.
The provider supports two prompt formats:
Legacy UI (used with --legacy-ui flag):
[developer] > # Basic prompt
[developer] !> # Prompt with pending changes
[developer] 50% > # Prompt with progress indicator
[developer] λ > # Prompt with lambda symbol
[developer] 50% λ > # Combined progress and lambda
Pattern: \[{agent_profile}\]\s*(?:\d+%\s*)?(?:\u03bb\s*)?!?>\s*
New TUI (default in latest Kiro CLI):
code_supervisor · claude-opus-4.6-1m · ◔ 1%
ask a question, or describe a task ↵
The new TUI idle state is detected by the ask a question, or describe a task pattern. The provider currently launches with --legacy-ui for reliability, but includes new TUI detection as a fallback.
The provider extracts the last assistant response using the green arrow indicator:
- Strip ANSI codes from output
- Find all green arrow (
>) markers (response start) - Take the last one
- Find the next idle prompt after it (response end)
- Extract and clean text between them (strip ANSI, escape sequences, control characters)
Kiro CLI shows Allow this action? [y/n/t]: prompts for sensitive operations (file edits, command execution). The provider detects these as WAITING_USER_ANSWER status. Unlike Claude Code, Kiro CLI does not have a trust folder dialog.
Kiro CLI always requires an agent profile. CAO passes it via:
kiro-cli chat --legacy-ui --agent {profile_name}
The profile name determines the prompt pattern used for status detection. Built-in profiles include developer and reviewer.
The provider constructs the command with --legacy-ui to ensure the old prompt format is used for reliable status detection:
kiro-cli chat --legacy-ui --agent developer
The --legacy-ui flag restores the [agent] > prompt format. Without it, the latest Kiro CLI defaults to a new TUI with a different prompt format that CAO also supports as a fallback.
- ANSI stripping: All pattern matching operates on ANSI-stripped output for reliability
- Green arrow pattern:
^>\s*matches the start of agent responses (after ANSI stripping) - Generic prompt pattern:
\x1b\[38;5;13m>\s*\x1b\[39m\s*$matches the purple-colored prompt in raw output (used for log monitoring) - Error detection: Checks for known error strings like "Kiro is having trouble responding right now"
- Multi-format cleanup: Extraction strips ANSI codes, escape sequences, and control characters
- Exit command:
/exitviaPOST /terminals/{terminal_id}/exit
TerminalStatus.IDLE: Ready for inputTerminalStatus.PROCESSING: Working on taskTerminalStatus.WAITING_USER_ANSWER: Waiting for permission confirmationTerminalStatus.COMPLETED: Task finishedTerminalStatus.ERROR: Error occurred
The E2E test suite validates handoff, assign, and send_message flows for Kiro CLI.
# Start CAO server
uv run cao-server
# Run all Kiro CLI E2E tests
uv run pytest -m e2e test/e2e/ -v -k kiro_cli
# Run specific test types
uv run pytest -m e2e test/e2e/test_handoff.py -v -k kiro_cli
uv run pytest -m e2e test/e2e/test_assign.py -v -k kiro_cli
uv run pytest -m e2e test/e2e/test_send_message.py -v -k kiro_cli
uv run pytest -m e2e test/e2e/test_supervisor_orchestration.py -v -k KiroCli -o "addopts="-
"Agent profile required" Error:
- Kiro CLI cannot be launched without an agent profile
- Always specify
--agentswhen launching:cao launch --agents developer --provider kiro_cli
-
Permission Prompts Blocking:
- Kiro CLI shows
[y/n/t]prompts for operations - The provider detects these as
WAITING_USER_ANSWER - In multi-agent flows, the supervisor or user must handle these
- Kiro CLI shows
-
Authentication Issues:
# Verify AWS credentials aws sts get-caller-identity # Set credentials via environment export AWS_ACCESS_KEY_ID=... export AWS_SECRET_ACCESS_KEY=... export AWS_DEFAULT_REGION=...
-
Prompt Pattern Not Matching:
- The provider supports both legacy (
[name] >) and new TUI (ask a question, or describe a task) formats - The
--legacy-uiflag is used by default for reliable detection - If
--legacy-uiis removed in a future Kiro CLI version, the new TUI fallback patterns will be used - Check with:
kiro-cli chat --legacy-ui --agent your_profile
- The provider supports both legacy (
-
JSON-Only Agent Profiles (AIM-Installed):
- Agents installed via AIM (Agent Install Manager) may only have
.jsonprofiles (e.g.,~/.kiro/agents/librarian/agent-spec.json) - CAO's
load_agent_profile()primarily scans for.mdfiles - If the agent is not found, CAO gracefully falls back — kiro-cli resolves
.jsonprofiles natively - As a workaround, you can create a stub
.mdfile alongside the.jsonprofile
- Agents installed via AIM (Agent Install Manager) may only have