Add a retry policy
Passretry on task (not retryPolicy). Retries are opt-in. If the policy omits retryOn, LangGraph retries most thrown errors except abort/cancel, GraphValueError, aborted connections, selected HTTP 4xx statuses, and OpenAI-style quota errors. This example retries any Error. See Fault tolerance for the full default list.
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 milliseconds, or as { idleTimeout: 30_000 }. Use isNodeTimeoutError to narrow timeout errors. NodeTimeoutError is retryable when a retry policy is set.
The first attempt sleeps past the timeout. The retry policy retries. 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 null.
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.

