id stringlengths 15 25 | source stringclasses 1
value | chunk_index int64 0 393k | token_count int32 449 512 | content stringlengths 203 7.95k |
|---|---|---|---|---|
combine_chunk_700 | combine.txt | 700 | 512 | .0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS ... |
combine_chunk_701 | combine.txt | 701 | 512 | . ``instructions``
becomes ``system_prompt``, the connection ID goes in ``llm_conn_id``, ``toolsets``
and ``output_type`` keep their names, and any other agent argument, such as
``retries``, goes in ``agent_params``.
.. code-block:: python
# dags/orders_report.py
from airflow.providers.common.ai.toolsets.sql ... |
combine_chunk_702 | combine.txt | 702 | 512 | {returns[-1].content}")])
def test_report_counts_orders():
with mock.patch.object(
PydanticAIHook, "get_conn", autospec=True, return_value=FunctionModel(scripted_model)
):
dag_run = orders_report().test()
assert dag_run.state == "success"
The first reply calls th... |
combine_chunk_703 | combine.txt | 703 | 512 | you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARR... |
combine_chunk_704 | combine.txt | 704 | 512 | a marked tool call until a person approves it. See
:doc:`../tool_approval`.
Pydantic AI is the recommendation, not a requirement. For a new agent, start with
``AgentOperator``, which gets the most from this provider. If your team has standardized
on Strands, ADK, LangChain, the Anthropic SDK, the OpenAI Agents SDK ... |
combine_chunk_705 | combine.txt | 705 | 512 | class:`~airflow.providers.common.ai.tools.anthropic.AirflowTools` hands the same
tools to ``client.beta.messages.tool_runner`` and makes a tool failure the model
cannot fix fail the task. Guide: :doc:`anthropic`.
- You
- ``[anthropic]`` extra
* - OpenAI Agents SDK
- :class:`~airflow.prov... |
combine_chunk_706 | combine.txt | 706 | 512 | 55
* - Framework
- Version
- Notes
* - Strands Agents
- 1.56.0
- Pins ``mcp`` below 2.2, so installing it downgrades ``mcp`` if a newer one is
installed.
* - Google ADK
- 2.9.1
- Pins OpenTelemetry at 1.42.1 or lower, below the version in Airflow's constraints
file.... |
combine_chunk_707 | combine.txt | 707 | 512 | gets. It
installs the newest framework release that is older than the repository's
``exclude-newer`` window, so it does not show that the versions in the table above work in
the environment a user gets. Canary runs, which include
scheduled and manual runs on ``main`` and pull requests labeled ``canary``, install each
... |
combine_chunk_708 | combine.txt | 708 | 512 | : some frameworks pin versions of packages
Airflow also depends on, such as OpenTelemetry or a vendor SDK.
To give such a framework Airflow's toolsets rather than hand-written tools, build on
the framework-neutral interface in :mod:`airflow.providers.common.ai.tools`, which is
what the Strands, ADK, Anthropic, OpenAI ... |
combine_chunk_709 | combine.txt | 709 | 512 | AI Agents SDK agent inside
:func:`~airflow.providers.common.ai.tools.tracing.agent_framework_tracing` to keep its
spans tied to the task, and free of prompt text unless ``[common.ai] capture_content`` is
on; see :doc:`../observability`. For an OpenAI Agents SDK agent, also register
:class:`~airflow.providers.common.ai.... |
combine_chunk_710 | combine.txt | 710 | 512 | /src/airflow/providers/common/ai/example_dags/example_pydantic_ai_agent.py
:language: python
:start-after: [START example_pydantic_ai_agent]
:end-before: [END example_pydantic_ai_agent]
``PydanticAIHook.get_hook`` returns the hook for the connection's type, and its
:meth:`~airflow.providers.common.ai.hooks... |
combine_chunk_711 | combine.txt | 711 | 512 | you get, and what you do not
---------------------------------
The SQL, hook, object storage, DataFusion, MCP, sandbox and managed-agent toolsets behave
as they do inside ``AgentOperator``: SQL validation, ``allowed_tables``, result bounds,
object-storage path checks, and the secret masker on everything a tool return... |
combine_chunk_712 | combine.txt | 712 | 512 |
specific language governing permissions and limitations
under the License.
.. _howto/frameworks:anthropic:
Anthropic SDK tool runner
=========================
If your agent is a loop on the Anthropic Python SDK's
``client.beta.messages.tool_runner``, you can run it in an Airflow task as it is and
give it th... |
combine_chunk_713 | combine.txt | 713 | 512 | the task only for Airflow's tools:
the runner still hands an exception from one of your own tools to the model. A run that
reaches ``max_iterations`` while the model is still calling tools has no answer, so
``tools.run`` raises
:class:`~airflow.providers.common.ai.exceptions.ToolRunnerMaxIterationsError` and the
task ... |
combine_chunk_714 | combine.txt | 714 | 512 | . The
model received this block when it was told to count the rows of a ``sales`` table that
the toolset did not allow:
.. code-block:: json
{
"type": "tool_result",
"tool_use_id": "toolu_01PNeqBojrc5S7FnNAeP1brL",
"content": "The query tool failed: Query references tables that are not in the al... |
combine_chunk_715 | combine.txt | 715 | 512 | goes to the model this way.
``tools.run`` runs each turn's tool calls itself, which is also how the retry limit
knows where one model turn ends. When a call fails in a way that ends the run, the
turn's later calls are not run; the calls before it already have.
``tools.run`` takes the runner that ``client.beta.messag... |
combine_chunk_716 | combine.txt | 716 | 512 | . Add ``apache-airflow-providers-anthropic`` if
you build the client with ``AnthropicHook``. ``tool_runner`` is a beta helper of the
SDK. The adapter needs ``anthropic`` 1.1.0 or later, which the extra requires,
and is tested with 1.8.0.
.. seealso::
- :doc:`../toolsets/index`, for what each toolset exposes and i... |
combine_chunk_717 | combine.txt | 717 | 512 | a Strands agent in a task
-----------------------------
The agent below answers a question about a database. Its model's API key comes
from an Airflow connection, and its tools come from a
:class:`~airflow.providers.common.ai.toolsets.sql.SQLToolset`, so the agent can
list tables, read schemas and run read-only queri... |
combine_chunk_718 | combine.txt | 718 | 512 | an invalid
argument, reaches it as a Strands result with ``status="error"``, and the model
can try again. The tool's retry limit bounds how many times in a row it can do so.
``SQLToolset`` treats every database error this way, so a query that fails because
the database rejects the connection's credentials ends... |
combine_chunk_719 | combine.txt | 719 | 512 | Strands' ``@tool`` decorator do not pass through
the masker. To give one of your own functions the same treatment, wrap it as an
:class:`~airflow.providers.common.ai.tools.AirflowTool` and pass it to
``AirflowTools`` alongside the toolsets:
.. code-block:: python
import asyncio
from airflow.providers.common... |
combine_chunk_720 | combine.txt | 720 | 512 | _durable]
:end-before: [END example_strands_durable]
The example needs Airflow 3.3 or later, ``strands-agents``, a connection holding an
Anthropic API key, and a database connection; its module docstring lists the details.
``invoke_durably`` takes a function that builds the agent, here
``functools.partial(Agent, ... |
combine_chunk_721 | combine.txt | 721 | 512 | some work again:
- It resumes from a cycle boundary. If the task fails while a cycle's tools run,
the retry runs all of that cycle's tools again, the finished ones included, so
tools that change data must still be safe to repeat.
- A task that fails before the model's first request for tools starts over.
- A retr... |
combine_chunk_722 | combine.txt | 722 | 512 | in that storage after the rows are gone,
and clearing the task does not reach it.
Within one try, a tool's retry limit in ``AirflowTools`` counts across the agent's
pauses; a task retry starts the count again. The ``AgentResult`` that
``invoke_durably`` returns comes from the agent's last invocation. Its metrics
cove... |
combine_chunk_723 | combine.txt | 723 | 512 | implements on top of
Pydantic AI work differently or do not apply:
- Durable execution resumes from a cycle boundary rather than replaying each
model call and tool call. See :ref:`howto/frameworks:strands-durable`.
- There is no human review step like ``AgentOperator(enable_hitl_review=True)``.
.. _howto/framework... |
combine_chunk_724 | combine.txt | 724 | 512 | task: on a schedule, after an upstream task, or when an asset updates, reading data
through connections your deployment already manages. The agent, its runner, handoffs,
guardrails and your own function tools stay plain OpenAI Agents SDK. Airflow adds these,
each of which you can use without the others:
- :func:`~airf... |
combine_chunk_725 | combine.txt | 725 | 512 | .
Try the tools from a script
---------------------------
``AirflowTools`` needs no Dag, scheduler or metadata database. A Python script that can
see an Airflow connection can give an agent a toolset's tools, so you can try an agent
on your machine before you put it in a task. Define the connection in an environment
... |
combine_chunk_726 | combine.txt | 726 | 512 | as a gateway or a
self-hosted server, come from an Airflow connection too:
.. exampleinclude:: /../../ai/src/airflow/providers/common/ai/example_dags/example_openai_agents_agent.py
:language: python
:start-after: [START example_openai_agents_agent]
:end-before: [END example_openai_agents_agent]
The examp... |
combine_chunk_727 | combine.txt | 727 | 512 | `` database such as Postgres, and ``aws_reports_reader`` for AWS.
What each toolset gives the agent, and what limits it:
.. list-table::
:header-rows: 1
:widths: 22 40 38
* - Toolset
- Tools the model gets
- What you limit it with
* - :class:`~airflow.providers.common.ai.toolsets.sql.SQLT... |
combine_chunk_728 | combine.txt | 728 | 512 | , salary FROM salaries``
.. code-block:: text
{"error": "The query tool failed: Query references tables that are not in the allowed tables list: salaries. Use list_tables to see the allowed tables.\nUse the list_tables and get_schema tools to inspect the database, then fix the query and try again."}
``rea... |
combine_chunk_729 | combine.txt | 729 | 512 | a proxy or turn off TLS
verification for the request.
- What it returns. The model sees the result serialized as JSON, or as ``str()`` of an
object that is not JSON-compatible. ``HttpHook.run`` returns a ``requests.Response``,
which the model would see as ``<Response [200]>``.
:ref:`hook-toolset-restricted` sho... |
combine_chunk_730 | combine.txt | 730 | 512 | - A failure the model can correct
- Replayed on a durable retry
* - ``AirflowTools``
- Yes
- Returned to the model as ``{"error": ...}``; for a toolset's tools, up to a retry limit
- Yes, an ``{"error": ...}`` result too; a call that raised runs again
* - Your own ``@function_tool`... |
combine_chunk_731 | combine.txt | 731 | 512 | destroys the sandbox when the block ends. A call outside the block fails with
``SandboxToolset is not open``. Build and run the agent inside it:
.. code-block:: python
from agents import Agent, Runner
from airflow.providers.common.ai.sandbox.modal import ModalSandboxBackend
from airflow.providers.common.... |
combine_chunk_732 | combine.txt | 732 | 512 | toolset's tool may fail this way once in a row by default; pass ``max_retries`` to the
toolset to allow more. The count starts over after a call that succeeds and on every run
of the agent, except that a retry of a durable run counts the failures it replays as well
(see :ref:`howto/frameworks:openai-agents-durable`). ... |
combine_chunk_733 | combine.txt | 733 | 512 | and pass it to ``AirflowTools``
next to the toolsets:
.. code-block:: python
import asyncio
from agents import Agent
from airflow.providers.common.ai.tools import AirflowTool, ToolResult
from airflow.providers.common.ai.tools.openai_agents import AirflowTools
from airflow.providers.common.ai.to... |
combine_chunk_734 | combine.txt | 734 | 512 | Toolset(db_conn_id="warehouse")),
)
lead = Agent(
name="lead",
model="gpt-5-mini",
tools=[analyst.as_tool("ask_analyst", "Ask the SQL analyst.", failure_error_function=None)],
)
The ``ToolCallError`` then fails the outer run, and with it the task. The same applies to
a function tool... |
combine_chunk_735 | combine.txt | 735 | 512 | .providers.common.ai.tools.openai_agents import AirflowTraceProcessor
from airflow.providers.common.ai.tools.tracing import agent_framework_tracing
set_trace_processors([AirflowTraceProcessor()])
with agent_framework_tracing():
answer = Runner.run_sync(agent, question).final_output
``set_trace_pro... |
combine_chunk_736 | combine.txt | 736 | 512 | /src/airflow/providers/common/ai/example_dags/example_openai_agents_durable.py
:language: python
:start-after: [START example_openai_agents_durable]
:end-before: [END example_openai_agents_durable]
Each model call and function tool call is recorded in the task instance's durable
journal as it completes (se... |
combine_chunk_737 | combine.txt | 737 | 512 | in its ``handoffs`` list, and an agent used through
``as_tool``, which replays as one call. Recorded tool results pass through Airflow's
secret masker before they are saved, and a replayed model call reports no token usage.
A failure the model could correct, which an ``AirflowTools`` tool answers with
``{"error": ...... |
combine_chunk_738 | combine.txt | 738 | 512 | asks the
model again from the request that chose the call, since replaying that answer would
only reach the same failure.
- Tools other than function tools: hosted tools, the tools of ``mcp_servers``, and shell
and computer tools.
- A function tool whose ``needs_approval`` is a function: the SDK checks that the
... |
combine_chunk_739 | combine.txt | 739 | 512 | **Reject**, and can fill in a reason.
The answer resumes the task, which runs from the top again. ``run_durably_sync`` replays
the calls it recorded before the pause instead of making them again (the calls in "What
always runs live" above still run live), and then:
- On **Approve**, the tool runs and the agent conti... |
combine_chunk_740 | combine.txt | 740 | 512 | , so make it safe to repeat, or use ``needs_approval=True`` on a
function tool of your own.
- The task fails with ``UnsupportedToolDeferralError`` instead of pausing when the run has
a ``session``, when the call is made by an agent used through ``as_tool`` or reached
through ``handoff()``, or when the approval is... |
combine_chunk_741 | combine.txt | 741 | 512 |
.. Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under ... |
combine_chunk_742 | combine.txt | 742 | 512 | 54.324694Z [info ] ::group::Tool call: list_tables [airflow.providers.common.ai.tools] loc=__init__.py:116
2026-10-19T07:56:54.603210Z [info ] Tool list_tables returned in 0.28s [airflow.providers.common.ai.tools] loc=__init__.py:130
2026-10-19T07:56:54.603326Z [info ] ::endgroup:: ... |
combine_chunk_743 | combine.txt | 743 | 512 |
ORDER BY total_amount DESC
LIMIT 5, parameters: None [airflow.task.hooks.airflow.providers.sqlite.hooks.sqlite.SqliteHook] loc=sql.py:896
2026-10-19T07:56:59.495567Z [info ] Tool query returned in 0.79s [airflow.providers.common.ai.tools] loc=__init__.py:130
2026-10-19T07:56:59.495691Z [info ... |
combine_chunk_744 | combine.txt | 744 | 512 | mcp__<server_name>__<tool name>``.
- Runs through the toolset, so connection resolution, SQL validation,
``allowed_tables``, ``allowed_methods`` and result limits behave as they do in
:class:`~airflow.providers.common.ai.operators.agent.AgentOperator`. Because the
built-in tools are off, the model cannot open a r... |
combine_chunk_745 | combine.txt | 745 | 512 | 's return value or the MCP wire format:
.. code-block:: json
{
"type": "tool_result",
"tool_use_id": "toolu_01Sitdzj84kaH1CKYC8LFW2b",
"content": "The query tool failed: Statement type 'Delete' is not allowed. Allowed types: Select, Union, Intersect, Except, Describe, Show\nUse the list_tables a... |
combine_chunk_746 | combine.txt | 746 | 512 | raises
``claude_agent_sdk.ResultError`` (a ``ProcessError``) from the stream on the next
iteration, before ``run()`` reaches its own check. ``ResultError`` carries the result's
``subtype``, ``terminal_reason`` and the rest of its payload.
* ``ClaudeSDKClient.receive_response()``: the stream ends at the ``ResultM... |
combine_chunk_747 | combine.txt | 747 | 512 | an ``is_error`` result until the next run starts, including a handler
called directly between two runs.
Built-in tools run on the worker host
----------------------------------------
``ClaudeAgentOptions()`` on its own loads every settings source on the worker
(``~/.claude``, project settings, a project ``.mcp.json`... |
combine_chunk_748 | combine.txt | 748 | 512 | to the CLI, but whether the CLI emits its own telemetry from it is not something
this provider verifies or relies on.
Differences from ``AgentOperator``
-------------------------------------
The loop is the SDK's, so what ``AgentOperator`` builds on top of Pydantic AI does not
apply:
- A task retry runs the loop ag... |
combine_chunk_749 | combine.txt | 749 | 512 | for the
specific language governing permissions and limitations
under the License.
.. _howto/frameworks:adk:
Google ADK
==========
You have an agent built with the `Agent Development Kit
<https://google.github.io/adk-docs/>`__ and you want it to run as an Airflow task,
reading data through connections your ... |
combine_chunk_750 | combine.txt | 750 | 512 | , such as a rejected SQL statement or an invalid
argument, reaches it as ``{"error": ...}``, ADK's own convention for a failed tool,
and is marked as an error in ADK's telemetry. The tool's retry limit bounds how many
times in a row the model can try again.
- A refusal the tool reports as final, such as a file th... |
combine_chunk_751 | combine.txt | 751 | 512 | For ``AnthropicLlm``, install ``anthropic`` through this
provider's ``anthropic`` extra.
<|file|>airflow/providers/common/ai/docs/memory.rst
.. Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional inf... |
combine_chunk_752 | combine.txt | 752 | 512 | "
``pydantic-ai-harness`` is pre-1.0, and its API can change between minor releases.
How it works
------------
``Memory`` gives the agent a notebook of Markdown files. At the start of each model
request it adds a bounded excerpt of the main file, ``MEMORY.md``, to the prompt, and it
gives the model four tools: ``wri... |
combine_chunk_753 | combine.txt | 753 | 512 | namespace`` is resolved by your code from the run's dependencies, not by the model, so
the agent cannot read or write another customer's notes through its tools.
``PostgresMemoryStore`` takes an ``asyncpg`` pool, which you create with ``await`` and
close when the run is done. A Dag file cannot do either around an ``Ag... |
combine_chunk_754 | combine.txt | 754 | 512 | other-frameworks:
Strands and ADK
---------------
Strands and ADK agents run in your own ``@task`` (see :doc:`frameworks/index`), so they
use the memory their framework ships. The same rule about where the store lives applies.
A Strands agent takes a ``MemoryManager`` with one or more stores in its
``memory_manager`... |
combine_chunk_755 | combine.txt | 755 | 512 | /example_dags>`__,
listed here by operator. Guides embed the Dags they walk through; the rest link to source.
For what to build rather than how, start at :doc:`use_cases/index`.
Single-prompt tasks
--------------------
.. list-table::
:header-rows: 1
:widths: 30 70
* - Guide
- What it shows
* - :do... |
combine_chunk_756 | combine.txt | 756 | 512 | _reviews_in_bulk>`
through one OpenAI or Anthropic batch job, with structured output and results landed on
object storage
(`example_llm_batch.py <https://github.com/apache/airflow/blob/providers-common-ai/|version|/providers/common/ai/src/airflow/providers/common/ai/example_dags/example_llm_batch.p... |
combine_chunk_757 | combine.txt | 757 | 512 | example_agent_tool_approval.py <https://github.com/apache/airflow/blob/providers-common-ai/|version|/providers/common/ai/src/airflow/providers/common/ai/example_dags/example_agent_tool_approval.py>`__).
* - :doc:`use_cases/research_agent_with_review`
- A LangChain ReAct agent that decides its own tool calls, co... |
combine_chunk_758 | combine.txt | 758 | 512 | ai/|version|/providers/common/ai/src/airflow/providers/common/ai/example_dags/example_llamaindex_rag.py>`__: a weekly indexing Dag
plus an on-demand query Dag, with single-Dag and multi-source variants.
* - :doc:`use_cases/compare_10k_filings`
- `example_llamaindex_10k.py <https://github.com/apache/airfl... |
combine_chunk_759 | combine.txt | 759 | 512 | as a deterministic pipeline with a hallucination check and as one
autonomous agent.
* - :doc:`use_cases/research_agent_with_review`
- `example_langchain_tool_agent.py <https://github.com/apache/airflow/blob/providers-common-ai/|version|/providers/common/ai/src/airflow/providers/common/ai/example_dags/ex... |
combine_chunk_760 | combine.txt | 760 | 512 | compliance
with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND... |
combine_chunk_761 | combine.txt | 761 | 512 | backends; other services can be added with a
``SandboxBackend`` subclass
* - :doc:`AgentSkillsToolset <toolsets/skills>`
- Agent skills from local paths and remote Git repositories
* - :doc:`LangChain Bridge <toolsets/langchain>`
- LangChain tools
* - :doc:`Managed Agent Toolsets <toolsets/ma... |
combine_chunk_762 | combine.txt | 762 | 512 | copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for t... |
combine_chunk_763 | combine.txt | 763 | 512 | :
- **Push the work into a tool.** Do the aggregation in SQL (``SQLToolset``), or
expose a hook method that returns the processed result (``HookToolset``). The
tool runs in the full worker environment with all its dependencies, and code
mode just orchestrates it.
- **Give the agent a real environment**, with
:... |
combine_chunk_764 | combine.txt | 764 | 512 | ``speculate`` are off; see :ref:`durable-code-mode`.
Code mode turns off :doc:`tool_approval`. A tool that needs
approval and is called from ``run_code`` does not run: the model gets an error back and may
carry on without it, so the task can still succeed. To keep such a tool out of ``run_code``,
list the other tools ... |
combine_chunk_765 | combine.txt | 765 | 512 | this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed to in writing,
software di... |
combine_chunk_766 | combine.txt | 766 | 512 | -labs/strands-decider>`__, and
`Kev <https://github.com/jaredpalmer/kev>`__ is an open-weight model built to serve
it. `pydantic-ai's System One page <https://pydantic.dev/docs/ai/models/system-one/>`__
lists more.
``system-one:`` needs ``pydantic-ai-slim`` 2.53.0 or later, newer than the provider... |
combine_chunk_767 | combine.txt | 767 | 512 | is sent to the server as the model to answer with. A
server that runs several, such as Ollama, picks one by it.
3. Describe every option you ask about, and give the question its text. Servers differ in
what they accept, and Strands Decider 0.1.0 refuses, with an HTTP 422 that fails the task,
a question that ... |
combine_chunk_768 | combine.txt | 768 | 512 | on a path where latency or cost is the constraint.** One decision per
Dag run rarely justifies changing models. One per row, per file, or per retrieved document
does, and so does a branch a scheduler is waiting on.
**You want a number to branch on, not a sentence to trust.** A pick, a rubric, and a
yes/no each come b... |
combine_chunk_769 | combine.txt | 769 | 512 | describe each option, which is what tells them apart. An
option with no description is read from its name alone, and some servers refuse it.
* - :doc:`ClassifierRetryPolicy <retry_policies>`
- Yes
- The model names one of the policy's ``categories`` and nothing else; retry or
fail, the delay... |
combine_chunk_770 | combine.txt | 770 | 512 | the task, before anything downstream runs on it, and record the confidence, the
probabilities and the bar in the ``decision`` XCom (see :doc:`operators/llm_branch`).
``decision_policy`` and the per-option ``BranchOption.min_confidence`` are experimental;
see :ref:`howto/stability`.
:doc:`ClassifierRetryPolicy <retry_po... |
combine_chunk_771 | combine.txt | 771 | 512 | /common/ai/example_dags/example_decision_model.py>`__
has both halves: a branch with nothing specific to decision models but its connection, and a
classification that escalates when the confidence is low.
What it answers badly
---------------------
Read `pydantic-ai's decision model guide <https://pydantic.dev/docs/a... |
combine_chunk_772 | combine.txt | 772 | 512 | , PDF, DOCX) into a list of ``{"text", "metadata"}`` dicts with
no AI framework involved. :doc:`operators/llamaindex_embedding` chunks those documents and
produces embedding vectors. :doc:`operators/llamaindex_retrieval` pulls the closest chunks back
out for a question, ready to drop into an :doc:`LLMOperator <operator... |
combine_chunk_773 | combine.txt | 773 | 512 | Com.
Connections choose the model
----------------------------
``common.ai`` is built on `pydantic-ai <https://ai.pydantic.dev/>`__, so the model vendor
(OpenAI, Anthropic, Google, Bedrock, …) is picked by the connection ``llm_conn_id`` points
at, so switching providers later is a connection change, not a Dag rewrite... |
combine_chunk_774 | combine.txt | 774 | 512 | .ext.langchain.LangChainToolset`` upstream, which wraps LangChain tools for a
common.ai agent, and the provider's own
:func:`~airflow.providers.common.ai.toolsets.langchain_bridge.airflow_toolset_to_langchain_tools`
converts the other way, from Airflow-managed toolsets into LangChain tools (see
:doc:`toolsets/langchain... |
combine_chunk_775 | combine.txt | 775 | 512 | :`~airflow.providers.common.ai.hooks.mcp.MCPHook`
- Backs ``MCPToolset`` (see :doc:`toolsets/mcp`) for agent tasks that call
tools on a remote MCP server. Configure the connection via
:doc:`connections/mcp`. See :doc:`hooks/mcp`.
Results flow through XCom
-------------------------
Every operator pu... |
combine_chunk_776 | combine.txt | 776 | 512 | additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.... |
combine_chunk_777 | combine.txt | 777 | 512 | to_operator_llm_structured_output_class]
.. exampleinclude:: /../../ai/src/airflow/providers/common/ai/example_dags/example_llm.py
:language: python
:start-after: [START howto_operator_llm_structured]
:end-before: [END howto_operator_llm_structured]
Registration covers downstream tasks in the **same Dag**... |
combine_chunk_778 | combine.txt | 778 | 512 | output as a model instance when ``output_type`` was one of the output types
listed above. It dumped a top-level model with plain ``model_dump()`` only
when ``serialize_output=True`` was set or in HITL review. A downstream task
loaded the instance when the class was listed in
``[core] allowed_deserialization_cl... |
combine_chunk_779 | combine.txt | 779 | 512 | way whether a model is pushed as an instance or dumped. Set
``serialize_output=True`` when a downstream consumer needs the dict shape (for example to forward
it to a system that expects JSON-style payloads).
* With ``serialize_output=True``, an output that is itself a model is dumped with ``model_dump()``, so
field... |
combine_chunk_780 | combine.txt | 780 | 512 | in it stays an object that the default XCom backend
cannot serialize.
<|file|>airflow/providers/common/ai/docs/provider_fallback.rst
.. Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information... |
combine_chunk_781 | combine.txt | 781 | 512 | ``"openai:gpt-5"``) is forwarded down
the chain as a logical model name: each connection that has no ``model`` of its own
resolves that name against its own platform, so one bare name can reach a primary and
every fallback without repeating it per connection. It does not matter where the primary's
name comes from -- t... |
combine_chunk_782 | combine.txt | 782 | 512 | connections/pydantic_ai_bedrock` and :doc:`connections/pydantic_ai_vertex` for how
each connection type resolves a bare name.
Configure it on the operator
-----------------------------
``fallback_conn_ids`` is also a parameter on
:class:`~airflow.providers.common.ai.operators.llm.LLMOperator`,
:class:`~airflow.provid... |
combine_chunk_783 | combine.txt | 783 | 512 | API is returning errors; ask the next one (any ``ModelAPIError``,
transient or not)
* - Within one task attempt
- ``timeout`` in pydantic-ai's ``ModelSettings``
- This vendor is slow rather than down
* - Across task attempts
- :doc:`retry_policies` (including ``LLMRetryPolicy``)
- Whet... |
combine_chunk_784 | combine.txt | 784 | 512 | prompt is the one error every connection in the chain shares: the same
request body goes to each of them, so all reject it alike before the task finally sees the
failure -- N requests for a request that was never going to succeed. Each rejection comes
back at once, and the OpenAI and Anthropic SDKs do not retry a 400,... |
combine_chunk_785 | combine.txt | 785 | 512 | the primary resolves every connection in the
chain, so a fallback with a missing ``model`` or an unknown connection ID is reported by name
there rather than discovered mid-incident. Fields a provider class cannot be built from (a
``TypeError``) fail the resolution with a ``ValueError`` naming the connection, the provi... |
combine_chunk_786 | combine.txt | 786 | 512 | .apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permis... |
combine_chunk_787 | combine.txt | 787 | 512 | -------
**Approve** runs the call and the agent carries on from where it stopped.
**Reject** does not fail the task. The agent is told the call was denied -- with
the reviewer's reason when one is given, such as "Refunds over $40 need a support
ticket number." -- and carries on without it, so it can explain the refus... |
combine_chunk_788 | combine.txt | 788 | 512 | have the
agent request the gated calls in one step, or give each irreversible action its own
task.
Timeouts and who decides
------------------------
``tool_approval_timeout`` bounds the pause; ``None`` (the default) waits for as
long as it takes. What a timeout does is set by ``on_tool_approval_timeout``:
- ``"fail... |
combine_chunk_789 | combine.txt | 789 | 512 | howto_agent_tool_judge]
What happens to each call:
.. list-table::
:header-rows: 1
:widths: 30 35 35
* - The model answers
- Confidence at or above ``MIN_CONFIDENCE``
- Below it, or none reported
* - ``allow``
- The call runs.
- A person decides.
* - ``deny``
- The call does ... |
combine_chunk_790 | combine.txt | 790 | 512 | and limits
-----------------------
- Airflow 3.3 or later. On older versions a tool marked for approval fails the
task, as it did before.
- Not together with ``durable=True``, ``enable_hitl_review=True``, a ``CodeMode``
capability, or a ``SandboxToolset`` that
provisions its own sandbox. Each
assumes the run ... |
combine_chunk_791 | combine.txt | 791 | 512 | st
.. Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License")... |
combine_chunk_792 | combine.txt | 792 | 512 | `` pushes the ``usage`` XCom. Both tasks use the model set on the
``pydanticai_default`` connection.
1. Install the provider with the extra for your vendor:
.. code-block:: bash
pip install "apache-airflow-providers-common-ai[anthropic]>=1.1.0"
2. Trigger the Dag:
.. code-block:: bash
airflow ... |
combine_chunk_793 | combine.txt | 793 | 512 | _iterations=20): score 0.5; $0.087213 of $5.00, 16,883 of 500,000 tokens
Loop iteration 11: stop (max_iterations=20): passed: score 0.9; $0.096552 of $5.00, 18,624 of 500,000 tokens
11 passes, score 0.9, 18624 tokens, $0.096552
The Dag
-------
The whole loop, with the budget in ``tally`` and ``good_enough``:
... |
combine_chunk_794 | combine.txt | 794 | 512 | 0.0; cost unknown, 745 of 600 tokens``
- The gate succeeds and ``publish`` runs.
* - ``max_iterations`` reached
- ``score 0.0; cost unknown, 4,995 of 500,000 tokens``
- The last gate fails and ``publish`` is ``upstream_failed``.
The converged row is the run above. The dollar row ran the same models ... |
combine_chunk_795 | combine.txt | 795 | 512 | `` in the ``usage`` XCom is
pydantic-ai's ``RunUsage.cost``, which `genai-prices <https://github.com/pydantic/genai-prices>`__
computes from the token counts and the model name at the provider's list prices. The provider is
matched by its API URL first and by its name after that, so a call through a gateway that
``gena... |
combine_chunk_796 | combine.txt | 796 | 512 | call and passed on retry,
each try used 127 tokens and the loop counted 127. A retry of ``write_draft`` or ``judge`` after a
try that reached the model leaves that try's spend out of the totals.
Adapting it
-----------
* Give the writer and the judge different models with ``model_id``, for example a cheaper judge.
... |
combine_chunk_797 | combine.txt | 797 | 512 | * :doc:`../sandbox/index` -- ``SandboxToolset`` runs everything the model writes off the
worker.
* Templating -- ``{{ ds }}`` in the prompt ties the question to the Dag run's date.
Run it
------
1. Install the provider with the SQL and Modal extras and authenticate with Modal:
.. code-block:: bash
pip i... |
combine_chunk_798 | combine.txt | 798 | 512 | ) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
w... |
combine_chunk_799 | combine.txt | 799 | 512 | _loads_on_schema_drift`
- Compares source and target schemas and reports what would break a load
- Branches to the load or to a notification, no migration ever runs
* - :doc:`explain_revenue_anomaly`
- Queries the warehouse and does the pivots in a sandbox to explain a revenue move
- Injects the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.