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

# What are Agents?

> Agents are AI programs that use tools to accomplish tasks.

Agents are a stateful control loop around a stateless model. The model reasons and calls tools in a loop, guided by instructions. Add memory, knowledge, tools, guardrails, and middleware as needed.

```python theme={null}
from definable.agent import Agent
from definable.tool.decorator import tool

@tool
def search_web(query: str) -> str:
    """Search the web for information."""
    return f"Results for: {query}"

agent = Agent(
    model="gpt-4o",
    tools=[search_web],
    instructions="You are a research assistant.",
)

output = agent.run("What are the latest developments in quantum computing?")
print(output.content)
```

## Guides

<CardGroup cols={3}>
  <Card title="Build Agents" icon="wrench" iconType="duotone" href="/agents/building-agents">
    Create agents with tools and instructions.
  </Card>

  <Card title="Run Agents" icon="play" iconType="duotone" href="/agents/running-agents">
    Execute agents sync, async, and with streaming.
  </Card>

  <Card title="Configure Agents" icon="gear" iconType="duotone" href="/agents/configuration">
    Control retries, limits, compression, and tracing.
  </Card>
</CardGroup>

## Key Concepts

| Concept                          | What it does                                             |
| -------------------------------- | -------------------------------------------------------- |
| [Tools](/tools/overview)         | Functions the agent can call to take actions             |
| [Knowledge](/knowledge/overview) | RAG pipeline for grounding responses in documents        |
| [Memory](/memory/overview)       | Persistent session history across conversations          |
| [Thinking](/reasoning/thinking)  | Reasoning phase before generating responses              |
| [Middleware](/agents/middleware) | Composable wrappers for logging, retries, metrics        |
| [Tracing](/agents/tracing)       | Structured event export for debugging                    |
| [Security](/agents/security)     | Tool policies, rate limiting, prompt injection detection |
| [Evaluation](/agents/evaluation) | Accuracy, performance, and reliability testing           |

## Beyond Single Agents

| Abstraction                         | What it does                                                                      |
| ----------------------------------- | --------------------------------------------------------------------------------- |
| [**Team**](/teams/overview)         | Multiple agents that coordinate, route, collaborate, or divide tasks              |
| [**Workflow**](/workflows/overview) | Orchestrate agents through sequential, parallel, conditional, and iterative steps |

## Usage Examples

<CardGroup cols={3}>
  <Card title="Agent with Tools" icon="wrench" href="/agents/usage/agent-with-tools">
    Multiple tools with parallel execution.
  </Card>

  <Card title="Agent with Knowledge" icon="book" href="/agents/usage/agent-with-knowledge">
    RAG-grounded responses from documents.
  </Card>

  <Card title="Agent with Memory" icon="brain" href="/agents/usage/agent-with-memory">
    Persistent memory across conversations.
  </Card>

  <Card title="Structured Output" icon="brackets-curly" href="/agents/usage/agent-with-structured-output">
    Return typed Pydantic models.
  </Card>

  <Card title="Streaming" icon="signal-stream" href="/agents/usage/agent-with-streaming">
    Stream tokens in real time.
  </Card>
</CardGroup>

## Resources

* [Agent reference](/reference/agents/agent)
* [AgentConfig reference](/reference/agents/config)
* [RunOutput reference](/reference/agents/run-output)
* [Agent examples](/examples/agents)
