Skip to content

fix: use google-genai instead of google-generativeai for strands template#183

Merged
jesseturner21 merged 1 commit into
mainfrom
fix/strands-google-genai-dependency
Feb 9, 2026
Merged

fix: use google-genai instead of google-generativeai for strands template#183
jesseturner21 merged 1 commit into
mainfrom
fix/strands-google-genai-dependency

Conversation

@aidandaly24

@aidandaly24 aidandaly24 commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes ImportError: cannot import name 'genai' from 'google' when running strands agents with Gemini model provider.

The strands SDK's strands.models.gemini module uses from google import genai, which requires the google-genai package. The template was incorrectly specifying google-generativeai (the older SDK with a different
import path).

Change

  • src/assets/python/strands/base/pyproject.toml: google-generativeai >= 0.5.0 → google-genai >= 1.0.0

…late

strands.models.gemini uses 'from google import genai' which requires
the google-genai package, not google-generativeai.
@aidandaly24 aidandaly24 changed the title fix: use google-genai instead of google-generativeai for strands temp… fix: use google-genai instead of google-generativeai for strands template Feb 9, 2026
"bedrock-agentcore >= 1.0.3",
"botocore[crt] >= 1.35.0",
"google-generativeai >= 0.5.0",
"google-genai >= 1.0.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

great catch!

@jesseturner21 jesseturner21 merged commit 77f07f3 into main Feb 9, 2026
9 of 14 checks passed
@jesseturner21 jesseturner21 deleted the fix/strands-google-genai-dependency branch February 9, 2026 14:24
@aidandaly24

Copy link
Copy Markdown
Contributor Author

Fixes Issue #149 #149

@agentcore-cli-automation

Copy link
Copy Markdown

Reviewed this PR. The fix is correct — the strands SDK's strands/models/gemini.py does from google import genai, which is provided by the google-genai PyPI package (not google-generativeai, which exposes a different google.generativeai import path). Verified against the strands SDK source.

Nothing else to flag — trivial dependency correction, no tests or telemetry needed. Already approved and merged; looks good. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants