
Set up
1
Install the plugin
In Dify, open Plugins, click Install plugin, choose Marketplace and search for
boxd.2
Create an API key
3
Authorize the plugin
On the Plugins page, select boxd, click Authorize and paste the key. Dify checks it by listing your machines once.The other fields are optional: an organization, a region (
nyc or fra), and a prefix for machine names (dify- by default).4
Run a workflow
Download The machine exists for this one call. The plugin deletes it when the code has finished.
quickstart.yml. In Studio, choose Import DSL file, pick the file, and run the workflow with its default input.It has three nodes: Start, the boxd Run Code tool, and End. Your Python runs on a new machine, and the workflow returns its stdout and exit_code:Call it from your code
Click Publish on the workflow, create an API key under API Access, and post to Dify’s workflow API.DIFY_API_URL is https://api.dify.ai/v1 on Dify Cloud and http://<your-host>/v1 on a self-hosted Dify.
"outputs": {"stdout": "42\n", "exit_code": 0}.
One call, or a machine you keep
Run Command and Run Code work without amachine_id. The plugin then creates a machine, runs the code, and deletes the machine.
To keep state, call Create Machine first and pass its machine_id to the other tools. Files, installed packages and running services stay on the machine between calls and between runs of your workflow. A tool that works inside a machine starts or wakes it first, so a workflow can come back to a machine that has hibernated.
Tools
machine_id, stdout, stderr, exit_code, service_id and url are workflow variables, so a later node can use them directly.
What each machine gets
- Isolation: every machine the plugin creates or forks is isolated. It has no boxd credentials and no route to your organization’s other machines. The API key stays in Dify.
- A label: every machine carries
created-by=dify. Delete Machine only deletes machines with that label. - A deadline, if you set one: with Delete after on Create Machine or Fork Machine, boxd deletes the machine after that many seconds, also when the workflow stops halfway. A machine made for a single call always gets one hour.
- A timeout per command: 1 to 600 seconds, 120 by default. A command that runs out is stopped inside the machine, and the result has
timed_outset. Use Start Service for anything that does not exit. - Public preview URLs: anyone with a URL from Get Preview URL can reach the service behind it. A new URL can take up to a minute before it answers.
More examples
The repository has two more workflows to import:persistent_workspace.ymlcreates a machine on the first run, appends a line to a file on every run, and hibernates the machine in between.parallel_forks.ymlsets a machine up once, forks it twice, and runs Python on one fork and JavaScript on the other at the same time.
Read more
- boxd in the Dify Marketplace
- The plugin’s README, with every error message and limit
- Sandboxes on boxd