| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Sorry, something went wrong.
When a module defines root_agent with a non-agent type, AgentLoader now raises a targeted ValueError naming the module and the actual type (with a hint to use the name 'app' when the object is an App), instead of the misleading generic not-found error. Fixes google#6606.
| Back | FazBrowse Home | New Git URL |
Fixes #6606
Problem
When a module defines root_agent with a non-agent type, AgentLoader
logs the type mismatch at WARNING but then raises the generic
ValueError: No root_agent found, whose directory-structure guidance
sends users in the wrong direction when their layout is correct.
Fix
_load_from_module_or_package and _load_from_submodule record each
type mismatch; _perform_load raises a targeted ValueError naming the
module and the actual type at its final failure point. When the object
is an App, the error suggests exporting it under the name app.
Fallthrough behavior is preserved: a mismatch in one pattern does not
block a later pattern from loading successfully, and the generic
not-found message is unchanged for the genuinely-missing case.
Testing Plan
py311 has one failure in
tests/unittests/sessions/migration/test_migration.py::test_migrate_from_sqlalchemy_pickle_preserves_nested_safe_actions_pickle
that is unrelated to this change and reproduces identically on main:
the migration unpickler's _ALLOWED_PICKLE_GLOBALS blocks
builtins.getattr only in the py311 environment (the one where the
crewai extras install per the pyproject markers). This diff touches
only cli/utils/agent_loader.py and its test file. Filed separately.
🤖 Generated with Claude Code