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

# Time Limits

> Cap wall-clock execution time

Stop workflows after N seconds.

## Usage

```python theme={null}
from splinter import Gateway, ExecutionLimits

gateway = Gateway(limits=ExecutionLimits(
    max_time_seconds=300,  # 5 minutes max
))
```

## Error Handling

```python theme={null}
from splinter.exceptions import TimeLimitExceededError

try:
    result = await workflow.run()
except TimeLimitExceededError as e:
    print(f"Time limit exceeded: {e.elapsed:.2f}s >= {e.limit:.2f}s")
```

## Metrics

```python theme={null}
metrics = gateway.get_metrics()
print(f"Elapsed: {metrics['elapsed_seconds']:.2f}s")
```

## Use Cases

* **SLA compliance**: Ensure workflows complete in time
* **Resource management**: Free up resources after timeout
* **User experience**: Don't leave users waiting forever
