airflow.providers.common.ai.toolsets.logging

Logging wrapper toolset for pydantic-ai tool calls.

Classes

LoggingToolset

Wrap a toolset to log each tool call with timing.

ToolLoggingCapability

Apply tool-call logging to the assembled function toolset for an agent run.

Module Contents

class airflow.providers.common.ai.toolsets.logging.LoggingToolset[source]

Bases: pydantic_ai.toolsets.wrapper.WrapperToolset[Any]

Wrap a toolset to log each tool call with timing.

Note

Experimental: this can change or be removed in a minor release of this provider. See Stable and experimental features.

logger: airflow.sdk.types.Logger | logging.Logger[source]
async call_tool(name, tool_args, ctx, tool)[source]

Call a tool with the given arguments.

Args:

name: The name of the tool to call. tool_args: The arguments to pass to the tool. ctx: The run context. tool: The tool definition returned by [get_tools][pydantic_ai.toolsets.AbstractToolset.get_tools] that was called.

class airflow.providers.common.ai.toolsets.logging.ToolLoggingCapability[source]

Bases: pydantic_ai.capabilities.AbstractCapability[Any]

Apply tool-call logging to the assembled function toolset for an agent run.

logger: airflow.sdk.types.Logger | logging.Logger[source]
classmethod get_serialization_name()[source]

Return the name used for spec serialization (CamelCase class name by default).

Return None to opt out of spec-based construction.

get_ordering()[source]

Place logging innermost so outer capability wrappers delegate base-tool calls through it.

get_wrapper_toolset(toolset)[source]

Wrap the agent’s assembled toolset, or return None to leave it unchanged.

Called per-run with the combined non-output toolset (after the [prepare_tools][pydantic_ai.capabilities.AbstractCapability.prepare_tools] hook has already wrapped it). Output tools are added separately and are not included.

Unlike value-contribution methods such as [get_instructions][pydantic_ai.capabilities.AbstractCapability.get_instructions], this receives the already assembled toolset and is called each run (after [for_run][pydantic_ai.capabilities.AbstractCapability.for_run]). When multiple capabilities provide wrappers, they follow middleware semantics: the first capability in the list wraps outermost (matching wrap_* hooks).

Use this to apply cross-cutting toolset wrappers like [PreparedToolset][pydantic_ai.toolsets.PreparedToolset], [FilteredToolset][pydantic_ai.toolsets.FilteredToolset], or custom [WrapperToolset][pydantic_ai.toolsets.WrapperToolset] subclasses.

Was this entry helpful?