aiq.profiler.callbacks.agno_callback_handler#

Attributes#

Classes#

AgnoProfilerHandler

A callback manager/handler for Agno that intercepts calls to:

Module Contents#

logger#
class AgnoProfilerHandler#

Bases: aiq.profiler.callbacks.base_callback_class.BaseProfilerCallback

A callback manager/handler for Agno that intercepts calls to:

  • Tool execution

  • LLM Calls

to collect usage statistics (tokens, inputs, outputs, time intervals, etc.) and store them in AIQ Toolkit’s usage_stats queue for subsequent analysis.

_lock#
last_call_ts#
step_manager#
_original_tool_execute = None#
_original_llm_call = None#
instrument() None#

Monkey-patch the relevant Agno methods with usage-stat collection logic.

_tool_execute_monkey_patch() collections.abc.Callable[Ellipsis, Any]#

Returns a function that wraps tool execution calls with usage-logging.

Note: This method is currently not used in the instrument() function since Agno doesn’t have a class-based tool structure to patch. It’s kept for reference or future use if Agno changes its architecture.

_llm_call_monkey_patch() collections.abc.Callable[Ellipsis, Any]#

Returns a function that wraps calls to litellm.completion(…) with usage-logging.