The BrowserAgent class for browser automation.
BrowserAgent
is the primary class for browser automation with Magnitude. It provides a high-level, AI-powered API for controlling a web browser.
An agent is created and initialized using the startBrowserAgent
function.
startBrowserAgent(options?)
BrowserAgent
instance.
act(description, options?)
{key}
which will be substituted by values from options.data
.nav(url: string)
page
and context
Page
and BrowserContext
.
extract(instructions, schema)
BrowserAgent
provides a powerful extract()
method that uses AI to pull structured data from a webpage based on your instructions and a Zod schema.
.describe()
calls to your schema fields can significantly improve the accuracy of the extraction by providing more context to the AI.stop()