@tangle-network/sandbox-cli 0.9.2-develop.20260626160426.615563e → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,7 +30,9 @@ npx @tangle-network/sandbox-cli sandbox list
30
30
  npx tangle-sandbox --help
31
31
  ```
32
32
 
33
- Never run bare `npx tangle` (or `npx tangle-cli`) — those npm names belong to unrelated third-party packages and would execute someone else's code. The official names are `@tangle-network/sandbox-cli` and its forwarding alias `tangle-sandbox`.
33
+ Never run bare `npx tangle` (or `npx tangle-cli`).
34
+ Those npm names belong to unrelated third-party packages and would execute someone else's code.
35
+ The official names are `@tangle-network/sandbox-cli` and its forwarding alias `tangle-sandbox`.
34
36
 
35
37
  Install globally to expose the short `tangle` binary on PATH:
36
38
 
@@ -56,14 +58,13 @@ Three flows are supported:
56
58
 
57
59
  - **Browser login** (default): `tangle auth login` opens a browser to complete OAuth with `github`, `google`, or `microsoft` identity providers.
58
60
  - **Device code**: `tangle auth login --no-browser` for headless environments.
59
- - **API key**: `tangle auth login --api-key sk-tan-...` (or set `TANGLE_API_KEY`; `SANDBOX_API_KEY` accepted as deprecated alias).
61
+ - **API key**: `tangle auth login --api-key sk-tan-...` (or set `TANGLE_API_KEY`).
60
62
 
61
63
  Credential lookup precedence:
62
64
 
63
65
  1. `--api-key` flag
64
- 2. `TANGLE_API_KEY` environment variable (preferred)
65
- 3. `SANDBOX_API_KEY` environment variable (deprecated alias, accepted for backwards compatibility)
66
- 4. `~/.tangle/credentials` (populated by `tangle auth login`)
66
+ 2. `TANGLE_API_KEY` environment variable
67
+ 3. `~/.tangle/credentials` (populated by `tangle auth login`)
67
68
 
68
69
  Common commands:
69
70
 
@@ -86,10 +87,12 @@ Top-level command groups:
86
87
  - `exec`
87
88
  - `ssh`
88
89
  - `agent`
90
+ - `fleet`
89
91
  - `snapshot`
90
92
  - `usage`
91
93
  - `permissions`
92
94
  - `backend`
95
+ - `batch`
93
96
  - `process`
94
97
  - `fs`
95
98
 
@@ -100,7 +103,7 @@ Examples:
100
103
  tangle auth login --api-key sk_...
101
104
 
102
105
  # sandbox lifecycle
103
- tangle sandbox create --name my-box --image node:20 --ssh
106
+ tangle sandbox create --name my-box --environment node:20 --ssh
104
107
  tangle sandbox list
105
108
  tangle sandbox get sbx_123
106
109
  tangle sandbox stop sbx_123
@@ -111,13 +114,23 @@ tangle sandbox delete sbx_123
111
114
  tangle exec sbx_123 "npm test"
112
115
  tangle ssh sbx_123
113
116
  tangle agent prompt sbx_123 "Summarize this repo"
114
- tangle agent task sbx_123 "Fix the failing tests"
117
+ tangle agent prompt sbx_123 "Fix the failing tests"
118
+ tangle fleet create --count 4 --coordinator
115
119
 
116
120
  # grant hub connections to the agent (see hub-reference.md for the 3 modes).
117
121
  # the connection is an id or a provider name (resolved via `tangle hub connections`).
118
- tangle agent task sbx_123 "triage issues" \
119
- --connection github:github.issues.listIssues,github.issues.create
120
- tangle agent task sbx_123 "file the report" --connection github:* --allow-writes
122
+ tangle agent prompt sbx_123 "triage issues" \
123
+ --connection github:github.issues.search,github.issues.create
124
+ tangle agent prompt sbx_123 "file the report" --connection github:* --allow-writes
125
+
126
+ # temporary GPU for an eval; omitted provider picks the cheapest configured cloud
127
+ tangle sandbox gpu run sbx_123 \
128
+ --accelerator-kind nvidia-3090 \
129
+ --accelerator-memory 24000 \
130
+ --max-spend-usd 1 \
131
+ --max-lifetime 900 \
132
+ --idle-timeout 120 \
133
+ -- python eval.py
121
134
 
122
135
  # state and operations
123
136
  tangle secret list
@@ -127,18 +140,90 @@ tangle fs ls sbx_123 /workspace
127
140
  ```
128
141
 
129
142
  Hub commands (`tangle hub …`) and `tangle agent --connection` auto-mint a
130
- short-lived platform Hub key from your `tangle auth login` session no separate
143
+ short-lived platform Hub key from your `tangle auth login` session, with no separate
131
144
  key needed. See [`hub-reference.md`](./hub-reference.md) for the `--connection`
132
145
  grant modes, `--allow-writes`, and `permissions revert-writes`.
133
146
 
147
+ ## Temporary GPUs
148
+
149
+ Keep the base sandbox cheap and attach a GPU only while the accelerated command runs.
150
+ Omit `--provider` to let Tangle choose the cheapest configured GPU cloud.
151
+ Always set a spend cap and lifetime.
152
+
153
+ ```bash
154
+ # Attach, run one command, and destroy the lease.
155
+ tangle sandbox gpu run sbx_123 \
156
+ --accelerator-kind nvidia-3090 \
157
+ --accelerator-memory 24000 \
158
+ --max-spend-usd 1 \
159
+ --max-lifetime 900 \
160
+ --idle-timeout 120 \
161
+ -- python eval.py
162
+ ```
163
+
164
+ For multiple GPU commands, use the manual lifecycle:
165
+
166
+ ```bash
167
+ tangle sandbox gpu attach sbx_123 \
168
+ --accelerator-kind nvidia-3090 \
169
+ --accelerator-memory 24000 \
170
+ --max-spend-usd 1 \
171
+ --max-lifetime 900 \
172
+ --idle-timeout 120
173
+
174
+ tangle sandbox gpu list sbx_123
175
+ tangle sandbox gpu exec sbx_123 gpu_abc -- python eval.py
176
+ tangle sandbox gpu detach sbx_123 gpu_abc
177
+ ```
178
+
179
+ Create-time GPU flags are a shortcut over the same lease lifecycle:
180
+
181
+ ```bash
182
+ tangle sandbox create --name gpu-eval \
183
+ --accelerator-kind nvidia-3090 \
184
+ --accelerator-memory 24000 \
185
+ --gpu-max-spend-usd 1 \
186
+ --gpu-max-lifetime 900 \
187
+ --gpu-idle-timeout 120
188
+ ```
189
+
190
+ The final detach output includes billed seconds and customer cost.
191
+ Use `tangle usage` to inspect account-level GPU seconds and GPU spend.
192
+
193
+ ## Batch Runs
194
+
195
+ Run each task against one explicitly named backend:
196
+
197
+ ```bash
198
+ tangle batch run --tasks tasks.json --backend primary=opencode
199
+ ```
200
+
201
+ `tasks.json` is an array of `{ "id": "...", "message": "..." }` objects or an object with a `tasks` array.
202
+ At least one `--backend <id=type>` is required with `--tasks` or `--task`.
203
+
204
+ Repeat `--backend <id=type>` to run every task against multiple backends:
205
+
206
+ ```bash
207
+ tangle batch run --tasks tasks.json \
208
+ --backend writer=opencode \
209
+ --backend reviewer=claude-code \
210
+ --stream
211
+ ```
212
+
213
+ Backend IDs must be unique and use 1 to 128 letters, numbers, dots, underscores, or hyphens.
214
+ Use `--model provider/model` only when one backend is selected.
215
+ Each result is identified by both `taskId` and `backendId`.
216
+ JSON output reports `totalTasks`, `totalBackends`, `totalExecutions`, `totalSuccess`, `totalFailure`, `totalRetries`, and `successRate`.
217
+
218
+ Use `--request <file.json>` when each backend needs its own model, profile, server, or lifecycle configuration.
219
+ The file uses the same complete request shape as the TypeScript SDK and cannot be combined with inline task or backend flags.
220
+
134
221
  ## Provisioning Coverage
135
222
 
136
- `tangle sandbox create` exposes the full SDK provisioning surface, including image/environment, resources (CPU, memory, disk), lifetime and idle timeout, driver and backend selection (`opencode`, `claude-code`, `codex`, `cursor`, `amp`, and other registry backends), SSH and web terminal, env and secret injection, metadata, initial permissions, git clone, tool pre-install, BYOS3 storage, snapshot restore, and outbound network controls. Run `tangle sandbox create --help` for the canonical flag list.
223
+ `tangle sandbox create` supports environments or container images, resources, temporary GPU leases, lifecycle limits, driver and backend selection, SSH and web terminal, environment variables, secrets, metadata, git clone, BYOS3 storage, and snapshot restore.
224
+ Use the `tools`, `permissions`, `network`, and `expose` commands after creation.
225
+ Run `tangle sandbox create --help` for the current flag list.
137
226
 
138
227
  ## Limitations
139
228
 
140
229
  - `snapshot restore` creates a new sandbox from a snapshot; the command signature suggests in-place restore.
141
-
142
- ## Design Follow-Up
143
-
144
- For the architecture review, parity checklist, and auth flow spec, see [CHECKLIST.md](./CHECKLIST.md).
package/SKILL.md CHANGED
@@ -1,13 +1,14 @@
1
1
  ---
2
2
  name: tangle-cli
3
- description: Use when interacting with Tangle sandboxes, executing hub tools, managing agent tasks, operating on sandbox filesystems, building workflows, connecting to external providers, or setting up integrations and automations from a terminal. Triggers include tangle, tangle sandbox, tangle hub, tangle agent, tangle exec, tangle fs, tangle snapshot, tangle secret, tangle workflows, tangle hub connect, github, slack, google, microsoft, external connections, provider integrations, hub tools, or any tangle command.
3
+ description: Use Tangle Sandbox CLI for lifecycle, prompts, files, fleets, Hub tools, and integrations.
4
4
  ---
5
5
 
6
6
  # Tangle CLI
7
7
 
8
8
  ## Overview
9
9
 
10
- `tangle` is the CLI for Tangle Sandbox operations create sandboxes, run agents, execute hub tools, manage files, secrets, snapshots, git, and more. All commands support `--help` for inline reference.
10
+ `tangle` is the CLI for Tangle Sandbox operations: create sandboxes, run agents, execute hub tools, and manage files, secrets, snapshots, and git.
11
+ All commands support `--help` for inline reference.
11
12
 
12
13
  ## Auth
13
14
 
@@ -16,7 +17,7 @@ Generic command auth modes, resolved in order:
16
17
  | Priority | Source | Set via |
17
18
  |----------|--------|--------|
18
19
  | 1 | CLI flag | `--api-key <key>` |
19
- | 2 | Env var | `TANGLE_API_KEY` or `SANDBOX_API_KEY` |
20
+ | 2 | Env var | `TANGLE_API_KEY` |
20
21
  | 3 | Profile store | `tangle auth login` (keychain or file) |
21
22
 
22
23
  Hub commands resolve auth in this order:
@@ -25,10 +26,11 @@ Hub commands resolve auth in this order:
25
26
  |----------|--------|--------|
26
27
  | 1 | CLI flag | `--api-key <key>` |
27
28
  | 2 | Hub capability | `TANGLE_HUB_CAPABILITY_TOKEN` |
28
- | 3 | Env var | `TANGLE_API_KEY` or `SANDBOX_API_KEY` |
29
+ | 3 | Env var | `TANGLE_API_KEY` |
29
30
  | 4 | Profile store | `tangle auth login` (keychain or file) |
30
31
 
31
- **Inside a sandbox:** `tangle` is automatically authenticated. No extra auth needed — commands work out of the box.
32
+ **Inside a sandbox:** `tangle` is automatically authenticated.
33
+ No extra authentication is needed.
32
34
 
33
35
  ```bash
34
36
  # Browser login (preferred)
@@ -48,7 +50,7 @@ tangle auth login --profile work
48
50
  tangle auth profiles use work
49
51
  ```
50
52
 
51
- For hub env auth, set **exactly one** of `TANGLE_API_KEY`/`SANDBOX_API_KEY` or `TANGLE_HUB_CAPABILITY_TOKEN`.
53
+ For hub env auth, set **exactly one** of `TANGLE_API_KEY` or `TANGLE_HUB_CAPABILITY_TOKEN`.
52
54
 
53
55
  ## Sandbox Lifecycle
54
56
 
@@ -67,7 +69,45 @@ tangle sandbox expose <id> --port 3000
67
69
  tangle sandbox urls <id>
68
70
  ```
69
71
 
70
- ## Hub — Full Workflow
72
+ ## Temporary GPUs
73
+
74
+ Use a normal sandbox first, then attach a GPU only for the work that needs it.
75
+ Omit `--provider` to use the cheapest configured GPU cloud.
76
+ Always set a spend cap and lifetime.
77
+
78
+ ```bash
79
+ # One-shot eval: attach GPU, run command, always destroy the lease.
80
+ tangle sandbox gpu run <sandbox-id> \
81
+ --accelerator-kind nvidia-3090 \
82
+ --accelerator-memory 24000 \
83
+ --max-spend-usd 1 \
84
+ --max-lifetime 900 \
85
+ --idle-timeout 120 \
86
+ -- python eval.py
87
+
88
+ # Manual lifecycle when the agent needs multiple GPU commands.
89
+ tangle sandbox gpu attach <sandbox-id> \
90
+ --accelerator-kind nvidia-3090 \
91
+ --accelerator-memory 24000 \
92
+ --max-spend-usd 1 \
93
+ --max-lifetime 900 \
94
+ --idle-timeout 120
95
+ tangle sandbox gpu exec <sandbox-id> <gpu-lease-id> -- python eval.py
96
+ tangle sandbox gpu detach <sandbox-id> <gpu-lease-id>
97
+ ```
98
+
99
+ For fleets, put the same GPU lease cap on every worker:
100
+
101
+ ```bash
102
+ tangle fleet create --count 4 \
103
+ --accelerator-kind nvidia-3090 \
104
+ --accelerator-memory 24000 \
105
+ --gpu-max-spend-usd 1 \
106
+ --gpu-max-lifetime 900 \
107
+ --gpu-idle-timeout 120
108
+ ```
109
+
110
+ ## Full Hub Workflow
71
111
 
72
112
  Hub lets agents use connected provider tools (GitHub, etc.) through Tangle without seeing provider OAuth tokens.
73
113
 
@@ -98,17 +138,17 @@ tangle hub tools sources --json
98
138
  tangle hub tools search "github issues" --provider github --json
99
139
 
100
140
  # Describe a tool to see input/output schemas
101
- tangle hub tools describe github.issues.listIssues --json
141
+ tangle hub tools describe github.issues.search --json
102
142
  ```
103
143
 
104
144
  ### Tool Execution
105
145
 
106
- Two equivalent commands `call` and `exec`:
146
+ Two equivalent commands are available: `call` and `exec`.
107
147
 
108
148
  ```bash
109
149
  # Basic call: <path tokens...> <json-input>
110
- tangle hub call github issues listIssues '{"owner":"tangle-network","repo":"agent-dev-container"}'
111
- tangle hub exec github.issues.listIssues '{"owner":"tangle-network","repo":"agent-dev-container"}'
150
+ tangle hub call github issues search '{"q":"repo:tangle-network/agent-dev-container is:issue"}'
151
+ tangle hub exec github.issues.search '{"q":"repo:tangle-network/agent-dev-container is:issue"}'
112
152
 
113
153
  # With explicit connection
114
154
  tangle hub call github issues createIssue '{"owner":"foo","repo":"bar","title":"Fix bug"}' --connection conn_xxx
@@ -116,7 +156,8 @@ tangle hub call github issues createIssue '{"owner":"foo","repo":"bar","title":"
116
156
 
117
157
  ### Policy & Approvals
118
158
 
119
- Tools default to `ask` policy — they pause and require approval on first use.
159
+ Tools default to the `ask` policy.
160
+ They pause and require approval on first use.
120
161
 
121
162
  ```bash
122
163
  # List pending approvals
@@ -125,7 +166,7 @@ tangle hub approvals approve <approval-id>
125
166
  tangle hub approvals deny <approval-id>
126
167
 
127
168
  # Set policy to always allow (skip future approvals)
128
- tangle hub permissions set --connection conn_xxx --action github.issues.listIssues --decision allow
169
+ tangle hub permissions set --connection conn_xxx --action github.issues.search --decision allow
129
170
 
130
171
  # Set policy to always deny (block tool)
131
172
  tangle hub permissions set --connection conn_xxx --action github.issues.deleteIssue --decision deny
@@ -172,20 +213,14 @@ tangle secret update DATABASE_URL "new-value"
172
213
  tangle secret delete DATABASE_URL
173
214
  ```
174
215
 
175
- ## Snapshots & Checkpoints
216
+ ## Snapshots
176
217
 
177
218
  ```bash
178
- # Snapshots (point-in-time for cloning/restoring)
179
219
  tangle snapshot create <sandbox-id>
180
220
  tangle snapshot list <sandbox-id>
181
221
  tangle snapshot restore <sandbox-id> <snapshot-id> # creates new sandbox
182
222
  tangle snapshot revert <sandbox-id> <snapshot-id> # reverts in-place
183
223
  tangle snapshot delete <sandbox-id> <snapshot-id>
184
-
185
- # Checkpoints (lightweight, local)
186
- tangle checkpoint create <id>
187
- tangle checkpoint list|ls <id>
188
- tangle checkpoint delete|rm <id> <checkpoint-id>
189
224
  ```
190
225
 
191
226
  ## Templates
@@ -221,14 +256,65 @@ tangle team invitations [team] # List pending/historical invitations
221
256
 
222
257
  ## Workflows
223
258
 
259
+ Authenticate with the `sk-tan-*` API key (`TANGLE_API_KEY`), same as the other
260
+ platform commands, not a hub capability token. These commands address the
261
+ platform control plane, not the sandbox API. The host resolves from
262
+ `--base-url`, then `TANGLE_HUB_URL` (which a spawned sandbox injects to name
263
+ its own hub, so it wins over an ambient value), then `TANGLE_PLATFORM_URL`,
264
+ then `https://id.tangle.tools`. On `workflows`,
265
+ `--base-url` names the PLATFORM host — unlike `tangle keys`, where `--base-url`
266
+ is the sandbox API and `--platform-url` is the platform.
267
+
268
+ Authoring a workflow (graph topology, guards, joins, KV state, decisions):
269
+ https://sandbox.tangle.tools/docs/workflows
270
+
224
271
  ```bash
225
272
  tangle workflows validate workflow.yml
226
273
  tangle workflows schema # print JSON Schema
227
274
  tangle workflows create workflow.yml
275
+ tangle workflows apply workflow.yml # create or update, matched by the definition's name
228
276
  tangle workflows list
277
+ tangle workflows fleet # run tallies over a trailing window, failing first
229
278
  tangle workflows get <id>
230
279
  tangle workflows update <id> workflow.yml
280
+ tangle workflows enable <id>
281
+ tangle workflows disable <id>
231
282
  tangle workflows delete <id>
283
+
284
+ # Templates
285
+ tangle workflows templates # starter gallery
286
+ tangle workflows init <template-id> # instantiate, print YAML
287
+ tangle workflows init <template-id> --param repo=o/r --file workflow.yml
288
+
289
+ # Revisions
290
+ tangle workflows revisions <id> # definition history
291
+ tangle workflows revision <id> <rev> # one revision's YAML
292
+ tangle workflows rollback <id> <rev> # restore a rev as the new head
293
+
294
+ # Runs
295
+ tangle workflows run <id> # trigger a run
296
+ tangle workflows run <id> --input pull_request.number=123 # with trigger inputs
297
+ tangle workflows run <id> --wait # wait + print result
298
+ tangle workflows runs <id> # run history
299
+ tangle workflows run-detail <id> <runId> # single-run detail
300
+ tangle workflows events <id> <runId> # tail live progress
301
+ tangle workflows cancel <id> <runId> # cancel a queued/running run
302
+ tangle workflows retry <id> <runId> # re-run a failed run with the same trigger context
303
+
304
+ # Cross-run KV state
305
+ tangle workflows kv list <id>
306
+ tangle workflows kv get <id> <key>
307
+ tangle workflows kv set <id> <key> '{"cursor":123}'
308
+ tangle workflows kv set <id> <key> '{"cursor":123}' --cas 4 # compare-and-swap
309
+ tangle workflows kv delete <id> <key>
310
+
311
+ # Run artifacts
312
+ tangle workflows artifacts <id> <runId>
313
+ tangle workflows artifact-download <id> <runId> <artifactId> --out report.json
314
+
315
+ # Human decisions
316
+ tangle workflows decisions <id> # pending approvals
317
+ tangle workflows decision-resolve <id> <runId> --choice deploy
232
318
  ```
233
319
 
234
320
  ## Other Commands
@@ -257,6 +343,7 @@ tangle tools install <id> python 3.12
257
343
 
258
344
  # Batch tasks across sandboxes
259
345
  tangle batch run --tasks tasks.json
346
+ tangle batch run --tasks tasks.json --backend writer=opencode --backend reviewer=claude-code --stream
260
347
 
261
348
  # Intelligence reports
262
349
  tangle intelligence sandbox <id>
@@ -286,22 +373,23 @@ tangle permissions add <sandboxId> --userId <userId> --role editor
286
373
 
287
374
  | Goal | Commands |
288
375
  |------|----------|
289
- | Spin up sandbox, run agent | `tangle sandbox create --name X` → `tangle agent task <id> "..."` |
290
- | Connect GitHub, read issues | `tangle hub connect github` → `tangle hub tools search "issues" --provider github` → `tangle hub call github issues listIssues '{"owner":"X","repo":"Y"}'` |
376
+ | Spin up sandbox, run agent | `tangle sandbox create --name X` → `tangle agent prompt <id> "..."` |
377
+ | Connect GitHub, read issues | `tangle hub connect github` → `tangle hub tools search "issues" --provider github` → `tangle hub call github issues search '{"q":"repo:X/Y is:issue"}'` |
291
378
  | Push code from sandbox to GitHub | `tangle hub connect github` → `tangle git add <id> files` → `tangle git commit <id> -m "msg"` → `tangle git push <id>` |
292
379
  | Save and restore state | `tangle snapshot create <id>` → ...work... → `tangle snapshot revert <id> <snap-id>` |
293
380
  | Set secret for agent use | `tangle secret create GITHUB_TOKEN "..."` → agent reads via `process.env.GITHUB_TOKEN` |
294
381
  | Set hub permissions | `tangle hub permissions set --connection conn_xxx --action github.issues.createIssue --decision allow` |
295
- | Batch parallel agent tasks | `tangle batch run --tasks tasks.json` (array of `{sandboxId, message}`) |
382
+ | Batch parallel agent prompts | `tangle batch run --tasks tasks.json --backend primary=opencode` (array of `{id, message}`) |
383
+ | Compare backends on the same tasks | `tangle batch run --tasks tasks.json --backend writer=opencode --backend reviewer=claude-code --stream` |
296
384
 
297
385
  ## Common Mistakes
298
386
 
299
- - **Forgetting `--reveal` on `secret show`** values are hidden by default for safety.
300
- - **Using API-key env and `TANGLE_HUB_CAPABILITY_TOKEN` together for hub** set exactly one env auth source, or use `--api-key` to override both.
301
- - **Calling hub tools without `--approve` on first use** use `--approve` or set policy to `allow` first.
302
- - **Missing `--json` flag when piping output** many commands need explicit `--json` for machine-readable output.
303
- - **`tangle hub exec` vs `tangle exec`** `hub exec` runs hub tools; `exec` runs shell commands in a sandbox.
304
- - **`hub resume` doesn't replay** after `hub resume --accept`, rerun original `hub exec` with `--approve`.
387
+ - **Forgetting `--reveal` on `secret show`:** values are hidden by default for safety.
388
+ - **Using API-key env and `TANGLE_HUB_CAPABILITY_TOKEN` together for hub:** set exactly one env auth source, or use `--api-key` to override both.
389
+ - **Calling hub tools without `--approve` on first use:** use `--approve` or set policy to `allow` first.
390
+ - **Missing `--json` when piping output:** many commands need explicit `--json` for machine-readable output.
391
+ - **`tangle hub exec` vs `tangle exec`:** `hub exec` runs hub tools; `exec` runs shell commands in a sandbox.
392
+ - **`hub resume` does not replay:** after `hub resume --accept`, rerun the original `hub exec` with `--approve`.
305
393
 
306
394
  ## Token Safety
307
395