airflow.providers.common.ai.tools.strands¶
Give Airflow tools to a Strands Agents agent.
Note
Experimental; see airflow.providers.common.ai.tools.
Classes¶
A Strands plugin that gives an agent Airflow's tools. |
Module Contents¶
- class airflow.providers.common.ai.tools.strands.AirflowTools(*sources)[source]¶
Bases:
strands.plugins.PluginA Strands plugin that gives an agent Airflow’s tools.
Pass toolsets that implement
ToolProvider, such asSQLToolsetandHookToolset, or individualAirflowToolobjects. The agent, its model and its loop stay plain Strands.from strands import Agent from airflow.providers.common.ai.tools.strands import AirflowTools from airflow.providers.common.ai.toolsets import SQLToolset warehouse = SQLToolset("warehouse", allowed_tables=["orders"]) agent = Agent(model=model, plugins=[AirflowTools(warehouse)])
Pass it in
plugins=, nottools=: Strands ignores a plugin given as a tool, and handing over only itstoolsleaves out the hook that ends the run on a failure.Each tool keeps the source tool’s name, description and argument schema, and every result passes through Airflow’s secret masker first. A failure the model can correct, such as a query naming a missing column, reaches it as a Strands result with
status="error", counted against the tool’s retry limit once per model turn and afresh on every run of the agent. A tool that is still failing once the limit is used up, or a failure the model cannot fix, such as a hook raising, fails the agent run, so the task fails and Airflow retries it. Strands on its own would hand that failure to the model and carry on. Tools a toolset marks sequential, such as the sandbox’s, run one at a time in the order the model called them.- Parameters:
sources (airflow.providers.common.ai.tools.ToolProvider | airflow.providers.common.ai.tools.AirflowTool) – Toolsets and tools to add, in order.