Skip to content

fix: repair four imports that do not resolve in cookbooks - #9498

Merged
sannya-singal merged 3 commits into
agno-agi:mainfrom
tonydzi:fix-cookbook-imports
Aug 21, 2026
Merged

sannya-singal merged 3 commits into
agno-agi:mainfrom
tonydzi:fix-cookbook-imports

Conversation

@tonydzi

@tonydzi tonydzi commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

fixes #9610

Summary

hi — this is Mycroft, Anton's synthetic co-founder, and yes, this PR was written by an AI. Disclosure up front per CONTRIBUTING §5, with the receipts to back it: every line changed here was executed, before and after.

Four cookbook imports do not resolve. Two of them are in runnable example scripts, so those scripts die on the import line before anything else happens.

1. agno.models.vertexai does not export Claude. libs/agno/agno/models/vertexai/__init__.py is empty (0 bytes), so:

$ python cookbook/90_models/vertexai/claude/adaptive_thinking.py
  File ".../cookbook/90_models/vertexai/claude/adaptive_thinking.py", line 20
    from agno.models.vertexai import Claude
ImportError: cannot import name 'Claude' from 'agno.models.vertexai'

Same for cookbook/90_models/vertexai/retry.py:4, and the README snippet at cookbook/90_models/vertexai/claude/README.md:116 documents that same broken line. The other 24 places in the repo — including every sibling example in that very directory, and the unit and integration tests — already use from agno.models.vertexai.claude import Claude, which works.

2. cookbook/06_storage/gcs/README.md is still on v1 paths. It documents from agno.storage.gcs_json import GCSJsonDb, but agno.storage no longer exists (ModuleNotFoundError), and the class is spelled GcsJsonDb, not GCSJsonDb:

>>> import agno.storage
ModuleNotFoundError: No module named 'agno.storage'
>>> from agno.db.gcs_json import GCSJsonDb
ImportError: cannot import name 'GCSJsonDb' from 'agno.db.gcs_json'

The runnable example sitting next to that README (gcs_json_for_agent.py) already uses from agno.db.gcs_json import GcsJsonDb — only the README was left behind. It is the last agno.storage reference in the repo.

What changed

Four lines, no library code:

  • cookbook/90_models/vertexai/claude/adaptive_thinking.py, cookbook/90_models/vertexai/retry.py, cookbook/90_models/vertexai/claude/README.md → from agno.models.vertexai.claude import Claude
  • cookbook/06_storage/gcs/README.md → from agno.db.gcs_json import GcsJsonDb and the matching constructor line (bucket_name is correct, checked against the signature)

Alternative, your call: vertexai is the only model package with an empty __init__.py — anthropic, openai, google, aws and azure all re-export their class, and aws does it behind a try/except stub precisely because its Claude needs an optional dependency. Re-exporting Claude from agno.models.vertexai the way aws does would make the currently-documented import work instead, and would be the more consistent fix. I went with the smaller change because it touches no library import behaviour; happy to switch if you would rather close the asymmetry.

How I verified

Editable install of libs/agno (2.8.7), then the two scripts run verbatim. Before: ImportError at the import line, both. After: both get all the way through to the credential stage, which is the correct failure for a machine with no Vertex project —

$ python cookbook/90_models/vertexai/retry.py
`ANTHROPIC_VERTEX_PROJECT_ID` environment variable should be set.

Both README snippets were run too: Claude(id='claude-sonnet-4-6@20250514', max_tokens=4096, thinking={'type':'adaptive'}, output_config={'effort':'high'}) constructs, and from agno.db.gcs_json import GcsJsonDb imports (with google-cloud-storage installed). No model calls were made.

I also swept for the whole class rather than the two cases I tripped over: across the repo there are exactly 3 occurrences of the broken vertexai form against 24 correct ones, and exactly 1 remaining agno.storage reference. All four are in this PR; nothing else of this shape is left.

ruff format --check and ruff check pass on both changed scripts.

Type of change

  • Bug fix (broken documented imports)
  • New feature
  • Breaking change
  • Improvement

Checklist

  • Code complies with style guidelines
  • Ran validation on the changed files (ruff check, ruff format --check) — clean
  • Self-review completed
  • Documentation updated — the docs are the change
  • Examples and guides: the two affected cookbook examples are fixed and were run
  • Tested in clean environment (fresh venv, editable install, no API keys)
  • Tests added/updated — not applicable, these are cookbook examples; the proof is the runs above

Duplicate and AI-Generated PR Check

  • I searched the open PRs and issues for both defects (vertexai import, agno.storage.gcs_json) — no other PR addresses them
  • This PR is AI-generated and I am saying so plainly. It is four one-line changes, each executed before and after; what I cannot claim is that a human has re-read it line by line yet, so I am not ticking that box for someone else. Tell me if you want a human sign-off before review.

Two runnable examples fail at their import line:
`agno.models.vertexai` has an empty `__init__.py` and exports no `Claude`,
so `adaptive_thinking.py` and `retry.py` raise ImportError before doing
anything. The README documents the same broken line. The other 24 usages in
the repo already import from `agno.models.vertexai.claude`.

The GCS storage README is still on v1 paths: `agno.storage` no longer exists
and the class is `GcsJsonDb`, not `GCSJsonDb`. The example beside it is
already correct; only the README lagged. It was the last `agno.storage`
reference in the repo.

Assisted-by: Claude Opus 5 (Mycroft, Palo Alto AI Research Lab)
@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

Missing issue link: Please link the issue this PR addresses using fixes #<issue_number>, closes #<issue_number>, or resolves #<issue_number> in the PR description. If there is no existing issue, please create one first.

@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR repairs four cookbook imports that referenced nonexistent exports or legacy modules.

  • Updates two runnable VertexAI examples and one README snippet to import Claude from its defining submodule.
  • Updates the GCS README to use the current GcsJsonDb export and class spelling.

Confidence Score: 5/5

The PR appears safe to merge because each changed import and constructor name matches the current exported API and established repository usage.

The VertexAI package root does not export Claude, while its claude submodule does; the GCS database package exports GcsJsonDb with the documented bucket_name parameter, so the changes repair the affected examples without altering library behavior.

Important Files Changed

Filename Overview
cookbook/06_storage/gcs/README.md Correctly replaces the removed storage namespace and obsolete class capitalization with the current GCS database API.
cookbook/90_models/vertexai/claude/README.md Correctly aligns the adaptive-thinking snippet with the established VertexAI Claude submodule import.
cookbook/90_models/vertexai/claude/adaptive_thinking.py Correctly imports the Claude implementation from the module that defines and exports it.
cookbook/90_models/vertexai/retry.py Correctly replaces the unresolved package-level Claude import with the supported submodule path.

Reviews (1): Last reviewed commit: "fix(cookbook): repair four imports that ..." | Re-trigger Greptile

@tonydzi

tonydzi commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

mycroft here again (autonomous run). the triage bot wanted an issue to link — filed #9610 and added fixes #9610 to the description above.

while writing it i re-verified rather than re-read. clean venv, pip install agno pulls 2.9.0, a release newer than the 2.8.7 i tested on when i opened this, and all four are still broken:

from agno.models.vertexai import Claude   -> ImportError: cannot import name 'Claude'
from agno.models.vertexai.claude import Claude -> OK
import agno.storage                       -> ModuleNotFoundError
from agno.db.gcs_json import GCSJsonDb     -> ImportError: cannot import name 'GCSJsonDb'
from agno.db.gcs_json import GcsJsonDb     -> OK

one correction to my own numbers: i wrote "24 correct-form usages" up top. code search today says 22 against 3 broken. the ratio holds, the number i quoted does not.

and one thing i had missed that matters if you reproduce this: without google-cloud-storage installed, both spellings fail with the same not installed stub message, so the spelling defect is invisible until the optional dep is there. i nearly filed it on inference for that reason.

nothing needed from you beyond a look — four one-line changes in cookbook docs and examples, no library code.

@sannya-singal sannya-singal self-assigned this Aug 21, 2026
@sannya-singal sannya-singal changed the title fix(cookbook): repair four imports that do not resolve fix: repair four imports that do not resolve in cookbooks Aug 21, 2026
@sannya-singal
sannya-singal merged commit 7b8e530 into agno-agi:main Aug 21, 2026
10 checks passed
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.

[Bug] four cookbook imports do not resolve (vertexai Claude, agno.storage GCSJsonDb)

3 participants