mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 06:04:43 +00:00
feat: move api cli commands under api subcommand
This commit is contained in:
parent
0ef3b998bb
commit
8a91b8e9aa
22 changed files with 351 additions and 246 deletions
68
docs/cli.mdx
68
docs/cli.mdx
|
|
@ -3,7 +3,7 @@ title: "CLI"
|
|||
description: "CLI reference and server flags."
|
||||
---
|
||||
|
||||
The `sandbox-agent` CLI mirrors the HTTP API so you can script everything without writing client code.
|
||||
The `sandbox-agent api` subcommand mirrors the HTTP API so you can script everything without writing client code.
|
||||
|
||||
## Server flags
|
||||
|
||||
|
|
@ -17,39 +17,57 @@ sandbox-agent server --token "$SANDBOX_TOKEN" --host 127.0.0.1 --port 2468
|
|||
- `--cors-allow-origin`, `--cors-allow-method`, `--cors-allow-header`, `--cors-allow-credentials`: configure CORS.
|
||||
- `--no-telemetry`: disable anonymous telemetry.
|
||||
|
||||
## Agent commands
|
||||
## Install agent (no server required)
|
||||
|
||||
<details>
|
||||
<summary><strong>agents list</strong></summary>
|
||||
<summary><strong>install-agent</strong></summary>
|
||||
|
||||
```bash
|
||||
sandbox-agent agents list --endpoint http://127.0.0.1:2468
|
||||
sandbox-agent install-agent claude --reinstall
|
||||
```
|
||||
</details>
|
||||
|
||||
## API agent commands
|
||||
|
||||
<details>
|
||||
<summary><strong>api agents list</strong></summary>
|
||||
|
||||
```bash
|
||||
sandbox-agent api agents list --endpoint http://127.0.0.1:2468
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>agents install</strong></summary>
|
||||
<summary><strong>api agents install</strong></summary>
|
||||
|
||||
```bash
|
||||
sandbox-agent agents install claude --reinstall --endpoint http://127.0.0.1:2468
|
||||
sandbox-agent api agents install claude --reinstall --endpoint http://127.0.0.1:2468
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>agents modes</strong></summary>
|
||||
<summary><strong>api agents modes</strong></summary>
|
||||
|
||||
```bash
|
||||
sandbox-agent agents modes claude --endpoint http://127.0.0.1:2468
|
||||
sandbox-agent api agents modes claude --endpoint http://127.0.0.1:2468
|
||||
```
|
||||
</details>
|
||||
|
||||
## Session commands
|
||||
## API session commands
|
||||
|
||||
<details>
|
||||
<summary><strong>sessions create</strong></summary>
|
||||
<summary><strong>api sessions list</strong></summary>
|
||||
|
||||
```bash
|
||||
sandbox-agent sessions create my-session \
|
||||
sandbox-agent api sessions list --endpoint http://127.0.0.1:2468
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>api sessions create</strong></summary>
|
||||
|
||||
```bash
|
||||
sandbox-agent api sessions create my-session \
|
||||
--agent claude \
|
||||
--agent-mode build \
|
||||
--permission-mode default \
|
||||
|
|
@ -58,64 +76,64 @@ sandbox-agent sessions create my-session \
|
|||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>sessions send-message</strong></summary>
|
||||
<summary><strong>api sessions send-message</strong></summary>
|
||||
|
||||
```bash
|
||||
sandbox-agent sessions send-message my-session \
|
||||
sandbox-agent api sessions send-message my-session \
|
||||
--message "Summarize the repository" \
|
||||
--endpoint http://127.0.0.1:2468
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>sessions send-message-stream</strong></summary>
|
||||
<summary><strong>api sessions send-message-stream</strong></summary>
|
||||
|
||||
```bash
|
||||
sandbox-agent sessions send-message-stream my-session \
|
||||
sandbox-agent api sessions send-message-stream my-session \
|
||||
--message "Summarize the repository" \
|
||||
--endpoint http://127.0.0.1:2468
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>sessions events</strong></summary>
|
||||
<summary><strong>api sessions events</strong></summary>
|
||||
|
||||
```bash
|
||||
sandbox-agent sessions events my-session --offset 0 --limit 50 --endpoint http://127.0.0.1:2468
|
||||
sandbox-agent api sessions events my-session --offset 0 --limit 50 --endpoint http://127.0.0.1:2468
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>sessions events-sse</strong></summary>
|
||||
<summary><strong>api sessions events-sse</strong></summary>
|
||||
|
||||
```bash
|
||||
sandbox-agent sessions events-sse my-session --offset 0 --endpoint http://127.0.0.1:2468
|
||||
sandbox-agent api sessions events-sse my-session --offset 0 --endpoint http://127.0.0.1:2468
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>sessions reply-question</strong></summary>
|
||||
<summary><strong>api sessions reply-question</strong></summary>
|
||||
|
||||
```bash
|
||||
sandbox-agent sessions reply-question my-session QUESTION_ID \
|
||||
sandbox-agent api sessions reply-question my-session QUESTION_ID \
|
||||
--answers "yes" \
|
||||
--endpoint http://127.0.0.1:2468
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>sessions reject-question</strong></summary>
|
||||
<summary><strong>api sessions reject-question</strong></summary>
|
||||
|
||||
```bash
|
||||
sandbox-agent sessions reject-question my-session QUESTION_ID --endpoint http://127.0.0.1:2468
|
||||
sandbox-agent api sessions reject-question my-session QUESTION_ID --endpoint http://127.0.0.1:2468
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>sessions reply-permission</strong></summary>
|
||||
<summary><strong>api sessions reply-permission</strong></summary>
|
||||
|
||||
```bash
|
||||
sandbox-agent sessions reply-permission my-session PERMISSION_ID \
|
||||
sandbox-agent api sessions reply-permission my-session PERMISSION_ID \
|
||||
--reply once \
|
||||
--endpoint http://127.0.0.1:2468
|
||||
```
|
||||
|
|
|
|||
|
|
@ -38,7 +38,18 @@ sandbox-agent server \
|
|||
--cors-allow-credentials
|
||||
```
|
||||
|
||||
## 2. Create a session
|
||||
## 2. Install agents (optional)
|
||||
|
||||
Agents install lazily on first use. To preinstall everything up front:
|
||||
|
||||
```bash
|
||||
sandbox-agent install-agent claude
|
||||
sandbox-agent install-agent codex
|
||||
sandbox-agent install-agent opencode
|
||||
sandbox-agent install-agent amp
|
||||
```
|
||||
|
||||
## 3. Create a session
|
||||
|
||||
```bash
|
||||
curl -X POST "http://127.0.0.1:2468/v1/sessions/my-session" \
|
||||
|
|
@ -47,7 +58,7 @@ curl -X POST "http://127.0.0.1:2468/v1/sessions/my-session" \
|
|||
-d '{"agent":"claude","agentMode":"build","permissionMode":"default"}'
|
||||
```
|
||||
|
||||
## 3. Send a message
|
||||
## 4. Send a message
|
||||
|
||||
```bash
|
||||
curl -X POST "http://127.0.0.1:2468/v1/sessions/my-session/messages" \
|
||||
|
|
@ -56,7 +67,7 @@ curl -X POST "http://127.0.0.1:2468/v1/sessions/my-session/messages" \
|
|||
-d '{"message":"Summarize the repository and suggest next steps."}'
|
||||
```
|
||||
|
||||
## 4. Read events
|
||||
## 5. Read events
|
||||
|
||||
```bash
|
||||
curl "http://127.0.0.1:2468/v1/sessions/my-session/events?offset=0&limit=50" \
|
||||
|
|
@ -79,14 +90,14 @@ curl -N -X POST "http://127.0.0.1:2468/v1/sessions/my-session/messages/stream" \
|
|||
-d '{"message":"Hello"}'
|
||||
```
|
||||
|
||||
## 5. CLI shortcuts
|
||||
## 6. CLI shortcuts
|
||||
|
||||
The CLI mirrors the HTTP API:
|
||||
The `sandbox-agent api` subcommand mirrors the HTTP API:
|
||||
|
||||
```bash
|
||||
sandbox-agent sessions create my-session --agent claude --endpoint http://127.0.0.1:2468 --token "$SANDBOX_TOKEN"
|
||||
sandbox-agent api sessions create my-session --agent claude --endpoint http://127.0.0.1:2468 --token "$SANDBOX_TOKEN"
|
||||
|
||||
sandbox-agent sessions send-message my-session --message "Hello" --endpoint http://127.0.0.1:2468 --token "$SANDBOX_TOKEN"
|
||||
sandbox-agent api sessions send-message my-session --message "Hello" --endpoint http://127.0.0.1:2468 --token "$SANDBOX_TOKEN"
|
||||
|
||||
sandbox-agent sessions send-message-stream my-session --message "Hello" --endpoint http://127.0.0.1:2468 --token "$SANDBOX_TOKEN"
|
||||
sandbox-agent api sessions send-message-stream my-session --message "Hello" --endpoint http://127.0.0.1:2468 --token "$SANDBOX_TOKEN"
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue