Adds a message to the conversation history
The message to add
Gets all messages in the conversation
Gets the most recent N messages
Number of messages to retrieve
Records a cost incurred during agent execution
The cost information to record
Gets the total cost of all operations in this context
Gets all recorded costs
Sets a budget limit for this context
Maximum allowed cost in dollars
Gets the remaining budget
The remaining budget, or undefined if no budget was set
Checks if the budget has been exceeded
Gets the duration of the context in milliseconds
Execution context for an AI agent, managing conversation history, cost tracking, and budgets.
Example