Overview
ThecreateEvent function creates a new event within the active step. Events track granular operations like LLM calls, API requests, or custom actions.
Syntax
Parameters
Optional object with event configuration:
Returns
Returns a Promise that resolves to an object with:eventId- Unique identifier for the eventstepId- Step the event is associated with
Examples
Basic Event Creation
Manual LLM Event Tracking
While LLM calls are auto-tracked with providers, you can create manual events:Non-LLM Events
With Screenshots
Batch Operations
Auto-Tracking vs Manual Events
Auto-Tracked (with providers)
Manual Events
Use manual events for:- Non-LLM operations
 - Custom LLM providers
 - External API calls
 - Database operations
 - File I/O
 - Custom tracking needs
 
Best Practices
1. Descriptive Events
2. Track Costs
3. Group Related Events
Notes
- Events must be created within an active step
 - Auto-tracked LLM calls don’t need manual event creation
 - Event IDs are returned for later updates
 - All parameters are optional
 
See Also
- updateEvent - Update event properties
 - createStep - Create steps to contain events
 - Provider Integrations - Auto-tracking setup