hen 0.20.1

Run protocol-aware API request collections from the command line or through MCP.
Documentation
---
sidebar_position: 4
title: Reliability
description: Use timeout, poll_until, and poll_every for eventual-consistency workflows.
---

## Core Directives

```hen
timeout = 30s
poll_every = 1s

---

Wait for export

GET https://example.com/exports/{{ JOB_ID }}
timeout = 5s
poll_until = 2m
poll_every = 2s

^ & status == 200
^ & body.state == "completed"
```

- `timeout` applies per attempt and defaults to `30s`.
- `poll_until` defines the total polling window across attempts.
- `poll_every` defines the fixed retry interval.

These directives can appear in the collection preamble or on an individual request. Request-level
reliability directives override only the fields they declare and inherit the remaining preamble
defaults.

## Retry Conditions

Polling retries only when:

- ordinary assertions fail
- a request attempt times out

Transport failures remain terminal.

When the polling window expires, Hen reports the last assertion mismatch or timeout detail rather
than a generic poll exhaustion message.

## Duration Grammar

Durations currently accept:

- `ms`
- `s`
- `m`

Examples: `250ms`, `2s`, `1m`

## `within` vs Request Reliability

`within` is separate from request reliability. Use `within` only for:

- SSE `receive`
- WebSocket `receive`
- WebSocket `exchange`

Use `timeout`, `poll_until`, and `poll_every` for ordinary execution timing.