Repository navigation
feat: migrate to Haystack 3.0 hooks-based HITL API - #2
Merged
Merged
Conversation
Haystack 3.0 recasts human-in-the-loop as a before_tool hook:
- Agent no longer accepts confirmation_strategies; register a
ConfirmationHook under hooks={"before_tool": [...]} instead
- The confirmation_strategy_context run argument is replaced by the
generic hook_context argument; the ConfirmationHook forwards it to
each strategy as confirmation_strategy_context
- ConfirmationStrategy.run/run_async are keyword-only in the protocol
Also bumps hayhooks to >=1.22.0 (first release supporting Haystack v3)
and installs haystack-ai from the main branch until 3.0 is on PyPI.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
julian-risch
commented
Jul 11, 2026
julian-risch
commented
Jul 11, 2026
4 tasks done
Member
Author
|
We can hold off merging this PR until the 3.0 release. |
julian-risch
marked this pull request as ready for review
July 11, 2026 16:47
sjrl
reviewed
Jul 15, 2026
julian-risch
commented
Jul 15, 2026
Co-authored-by: Julian Risch <julianrisch@gmx.de> Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes https://github.com/deepset-ai/haystack-private/issues/456
Haystack 3.0 uses hooks for human-in-the-loop. The docs there link to this repository as the production-style HITL example.
What changed
Agent(..., confirmation_strategies={tool: strategy})Agent(..., hooks={"before_tool": [ConfirmationHook(confirmation_strategies={tool: strategy})]})agent.run_async(..., confirmation_strategy_context={...})agent.run_async(..., hook_context={...})ConfirmationStrategy.run/run_asyncpositional-or-keyword params*,) per the v3 protocolThe strategy body is unchanged:
ConfirmationHookreadshook_contextfrom state viastate.data(avoidingState.get's deep copy, which would break the live Redis client and asyncio queue) and forwards it to the strategy as the sameconfirmation_strategy_contextkwarg as before.pipelines/hitl/pipeline_wrapper.py: hooks-based Agent config,hook_contextrun arg, keyword-only strategy signaturesrequirements.txt:hayhooks>=1.22.0;haystack-aiinstalled from gitmainREADME.md: updated custom-tools snippet and the pipeline-side explanation; added a Haystack 3.0 noteVerification
I ran the demo myself following the readme. Used:
then deployed pipe function and asked for the weather. Confirmation pop up came up as expected. Double-checked that the Hayhooks container was running haystack version: 3.0.0rc0 because in the UI it feels exactly the same as with 2.x. 🎉
In addition, I let my coding agent run end-to-end
agent.run_async(messages=..., hook_context=...)with a real OpenAI call: the LLM'sweather_toolcall was approved live through Redis and the agent answered from the tool result.🤖 Generated with Claude Code