Setting Timeouts
Set thetimeout attribute on the @function() decorator to control how long a function can run before it is terminated and marked as failed.
When a function times out, it is terminated and marked as failed. If the function has a retry policy, it will be retried according to that policy. Already-completed nested calls are served from checkpoints on retry — see Durable Execution.
Automatic Timeout Reset
When a function reports progress viactx.progress.update(), its timeout automatically resets. This allows functions to run indefinitely as long as they continue making progress.
- Function starts with 5 minute timeout
- At 3 minutes:
progress.update()called - Timeout resets to 5 minutes from this point
- Function can now run until minute 8 (3 + 5)
- Next
progress.update()resets timeout again
Examples
Agent Loops
An agent that runs hundreds of iterations can use a short timeout per iteration. Each progress update resets the clock:Batch Processing
Process an unbounded stream of items. The function runs as long as items keep arriving:Video/Audio Processing
Report progress every N frames to keep the timeout from firing during long media processing:Learn More
Streaming Progress
The full progress API, frontend integration, and SSE streaming.
Retries & Rate Limits
What happens after a timeout fires — auto-retry with checkpoint reuse.
Crash Recovery
Resume a request from where it timed out instead of restarting.
Durable Execution
How nested completed calls are reused across timeout-triggered retries.
Error Handling
Catch timeouts in caller code and degrade gracefully.
SDK Reference
Functions, retries, resource limits, and request context.