Commands and files ›
Start command
POST
/v1/sandboxes/{id}/commandsStart a command without waiting.
RequestTypeScript
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
- const command = await sandbox.commands.start(["npm", "run", "build"]);
Answer201 Created · StartedCommand
- {
- "id": string,
- "pid": integer | null,
- "status": string,
- }
Detached command.
Path
idrequiredstring | e.g. "sbx_0123456789abcdef" |
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Body
commandrequiredarray of string | Argv. The control plane does not invoke a shell. It runs as root, with the variables of the sandbox's template and its own in its environment, and AGENTAL_SANDBOX_ID, the sandbox's id, AGENTAL_API_URL, where this API answers, and AGENTAL_SANDBOX_TOKEN, the sandbox's own token for the run it is in, which reads and moves its stop and does nothing else. e.g. ["echo","hello"] |
timeoutMsinteger | Defaults to 60000. On timeout the exit code is 124. Up to 600000 for /commands and /exec/stream, and up to 90000 for POST /v1/sandboxes/{id}/exec, which answers only when its command ends: a proxy in front of the API stops waiting after 100 seconds. |
Returns
201 Detached command. pid is the process id when one is reported, otherwise null.
StartedCommand3 fields
idstring
pidintegernull
statusstring
Errors and other answers
| 404 | Not found. |
| 409 | Sandbox is not running. |
| 503 | sandbox_moved the sandbox was moved to another server while this was being done, and it was cut off. Send it again. |
Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.