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

# Context Snapshot • AI Agent SDK

> context_snapshot: Emit context snapshot event with full context state.

# context\_snapshot

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

> This is a method of the [**ContextTraceEmitter**](../classes/ContextTraceEmitter) class in the [**context\_events**](../modules/context_events) module.

Emit context snapshot event with full context state.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def context_snapshot(agent_name: str, messages_count: int, tokens_used: int, tokens_budget: int, messages: Optional[List[Dict[str, Any]]]) -> None
```

## Parameters

<ParamField query="agent_name" type="str" required={true}>
  No description available.
</ParamField>

<ParamField query="messages_count" type="int" required={true}>
  No description available.
</ParamField>

<ParamField query="tokens_used" type="int" required={true}>
  No description available.
</ParamField>

<ParamField query="tokens_budget" type="int" required={true}>
  No description available.
</ParamField>

<ParamField query="messages" type="Optional" required={false}>
  No description available.
</ParamField>

## Uses

* `ContextEvent`
* `time.time`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/trace/context_events.py#L763">
  `praisonaiagents/trace/context_events.py` at line 763
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Context Concept" icon="layer-group" href="/docs/docs/concepts/context" />

  <Card title="Context Management" icon="sliders" href="/docs/docs/features/context-management" />

  <Card title="Context Strategies" icon="diagram-project" href="/docs/docs/features/context-strategies" />
</CardGroup>
