Skip to content

Introduce AWS Strands Agents hook to common AI provider and Skills integration#67450

Open
gopidesupavan wants to merge 21 commits into
apache:mainfrom
gopidesupavan:add-strands-hook-gemini
Open

Introduce AWS Strands Agents hook to common AI provider and Skills integration#67450
gopidesupavan wants to merge 21 commits into
apache:mainfrom
gopidesupavan:add-strands-hook-gemini

Conversation

@gopidesupavan
Copy link
Copy Markdown
Member

Add Strands Agents hook to common AI provider

Summary

Add AWS Strands Agents 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:

    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 #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 library (Agent Skills / 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

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the 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) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

Comment thread providers/common/ai/src/airflow/providers/common/ai/hooks/strands_ai.py Outdated
Comment thread providers/common/ai/src/airflow/providers/common/ai/hooks/strands_ai.py Outdated
Comment thread providers/common/ai/provider.yaml
@gopidesupavan
Copy link
Copy Markdown
Member Author

Thanks you @kaxil — resolved comments.

@gopidesupavan gopidesupavan force-pushed the add-strands-hook-gemini branch from 56ab16f to 0d2ef3b Compare May 27, 2026 10:43
Comment thread providers/common/ai/src/airflow/providers/common/ai/hooks/strands_ai.py Outdated
Comment on lines +134 to +137
return AgentRunResult(
output=str(response),
model_name=self._resolved_model_id or self.model_id,
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constructs AgentRunResult with only output and model_name, so usage and tool_names stay at their None defaults. log_run_summary then skips both the token counts (logging.py:35) and the tool-call sequence (logging.py:49) for Strands even when tools ran, whereas the pydantic-ai path populates both. Strands' result exposes usage metrics and a tool trace; mapping them into AgentUsage / tool_names here would match the pydantic-ai path. Use getattr(..., None) guards if the metrics shape varies across SDK versions. (Low priority: no crash, just missing observability.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this needs refactor , will updated..

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

uv.lock on main just moved via #67860 ("[main] Upgrade important CI environment"), commit 707e316 and this PR currently conflicts.

Quickest fix:

git fetch upstream main && git rebase upstream/main
rm uv.lock && uv lock
git add uv.lock && git rebase --continue
git push --force-with-lease

Automated nudge — ignore if you're not ready to rebase. This comment is updated in place on future uv.lock bumps.

@gopidesupavan gopidesupavan force-pushed the add-strands-hook-gemini branch from 0d2ef3b to a2bf153 Compare May 31, 2026 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants