
Install the component
convex/convex.config.ts and bind the key into it:
convex/convex.config.ts
Every boxd API key is fenced to one organization. Machines are created in that org and billed to it. In a brand-new Convex project, run
npx convex dev once before setting the key, so there is a deployment to set it on.Run machines from your functions
Calls that reach boxd run in actions, and reads run in queries:convex/machines.ts
create and fork wait until the new machine accepts a command, and both return in under a second. A machine on standby or hibernated wakes by itself when it gets a command or an HTTPS request, so exec works without a resume first.
What the component can do
Errors arrive as a
ConvexError with a stable code such as NOT_FOUND, CONFLICT, or RATE_LIMITED. Branch on the code with isBoxdError.
Scope machines to your users
Pass anownerId on every call. A machine created with an ownerId is reachable only with that same ownerId. For any other owner, reads return null or an empty list, and actions fail with NOT_FOUND, the same as for a machine that does not exist. A fork inherits the owner of its source machine.
For code you did not write, create the machine with isolated: true. Isolation removes the in-machine boxd CLI, the metadata endpoint, integrations, and agent logins, and keeps the machine out of the org’s default network. The machine keeps outbound internet unless you set an egress allowlist.
Limits
Convex stops an action after 10 minutes.exec kills its command after timeoutMs, which defaults to 9 minutes and goes up to 9.5. For longer work, start the command in the background with nohup ... & and check on it with later exec calls.
exec returns up to 2 million characters per stream, and the execution row keeps the first 64,000.
boxd can change a machine without a call through the component, for example when auto-suspend kicks in. Call refresh to bring that change into the row, for instance on a timer while a machine is on screen.
The component ships as @boxd-sh/convex and is open source under the MIT license. The README covers the full API, the error codes, and testing with convex-test.