Dynamic Form Filling with Stagehand Agent
Intelligently fill out forms from natural language or unstructured data using Stagehand Agent

TypeScript
Source codenpx create-browser-app --template dynamic-form-filling
Get started with Stagehand Agent-driven dynamic form filling
This template uses a Stagehand Agent with Browserbase to autonomously fill out a form using natural language or unstructured data. Stagehand extracts relevant form questions and the agent fills the form with the closest options for radio buttons, dropdowns, and checkboxes—even when the wording doesn’t exactly match. Once all required fields are complete, it submits the form automatically.
Steps
- Start a Browserbase session with Stagehand and open the target form URL
- Create a Stagehand Agent with a system prompt tailored for form filling
- Provide natural language details (e.g., trip description) as the instruction input
- Agent fills all required fields, selecting the closest option for radio buttons, dropdowns, and checkboxes
- Clicks submit to complete the form submission