In today's fragmented digital landscape, data rarely lives in one place. For an e-commerce business, product information might be scattered across an internal SQL database, a Shopify store, and an Amazon FBA warehouse. This creates a significant challenge: how do you get a single, unified answer to a simple question like, "Where is product SKU-12345 and how many are in stock?"
Traditionally, solving this involved building a dedicated microservice, wrestling with multiple SDKs, managing data synchronization, and handling all the infrastructure overhead. It's a complex, time-consuming process that distracts from the core business logic.
But what if you could abstract all that complexity away? What if you could define that multi-source lookup logic once, using simple code, and instantly deploy it as a secure, scalable, and reusable service? This is the power of Agentic Search, a new paradigm for data retrieval, and we're going to explore it by building a "Universal Product Finder" with Searches.do.
Let's imagine our business, "Quantum Widgets," sells products through three channels:
When a customer support agent needs to find a product, they have to open three different browser tabs, log into three different systems, and manually search for the SKU. It's inefficient, error-prone, and a terrible user experience.
What we need is a single Data Retrieval API that can look up a product across all three sources and return a single, coherent answer.
The standard solution would be to build a new microservice. This project would involve:
About 80% of that work is undifferentiated heavy lifting. The only part that delivers unique business value is the query logic itself.
This is where the Business-as-Code philosophy comes in. Instead of building an entire service, you focus only on the code that defines the business operation. With Searches.do, you define this logic as a "Search Agent."
A Search Agent is a small, focused function that knows how to perform a specific data retrieval task. The platform then wraps this agent in a production-ready, secure, and scalable API endpoint. It’s API as a Service, but for your own custom business logic.
Let's design our agent. We'll use the TypeScript SDK provided by the platform.
Goal: Create a search agent named universal-product-finder.
Input: A single parameter, productId.
Logic: The agent will search for the productId in our data sources in a specific order:
The core of our agent would be its handler function, which might look conceptually like this:
// This is a conceptual example of the agent's handler logic
import { searchSql, searchShopify, searchAmazon } from './data-sources';
export async function handler({ productId }) {
// 1. Check the internal database first
let product = await searchSql(productId);
if (product) {
return { ...product, source: 'InternalDB' };
}
// 2. If not found, check Shopify
product = await searchShopify(productId);
if (product) {
return { ...product, source: 'Shopify' };
}
// 3. Finally, check Amazon
product = await searchAmazon(productId);
if (product) {
return { ...product, source: 'AmazonFBA' };
}
// 4. If not found anywhere, return null
return null;
}
This code is clean, focused, and contains only the essential business logic. It queries multiple disparate systems and aggregates the result, showcasing the power of a multi-source search agent. We don't have to worry about the API gateway, authentication, or scalability—the platform handles that.
Once we deploy this agent code to Searches.do, the platform instantly generates a secure API endpoint. Now, any authorized application can use our Universal Product Finder.
The customer support dashboard can make a simple API call to find a product, abstracting away the underlying complexity. This is Headless Search in its purest form—the powerful search logic is completely decoupled from the front-end presentation layer.
A call to our new API would look like this:
Request:
POST https://api.searches.do/run
Content-Type: application/json
Authorization: Bearer <YOUR_API_KEY>
{
"searchId": "universal-product-finder",
"parameters": {
"productId": "SKU-QW-789"
}
}
Response (if found in Shopify):
{
"status": "success",
"query": {
"searchId": "universal-product-finder",
"parameters": {
"productId": "SKU-QW-789"
}
},
"result": {
"productName": "Quantum Widget Pro",
"sku": "SKU-QW-789",
"price": 99.99,
"stock": 150,
"source": "Shopify"
},
"executionTimeMs": 124
}
Just like that, we've turned a complex, multi-system data retrieval problem into a single, elegant API call.
The true power of this approach is that we haven't just built a one-off solution. We've created a durable, reusable business asset. This universal-product-finder API can now be consumed by:
By encapsulating core business logic into a deployable agent, you are delivering Services-as-Software. You're building a library of intelligent, composable business capabilities that can accelerate development across your entire organization.
Ready to stop writing boilerplate and start building powerful data APIs? Explore Searches.do and transform your complex queries into simple, reusable services.