@langchain/langgraph
Version:
45 lines • 1.67 kB
TypeScript
//#region src/pregel/utils/timeout.d.ts
/**
* Configuration for timing out node attempts.
*
* A timeout applies to a single attempt of a node/task. When a node has a
* {@link RetryPolicy}, the timer resets for each retry attempt.
*
* Timeouts are expressed in **milliseconds**, matching other LangGraph.js
* durations (e.g. {@link RetryPolicy} intervals and `stepTimeout`).
*
* @remarks
* Cooperative cancellation: timeouts rely on aborting the node's
* {@link AbortSignal} and dropping its buffered writes. A node that ignores its
* `signal` and performs blocking work cannot be interrupted mid-operation, but
* its writes are still discarded and `NodeTimeoutError` is raised.
*/
type TimeoutPolicy = {
/**
* Hard wall-clock cap (in milliseconds) for a single node attempt.
*
* This timeout is never refreshed by progress signals or
* `runtime.heartbeat()`.
*/
runTimeout?: number;
/**
* Maximum time (in milliseconds) a single node attempt may go without
* observable progress before timing out.
*
* Refreshed by writes, custom stream writer calls, child-task scheduling,
* LangChain callback events emitted under the node's run, and explicit
* `runtime.heartbeat()` calls (see {@link TimeoutPolicy.refreshOn}).
*/
idleTimeout?: number;
/**
* Which signals refresh {@link TimeoutPolicy.idleTimeout}.
*
* - `"auto"` (default): refreshes on standard graph progress signals and
* explicit heartbeats.
* - `"heartbeat"`: refreshes only on explicit `runtime.heartbeat()` calls.
*/
refreshOn?: "auto" | "heartbeat";
};
//#endregion
export { TimeoutPolicy };
//# sourceMappingURL=timeout.d.ts.map