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

# autogen.agents.experimental.ThinkNode

<h2 id="autogen.agents.experimental.ThinkNode" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

  <span class="doc doc-object-name doc-class-name">ThinkNode</span>
</h2>

```python theme={null}
ThinkNode(content: str, parent: ForwardRef('ThinkNode') | None = None)
```

A node in a tree structure representing a step in the reasoning process.<br />This class implements a tree node that stores content (text describing a reasoning step),
maintains parent-child relationships, tracks node statistics, and provides utilities
for traversing/visualizing the reasoning path.<br />

<b>Parameters:</b>

| Name      | Description                                                                                                                         |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `content` | **Type:** str                                                                                                                       |
| `parent`  | **Type:** ForwardRef('[ThinkNode](/docs/api-reference/autogen/agents/experimental/ThinkNode)') \| None<br /><br />**Default:** None |

### Static Methods

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### from\_dict

```python theme={null}
from_dict(data: dict[str, Any], parent: ForwardRef('ThinkNode') | None = None) -> ThinkNode
```

Create ThinkNode from dictionary representation.<br />

<b>Parameters:</b>

| Name     | Description                                                                                                                                                             |
| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`   | dictionary containing node data<br /><br />**Type:** dict\[str, typing.Any]                                                                                             |
| `parent` | Parent node to attach to<br /><br />**Type:** ForwardRef('[ThinkNode](/docs/api-reference/autogen/agents/experimental/ThinkNode)') \| None<br /><br />**Default:** None |

<b>Returns:</b>

| Type                                                                   | Description                                     |
| ---------------------------------------------------------------------- | ----------------------------------------------- |
| [ThinkNode](/docs/api-reference/autogen/agents/experimental/ThinkNode) | ThinkNode: Reconstructed node with all children |

<br />

### Instance Attributes

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### trajectory

<br />

Get a formatted string representation of the path from root to this node.<br />Returns: <br />    str: A formatted string showing the question and each step in the reasoning process

### Instance Methods

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### backpropagate

```python theme={null}
backpropagate(self, reward: float) -> None
```

Update the score of this node and its parents using moving average.<br />

<b>Parameters:</b>

| Name     | Description                                                         |
| -------- | ------------------------------------------------------------------- |
| `reward` | The reward to backpropagate up the tree.<br /><br />**Type:** float |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### to\_dict

```python theme={null}
to_dict(self) -> dict[str, Any]
```

Convert ThinkNode to dictionary representation.<br />Returns: <br />    dict\[str, Any]: dictionary containing all node attributes and recursive children

<b>Returns:</b>

| Type                   | Description                                                                       |
| ---------------------- | --------------------------------------------------------------------------------- |
| dict\[str, typing.Any] | dict\[str, Any]: dictionary containing all node attributes and recursive children |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### visualize\_tree

```python theme={null}
visualize_tree(self) -> None
```

Visualize the tree of thoughts using graphviz.

<br />
