context_events
AI Agent 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
Import
Classes
ContextEventType
Types of context events for replay.
ContextEvent
A single context event for replay.
ContextTraceSinkProtocol
Protocol for context trace event sinks.
ContextNoOpSink
No-operation sink that discards all events.
ContextListSink
Sink that collects events in a list.
ContextTraceEmitter
Emitter for context trace events.
Functions
get_context_emitter()
Get the current context trace emitter.
set_context_emitter()
Set the context trace emitter for the current async context.
reset_context_emitter()
Reset the context emitter to its previous state.
trace_context()
Context manager for trace emitter lifecycle.
copy_context_to_callable()
Wrap a callable to copy the current context to the new thread/executor.

