Skip to main content
Agents can take an unpredictable amount of time to do their work — an LLM tool-calling loop might finish in seconds or run for hours depending on the task. Tensorlake handles this by letting functions run indefinitely as long as they keep sending heartbeats in the form of progress updates. A timeout only kicks in if a function stops making progress — it doesn’t finish within the allotted time and it doesn’t send any progress updates to reset the clock.

Setting Timeouts

Set the timeout 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 via ctx.progress.update(), its timeout automatically resets. This allows functions to run indefinitely as long as they continue making progress.
Timeline:
  1. Function starts with 5 minute timeout
  2. At 3 minutes: progress.update() called
  3. Timeout resets to 5 minutes from this point
  4. Function can now run until minute 8 (3 + 5)
  5. Next progress.update() resets timeout again
Set a short timeout (e.g., 5 minutes) and rely on progress updates to extend it. This way, if a function gets stuck and stops reporting progress, it fails fast instead of running silently for hours.

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.