gopidesupavan opened a new pull request, #67450:
URL: https://github.com/apache/airflow/pull/67450
Add Strands Agents hook to common AI provider
## Summary
Add [AWS Strands Agents](https://strandsagents.com/) as a new agent backend
for `AgentOperator` and `@task.agent` in the common AI provider, building on
the `BaseAIHook` contract.
- Introduce `StrandsHook` (shared Strands SDK integration) and
`StrandsGeminiHook` as the first backend (`conn_type`: `strands-gemini`,
default connection ID: `strands_default`)
- Wire toolsets through `_tool_spec_to_native`, converting `ToolSpec`
instances to Strands-native tools
- Add skills support end-to-end: `SkillSpec` dataclass on `BaseAIHook`,
`skills` / `skills_params` on `AgentRunRequest` and `AgentOperator`, and
Strands `AgentSkills` plugin integration for filesystem paths and inline skill
definitions
- Register the new connection type in `provider.yaml` /
`get_provider_info.py` and add optional dependency:
```bash
pip install 'apache-airflow-providers-common-ai[strands]'
```
(`strands-agents[gemini]>=1.0.0`)
- Add example DAGs (`example_strands.py`) covering basic operator usage,
skills, inline `SkillSpec` + SQL toolset, direct hook usage, and `@task.agent`
- Document connection setup, hook usage, and operator skills in new/updated
RST pages
### Depends on
BaseAIHook PR https://github.com/apache/airflow/pull/67438
---
## Follow-ups
### Durable execution for Strands (`durable=True`)
`StrandsHook` currently sets `supports_durable=False`. A follow-up PR should
mirror the pydantic-ai durable path so Strands agents can resume from cached
steps on task retry.
**Out of scope for this PR:** usage limits for Strands hooks.
### Skills for Pydantic AI (`pydantic-ai-skills`)
`PydanticAIHook` currently leaves `supports_skills=False`, so
`AgentOperator.skills` / `skills_params` only work with Strands backends in
this PR. A follow-up should wire the same operator-level skills API to
pydantic-ai via the
[`pydantic-ai-skills`](https://github.com/DougTrajano/pydantic-ai-skills)
library (Agent Skills / [agentskills.io](https://agentskills.io) spec with
progressive disclosure).
## Files changed
| Area | Files |
|------|-------|
| Hooks | `hooks/strands_ai.py`, `hooks/base_ai.py` |
| Operator | `operators/agent.py` |
| Examples | `example_dags/example_strands.py` |
| Provider metadata | `provider.yaml`, `get_provider_info.py`,
`pyproject.toml` |
| Docs | `docs/connections/strands.rst`, `docs/hooks/strands_ai.rst`,
`docs/operators/agent.rst`, … |
| Tests | `tests/unit/common/ai/hooks/test_strands_ai.py`,
`test_base_ai.py`, `operators/test_agent.py` |
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
<!--
Thank you for contributing!
Please provide above a brief description of the changes made in this pull
request.
Write a good git commit message following this guide:
http://chris.beams.io/posts/git-commit/
Please make sure that your code changes are covered with tests.
And in case of new features or big changes remember to adjust the
documentation.
Feel free to ping (in general) for the review if you do not see reaction for
a few days
(72 Hours is the minimum reaction time you can expect from volunteers) - we
sometimes miss notifications.
In case of an existing issue, reference it using one of the following:
* closes: #ISSUE
* related: #ISSUE
-->
---
##### Was generative AI tooling used to co-author this PR?
<!--
If generative AI tooling has been used in the process of authoring this PR,
please
change below checkbox to `[X]` followed by the name of the tool, uncomment
the "Generated-by".
-->
- [ ] Yes (please specify the tool below)
<!--
Generated-by: [Tool Name] following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
-->
---
* 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]