You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cea2090
Browse filesBrowse the repository at this point in the historyBrowse files
Default the Agents API to the first runtime and enable each route.
A request that does not name an adapter uses codex. Name qwen-code to use the other one. Agents endpoints are in the catalogue with scope agents:use. The cloud examples use the base template and python -m playwright.
Copy file name to clipboardExpand all lines: docs/en/guide/agents-api.md
+15-4Lines changed: 15 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Field-by-field refusals are in [Hosted agents](hosted-agents.md). This page is t
8
8
9
9
## Install a CLI
10
10
11
-
Neither CLI is installed by default. Installing both into the base image makes the image large.
11
+
Install one CLI. Installing both into the base image makes the image large. When the request does not name an adapter, the server uses the first in the product order: `codex`. Name Qwen Code in the request, or set `EBX_AGENTS_DEFAULT=qwen-code`, to use the other one.
The shapes below are what the server returns. The server assigns the session id.
40
40
41
-
A model id such as `gpt-5` does not select a CLI:
41
+
When the request does not name an adapter, the server uses the first in the product order (`codex`). A model id such as `gpt-5`is passed to that CLI. It does not switch the adapter:
42
42
43
43
```text
44
-
POST /v1/agents/sessions 400
44
+
POST /v1/agents/sessions {"agent":{"model":"gpt-5"}} 200
45
+
agent.id: codex
46
+
agent.model: gpt-5
45
47
X-Easy-Sandbox-Local: 1
46
-
code: agents.adapter_required
48
+
```
49
+
50
+
`GET /v1/agents/runtimes` uses the same paging as the other lists, so the default `order` is `desc`. Pass `order=asc` to see the product order `codex`, then `qwen-code`. `default: true` marks the runtime used when the request does not name one. The flag does not follow the array index. With no config it is on `codex`. After `EBX_AGENTS_DEFAULT=qwen-code` it moves to `qwen-code`.
51
+
52
+
Name the other one:
53
+
54
+
```text
55
+
POST /v1/agents/sessions {"adapter":"qwen-code","agent":{"model":"gpt-5"}} 200
56
+
agent.id: qwen-code
57
+
agent.model: gpt-5
47
58
```
48
59
49
60
An adapter name that is not supported today, for example `claude-code`:
Copy file name to clipboardExpand all lines: docs/en/guide/best-practices.md
+45Lines changed: 45 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,51 @@ The Agents routes stay off until the process is started with `EBX_SERVER_ENABLED
28
28
29
29
Codex and Qwen Code are supported today. Checklist, the local header, and the 404s: [Hosted agents — Best practices](hosted-agents.md#best-practices).
30
30
31
+
## One agent by default
32
+
33
+
Install only the CLI you are going to call. Installing both Codex and Qwen Code makes the image large.
34
+
35
+
The server's order is `codex`, then `qwen-code`. A request that does not name an adapter uses the first. `GET /v1/agents/runtimes?order=asc` returns them in that order. The list's default `order` is `desc`. `default: true` marks the one in effect. It does not follow the array index.
36
+
37
+
```bash
38
+
npm install -g @openai/codex
39
+
```
40
+
41
+
To use Qwen Code, send `adapter`, `runtime`, or the `X-EBX-Adapter` header, or set `model` to `qwen-code` (aliases `qwen` and `qwencode`). A model id such as `gpt-5` is passed to the selected CLI. It does not switch the adapter.
42
+
43
+
Move the default off the first entry:
44
+
45
+
```bash
46
+
export EBX_AGENTS_DEFAULT=qwen-code
47
+
```
48
+
49
+
A JSON file named by `EBX_AGENTS_CONFIG` does the same with a top-level `default` or `agents.default`. `claude-code`, Cursor, and Qoder stay 404.
50
+
51
+
## Open Agents routes one endpoint at a time
52
+
53
+
`groups.agents: true` is only the gate for this group. Each Agents route has its own endpoint id, the same way `upload` and `shell` do. The default scope is `agents:use`. This opens session create and nothing else:
54
+
55
+
```python
56
+
from easy_sandbox.server import SandboxServer, ServerPolicy, default_table
server = SandboxServer(route_table=default_table(), policy=policy)
60
+
```
61
+
62
+
The same policy in YAML:
63
+
64
+
```yaml
65
+
groups:
66
+
agents: true
67
+
endpoints:
68
+
"*":
69
+
enabled: false
70
+
agents_sessions_create:
71
+
enabled: true
72
+
```
73
+
74
+
These endpoints do not accept `paths` or specialised `params`. A policy that sets either fails to load. The full endpoint id list is in [Fine-grained capabilities](fine-grained-capabilities.md).
75
+
31
76
## Secrets are not echoed
32
77
33
78
`GET /env`omits a variable whose name contains `TOKEN`, `SECRET`, `KEY`, `PASSWORD`, or `CREDENTIAL`. When a policy is loaded it also omits `EBX_SERVER_TOKEN`, `EBX_SERVER_POLICY`, `EBX_SERVER_POLICY_FILE`, every `token_env` name, and every name that starts with `EBX_SERVER_`.
Copy file name to clipboardExpand all lines: docs/en/guide/hosted-agents.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,8 @@ The template server listens on **port 9000**. Point an OpenAI-shaped client at `
18
18
* Codex and Qwen Code are supported today. A body that names an adapter that is not supported yet is HTTP 404 `not_found_error` with `x-should-retry: false`.
19
19
* Treat every response as local. Read the header `X-Easy-Sandbox-Local: 1` (errors included). `x_easy_sandbox.compute` is `local_process`, `local_state`, or `none`.
20
20
* Do not call `POST /v1/responses/input_tokens`. It is 404 `agents.not_implemented_locally` with `x-should-retry: false`. No tokenizer matches the model the CLI will call.
21
+
* Install one CLI in the image. A request that does not name an adapter uses the first in the product order (`codex`). Name `adapter`, `runtime`, or `X-EBX-Adapter`, or set `EBX_AGENTS_DEFAULT`, to use another.
22
+
* Open endpoints one id at a time. `groups.agents: true` is only the gate. Each route's default scope is `agents:use`. See [Fine-grained capabilities](fine-grained-capabilities.md).
21
23
* Leave the group off until a session needs it. Start the process with `EBX_SERVER_ENABLED_GROUPS=agents`.
22
24
* Keep model API keys out of the HTTP client. The server token, when set, is the only credential these examples send.
23
25
@@ -62,8 +64,9 @@ Selection order:
62
64
1.`X-EBX-Adapter` header, or a body field `adapter` / `runtime` (top-level or under `agent`)
63
65
2.`agent.model` or `model` when that string is one of the names above (a real model id such as `gpt-5-codex` is passed through to the CLI and does not choose an adapter)
64
66
3. Config `agents.default`: the `EBX_AGENTS_DEFAULT` environment variable, or in `EBX_AGENTS_CONFIG` a JSON string at `default` or `agents.default`
67
+
4. Otherwise the first runtime in the product order: `codex`, then `qwen-code`
65
68
66
-
If none of those names an adapter, the response is **400**`agents.adapter_required`.
69
+
`GET /v1/agents/runtimes` defaults to `order=desc`. `order=asc` is the product order above. `default: true` marks the runtime step 4 selected. It does not follow the array index. A real model id (`gpt-5`) is passed to that CLI and does not change the adapter. Name the other runtime in the request to use it.
`GET .../items`, `GET .../turns`, `GET .../turns/{turn_id}`, and `GET .../turns/{turn_id}/items` return the list envelope `{object, data, first_id, last_id, has_more}`. `limit` is 1–100 (default 20) and `order` is `asc` or `desc` (default `desc`).
99
102
100
-
`GET /v1/agents/runtimes` lists **codex** and **qwen-code** only, including whether each binary is on `PATH`.
103
+
`GET /v1/agents/runtimes` lists **codex** and **qwen-code** only, including whether each binary is on `PATH`. Each object has `default`. That flag is true for the runtime used when the request does not name one. `order=asc` is `codex`, then `qwen-code`. The default `order` is `desc`.
Copy file name to clipboardExpand all lines: docs/en/guide/template-server-api.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -569,7 +569,7 @@ All of these need Playwright. If `import playwright` fails the handler returns `
569
569
570
570
### `agents` (off until enabled)
571
571
572
-
Turn the group on with `EBX_SERVER_ENABLED_GROUPS=agents` (or `default_table().enable_group(CapabilityGroup.AGENTS)` before `serve()`). This slice hosts the Codex CLI (`codex`) and Qwen Code (`qwen-code`, also `qwen` and `qwencode`). Any other adapter name is `404``not_found_error` with `x-should-retry: false`. If the body and `agents.default` (`EBX_AGENTS_DEFAULT`) name neither adapter, create calls are `400``agents.adapter_required`.
572
+
Turn the group on with `EBX_SERVER_ENABLED_GROUPS=agents` (or `default_table().enable_group(CapabilityGroup.AGENTS)` before `serve()`). Codex CLI (`codex`) and Qwen Code (`qwen-code`, also `qwen` and `qwencode`) are supported today. An adapter name that is not supported yet is `404``not_found_error` with `x-should-retry: false`. When the body and `agents.default` (`EBX_AGENTS_DEFAULT`) do not name an adapter, create calls use the first in the product order: `codex`. Each Agents route can be enabled on its own. Endpoint ids are in [Fine-grained capabilities](fine-grained-capabilities.md). The default scope is `agents:use`.
573
573
574
574
Every route here is a local operation. Every response carries `X-Easy-Sandbox-Local: 1` and every object an `x_easy_sandbox` label (`local`, `compute`, `differences`). A field the server cannot honor is `400` with `param`, never accepted and ignored. Objects belong to the caller; a foreign id answers like an unknown id.
575
575
@@ -597,7 +597,7 @@ Every route here is a local operation. Every response carries `X-Easy-Sandbox-Lo
597
597
598
598
No local capability, `404``not_found_error` (`agents.not_implemented_locally`, `x-should-retry: false`): `POST /v1/responses/input_tokens`, `DELETE /v1/models/{id}`, and executor registration and channel.
599
599
600
-
The CLIs are not installed until a session uses them. See [Hosted agents](hosted-agents.md) for every refusal, environment variable and difference code. Best practices (Codex and Qwen only, the local header, 404 for Claude, Cursor, and Qoder, and 404 for `input_tokens`) are in [Hosted agents — Best practices](hosted-agents.md#best-practices).
600
+
The CLIs are not installed until a session uses them. See [Hosted agents](hosted-agents.md) for every refusal, environment variable and difference code. Supported adapters, the local header, and the 404s for names that are not supported yet and for `input_tokens` are in [Hosted agents — Best practices](hosted-agents.md#best-practices).
0 commit comments