airflow.providers.common.ai.utils.toolsets

Walk a pydantic-ai toolset and the toolsets it wraps or combines.

Functions

iter_toolsets(toolset)

Yield toolset and every toolset nested inside it, outermost first.

find_toolset(toolsets, cls)

Return the first toolset of type cls in toolsets, looking inside wrappers, or None.

Module Contents

airflow.providers.common.ai.utils.toolsets.iter_toolsets(toolset)[source]

Yield toolset and every toolset nested inside it, outermost first.

pydantic-ai composes toolsets by wrapping: .prefixed(), .filtered(), .prepared() and .renamed() each return a WrapperToolset around the original, and passing several toolsets together produces a CombinedToolset. A check that only looks at the top level therefore misses a toolset the moment an author composes it, which the documentation recommends for running two sandboxes on one agent. This walks both shapes.

A toolset resolved per run from a callable (DynamicToolset) has nothing to walk until the run starts, so it is yielded as itself and its contents are not inspected.

airflow.providers.common.ai.utils.toolsets.find_toolset(toolsets, cls)[source]

Return the first toolset of type cls in toolsets, looking inside wrappers, or None.

Was this entry helpful?