Skip to main content
Version 2 changes the primary Modal lifecycle. Upgrade the SDK and runtime artifacts together to modal-computer-use==2.0.2. The daemon keeps its v1 REST and JSON/base64 compatibility routes, but the v2 placed trajectory requires the protocol capabilities it verifies during preflight. Version 2.0.2 requires no API migration from 2.0.1. If you remain on v1.1.0, use the preserved 1.x documentation. The version selector also keeps every 1.x guide available.

Replace the primary lifecycle

Before: v1 external owner

After: v2 placed trajectory

The owner waits for the Function result. Borrow exit releases the trajectory lease first. Owner exit then terminates the desktop.

Select and verify placement

Use the same requested selector in ComputerConfig, the Modal Function decorator, and borrow_async(function_region=...).
  • A public narrow selector such as us-west may resolve to a concrete provider-native runtime region such as AWS us-west-2, GCP us-west1, or Azure westus3. These are valid concrete observations for the public selector.
  • A Workspace-granted granular selector such as us-west-2 must match the observed runtime region exactly.
  • Broad selectors such as us and eu fail before allocation. Missing, mismatched, malformed, or unverifiable placement fails before credentials, lease acquisition, or desktop mutation.
The SDK does not fall back to an external caller when placement cannot be verified.

Update screenshot and Step handling

computer.step() requires computer-step-envelope-v1. Capability preflight fails before mutation when the daemon does not support it. A lost response after possible mutation is not replayed automatically. Observe or recover according to the reported outcome. The returned Step frame is an immediate post-action screenshot. It is not an application-readiness signal. Direct clients can continue to use retained REST and JSON/base64 routes.

Review input capacity

The v1 input limit counted flat actions in a rolling window. In v2.0.1, actions.input_rate_limit_per_sec=100 is a weighted-token refill rate and actions.input_rate_limit_burst=400 is the burst. The daemon reserves the complete recursive batch before mutation. If you previously set the rate explicitly, review both values. A transient rate_limited response is safe because no action in that request ran. input_cost_exceeds_burst requires a different explicit capacity or request shape.

Compatibility and rollback

Version 1.1 clients remain compatible with the retained v1 REST and JSON contracts. Do not infer v2 trajectory support from package versions alone. The v2 SDK verifies capabilities before mutation. For rollback, restore the package and runtime artifacts as one compatible release set. Do not make the v2 client silently select the v1 external-caller topology. The 1.x quickstart remains available while you migrate. The exact v2.0.1 migration source records the release contract.