In this guide, you'll configure and run a local agent. Local agents are used to launch user code in operating system subprocesses.
Considering running the agent in production? Running the local agent in production can be a good choice if:
Load is relatively light (guaranteed to fit on a single node)
Jobs aren’t computationally intensive and don’t use much memory
A Kubernetes cluster is prohibitively difficult to set up
You can restart the agent when you update your code
Keep in mind that the local agent’s ability to run jobs is limited by the capacity of the single node on which it’s running.
If you’re running the local agent in production, make sure you’ve set up a supervisor to automatically restart the agent process if it crashes. You’ll also want a system in place to alert you if the VM or container dies, or to automatically restart it.
Permissions in Dagster Cloud that allow you to manage agent tokens. Refer to the User permissions documentation for more info.
To install the dagster-cloud CLI. This should be in the same environment where the agent will run.
Note: Your Dagster application code and its Python and system requirements must also be installed in this environment. We recommend using Python virtual environments to accomplish this.
agent_token - Add the agent token you created in Step 1. This specifies that the agent will launch work in local processes, reading the API URL and authentication token from environment variables.
deployment - Enter the deployment associated with this instance of the agent.
In the above example, we specified prod as the deployment. This is present when Dagster Cloud organizations are first created.
Next, run the process agent by pointing at the home directory you created:
dagster-cloud agent run ~/dagster_home/
To view the agent in Dagster Cloud, navigate to the Status page and click the Agents tab. You should see the agent running in the Agent statuses section: