Anchor Browser delivers a state-of-the-art 89% Score on the industry-standard benchmark WebVoyager, leveraging browser-use as a core component of the automation capability.
Anchor Browser provides within its SDK the agent.task method that enables natural language control over web browsing sessions. This capability allows you to automate complex web tasks without coding the whole flow.
import Anchorbrowser from 'anchorbrowser';const anchorClient = new Anchorbrowser({ apiKey: process.env.ANCHORBROWSER_API_KEY});const response = await anchorClient.agent.task( 'Extract the main heading', // Required { taskOptions: { url: 'https://example.com', // Either sessionId or url is required humanIntervention: false, // Disable human intervention during task execution (disabled by default) detectElements: true, // Improves the agent's ability to identify and interact with UI elements maxSteps: 40, // Maximum number of steps the agent can take agent: 'browser-use', // browser-use (default), openai-cua, or gemini-computer-use provider: 'openai', // For browser-use agent only, openai, gemini, groq, azure, xai model: 'gpt-5', // For browser-use agent only, see model list below extendedSystemMessage: 'Focus on extracting the main heading from the page', secretValues: { // Secret values to pass to the agent for secure credential handling API_KEY: 'your-secret-key' } } });console.log(response);
The AI object can also be used to extract structured data from the browser. This is done by providing a JSON schema to the AI object, which will then return the structured data.
The following demonstrates using Zod and Pydantic to utilize the structured output capability.
Copy
Ask AI
import { z } from 'zod';import { zodToJsonSchema } from 'zod-to-json-schema';const anchorClient = new Anchorbrowser()// Define the expected output structure using Zod schemaconst outputSchema = z.object({ nodes_cpu_usage: z.array( z.object({ node: z.string(), // Node name cluster: z.string(), // Cluster identifier cpu_avg_percentage: z.number(), // CPU usage percentage }) )});// Execute the AI task with structured outputconst result = await anchorClient.agent.task('Collect the node names and their CPU average %', { taskOptions: { outputSchema: zodToJsonSchema(outputSchema), // Convert to JSON Schema url: 'https://play.grafana.org/a/grafana-k8s-app/navigation/nodes?from=now-1h&to=now&refresh=1m', }});console.info(result);
Securely pass credentials and sensitive data to AI agents during task execution. Secret values are not logged and automatically cleaned up after completion.