showcase/shell-docs/src/content/docs/integrations/mastra/human-in-the-loop/index.mdx
<video src="https://cdn.copilotkit.ai/docs/copilotkit/images/coagents/human-in-the-loop-example.mp4" className="rounded-lg shadow-xl" loop playsInline controls autoPlay muted />
Human-in-the-loop (HITL) allows agents to request human input or approval during execution, making AI systems more reliable and trustworthy. This pattern is essential when building AI applications that need to handle complex decisions or actions that require human judgment.
HITL combines the efficiency of AI with human judgment, creating a system that's both powerful and reliable. The key advantages include:
Mastra supports HITL through frontend tools that render UI and collect user input.
<CTACards columns={2} cards={[ { iconKey: "share2", title: "Tool-based (Supported)", description: "Register frontend tools with useHumanInTheLoop that render UI and wait for user responses. This is the working approach for Mastra.", href: "/mastra/human-in-the-loop/tool-based", }, { iconKey: "circlePause", title: "Interrupt-based (Not Supported)", description: "Mastra does not support native interrupt flow. See this page to understand why and learn about the tool-based alternative.", href: "/mastra/human-in-the-loop/interrupt-flow", }, ]} />