Data Extraction
Intelligently turn browser content into structured data
Extract 101
Pass instructions and a zod schema to extract()
in order to intelligently collect data from the current page:
Schemas can be any valid zod schema to capture complex data:
Data Chaining
Capturing structured data on its own is helpful. You could save that data to a filesystem, upload it to a database, or pass it off to another process.
However, you might want to integrate that data into another web application or trigger additional agent workflows with it.
A great way to do this is by using standard control flow based on extracted data, or passing data
to act
where needed:
Extractable content
extract()
will show the agent:
- A screenshot of the browser window
- A simplified version of the DOM content
- The instructions and schema you provide
As long as its clear enough how that data should be converted to the provdided zod schema, the agent will return data conforming to the schema based on what it sees in the browser.
Magnitude supports any schema that can be defined with zod
- including arrays, composite objects, numbers, strings, etc.
See https://zod.dev/ for more information about zod.