Introduction
In 2026, the term "agentic search" has become a buzzword, but the underlying concept is both powerful and straightforward. Agentic search refers to the pattern where an AI agent autonomously decides when, what, and how to search the web as part of completing a task. Unlike traditional RAG where every query triggers a search, agentic search is dynamic and context-aware.
What Is an AI Agent?
An AI agent is an LLM that has been given access to tools (like web search, code execution, or database queries) and the ability to decide which tools to use and when. The key difference from a simple chatbot is autonomy: the agent plans, acts, observes, and iterates.
The ReAct Pattern
The most common pattern for agentic search is ReAct (Reasoning + Acting). The agent follows this loop:
- Reason: Think about what information is needed
- Act: Use a tool (like web search) to get that information
- Observe: Process the tool's output
- Repeat or Respond: Decide if more information is needed, or generate a final answer
ReAct Example with Keiro
import requests
from openai import OpenAI
client = OpenAI()
KEIRO_KEY = "your-keiro-api-key"
KEIRO_BASE = "https://kierolabs.space/api"
tools = [
{
"type": "function",
"function": {
"name": "web_search",
"description": "Search the web for current information",
"parameters": {
"type": "object",
"properties": {
"query": {"type": "string", "description": "The search query"}
},
"required": ["query"]
}
}
},
{
"type": "function",
"function": {
"name": "deep_research",
"description": "Perform deep research on a complex topic",
"parameters": {
"type": "object",
"properties": {
"query": {"type": "string", "description": "The research topic"}
},
"required": ["query"]
}
}
},
{
"type": "function",
"function": {
"name": "read_page",
"description": "Extract the full content of a specific web page",
"parameters": {
"type": "object",
"properties": {
"url": {"type": "string", "description": "The page URL"}
},
"required": ["url"]
}
}
}
]
def execute_tool(name: str, args: dict) -> str:
if name == "web_search":
resp = requests.post(f"{KEIRO_BASE}/search", json={
"apiKey": KEIRO_KEY,
"query": args["query"]
})
results = resp.json().get("results", [])
return "\n".join([f"- {r['title']}: {r.get('content', r.get('snippet', ''))} ({r['url']})" for r in results[:5]])
elif name == "deep_research":
resp = requests.post(f"{KEIRO_BASE}/research", json={
"apiKey": KEIRO_KEY,
"query": args["query"]
})
data = resp.json()
return data.get("summary", "No results found.")
elif name == "read_page":
resp = requests.post(f"{KEIRO_BASE}/web-crawler", json={
"apiKey": KEIRO_KEY,
"url": args["url"]
})
return resp.json().get("content", "Could not extract content.")[:5000]
return "Unknown tool"
The Agent Loop
import json
def run_agent(user_message: str) -> str:
messages = [
{"role": "system", "content": (
"You are a helpful research assistant with access to web search tools. "
"Use tools to find current, accurate information before answering. "
"You can search multiple times to gather comprehensive information."
)},
{"role": "user", "content": user_message}
]
while True:
response = client.chat.completions.create(
model="gpt-4o",
messages=messages,
tools=tools,
tool_choice="auto"
)
message = response.choices[0].message
messages.append(message)
# If no tool calls, we have the final answer
if not message.tool_calls:
return message.content
# Execute each tool call
for tool_call in message.tool_calls:
args = json.loads(tool_call.function.arguments)
result = execute_tool(tool_call.function.name, args)
messages.append({
"role": "tool",
"tool_call_id": tool_call.id,
"content": result
})
# Safety: limit iterations
if len(messages) > 20:
break
return "I was unable to complete the research. Please try a more specific question."
Why Keiro Is Ideal for Agentic Search
Keiro's multi-endpoint API maps naturally to the different actions an agent might take:
| Agent Need | Keiro Endpoint | When to Use |
|---|---|---|
| Quick lookup | /search | Simple factual questions |
| High-quality search | /search-pro | When precision matters |
| Deep research | /research | Complex topics needing synthesis |
| Direct answer | /answer | Straightforward questions |
| Read a page | /web-crawler | When the agent needs full page content |
| Context-aware search | /memory-search | Follow-up queries in a conversation |
Common Agentic Search Patterns
Pattern 1: Verify-Then-Answer
The agent searches to verify its knowledge before answering, only searching when the topic might have changed since its training data.
Pattern 2: Iterative Deepening
The agent starts with a broad search, identifies the most relevant angle, then performs a more targeted search. This is particularly effective with Keiro's combination of /search (broad) and /research (deep).
Pattern 3: Multi-Source Triangulation
The agent searches from multiple angles and cross-references results to identify consensus and contradictions. Keiro's free batch search makes this cost-effective.
Pattern 4: Search-Read-Search
The agent searches, reads the most promising result in full (via /web-crawler), then performs a follow-up search based on what it learned. This is the most thorough pattern.
Best Practices
- Give the agent clear tool descriptions: The better the tool descriptions, the better the agent will decide when to use each one.
- Limit iterations: Set a maximum number of tool calls to prevent infinite loops. 5-10 iterations is usually sufficient.
- Use the right endpoint for the right task: Do not use /research for a simple lookup, and do not use /search for a topic that needs deep investigation.
- Log all tool calls: In production, log every tool call and its results for debugging and quality analysis.
- Cost-aware design: With Keiro's Pro plan at $24.99/month for 200,000 requests, each tool call costs a fraction of a cent. The LLM reasoning is the expensive part.
Agentic Search vs Traditional RAG
| Aspect | Traditional RAG | Agentic Search |
|---|---|---|
| Search Trigger | Every query | Agent decides |
| Number of Searches | Exactly one | Zero to many |
| Query Formulation | User's original query | Agent reformulates |
| Depth | Single search pass | Iterative deepening |
| Cost | Predictable | Variable |
| Quality | Good for simple questions | Excellent for complex topics |
Conclusion
Agentic search represents the next evolution of AI-powered information retrieval. By giving LLMs the autonomy to decide when and how to search, we get more accurate, more thorough, and more natural interactions. Keiro's diverse set of endpoints makes it the ideal search backend for agentic systems, providing the right tool for every type of information need.
Build your first agentic search system with Keiro. Sign up at kierolabs.space.