awslabs / awslabs/cli-agent-orchestrator
[feat] Add Devin CLI provider
- Dominant language
- Python
- Stars
- 1.3k
- Forks
- 267
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 70
Description
## Summary
Add [Devin CLI](https://cli.devin.ai/) as a new built-in provider alongside the existing 7 (Kiro CLI, Claude Code, Codex, Gemini CLI, Kimi CLI, Copilot CLI, Q CLI).
Devin is Cognition's terminal-based AI agent. It supports `--permission-mode dangerous` for autonomous operation and `--prompt-file` for system prompt injection, making it well-suited for CAO orchestration.
## Implementation Details
We have a working `DevinCliProvider` (338 lines) implementing `BaseProvider`. Key aspects:
### Terminal State Detection
Devin's TUI has a unique layout that requires special handling:
```
> user message ← user input
Response text ← agent reply
──────────────────── ← horizontal rule (fixed TUI chrome)
# ← input prompt (never disappears)
──────────────────── ← horizontal rule
Mode: ... Model: ... ← status bar
```
**Challenges solved:**
- The `#` prompt is **fixed TUI chrome** — it never disappears during processing. Processing must be detected by spinner text (`Running tools`, `esc to interrupt`) taking priority over prompt detection.
- Ghost/autocomplete text appears after `#` (e.g. `# may be`). A **relaxed prompt pattern** (`^[\s]*#`) is used, but only when the status bar (`Mode:.*Model:`) is also visible — proving the TUI is rendered and avoiding false matches on `#` in code output.
- **Stateless completed detection**: User input lines are prefixed with `> ` in Devin's TUI. By scanning for `^> .+`, we distinguish idle (no input yet) from completed (input was sent, prompt returned) without ephemeral flags that break on server restart.
### Command Construction
```python
devin --permission-mode dangerous --respect-workspace-trust false \
--prompt-file /tmp/cao_devin_prompt_xxx.md \
--config /tmp/cao_devin_config_xxx.json
```
### MCP Config Merging
Agent profile MCP servers are merged into Devin's `~/.config/devin/config.json`, with `CAO_TERMINAL_ID` injected into each server's env for cross-agent communication.
### Response Extraction
Responses are extracted between the last `> user input` line and the horizontal rule preceding the `#` prompt — scanning backwards for 2 horizontal rules (Unicode box-drawing characters U+2500-U+257F).
### Provider Properties
- `paste_enter_count`: 1 (single Enter after paste)
- `exit_cli()`: `/exit`
- `requires_workspace`: true
## Agent Profiles
Three ready-to-use agent profiles:
- **developer.md** — Developer agent with MCP server config and multi-agent handoff protocol
- **reviewer.md** — Code reviewer (review-only, structured APPROVE/REQUEST_CHANGES output)
- **supervisor.md** — Supervisor that delegates to developer and reviewer in an iterative loop
## Tool Mapping
```yaml
tool_mapping:
fs_read: Read
fs_write: Write
execute_bash: Bash
web_search: WebSearch
list_dir: List
```
## Reference Implementation
Full working implementation available at [cao-poc](https://github.com/ThePlenkov/cli-agent-orchestrator) — tested and verified with Devin CLI v2.x in both native and containerized environments.
## Related
- #147 (Plugin/provider extension API) — Devin CLI could be the first provider to use a plugin API if one is built, or it can be added as a built-in provider directly.
Contributor guide
Research direction
Start by comparing the existing built-in provider entry points and registration with the DevinCliProvider described here. Then inspect the three named profiles—developer.md, reviewer.md, and supervisor.md—and the referenced cao-poc implementation. Verify the command construction, TUI state and response handling, MCP config merging, and tool_mapping against Devin CLI v2.x.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100