mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-24 08:32:24 +02:00
Replace the hidden __error_handler__<name> node approach with a callable field on PregelNode/PregelExecutableTask, matching how retry_policy and cache_policy work: - error_handler: Runnable | None lives on StateNodeSpec, PregelNode, and PregelExecutableTask — no separate node registration at compile time - ErrorHandlerNode type alias added to _node.py covering the common handler signatures (state + NodeError, runtime + NodeError, etc.) - Handler task is synthesized at runtime in schedule_error_handler using the failed task's write pipeline (failed_task.writers), so no separate PregelNode is needed - compile(error_handler=...) adds a graph-level fallback handler; per-node handlers take precedence - @task(error_handler=...) in the functional API uses inline try/except wrapping so the caller's future always resolves to a value - interrupt_before/after ["__error_handler__<node>"] still works via updated validate() and _validate.py checks - RunnableCallable gains takes_input flag so handlers whose only parameters are injected kwargs (e.g. def h(error: NodeError) -> T) are called without a spurious positional input arg