The digital world is drowning in unstructured data. It’s trapped in emails, support tickets, PDFs, and scattered across millions of web pages. For decades, developers have fought a valiant but frustrating battle to tame this chaos with custom parsers, complex regular expressions, and brittle ETL pipelines. Change one div on a website, and your scraper breaks. Receive an invoice in a slightly new format, and your script fails.
This endless cycle of building, breaking, and fixing is a significant drain on resources. But what if you could skip the tedious part? What if, instead of telling a machine how to find the data, you could simply tell it what data you need?
Welcome to the paradigm shift powered by extract.do. Our AI Agent doesn't need step-by-step instructions. It just needs a blueprint—your desired data schema—to intelligently extract and structure information from any source.
Let's pull back the curtain and explore how this powerful process works.
Traditional data extraction is an imperative process. You write explicit, step-by-step commands: "Go to this URL, find the HTML element with the class product-title, get its inner text, then find the element with the ID price, and so on." This is fragile and depends entirely on the source's structure remaining static.
extract.do embraces a declarative approach, a concept we call Data as Code. You don't write the extraction logic; you define the final output. You provide a simple schema, and our AI handles the rest.
This moves the complexity away from your codebase and into our intelligent agent, turning a complex engineering challenge into a single, elegant API call.
The secret to extract.do's accuracy and flexibility lies in the schema you provide. This can be a simple JSON object or, for added clarity and type safety, a TypeScript interface. This schema acts as a "shopping list" for our AI Agent.
Let’s look at a simple example. Imagine you have the following text:
'Contact John Doe at j.doe@example.com. He is the CEO of Acme Inc.'
You want to extract the contact’s details. With extract.do, you simply define the structure you want:
interface ContactInfo {
name: string;
email: string;
company: string;
}
This interface is more than just a list of fields. It's a rich set of instructions for the AI:
The field names you choose provide critical context, guiding the agent to find precisely the data you're looking for.
So, what happens when you run the agent? How does it get from raw text to clean JSON? The process is a sophisticated blend of comprehension, search, and transformation.
import { DO } from '@do-inc/sdk';
// Initialize the .do client
const secret = process.env.DO_SECRET;
const digo = new DO({ secret });
// Define the source and the extraction task
const sourceText = 'Contact John Doe at j.doe@example.com. He is the CEO of Acme Inc.';
// Run the extraction agent
const extractedData = await digo
.agent<ContactInfo>('extract')
.run({
source: sourceText,
description: 'Extract the full name, email, and company from the text.'
});
console.log(extractedData);
// {
// "name": "John Doe",
// "email": "j.doe@example.com",
// "company": "Acme Inc."
// }
Here's what happens under the hood during that .run() call:
First, the agent ingests the source data, whether it's raw text, the HTML from a URL, or text extracted from a document. It doesn't just see a string of characters. It uses advanced language models to understand the content's meaning, context, and the relationships between different entities. It knows "CEO of Acme Inc." connects "John Doe" to a company.
Armed with this understanding, the AI Agent consults your schema—our ContactInfo interface. It now has a targeted mission. It's not just crawling text randomly; it's actively seeking data points that correspond to a "name," an "email," and a "company."
This is where the real intelligence shines. The agent identifies "John Doe" and confidently maps it to the name field. It recognizes the j.doe@example.com string as an email and maps it to email. Most impressively, it correctly infers that "Acme Inc." is the entity that maps to the company field. If there were multiple companies mentioned, the agent would use the context to disambiguate and find the one most relevant to John Doe.
Finally, the agent assembles the extracted data points into a clean JSON object that perfectly matches your schema. It doesn't return messy HTML, extra whitespace, or unrelated text. It delivers exactly what you asked for, in the format you defined, ready for immediate use in your application.
While extract.do is a game-changer for web scraping, its applications are far broader. Because it's source-agnostic, you can point it at any unstructured text source:
This is the power of replacing a complex, brittle ETL pipeline with a single, intelligent API call.
The era of writing and maintaining custom extraction scripts is over. With extract.do, you can shift your focus from the tedious mechanics of how to get data to the valuable goal of what data you need.
By simply defining your desired schema, you empower an AI agent to handle the heavy lifting, adapting to source changes and delivering clean, structured JSON every time.
Ready to transform your data extraction workflow from business-as-usual to Business-as-Code? Get started with extract.do today and get your first structured data in minutes.