feat: add common human-in-the-loop patterns #125
Merged
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.
feat: Add Common Human-in-the-Loop Patterns
This PR introduces a suite of common and powerful "human-in-the-loop" (HITL) patterns to the Eino examples. These patterns demonstrate how to build sophisticated agentic workflows that can pause for human intervention, enabling collaboration, oversight, and fine-grained control over agent execution.
Each pattern is implemented as a self-contained example within the
adk/human-in-the-loop/directory and includes detailedREADME.mdfiles in both English and Chinese.Core Contribution
This PR adds four distinct HITL patterns:
These examples are built using a new set of reusable tool wrappers (
approval_wrapper.go,review_edit_wrapper.go, etc.) that make it easy to integrate these HITL mechanisms into any agent.1. Approval Pattern
Y) or deny (N) it before it can proceed.InvokableApprovableToolwrapper that triggers a stateful interrupt before executing the wrapped tool. The workflow only resumes after receiving the user's confirmation.2. Review-and-Edit Pattern
InvokableReviewEditToolwrapper. On interrupt, the user can provide a new JSON string with corrected arguments, which are then used when the tool call resumes.3. Feedback Loop Pattern
WriterAgentgenerates content and aReviewerAgentpresents it to the user. The user's feedback is passed back to theWriterAgentto generate a revised version.4. Follow-up Pattern
FollowUpToolthat, when its own capabilities are insufficient, can interrupt and ask the user for the next step (e.g., "The search results are ambiguous, which one should I proceed with?").