Skip to content

Commit 050ee6a

Browse files
committed
docs: simplify quickstart examples with --no-token default
1 parent a25991b commit 050ee6a

File tree

1 file changed

+49
-24
lines changed

1 file changed

+49
-24
lines changed

docs/quickstart.mdx

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ icon: "rocket"
7676

7777
```bash
7878
curl -fsSL https://releases.rivet.dev/sandbox-agent/latest/install.sh | sh
79-
sandbox-agent server --token "$SANDBOX_TOKEN" --host 127.0.0.1 --port 2468
79+
sandbox-agent server --no-token --host 0.0.0.0 --port 2468
8080
```
8181
</Tab>
8282

8383
<Tab title="npx">
8484
Run without installing globally.
8585

8686
```bash
87-
npx sandbox-agent server --token "$SANDBOX_TOKEN" --host 127.0.0.1 --port 2468
87+
npx @sandbox-agent/cli server --no-token --host 0.0.0.0 --port 2468
8888
```
8989
</Tab>
9090

@@ -93,15 +93,15 @@ icon: "rocket"
9393

9494
```bash
9595
npm install -g @sandbox-agent/cli
96-
sandbox-agent server --token "$SANDBOX_TOKEN" --host 127.0.0.1 --port 2468
96+
sandbox-agent server --no-token --host 0.0.0.0 --port 2468
9797
```
9898
</Tab>
9999

100100
<Tab title="Build from source">
101101
If you're running from source instead of the installed CLI.
102102

103103
```bash
104-
cargo run -p sandbox-agent -- server --token "$SANDBOX_TOKEN" --host 127.0.0.1 --port 2468
104+
cargo run -p sandbox-agent -- server --no-token --host 0.0.0.0 --port 2468
105105
```
106106
</Tab>
107107

@@ -118,9 +118,45 @@ icon: "rocket"
118118
</Tab>
119119
</Tabs>
120120

121+
Binding to `0.0.0.0` allows the server to accept connections from any network interface, which is required when running inside a sandbox where clients connect remotely.
122+
121123
<AccordionGroup>
122-
<Accordion title="Running without tokens">
123-
If endpoint is not public, use `--no-token` to disable authentication. Most sandbox providers already secure their networking, so tokens are not required.
124+
<Accordion title="Configuring token">
125+
Tokens are usually not required. Most sandbox providers (E2B, Daytona, etc.) already secure their networking at the infrastructure level, so the server endpoint is never publicly accessible. For local development, binding to `127.0.0.1` ensures only local connections are accepted.
126+
127+
If you need to expose the server on a public endpoint, use `--token "$SANDBOX_TOKEN"` to require authentication on all requests:
128+
129+
```bash
130+
sandbox-agent server --token "$SANDBOX_TOKEN" --host 0.0.0.0 --port 2468
131+
```
132+
133+
Then pass the token when connecting:
134+
135+
<Tabs>
136+
<Tab title="TypeScript">
137+
```typescript
138+
const client = await SandboxAgent.connect({
139+
baseUrl: "http://your-server:2468",
140+
token: process.env.SANDBOX_TOKEN,
141+
});
142+
```
143+
</Tab>
144+
145+
<Tab title="curl">
146+
```bash
147+
curl "http://your-server:2468/v1/sessions" \
148+
-H "Authorization: Bearer $SANDBOX_TOKEN"
149+
```
150+
</Tab>
151+
152+
<Tab title="CLI">
153+
```bash
154+
sandbox-agent api sessions list \
155+
--endpoint http://your-server:2468 \
156+
--token "$SANDBOX_TOKEN"
157+
```
158+
</Tab>
159+
</Tabs>
124160
</Accordion>
125161
<Accordion title="CORS">
126162
If you're calling the server from a browser, see the [CORS configuration guide](/docs/cors).
@@ -149,7 +185,6 @@ icon: "rocket"
149185

150186
const client = await SandboxAgent.connect({
151187
baseUrl: "http://127.0.0.1:2468",
152-
token: process.env.SANDBOX_TOKEN,
153188
});
154189

155190
await client.createSession("my-session", {
@@ -163,7 +198,6 @@ icon: "rocket"
163198
<Tab title="curl">
164199
```bash
165200
curl -X POST "http://127.0.0.1:2468/v1/sessions/my-session" \
166-
-H "Authorization: Bearer $SANDBOX_TOKEN" \
167201
-H "Content-Type: application/json" \
168202
-d '{"agent":"claude","agentMode":"build","permissionMode":"default"}'
169203
```
@@ -173,8 +207,7 @@ icon: "rocket"
173207
```bash
174208
sandbox-agent api sessions create my-session \
175209
--agent claude \
176-
--endpoint http://127.0.0.1:2468 \
177-
--token "$SANDBOX_TOKEN"
210+
--endpoint http://127.0.0.1:2468
178211
```
179212
</Tab>
180213
</Tabs>
@@ -193,7 +226,6 @@ icon: "rocket"
193226
<Tab title="curl">
194227
```bash
195228
curl -X POST "http://127.0.0.1:2468/v1/sessions/my-session/messages" \
196-
-H "Authorization: Bearer $SANDBOX_TOKEN" \
197229
-H "Content-Type: application/json" \
198230
-d '{"message":"Summarize the repository and suggest next steps."}'
199231
```
@@ -203,8 +235,7 @@ icon: "rocket"
203235
```bash
204236
sandbox-agent api sessions send-message my-session \
205237
--message "Summarize the repository and suggest next steps." \
206-
--endpoint http://127.0.0.1:2468 \
207-
--token "$SANDBOX_TOKEN"
238+
--endpoint http://127.0.0.1:2468
208239
```
209240
</Tab>
210241
</Tabs>
@@ -227,16 +258,13 @@ icon: "rocket"
227258
<Tab title="curl">
228259
```bash
229260
# Poll for events
230-
curl "http://127.0.0.1:2468/v1/sessions/my-session/events?offset=0&limit=50" \
231-
-H "Authorization: Bearer $SANDBOX_TOKEN"
261+
curl "http://127.0.0.1:2468/v1/sessions/my-session/events?offset=0&limit=50"
232262

233263
# Stream events via SSE
234-
curl "http://127.0.0.1:2468/v1/sessions/my-session/events/sse?offset=0" \
235-
-H "Authorization: Bearer $SANDBOX_TOKEN"
264+
curl "http://127.0.0.1:2468/v1/sessions/my-session/events/sse?offset=0"
236265

237266
# Single-turn stream (post message and get streamed response)
238267
curl -N -X POST "http://127.0.0.1:2468/v1/sessions/my-session/messages/stream" \
239-
-H "Authorization: Bearer $SANDBOX_TOKEN" \
240268
-H "Content-Type: application/json" \
241269
-d '{"message":"Hello"}'
242270
```
@@ -246,19 +274,16 @@ icon: "rocket"
246274
```bash
247275
# Poll for events
248276
sandbox-agent api sessions events my-session \
249-
--endpoint http://127.0.0.1:2468 \
250-
--token "$SANDBOX_TOKEN"
277+
--endpoint http://127.0.0.1:2468
251278

252279
# Stream events via SSE
253280
sandbox-agent api sessions events-sse my-session \
254-
--endpoint http://127.0.0.1:2468 \
255-
--token "$SANDBOX_TOKEN"
281+
--endpoint http://127.0.0.1:2468
256282

257283
# Single-turn stream
258284
sandbox-agent api sessions send-message-stream my-session \
259285
--message "Hello" \
260-
--endpoint http://127.0.0.1:2468 \
261-
--token "$SANDBOX_TOKEN"
286+
--endpoint http://127.0.0.1:2468
262287
```
263288
</Tab>
264289
</Tabs>

0 commit comments

Comments
 (0)