kaxil opened a new pull request, #73898:
URL: https://github.com/apache/airflow/pull/73898

   Follow-up to #73587, which added Strands support through 
`as_strands_tools()`. A tool that kept raising `ModelRetry`, or kept failing 
argument validation, came back to the model as an error result every time, so a 
Strands agent could loop without end. Raising from the tool does not help: 
Strands catches any exception a function tool raises and hands it to the model 
as another error. `as_strands_tools()` has not been released yet, so this 
replaces it rather than deprecating it.
   
   - **`AirflowTools` is now a Strands plugin.** Its `AfterToolCallEvent` hook 
re-raises `ToolCallError`, which Strands raises out of the run as 
`EventLoopException`, so a failure the model cannot fix fails the task and 
Airflow's retry takes over.
   - **Failures the model can correct are bounded by the tool's 
`max_retries`**, counted as Pydantic AI counts them: once per tool per model 
turn, so calls a framework runs concurrently in one turn count once.
   - **Google ADK**: `AirflowTools` in `tools.adk` is an ADK toolset. A result 
reaches the model as `{"result": ...}`, a failure it can correct as `{"error": 
...}`, and any other failure raises `ToolCallError` out of the run.
   - `airflow_tools()` moves to the shared toolset base, and `collect_tools()` 
turns the toolsets and tools an adapter is given into one list.
   - The LangChain bridge runs on the same interface: a correctable failure 
becomes a `ToolMessage` with `status="error"`, and a tool that keeps failing 
raises `ToolCallError`.
   - `SandboxToolset` can own its sandbox from synchronous code with a `with` 
block, which a task running a native agent needs. A tool call outside the block 
is refused instead of provisioning a sandbox nothing would destroy. Attaching 
to another task's sandbox works from both forms.
   - `MCPToolset.airflow_tools()` raises: an MCP session belongs to the 
Pydantic AI run that opens it, so a native agent should use its framework's own 
MCP client.
   
   **Why one neutral interface under both adapters?** Strands, ADK and the 
LangChain bridge now share one conversion, one error model and one retry 
budget, so an adapter for another framework is a thin mapping rather than a 
copy of those rules.
   
   **Why the Strands and ADK tests skip in CI.** Strands pins `mcp` below 2.2 
and ADK pins OpenTelemetry at 1.42.1 or lower, both below the versions in 
Airflow's development environment, so neither framework can be installed there. 
Both integrations are marked experimental, and the docs list the versions they 
are tested with (Strands 1.56.0, ADK 2.9.1).
   
   An end-to-end Dag that runs every toolset through `AgentOperator`, a 
Pydantic AI agent, Strands, ADK and LangChain passes with a real Claude model 
and a Modal sandbox.
   
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to