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

# Get Message Count • AI Agent SDK

> get_message_count: Get the number of messages in the transcript window.

# get\_message\_count

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**PreparedTurnContext**](../classes/PreparedTurnContext) class in the [**turn\_context**](../modules/turn_context) module.

Get the number of messages in the transcript window.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def get_message_count() -> int
```

### Returns

<ResponseField name="Returns" type="int">
  The result of the operation.
</ResponseField>

## Used By

* [`DefaultTurnContextBuilder.build_context`](../functions/DefaultTurnContextBuilder-build_context)
* [`PreparedTurnContext.to_dict`](../functions/PreparedTurnContext-to_dict)

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/runtime/turn_context.py#L247">
  `praisonaiagents/runtime/turn_context.py` at line 247
</Card>
