> ## 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.tools.ChatContext

<h2 id="autogen.tools.ChatContext" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

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

```python theme={null}
ChatContext(agent: ConversableAgent)
```

ChatContext class that extends BaseContext.<br />This class is used to represent a chat context that holds a list of messages.<br />It inherits from `BaseContext` and adds the `messages` attribute.<br />Initializes the ChatContext with an agent.<br />

<b>Parameters:</b>

| Name    | Description                |
| ------- | -------------------------- |
| `agent` | **Type:** ConversableAgent |

### Instance Attributes

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

#### chat\_messages

<br />

The messages in the chat.<br />Returns: <br />    A dictionary of agents and their messages.

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

#### last\_message

<br />

The last message in the chat.<br />Returns: <br />    The last message in the chat.
