What the agent sees
The server resolves its backend once at startup, so the catalog the agent lists and the tools it can actually run never disagree.workspace_inforeports which workspace and environment calls go to, how many apps are deployed, and whether Modal credentials are present at all.list_toolsdefaults to the tools you have deployed. Passingdeployed_only=falsereturns the full catalog, which is how the agent identifies what remains available to deploy.run_toolexecutes a deployed tool and blocks until it finishes.
Deploying a tool
An agent can deploy a tool you have not set up yet, throughdeploy_tool. It never does so silently.
The spend is real: a deployment builds a container image and then executes the tool once to warm
it, on a GPU where the tool requires one. Both happen before any result comes back, and both are
billed to your account. The weights it downloads then persist on a Modal volume and accrue storage
cost until you remove them.
The target environment is a required argument rather than an inherited default, so an agent
cannot deploy into production by accident.
Deployment is a one-time cost per tool. Later calls reuse the app and the cached weights.
Keeping spend predictable
Two things account for most of what a workspace costs:- Deploy only what you need. Cached weights persist on a Modal volume and accrue storage cost until they are removed. Remove the weights for tools you no longer use.
- Tune the scale-down window. Containers stay warm briefly after a call so the next one skips the model load. A longer window is faster for an interactive session and costs more while the GPU idles.
PROTO_MODAL_SCALEDOWN_WINDOW setting.
Next Steps
Modal Setup
Account creation, authentication, environments, and deploying from the command line.
Installation
Install the extra, register the server, and select the Modal backend.
Server Functions
Every function the server exposes, including
deploy_tool and its confirmation step.Cloud Inference
A runnable walkthrough that deploys a model and folds a structure with it.