> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc-redirect-agent-platform-overview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Timeout

> Set deadlines for HITL responses so workflows don't wait indefinitely.

HITL timeouts set a deadline for human responses. When the timeout expires, the workflow auto-resolves the pending requirement based on the `on_timeout` policy.

```python theme={null}
from agno.workflow import Workflow
from agno.workflow.step import Step
from agno.workflow.types import OnTimeout
from agno.db.sqlite import SqliteDb

workflow = Workflow(
    name="timeout_workflow",
    db=SqliteDb(db_file="workflow.db"),
    steps=[
        Step(
            name="draft_email",
            agent=draft_agent,
            requires_output_review=True,
            output_review_message="Review the draft (auto-approves in 5 minutes)",
            hitl_timeout=300,
            on_timeout=OnTimeout.approve,
        ),
        Step(name="send_email", agent=send_agent),
    ],
)
```

Timeout is checked at `continue_run()` time. There is no background timer. If the timeout has elapsed when `continue_run()` is called, the requirement is auto-resolved.

## Parameters

| Parameter      | Type        | Default | Description                                        |
| -------------- | ----------- | ------- | -------------------------------------------------- |
| `hitl_timeout` | `int`       | `None`  | Seconds before auto-resolving. `None` = no timeout |
| `on_timeout`   | `OnTimeout` | `None`  | Action when timeout expires                        |

## OnTimeout Options

| Value               | Behavior                |
| ------------------- | ----------------------- |
| `OnTimeout.approve` | Auto-confirm the output |
| `OnTimeout.skip`    | Skip the step           |
| `OnTimeout.cancel`  | Cancel the workflow     |

## Timeout Flow

```python theme={null}
run_output = workflow.run("Draft an email about the team lunch")

if run_output.is_paused:
    for req in run_output.steps_requiring_output_review:
        print(f"Draft: {req.step_output.content}")
        print(f"Timeout at: {req.timeout_at}")
        print(f"On timeout: {req.on_timeout}")

    # If called after timeout expires, auto-resolves based on on_timeout
    run_output = workflow.continue_run(run_output)
```

The `timeout_at` datetime is available on the `StepRequirement` for frontend countdown display.

## With Output Review

Timeout is most useful with output review. If a reviewer doesn't respond in time, the workflow proceeds automatically.

```python theme={null}
Step(
    name="generate_report",
    agent=report_agent,
    requires_output_review=True,
    output_review_message="Review the report",
    hitl_timeout=600,           # 10 minutes
    on_timeout=OnTimeout.approve,  # Auto-approve after 10 minutes
)
```

## With Confirmation

Timeout also works with pre-execution confirmation:

```python theme={null}
Step(
    name="deploy",
    agent=deploy_agent,
    requires_confirmation=True,
    confirmation_message="Deploy to production?",
    hitl_timeout=120,            # 2 minutes
    on_timeout=OnTimeout.cancel,  # Cancel if no response
)
```

## Choosing an OnTimeout Policy

| Policy    | Use When                                                                         |
| --------- | -------------------------------------------------------------------------------- |
| `approve` | Output is low-risk and delays are costly. The step's output is likely acceptable |
| `skip`    | The step is optional. Skipping doesn't break the workflow                        |
| `cancel`  | The step is critical. Proceeding without review is unacceptable                  |

## Developer Resources

* [Output Review](/workflows/hitl/output-review)
* [Workflow HITL overview](/workflows/hitl/overview)
* [Step reference](/reference/workflows/step)
* [Cookbooks](https://github.com/agno-agi/agno/tree/main/cookbook/04_workflows/08_human_in_the_loop/timeout)
