Skip to main content

Overview

LLM provider APIs fail transiently — rate limits (429), overloaded servers (503), and flaky networks are normal in production. Without retry logic a single transient error silently kills an otherwise-healthy run. SirenSpec’s retry policy system gives you configurable backoff, jitter, and structured failure handling with zero boilerplate.

retry block

Add a retry block to any node to override the retry behaviour for that node.

Fields

Backoff strategies

All strategies are clamped to max_delay.

Retrying on guardrail violations

By default, retries only fire on transient transport errors (HTTP codes and network failures). Output guardrails — such as schema — run after the retry loop, so a malformed-but-successful response fails the run outright. Set retry_on_guardrail: true to fold output guardrail checks into the retry loop. A GuardrailViolation then counts as a retryable error and triggers another LLM call, giving the model additional chances to produce output that satisfies the guardrail. Add guardrail_violation to the on list to make the trigger explicit.
This is the recommended pattern whenever an agent must satisfy a schema (or other output) guardrail — see Guardrails.

on_failure block

on_failure controls what happens when all retry attempts are exhausted.

Fields

Actions


Workflow-level defaults

Set retry and failure defaults at the top level of your workflow. Every node that does not specify its own retry or on_failure block inherits these defaults.
Per-node retry and on_failure blocks completely override the defaults for that node — they are not merged field-by-field.

Error types

RetryExhaustedError carries the node ID, the number of attempts made, and the last upstream exception so you can log and inspect the root cause.

Tracing

Every retry attempt is recorded in the run trace under the node’s retry_attempts list:
Silent retries make debugging impossible — every attempt, delay, and error is always logged.

Full example