# Agentic Search

> The Agentic Search is a technique where an AI agent finds information by itself using search tools in several steps.

## What is agentic search vs RAG?

The technique where an agent searches iteratively with tools like 'grep', file reading or web search, refining queries based on what it finds. Coding agents often use it instead of a vector index to explore codebases.

- Topic: Retrieval
- Type: technique

## Example

Wrong:

```js
const hits = await grep('handleLogin');
return agent.answer(question, hits);
```

Right:

```js
let query = 'handleLogin';
for (let i = 0; i < 5; i++) {
  const hits = await grep(query);
  const step = await agent.review(question, hits);
  if (step.done) return step.answer;
  query = step.nextQuery;
}
```

Agentic search feeds each result back to the agent, which refines the next 'grep' query until it has enough context instead of answering from one search.

## Common mistakes

- The agent keeps searching in circles without a stop condition.

## Key points

- The agent has a limit on the number of searches or steps.
- Search results are treated as data, and instructions inside them are not followed.
- The final answer links to the sources it actually read.

## Interview questions

### Is agentic search slower than RAG?

Usually, yes. Each extra search adds a model call and a tool call, so it suits harder questions more than simple lookups.

### What tools does agentic search use?

Commonly web search, file search, database queries or a vector index, exposed as tools the agent can call.

### When is classic RAG enough?

When one retrieval step reliably finds the answer, such as FAQ or docs lookup. It is faster and cheaper than an agent loop.

## Related cards

- [RAG](https://wonderium.dev/ai/rag.md)
- [Deep Research](https://wonderium.dev/ai/deep-research.md)
- [AI Agent](https://wonderium.dev/ai/ai-agent.md)
- [Tool Calling](https://wonderium.dev/ai/tool-calling.md)

---

- Level: [Artificial Intelligence](https://wonderium.dev/ai.md)
- HTML version: https://wonderium.dev/ai/agentic-search
- Last updated: 2026-11-25
