> ## 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 Events • AI Agent SDK

> Context Events for PraisonAI Agents.

# context\_events

<Badge color="blue">AI Agent</Badge>

Context Events for PraisonAI Agents.

Provides context-level tracing for replay functionality.
Tracks context changes during agent execution for debugging and replay.

Zero Performance Impact:

* NoOpSink is the default (zero overhead when not used)
* Disabled emitter has near-zero overhead
* Uses **slots** for memory efficiency

Schema Version: 1.0

## Import

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents.trace import context_events
```

## Classes

<CardGroup cols={2}>
  <Card title="ContextEventType" icon="brackets-curly" href="../classes/ContextEventType">
    Types of context events for replay.
  </Card>

  <Card title="ContextEvent" icon="brackets-curly" href="../classes/ContextEvent">
    A single context event for replay.
  </Card>

  <Card title="ContextTraceSinkProtocol" icon="brackets-curly" href="../classes/ContextTraceSinkProtocol">
    Protocol for context trace event sinks.
  </Card>

  <Card title="ContextNoOpSink" icon="brackets-curly" href="../classes/ContextNoOpSink">
    No-operation sink that discards all events.
  </Card>

  <Card title="ContextListSink" icon="brackets-curly" href="../classes/ContextListSink">
    Sink that collects events in a list.
  </Card>

  <Card title="ContextTraceEmitter" icon="brackets-curly" href="../classes/ContextTraceEmitter">
    Emitter for context trace events.
  </Card>
</CardGroup>

## Functions

<CardGroup cols={2}>
  <Card title="get_context_emitter()" icon="function" href="../functions/get_context_emitter">
    Get the current context trace emitter.
  </Card>

  <Card title="set_context_emitter()" icon="function" href="../functions/set_context_emitter">
    Set the context trace emitter for the current async context.
  </Card>

  <Card title="reset_context_emitter()" icon="function" href="../functions/reset_context_emitter">
    Reset the context emitter to its previous state.
  </Card>

  <Card title="trace_context()" icon="function" href="../functions/trace_context">
    Context manager for trace emitter lifecycle.
  </Card>

  <Card title="copy_context_to_callable()" icon="function" href="../functions/copy_context_to_callable">
    Wrap a callable to copy the current context to the new thread/executor.
  </Card>
</CardGroup>

### Constants

| Name                     | Value   |
| ------------------------ | ------- |
| `CONTEXT_SCHEMA_VERSION` | `'1.0'` |

***

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