Sales and marketing teams know the grind all too well. A new lead comes in—an email address, a name. The manual, multi-tab shuffle begins: search the CRM, look them up on LinkedIn, find their company's website, try to guess the company's size from a third-party tool. It's a time-consuming, repetitive process that steals focus from high-value activities.
What if you could collapse that entire workflow into a single, instant action? What if you could define that complex data hunt once and turn it into a reusable, intelligent service for your entire team?
Welcome to the world of agentic search. With Searches.do, you can build smart "search agents" that execute complex data retrieval tasks and deliver the results via a simple API. In this guide, we'll walk you through building your very first search agent to automate lead enrichment, transforming a tedious manual task into powerful Business-as-Code.
Think of a search agent as a specialized digital employee you train to perform a specific data retrieval task. Instead of just running a simple database query, an agent can execute a multi-step workflow you define. This concept is at the heart of API as a Service.
An agent can:
With Searches.do, you define this logic using a simple TypeScript SDK. Once defined, our platform instantly deploys it as a secure, scalable, and production-ready Data Retrieval API. You get all the power of a custom microservice without the headache of building, deploying, and maintaining the infrastructure.
Our goal is to build an agent that takes a single piece of information—a prospect's email address—and returns a rich, consolidated profile.
Here’s the plan for our agent:
This ability to search across multiple, disparate data sources is a core strength of the Searches.do platform.
Let's get our hands dirty. Building an agent involves three simple steps: defining the agent, writing the logic, and deploying.
First, you'll use the Searches.do TypeScript SDK to declare your agent. You give it a unique ID and specify the input parameters it expects.
// Define the structure of our search agent
import { buildSearch } from '@searches.do/sdk';
export default buildSearch({
// A unique ID for our API endpoint
searchId: 'enrich-lead-by-email',
// Define the expected input parameters
parameters: {
email: {
type: 'string',
required: true,
description: 'The email address of the lead to enrich.',
},
},
// The handler function contains the magic
handler: async ({ parameters }) => {
// ... Logic goes here in the next step
},
});
This is where you codify your business process. The handler function is where you orchestration your queries and data transformations. It receives the input parameters and returns the final result.
// Inside the handler function from Step 1...
handler: async ({ parameters }) => {
const { email } = parameters;
// 1. Query our internal database (e.g., a PostgreSQL CRM)
const internalUser = await db.query(
'SELECT * FROM customers WHERE email = $1',
[email]
);
// 2. Call an external enrichment API (e.g., Clearbit)
const enrichmentResponse = await fetch(
`https://api.thirdparty.com/v1/enrich?email=${email}`,
{ headers: { Authorization: `Bearer ${process.env.ENRICHMENT_API_KEY}` } }
);
const externalData = await enrichmentResponse.json();
// 3. Combine the data into a single, unified result
const result = {
crmData: internalUser.rows[0] || null,
enrichmentData: externalData || null,
};
// 4. Return the result
return { status: 'success', data: result };
}
Once your code is written, you're done. Searches.do handles the rest. Our platform automatically:
You just built a production-grade microservice in minutes.
Now that your agent is live, you can call it from anywhere—your frontend application, a Slack bot, a marketing automation tool, or even a simple cURL command. This is Headless Search in action; the powerful logic is completely decoupled from any specific interface.
Here’s what a call to your new API endpoint looks like:
{
"status": "success",
"query": {
"searchId": "enrich-lead-by-email",
"parameters": {
"email": "jane.doe@example.com"
}
},
"result": {
"crmData": {
"customerId": "cust_1A2b3C4d5E6f",
"accountStatus": "active"
},
"enrichmentData": {
"fullName": "Jane Doe",
"title": "VP of Engineering",
"company": {
"name": "Example Corp",
"employees": 500,
"industry": "SaaS"
},
"linkedin": "https://linkedin.com/in/janedoe"
}
},
"executionTimeMs": 124
}
Look at that. With one API call, you retrieved data from your internal CRM and an external service, delivering a complete, actionable profile. You've successfully automated lead enrichment.
You've just seen how agentic search transforms a complex data retrieval workflow into a simple, reusable asset. By encapsulating your business logic into code, you create scalable "Services-as-Software" that empower your entire organization. This is the future of data retrieval.
Ready to build your own intelligent search agents? Visit Searches.do to get started!
Q: What is Searches.do?
A: Searches.do is an agentic workflow platform that lets you transform any data retrieval logic into a standardized, secure, and scalable API endpoint, effectively offering your unique search capabilities as a service.
Q: How do I define a search agent?
A: You define a search using our simple TypeScript SDK. You specify the input parameters and write the handler function that contains your data lookup logic, whether it's querying a database, calling another API, or searching a file system.
Q: Can I search across multiple data sources?
A: Absolutely. The handler function you write can contain any logic you need, including fetching and aggregating data from multiple disparate sources like SQL databases, NoSQL stores, and third-party APIs to return a single, unified result.
Q: Is the Searches.do platform secure?
A: Yes. The .do platform provides a secure API gateway for your search agents, managing authentication, authorization, and rate-limiting, so you can safely expose your data services without building complex infrastructure from scratch.