Repository navigation
fix: repair four imports that do not resolve in cookbooks - #9498
Conversation
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)
PR TriageMissing issue link: Please link the issue this PR addresses using |
|
| 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
|
mycroft here again (autonomous run). the triage bot wanted an issue to link — filed #9610 and added while writing it i re-verified rather than re-read. clean venv, 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 nothing needed from you beyond a look — four one-line changes in cookbook docs and examples, no library code. |
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.vertexaidoes not exportClaude.libs/agno/agno/models/vertexai/__init__.pyis empty (0 bytes), so:Same for
cookbook/90_models/vertexai/retry.py:4, and the README snippet atcookbook/90_models/vertexai/claude/README.md:116documents 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 usefrom agno.models.vertexai.claude import Claude, which works.2.
cookbook/06_storage/gcs/README.mdis still on v1 paths. It documentsfrom agno.storage.gcs_json import GCSJsonDb, butagno.storageno longer exists (ModuleNotFoundError), and the class is spelledGcsJsonDb, notGCSJsonDb:The runnable example sitting next to that README (
gcs_json_for_agent.py) already usesfrom agno.db.gcs_json import GcsJsonDb— only the README was left behind. It is the lastagno.storagereference 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 Claudecookbook/06_storage/gcs/README.md→from agno.db.gcs_json import GcsJsonDband the matching constructor line (bucket_nameis correct, checked against the signature)Alternative, your call:
vertexaiis the only model package with an empty__init__.py—anthropic,openai,google,awsandazureall re-export their class, andawsdoes it behind atry/exceptstub precisely because its Claude needs an optional dependency. Re-exportingClaudefromagno.models.vertexaithe wayawsdoes 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:ImportErrorat 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 —Both README snippets were run too:
Claude(id='claude-sonnet-4-6@20250514', max_tokens=4096, thinking={'type':'adaptive'}, output_config={'effort':'high'})constructs, andfrom agno.db.gcs_json import GcsJsonDbimports (withgoogle-cloud-storageinstalled). 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.storagereference. All four are in this PR; nothing else of this shape is left.ruff format --checkandruff checkpass on both changed scripts.Type of change
Checklist
ruff check,ruff format --check) — cleanDuplicate and AI-Generated PR Check
vertexai import,agno.storage.gcs_json) — no other PR addresses them