Basic usage
The integration is based on theCrewAIEventListener class, which implements CrewAI’s event listener. To use it, create an instance of the listener before you kick off your crew, for example in your run function. When this listener is created, it automatically registers event handlers to capture the relevant events.
CrewAIEventListener captures various CrewAI events, including:
- Crew Kickoff events
- Agent events
- Task events
- Tool usage
- LLM calls
- Input prompts and messages
- Output responses
- Model information
- Timing data
- Token usage
- Error information (if any)
CrewAIEventListener automatically handles nested crews and agents, creating a hierarchical trace that reflects the structure of your CrewAI application.
Use a custom logger
When initializing theCrewAIEventListener, you can optionally specify a Galileo logger instance, either by creating a new logger, or by using the current logger from the Galileo context:
log decorator, or from inside an experiment.
Session and trace support
Every time you kick off a crew, a new session and trace is created. If you want to manually manage sessions or traces, you can do this using by passing a Galileo logger instance to the listener. To add the crew kickoff as a new trace to an existing session, create the session first using the logger instance that was used to create the listener:start_new_trace parameter to False.
Next steps
Basic logging components
Galileo logger
Log with full control over sessions, traces, and spans using the Galileo logger.
Log decorator
Quickly add logging to your code with the log decorator and wrapper.
Galileo context
Manage logging using the Galileo context manager.