Skip to main content
View module source on GitHub

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:

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: