import { AgentsService, BrowserService, ChatService, workflow } from '@athree/runner'; import { dep } from 'mesh-ioc'; /** * Simple Generic Web Agent Workflow * * Demonstrates the GenericWebAgent pattern: * 1. Navigates to a URL * 2. Uses GenericWebAgent to extract content with a simple objective * 3. No stages - just a one-shot LLM call with browser tools * * This is the simplest way to use LLM-powered web automation. */ @workflow({ title: 'Simple Generic Web Agent', }) export class SimpleGenericWebAgentWorkflow { @dep() private chat!: ChatService; @dep() private browserService!: BrowserService; @dep() private agentsService!: AgentsService; async run() { const url = 'https://example.com'; this.chat.addMessage({ content: 'Starting simple generic web agent workflow', }); // Navigate to the page const page = await this.browserService.getPage(); await page.goto(url); await page.waitForLoadState('networkidle'); this.chat.addMessage({ content: `Navigated to ${url}`, }); // Create the agent const agent = this.agentsService.createGenericWebAgent({ model: 'gemini-3-flash-preview', }); // Add context for the agent agent.addUserContext({ currentUrl: url, }); // Run the agent with a simple objective await agent.run(` Extract the main heading and description from this page. Use the evaluate tool to get the text content: - Get the h1 heading text - Get the first paragraph text Output the results using console.log in the evaluate tool. `); this.chat.addMessage({ content: 'Workflow complete', }); } }