Skip to main content
The generated application calls Worker.from_env(), so you can set runtime policy with MODAL_DEVIN_* environment variables through your preferred Modal configuration mechanism.

Common settings

For example:
none and null, in any letter case, both mean indefinite snapshot retention.

Trace sessions with OpenTelemetry

The scheduler and session runtimes include Pydantic Logfire instrumentation. Every scheduler poll creates a trace, and each dispatched session continues that trace through claim acquisition, Sandbox startup, the Devin worker process, final status handling, and claim release. The handoff uses a W3C OpenTelemetry trace carrier stored with the short-lived dispatch lease, so it crosses the remote Modal function boundary without changing the generated function signature. To send traces to Pydantic Logfire, add LOGFIRE_TOKEN to the Modal Secret attached to both generated functions. The existing generated Secret reference can contain both credentials:
Logfire only sends to its hosted service when a token is present. To use another OpenTelemetry-compatible backend, omit LOGFIRE_TOKEN and configure its OTLP/HTTP endpoint instead:
The service name is the worker’s generated Modal app name. Useful span attributes include devin.session.id, modal_devin.outpost.id, modal_devin.worker.name, and modal.function.name.

Configure in Python

Use WorkerSettings when configuration belongs in version control:
Use the constructor directly when settings are explicit in code, as above. Use Worker.from_env() instead when settings should come from MODAL_DEVIN_* environment variables; it has no settings parameter, so the two approaches apply to separate Worker instances rather than combining on one.

Preserve the generated timeout

Keep the session function decorator tied to the generated property:
The property leaves enough time for startup, recovery, and cleanup when the session duration changes.

Choose snapshot retention

Modal’s Sandbox snapshot guide documents filesystem snapshot retention and expiration behavior.
  • Use the default 30 days for bounded recovery storage.
  • Set a positive number of seconds for another finite duration.
  • Use None in Python or none in the environment for indefinite retention.
Keep the deployment active while relying on resumability, and remove persistent resources when an outpost is retired.
Additional readiness, API, retry, and snapshot timing controls exist for unusual deployments and support-guided troubleshooting. See the settings reference before changing them.