> ## Documentation Index
> Fetch the complete documentation index at: https://genai.codewithsiva.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Tools & Agents

> Build autonomous systems that use models to reason, make decisions, and interact with external tools

Agents are systems that use a language model to choose a sequence of actions to take. In chains, a sequence of actions is hardcoded. In agents, a language model is used as a reasoning engine to determine which actions to take and in what order.

## What is an Agent?

An Agent consists of three main components:

1. **The Model**: The LLM that acts as the core reasoning engine.
2. **Tools**: Functions or APIs that the agent can choose to execute (e.g. search engines, calculator, database retrievers).
3. **The Agent Loop**: The prompt-based loop (commonly ReAct: Reason and Action) that coordinates reasoning steps, tool calling, and parsing results.

## The ReAct Framework

ReAct stands for **Reasoning and Acting**. It allows LLMs to solve complex problems by combining reasoning traces (thoughts) with action execution (tool calls). The cycle continues until the agent determines it has enough information to formulate the final answer:

```mermaid theme={null}
graph TD
    Thought["1. Thought: Reason about the query"]
    Action["2. Action: Select and execute a tool"]
    Observation["3. Observation: Read tool execution results"]
    Final["4. Final Answer: Formulate the response"]

    Thought --> Action
    Action --> Observation
    Observation --> Thought
    Observation --> Final
```

In the next sections, we will cover how to build basic ReAct agents, add memory, load retriever tools, and build custom tools using various construct methods.
