Execution Timeouts
timeout=-1 to disable timeouts on functions and task queues. Endpoints are capped at 600 seconds, including when timeout is nonpositive. Use a task queue for longer jobs.
Pending-task Expiry
TaskPolicy(ttl=...) limits how long a task may remain pending. Defaults are 12 hours for functions and scheduled jobs, 2 hours for task queues, and 600 seconds for endpoints. The gateway caps an explicitly configured TTL at 24 hours.
Waiting for Capacity
When a call doesn’t land on a warm machine, the CLI and SDK print what it’s waiting for, and again whenever that changes:
If no machine becomes available within 20 minutes, the call fails with
No capacity became available in 20 minutes. and suggestions, and the task’s failure reason says the same. TaskPolicy(ttl=...) doesn’t shorten this wait.
To give up sooner, set BEAM_CAPACITY_WAIT to a number of seconds or a duration such as 90s or 5m. A function call that goes that long without a machine is cancelled, the function doesn’t run, and the command exits with status 1. With --json output, the error has code: CAPACITY.
beam serve.
While a task waits, the dashboard’s task view, the workspace REST API, and the MCP get_task tool show what it’s waiting for, in a pending object with phase, reason, waited_seconds, and message.
Retries
Functions, schedules, and task queues default to 3 retries. Configureretries on the decorator; the gateway caps retries at 5. Endpoint and ASGI requests have automatic task retries disabled.
A task queue can retry selected exceptions with retry_for:
retry_for is only available on task queues.
Nonzero TaskPolicy.timeout and max_retries override the decorator; zero uses its settings. Set retries=0 on the decorator to disable retries.
Container Lifetime
keep_warm_seconds controls how long idle containers stay running. For sandboxes, it sets the sandbox lifetime. Neither setting is a task execution timeout.