AsyncChain¶
Async orchestrator with the same semantics as Chain.
Differences
- Awaits async steps; can also offload sync steps via
asyncio.to_thread. - Hooks can be async or sync.
- Uses
asyncio.sleepduring backoff.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strict
|
bool
|
If True, unresolved dotted refs raise |
False
|
before_step
|
HooksFn | None
|
Optional hook (sync or async): |
None
|
after_step
|
HooksFn | None
|
Optional hook (sync or async): |
None
|
on_retry
|
HooksFn | None
|
Optional hook (sync or async) for retry events. |
None
|
redact
|
Callable[[str], str] | None
|
Optional log redactor. |
None
|
deadline_fn
|
Callable[[], float] | None
|
Optional function returning remaining seconds. |
None
|
safety_margin
|
float
|
Deadline buffer. |
0.25
|
jitter
|
bool
|
Randomize sleep in backoff window. |
True
|
allow_sync
|
bool
|
If True, synchronous steps are offloaded with |
True
|
See Also
Chain for the synchronous variant.
next ¶
next(func, *, out, args=(), kwargs=None, name=None, retries=0, retry_on=(Exception,), backoff=1.5, max_backoff=10.0, log=None, log_fmt=None, validate=None)
See Chain.next (async compatible).