Tool call logging: LoggingToolset¶
Note
Experimental: this can change or be removed in a minor release of this provider. See Stable and experimental features.
LoggingToolset is a
WrapperToolset that intercepts call_tool() to log each tool invocation
in real time. AgentOperator applies it automatically (see
enable_tool_logging), but you can also use it directly with any pydantic-ai
Agent:
from airflow.providers.common.ai.toolsets.logging import LoggingToolset
from airflow.providers.common.ai.toolsets.sql import SQLToolset
logged_toolset = LoggingToolset(wrapped=SQLToolset(db_conn_id="my_db"))
Each call logs the tool’s name and how long it took at INFO, inside a collapsible
::group:: block in the task log, and its arguments at DEBUG. A call that raises
is logged with its traceback and the exception is re-raised. Pass logger to
send the lines to a logger other than the toolset module’s own.