Human-in-the-Loop Agent
Build a human-in-the-loop AI agent that pauses for user input mid-task, then resumes autonomously with Stagehand and Browserbase.
Get started with human-in-the-loop automation
Give a Stagehand Agent a task and let it work autonomously. When it hits something it can't answer, it pauses and asks the human via a custom askHuman tool, then picks up where it left off.
Watch the whole thing happen in real time through Browserbase Live View with an SSE-powered activity log streaming every step. This template wires up the full loop: agent execution, human input collection, and resume logic, all in a single Next.js app. Perfect for assisted form filling, approval workflows, and supervised data entry where some decisions need a human in the loop.
Steps
Start a Browserbase session and navigate to the target job application page.
The Stagehand Agent begins filling out the application autonomously.
When the agent encounters a field it cannot answer, it invokes the askHuman tool to pause and prompt the user.
The user responds via the frontend UI, and the agent resumes with the provided information.
The agent completes and submits the application, streaming progress via SSE throughout.