ContextEvent
Defined in the Context Events module.AI Agent A single context event for replay. Represents a discrete change in agent context during execution. Designed for minimal memory footprint and fast serialization. Attributes: event_type: Type of context event timestamp: Unix timestamp when event occurred session_id: Session identifier for grouping events agent_name: Name of the agent (if applicable) sequence_num: Sequential event number within session messages_count: Number of messages in context at this point tokens_used: Tokens used in context at this point tokens_budget: Total token budget available data: Event-specific data (tool args, message content, etc.) branch_id: Optional branch identifier for parallel execution tracking prompt_tokens: Number of tokens in the prompt/request completion_tokens: Number of tokens in the completion/response cost_usd: Estimated cost in USD for this event content_hash: SHA256 hash of content for duplicate detection
Properties
ContextEventType
No description available.
float
No description available.
str
No description available.
Optional[str]
No description available.
int
No description available.
int
No description available.
int
No description available.
int
No description available.
Dict[str, Any]
No description available.
Optional[str]
No description available.
int
No description available.
int
No description available.
float
No description available.
Optional[str]
No description available.
Internal & Generic Methods
Internal & Generic Methods
- from_dict: Create ContextEvent from dictionary.
- to_dict: Convert to dictionary for serialization.
- to_json: Convert to JSON string.
Source
View on GitHub
praisonaiagents/trace/context_events.py at line 165
