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

# Agents

> The agent loop in five recognizable scenarios — ReAct tool use, conversational memory, multi-agent handoff, planning, streamed events.

Agent examples cover the loop end-to-end through scenarios you'd build yourself. Sources under [`examples/agents/`](https://github.com/0xvasanth/cognis/tree/main/examples/agents).

| Name                      | Scenario                                                                                | Source                                                                                            |
| ------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `agents_react_agent`      | The canonical ReAct agent — model decides which tool to call to answer a question.      | [src](https://github.com/0xvasanth/cognis/blob/main/examples/agents/react_agent.rs)               |
| `agents_conversational`   | Multi-turn recall test — user gives their name in turn 1, asks for it in turn 2.        | [src](https://github.com/0xvasanth/cognis/blob/main/examples/agents/conversational_agent.rs)      |
| `agents_multi_agent`      | Sequential handoff — one agent's reply becomes the next agent's input.                  | [src](https://github.com/0xvasanth/cognis/blob/main/examples/agents/multi_agent_collaboration.rs) |
| `agents_planning`         | Planning middleware — the agent drafts a plan before tool selection.                    | [src](https://github.com/0xvasanth/cognis/blob/main/examples/agents/planning_demo.rs)             |
| `agents_streaming_events` | Stream lifecycle events from a running agent — what wires into a UI's progress display. | [src](https://github.com/0xvasanth/cognis/blob/main/examples/agents/streaming_agent_events.rs)    |

## How to run

```bash theme={null}
COGNIS_PROVIDER=ollama COGNIS_OLLAMA_MODEL=llama3.1 \
  cargo run -p cognis-examples --example agents_react_agent
```

## See also

<CardGroup cols={2}>
  <Card title="Agents and the loop" icon="robot" href="/core-ideas/agents">
    The mental model.
  </Card>

  <Card title="Multi-agent" icon="people-arrows" href="/building-agents/multi-agent">
    Sequential / Supervisor / ParallelVote / RoundRobin strategies.
  </Card>

  <Card title="Memory examples" icon="brain" href="/examples/memory">
    Plug memory into any of these agents.
  </Card>

  <Card title="Patterns → Research assistant" icon="grid" href="/patterns/research-assistant">
    A worked multi-agent application.
  </Card>
</CardGroup>
