> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-studio-tools-doc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Reasoning Reference

This reference covers the core data structures and events used across all reasoning approaches in Agno (Reasoning Models, Reasoning Tools, and Reasoning Agents).

## ReasoningStep

The `ReasoningStep` class represents a single step in the reasoning process, whether generated by Reasoning Tools, Reasoning Agents, or native reasoning models.

### Attributes

| Attribute     | Type                       | Default               | Description                                                |
| ------------- | -------------------------- | --------------------- | ---------------------------------------------------------- |
| `title`       | `Optional[str]`            | `None`                | A concise title for this reasoning step                    |
| `reasoning`   | `Optional[str]`            | `None`                | The detailed thought process or reasoning for this step    |
| `action`      | `Optional[str]`            | `None`                | The action to be taken based on this reasoning             |
| `result`      | `Optional[str]`            | `None`                | The outcome or result of executing the action              |
| `next_action` | `NextAction`               | `NextAction.CONTINUE` | What to do next (continue, validate, final\_answer, reset) |
| `confidence`  | `float`                    | `0.8`                 | Confidence level for this step (0.0 to 1.0)                |
| `metadata`    | `Optional[Dict[str, Any]]` | `None`                | Additional metadata for this step                          |

### NextAction Enum

The `NextAction` enum defines possible next steps in the reasoning process:

| Value          | Description                                              |
| -------------- | -------------------------------------------------------- |
| `CONTINUE`     | Continue with more reasoning steps                       |
| `VALIDATE`     | Validate the current solution before finalizing          |
| `FINAL_ANSWER` | Ready to provide the final answer                        |
| `RESET`        | Reset and restart the reasoning process (error detected) |

## ReasoningSteps

The `ReasoningSteps` class is a container for multiple reasoning steps, used as the structured output for Reasoning Agents.

### Attributes

| Attribute         | Type                       | Default | Description                                     |
| ----------------- | -------------------------- | ------- | ----------------------------------------------- |
| `reasoning_steps` | `List[ReasoningStep]`      | `[]`    | List of reasoning steps taken                   |
| `metadata`        | `Optional[Dict[str, Any]]` | `None`  | Additional metadata about the reasoning process |

## ReasoningTools

The `ReasoningTools` toolkit provides explicit tools for structured thinking.

### Constructor Parameters

| Parameter           | Type            | Default | Description                             |
| ------------------- | --------------- | ------- | --------------------------------------- |
| `enable_think`      | `bool`          | `True`  | Enable the `think()` tool               |
| `enable_analyze`    | `bool`          | `True`  | Enable the `analyze()` tool             |
| `all`               | `bool`          | `False` | Legacy parameter to enable both tools   |
| `instructions`      | `Optional[str]` | `None`  | Custom instructions for using the tools |
| `add_instructions`  | `bool`          | `False` | Add default instructions to agent       |
| `add_few_shot`      | `bool`          | `False` | Add few-shot examples to instructions   |
| `few_shot_examples` | `Optional[str]` | `None`  | Custom few-shot examples                |

### Methods

#### think()

Use as a scratchpad to reason about problems step-by-step.

**Parameters:**

| Parameter       | Type             | Default  | Description                                    |
| --------------- | ---------------- | -------- | ---------------------------------------------- |
| `session_state` | `Dict[str, Any]` | Required | Agent's session state (automatically provided) |
| `title`         | `str`            | Required | Concise title for this thinking step           |
| `thought`       | `str`            | Required | Detailed reasoning for this step               |
| `action`        | `Optional[str]`  | `None`   | What you'll do based on this thought           |
| `confidence`    | `float`          | `0.8`    | Confidence level (0.0 to 1.0)                  |

**Returns:** `str` - Formatted list of all reasoning steps taken so far

#### analyze()

Analyze results from previous actions and determine next steps.

**Parameters:**

| Parameter       | Type             | Default      | Description                                                 |
| --------------- | ---------------- | ------------ | ----------------------------------------------------------- |
| `session_state` | `Dict[str, Any]` | Required     | Agent's session state (automatically provided)              |
| `title`         | `str`            | Required     | Concise title for this analysis                             |
| `result`        | `str`            | Required     | Outcome of the previous action                              |
| `analysis`      | `str`            | Required     | Your evaluation of the results                              |
| `next_action`   | `str`            | `"continue"` | What to do next: "continue", "validate", or "final\_answer" |
| `confidence`    | `float`          | `0.8`        | Confidence level (0.0 to 1.0)                               |

**Returns:** `str` - Formatted list of all reasoning steps taken so far

## Reasoning Events

Events emitted during reasoning processes when using Reasoning Agents or Reasoning Models.

### Event Types

| Event Type           | Description                                  |
| -------------------- | -------------------------------------------- |
| `ReasoningStarted`   | Indicates the start of the reasoning process |
| `ReasoningStep`      | Contains a single reasoning step             |
| `ReasoningCompleted` | Signals completion of the reasoning process  |

### ReasoningStartedEvent

Emitted when reasoning begins.

**Attributes:**

| Attribute    | Type            | Default              | Description                      |
| ------------ | --------------- | -------------------- | -------------------------------- |
| `event`      | `str`           | `"ReasoningStarted"` | Event type                       |
| `run_id`     | `Optional[str]` | `None`               | ID of the current run            |
| `agent_id`   | `Optional[str]` | `None`               | ID of the reasoning agent        |
| `created_at` | `int`           | Current timestamp    | Unix timestamp of event creation |

### ReasoningStepEvent

Emitted for each reasoning step during the process.

**Attributes:**

| Attribute           | Type            | Default           | Description                              |
| ------------------- | --------------- | ----------------- | ---------------------------------------- |
| `event`             | `str`           | `"ReasoningStep"` | Event type                               |
| `content`           | `Optional[Any]` | `None`            | Content of the reasoning step            |
| `content_type`      | `str`           | `"str"`           | Type of the content                      |
| `reasoning_content` | `str`           | `""`              | Detailed reasoning content for this step |
| `run_id`            | `Optional[str]` | `None`            | ID of the current run                    |
| `agent_id`          | `Optional[str]` | `None`            | ID of the reasoning agent                |
| `step_number`       | `Optional[int]` | `None`            | The sequential number of this step       |
| `created_at`        | `int`           | Current timestamp | Unix timestamp of event creation         |

### ReasoningCompletedEvent

Emitted when reasoning finishes.

**Attributes:**

| Attribute            | Type                            | Default                | Description                         |
| -------------------- | ------------------------------- | ---------------------- | ----------------------------------- |
| `event`              | `str`                           | `"ReasoningCompleted"` | Event type                          |
| `content`            | `Optional[Any]`                 | `None`                 | Final reasoning content             |
| `content_type`       | `str`                           | `"str"`                | Type of the content                 |
| `reasoning_steps`    | `Optional[List[ReasoningStep]]` | `None`                 | All reasoning steps taken           |
| `reasoning_messages` | `Optional[List[Message]]`       | `None`                 | Messages from the reasoning process |
| `run_id`             | `Optional[str]`                 | `None`                 | ID of the current run               |
| `agent_id`           | `Optional[str]`                 | `None`                 | ID of the reasoning agent           |
| `created_at`         | `int`                           | Current timestamp      | Unix timestamp of event creation    |

## Agent Configuration for Reasoning

### Reasoning Agent Parameters

Parameters for configuring Reasoning Agents (`reasoning=True`):

| Parameter             | Type              | Default | Description                                                 |
| --------------------- | ----------------- | ------- | ----------------------------------------------------------- |
| `reasoning`           | `bool`            | `False` | Enable reasoning agent mode                                 |
| `reasoning_model`     | `Optional[Model]` | `None`  | Separate model for reasoning (if different from main model) |
| `reasoning_agent`     | `Optional[Agent]` | `None`  | Custom reasoning agent instance                             |
| `reasoning_min_steps` | `int`             | `1`     | Minimum number of reasoning steps                           |
| `reasoning_max_steps` | `int`             | `10`    | Maximum number of reasoning steps                           |

### Display Parameters

Parameters for showing reasoning during execution:

| Parameter             | Type   | Default | Description                                  |
| --------------------- | ------ | ------- | -------------------------------------------- |
| `show_full_reasoning` | `bool` | `False` | Display complete reasoning process in output |
| `stream_events`       | `bool` | `False` | Stream each reasoning step in real-time      |

## See Also

* [Reasoning Overview](/reasoning/overview) - Introduction to reasoning approaches
* [Reasoning Agents Guide](/reasoning/reasoning-agents) - Using Reasoning Agents
* [Reasoning Tools Guide](/reasoning/reasoning-tools) - Using Reasoning Tools
* [Reasoning Models Guide](/reasoning/reasoning-models) - Using native reasoning models
