Logger
crewai.Client
Crewai client implementation for API interactions and model integration.
get_log_level
Set logging level based on debug flag. debug=False: Only WARNING and ERROR logs debug=True: INFO and DEBUG logs
MaximUsageCallback
Maxim usage callback.
This class represents a usage callback.
__init__
Initialize a usage callback.
log_success_event
Log a success event.
Arguments:
Name | Description |
---|---|
kwargs | The kwargs. |
response_obj | The response object. |
start_time | The start time. |
end_time | The end time. |
make_handle_non_streaming_wrapper
Make a handle non streaming wrapper.
This function wraps the original method to capture usage.
instrument_crewai
Patches CrewAI’s core components (Crew, Agent, Task, Flow, LLM) to add comprehensive logging and tracing.
This wrapper enhances CrewAI with:
- Detailed operation tracing for Crew, Flow, and Task executions
- Token usage tracking for LLM calls
- Tool execution monitoring
- Span-based operation tracking
- Error handling and reporting
The patching is done by wrapping key methods like:
- Crew.kickoff
- Agent.execute_task
- Task.execute_sync
- LLM.call and _handle_non_streaming_response
- Tool._run methods
Arguments:
Name | Type | Description |
---|---|---|
maxim_logger | Logger | A Maxim Logger instance for handling the tracing and logging operations. |
debug | bool | If True, show INFO and DEBUG logs. If False, show only WARNING and ERROR logs. |