# Workflow Timeouts

> For the complete documentation index, see [llms.txt](https://docs.temporal.io/llms.txt).
> Any documentation page is available as raw Markdown by appending `.md` to its URL.
> For related questions, query https://docs.temporal.io/api/retrieve?q=<question>&jtb=<job-to-be-done>&src=md-page&agent=<your-name> (no auth; returns JSON `{content, source_url, page_url}`, with `source_url` pointing to Markdown for docs pages). Don't include personal data or credentials.
> If this page is wrong or missing something you needed, or Temporal behaves differently from what it says, report it with https://docs.temporal.io/api/feedback?title=<summary>&message=<what-happened>&category=documentation&page_url=/develop/rust/workflows/timeouts&src=md-page&agent=<your-name> (use `category=product` when the product, not the page, is wrong). Report only a specific problem you hit, send it once, and don't include personal data or credentials.

> Optimize Workflow Execution with the Temporal Rust SDK by configuring Workflow Timeouts and Retry Policies.

## Workflow timeouts 

Each Workflow timeout controls the maximum duration of a different aspect of a Workflow Execution.

In most cases, **Workflow Timeouts are not recommended**. Temporal Workflows are designed to be long-running and resilient. Setting timeouts can unnecessarily limit their ability to tolerate delays or extended processing.

If you need to trigger logic after a specific duration, use a **Timer inside the Workflow** instead of a timeout.

You can configure Workflow timeouts when starting a Workflow Execution.

Available timeouts include:

- [Workflow Execution Timeout](/encyclopedia/detecting-workflow-failures#workflow-execution-timeout): Maximum total time a Workflow Execution can run.
- [Workflow Run Timeout](/encyclopedia/detecting-workflow-failures#workflow-run-timeout): Maximum time a single Workflow Run can last.
- [Workflow Task Timeout](/encyclopedia/detecting-workflow-failures#workflow-task-timeout): Maximum time a Worker can take to complete a Workflow Task.

In Rust, you set these via `WorkflowStartOptions` when starting or executing a Workflow.

Available fields:

- `execution_timeout`
- `run_timeout`
- `task_timeout`

<!--SNIPSTART rust-workflow-timeouts-timeouts {"enable_code_dedenting": true}-->
[rust-sandbox/workflows/timeouts/src/client.rs](https://github.com/temporalio/documentation-sdk-code-examples/blob/main/rust-sandbox/workflows/timeouts/src/client.rs)
```rs
let wf_handle = client
    .start_workflow(
        GreetingsWorkflow::run,
        (),
        WorkflowStartOptions::new("my-task-queue", "greetings-workflow-10")
            // Set timeouts
            .execution_timeout(Duration::from_secs(3600))
            .run_timeout(Duration::from_secs(600))
            .task_timeout(Duration::from_secs(10))
            .build(),
    )
    .await?;
```
<!--SNIPEND-->

## Workflow retries 

A Retry Policy can be used alongside timeouts to control how Workflow Executions are retried after failure.

Workflow Executions do **not retry by default**. Retry Policies should only be applied when restarting the entire Workflow is safe and intentional.

To enable retries, configure a [Retry Policy](/encyclopedia/retry-policies) when starting the Workflow.

<!--SNIPSTART rust-workflow-timeouts-retry-policy {"enable_code_dedenting": true}-->
[rust-sandbox/workflows/timeouts/src/client.rs](https://github.com/temporalio/documentation-sdk-code-examples/blob/main/rust-sandbox/workflows/timeouts/src/client.rs)
```rs
let wf_handle = client
    .start_workflow(
        GreetingsWorkflow::run,
        (),
        WorkflowStartOptions::new("my-task-queue", "greetings-workflow-11")
            .retry_policy(
                RetryPolicy::builder()
                    .initial_interval(Duration::from_secs(1))
                    .backoff_coefficient(2.0)
                    .maximum_interval(Duration::from_secs(100))
                    .maximum_attempts(5)
                    .non_retryable_error_types(["NonRetryableError"])
                    .build(),
            )
            .build(),
    )
    .await?;
```
<!--SNIPEND-->

Retry Policies define retry behavior such as backoff intervals, maximum attempts, and retry conditions.
