File size: 11,545 Bytes
cd8bd0a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
---
title: "Agent Protocols Guide"
version: 3.8.2
lastUpdated: 2026-05-13
---

# Agent Protocols Guide

> **Source:** `src/lib/{a2a,acp,cloudAgent}/`, `src/app/api/{a2a,acp,cloud}/`, `src/app/api/v1/agents/`
> **Last updated:** 2026-05-13 β€” v3.8.0

OmniRoute exposes three different agent-related surfaces. They look similar at first glance but solve different problems. Use this page to pick the right one.

## TL;DR

| Surface                       | Best for                                                                                                                                   | Transport                   | Standard             |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------- | -------------------- |
| **A2A β€” Agent-to-Agent**      | Cross-agent collaboration with peer agents that speak the A2A protocol                                                                     | JSON-RPC 2.0 over HTTP      | A2A v0.3 (open spec) |
| **ACP β€” CLI Agents Registry** | Detecting / registering / launching CLI coding agents installed on the user's machine (Cursor, Cline, Codex CLI, Claude Code, Aider, etc.) | HTTP REST                   | OmniRoute-specific   |
| **Cloud Agents**              | Submitting long-running coding tasks to external cloud services (Codex Cloud, Devin, Jules)                                                | HTTP REST + DB-backed tasks | OmniRoute-specific   |

The three are independent β€” pick any subset.

## Decision Tree

```
Do you need a cloud service to do work outside this machine (Codex Cloud / Devin / Jules)?
β”œβ”€ YES β†’ Cloud Agents (POST /api/v1/agents/tasks)
└─ NO β†’ Continue
    β”‚
    Do you have a peer agent that speaks A2A and wants to collaborate?
    β”œβ”€ YES β†’ A2A (POST /a2a)
    └─ NO β†’ Continue
        β”‚
        Do you need to list / configure CLI coding agents installed locally?
        β”œβ”€ YES β†’ ACP (GET /api/acp/agents)
        └─ NO β†’ Use plain /v1/chat/completions
```

## 1. A2A β€” Agent-to-Agent

**Spec:** [A2A v0.3](https://a2a-protocol.org)
**OmniRoute endpoint:** `POST /a2a` (JSON-RPC 2.0)
**Agent Card:** `GET /.well-known/agent.json`

### When to use

- Building a multi-agent system where OmniRoute is one of the peers
- Exposing OmniRoute's routing intelligence (smart-routing, quota-management, etc.) to agents in frameworks like Google ADK or generic agent meshes
- Wrapping OmniRoute behind a standard discovery + invocation surface

### Methods

- `message/send` β€” submit a message, receive sync response
- `message/stream` β€” submit + receive SSE-streamed progress events
- `tasks/get` β€” read task by ID
- `tasks/cancel` β€” cancel a running task

### Built-in skills (5)

- `smart-routing` β€” route a prompt through the optimal combo
- `quota-management` β€” report per-provider quota state
- `provider-discovery` β€” list installed providers with capabilities
- `cost-analysis` β€” estimate cost of a request/conversation
- `health-report` β€” aggregate breaker/cooldown/lockout state per provider

### Deep dive

See [A2A-SERVER.md](./A2A-SERVER.md) for transport details, agent card structure, task TTL config, and the template for adding new skills.

## 2. ACP β€” CLI Agents Registry

**OmniRoute endpoint:** `GET /api/acp/agents`
**Source:** `src/lib/acp/{index,manager,registry}.ts`

### What it is

ACP is OmniRoute's **local CLI agent inventory**. It detects which coding CLIs are installed on the host (Cursor, Cline, Claude Code, Codex CLI, Continue, etc.), resolves their versions, and surfaces them to the dashboard so the user can wire each CLI to point at OmniRoute.

This is NOT an external protocol β€” it's an internal registry that powers the "CLI Tools" UI and the CLI fingerprint tracking (see [CLI-TOOLS.md](../reference/CLI-TOOLS.md)).

### What it does

- Probes the host for installed CLI binaries (uses `which` / `where` per OS)
- Reads each CLI's version (calls `<bin> --version`)
- Optionally accepts user-defined custom agents (binary path + version probe + spawn args)
- Persists custom agents in settings
- Returns the unified list to the dashboard

### REST API

| Endpoint          | Method | Description                                                   | Auth    |
| ----------------- | ------ | ------------------------------------------------------------- | ------- |
| `/api/acp/agents` | GET    | List detected + custom agents (installed/total counts)        | API key |
| `/api/acp/agents` | POST   | Add/update/remove custom agent (action discriminator in body) | API key |

Body shape for POST (`customAgentBodySchema` in `src/app/api/acp/agents/route.ts`):

```json
{
  "action": "add|update|remove",
  "id": "cursor",
  "name": "Cursor",
  "binary": "/usr/local/bin/cursor",
  "versionCommand": "--version",
  "providerAlias": "cursor",
  "spawnArgs": ["--api-base", "http://localhost:20128"],
  "protocol": "stdio"
}
```

### Use cases

- Dashboard "CLI Tools" page lists what's installed and helps you point each at OmniRoute
- Custom agents let power users register internal/proprietary CLIs that OmniRoute doesn't know about by default
- Detection result fuels the `cli-tools` fingerprint matrix

### When NOT to use ACP

- ACP doesn't _run_ tasks. It only detects + configures CLIs. To actually invoke a CLI, you launch it yourself with the env vars OmniRoute provides (`OPENAI_BASE_URL`, `OPENAI_API_KEY`, etc.).

## 3. Cloud Agents

**OmniRoute endpoints:** `/api/v1/agents/tasks/*` (lifecycle) + `/api/cloud/*` (plumbing)
**Source:** `src/lib/cloudAgent/`

### What it is

A uniform interface over third-party cloud coding agents. You submit a prompt + repo URL, OmniRoute dispatches to the right cloud agent, polls status, returns results.

### Supported agents (3, all confirmed in `src/lib/cloudAgent/agents/`)

- `codex-cloud` β€” OpenAI Codex Cloud
- `devin` β€” Cognition Devin
- `jules` β€” Google Jules

### Lifecycle

```
POST /api/v1/agents/tasks
  β†’ BaseAgent.createTask() per agent class
  β†’ external service starts work
  β†’ task row created in DB (cloud_agent_tasks)
  ↓
GET /api/v1/agents/tasks/[id]
  β†’ lazy status sync from provider
  β†’ returns current status + plan + activity log
  ↓
POST /api/v1/agents/tasks/[id]   (action: "approve" | "message" | "cancel")
  β†’ forwards to provider (or marks cancelled locally)
  ↓
DELETE /api/v1/agents/tasks/[id]
  β†’ local cancel
```

### Auth

⚠️ **All `/api/v1/agents/tasks/*` endpoints require management auth** (commit `588a0333`). Bearer-only callers receive 401 since v3.8.0.

### Deep dive

See [CLOUD_AGENT.md](./CLOUD_AGENT.md) for the `CloudAgentBase` contract, per-agent specifics, schema details, and credential plumbing endpoints.

## Comparison: A2A vs Cloud Agents

Both have "long-running tasks" but at different layers:

| Aspect             | A2A                                                                               | Cloud Agents                             |
| ------------------ | --------------------------------------------------------------------------------- | ---------------------------------------- |
| Standard           | Open A2A v0.3                                                                     | OmniRoute-specific                       |
| Where compute runs | Inside OmniRoute (uses configured combos)                                         | External (Codex / Devin / Jules servers) |
| Task duration      | Default TTL 5 min (configurable in `TaskManager`)                                 | Minutes to hours                         |
| Repo-aware         | No (passes prompts only)                                                          | Yes (repo URL + branch)                  |
| Use case           | Cross-agent collab, smart routing as a service                                    | Delegate "implement feature X in repo Y" |
| Auth               | Optional `OMNIROUTE_API_KEY` for `/a2a`; management for `/api/a2a/*` REST helpers | Always management                        |

## Integration Examples

### Discover OmniRoute's A2A capabilities

```bash
curl http://localhost:20128/.well-known/agent.json
```

Returns the Agent Card with all 5 skills, transports, and version.

### Call OmniRoute as an A2A agent

```bash
curl -X POST http://localhost:20128/a2a \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "message/send",
    "params": {
      "messages": [{"role": "user", "content": "Route this prompt"}],
      "skillId": "smart-routing"
    },
    "id": 1
  }'
```

### List installed CLI agents via ACP

```bash
curl http://localhost:20128/api/acp/agents \
  -H "Authorization: Bearer <api-key>"
```

### Add a custom CLI agent

```bash
curl -X POST http://localhost:20128/api/acp/agents \
  -H "Authorization: Bearer <api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "add",
    "id": "my-custom-cli",
    "name": "My Custom CLI",
    "binary": "/opt/mycli/bin/mycli",
    "versionCommand": "--version",
    "providerAlias": "openai"
  }'
```

### Submit a Cloud Agent task

```bash
curl -X POST http://localhost:20128/api/v1/agents/tasks \
  -H "Cookie: auth_token=..." \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "devin",
    "prompt": "Implement feature X in repo Y",
    "repo": "https://github.com/user/repo",
    "branch": "main"
  }'
```

### Poll cloud task status

```bash
curl http://localhost:20128/api/v1/agents/tasks/<task-id> \
  -H "Cookie: auth_token=..."
```

## When to Use What

- **Chatbot / copilot frontend** β†’ `/v1/chat/completions` (OpenAI-compat β€” not an agent protocol)
- **Multi-agent collaboration** β†’ A2A
- **Listing local CLIs in the dashboard** β†’ ACP
- **Delegating long-running coding tasks to cloud services** β†’ Cloud Agents

## Internal Architecture

```
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β”‚   OmniRoute Core    β”‚
                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  ↑       ↑        ↑
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚        └─────────┐
        β”‚                 β”‚                  β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  A2A  β”‚        β”‚   ACP   β”‚       β”‚  Cloud     β”‚
    β”‚ (/a2a)β”‚        β”‚ (/acp)  β”‚       β”‚  Agents    β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚ (/v1/agentsβ”‚
        β”‚                 β”‚            β”‚  /tasks)   β”‚
        ↓                 ↓            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
   External peer    Local CLI               β”‚
   agents that      binaries on             ↓
   speak A2A v0.3   the host           Codex Cloud,
                                        Devin, Jules
```

## See Also

- [A2A-SERVER.md](./A2A-SERVER.md) β€” A2A deep dive
- [CLOUD_AGENT.md](./CLOUD_AGENT.md) β€” Cloud Agents deep dive
- [CLI-TOOLS.md](../reference/CLI-TOOLS.md) β€” External CLI integrations (uses ACP)
- [SKILLS.md](./SKILLS.md) β€” Skills framework (different from A2A skills β€” local execution sandbox)
- [API_REFERENCE.md](../reference/API_REFERENCE.md#agents-protocol) β€” endpoint reference
- Source: `src/lib/{a2a,acp,cloudAgent}/`