// AI-POWERED FORM FILLING AUTOMATION // Trip details to be used for form filling const tripDetails = `I'm planning a Summer in Japan. We're going to Tokyo, Kyoto, and Osaka (Japan)` async function main() { // Initialize Stagehand with Browserbase for cloud-based browser automation. const stagehand = new Stagehand({ env: "BROWSERBASE", verbose: 0, }); try { // Initialize browser session to start automation. await stagehand.init(); console.log(`Stagehand Session Started`); console.log( `Watch live: https://browserbase.com/sessions/${stagehand.browserbaseSessionId}`, ); const page = stagehand.context.pages()[0]; // Navigate to the trip example form. console.log("Navigating to form..."); await page.goto("https://forms.gle/DVX84XynAJwUWNu26"); // Create agent with custom system prompt for intelligent form filling. // The agent will use semantic matching to select appropriate form options. const agent = stagehand.agent({ cua: false, model: "google/gemini-2.5-pro", // Routed through Model Gateway systemPrompt: `You are filling out a trip planning form.