Add a retry policy
Passretry_policy on @task. The default RetryPolicy retries selected network and HTTP 5xx errors. It does not retry ValueError. This example retries ValueError.
Set a timeout
Cap how long a single async attempt can run. If a retry policy retries the timeout error, the timer resets on the next attempt. Passtimeout on @task or @entrypoint in seconds or as a datetime.timedelta. Timeouts apply only to async tasks and entrypoints. Setting timeout on a sync function raises an error at declaration.
The first attempt sleeps past the timeout and raises NodeTimeoutError, which subclasses TimeoutError. The retry policy retries that error. The second attempt returns immediately.
Cache a task
Cache a task result by input. Pass a cache on the entrypoint and a policy on the task.ttl is in seconds. The second call is a cache hit, so this run takes about 1 second, not 2.
Resume after an error
A checkpointer is required so completed task results survive the failed run.slow_task is restored from the checkpoint. get_info runs again and returns "OK". The entrypoint still returns the slow_task result.
Resume the same thread_id with None.
See also
- Functional API overview
- Build checklist for the Functional API
- Fault tolerance
- Stream with the Functional API
- Add memory with the Functional API
Connect these docs to your agent of choice via MCP for real-time answers.

