airflow.providers.common.ai.tools.adk

Give Airflow tools to a Google ADK agent.

Note

Experimental; see airflow.providers.common.ai.tools.

Classes

AirflowTools

An ADK toolset that gives an agent Airflow's tools.

Module Contents

class airflow.providers.common.ai.tools.adk.AirflowTools(*sources)[source]

Bases: google.adk.tools.base_toolset.BaseToolset

An ADK toolset that gives an agent Airflow’s tools.

Pass toolsets that implement ToolProvider, such as SQLToolset and HookToolset, or individual AirflowTool objects. The agent, its model and its runner stay plain ADK.

from google.adk.agents import LlmAgent

from airflow.providers.common.ai.tools.adk import AirflowTools
from airflow.providers.common.ai.toolsets import SQLToolset

warehouse = SQLToolset("warehouse", allowed_tables=["orders"])
agent = LlmAgent(name="analyst", model=model, tools=[AirflowTools(warehouse)])

Each tool keeps the source tool’s name, description and argument schema, and every result passes through Airflow’s secret masker first. A result reaches the model as {"result": ...}; a failure the model can correct, such as a query naming a missing column, as {"error": ...}, ADK’s own convention for a failed tool. Such failures count against the tool’s retry limit afresh on every run of the agent. A tool still failing once the limit is used up, or any other failure, raises ToolCallError out of the run, so the task fails and Airflow retries it. 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.

async get_tools(readonly_context=None)[source]

Was this entry helpful?