Repository navigation
feat(cli): pick tools for standalone agents and add them later - #9339
Conversation
`crewai create agent` opens the same tool picker and CrewAI Platform setup as `crewai create crew` for JSON and YAML agents. New `crewai tool add` appends tools to an existing agent definition, and `crewai tool setup` validates the definition's platform apps on AMP and saves the Enterprise Action Auth Token to .env. Refs OSS-270 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Strix Security ReviewWarning This pull request has 17 commits after the last Strix review ( To fix before merging (1)
PR summary: Adds a tool picker to `crewai create agent` and two new commands, `crewai tool add` and `crewai tool setup`, which append tool references to a standalone agent project's JSON/YAML definition, validate CrewAI Platform applications on AMP, and persist the Enterprise Action Auth Token to `.env`. Review summaryReviewed the new agent-tool management code and the platform-auth helpers it reuses. Definition handling is sound: the JSON/YAML path is confined to the project root, parsed with safe loaders, and written through a SafeDumper, and the Ruled out (6)
Fixed the findings? re-run the review, or tag Review 1 on this PR · Reviewed by Strix |
Importing crewai_tools runs load_dotenv(), which can load the .env of the project crewai is installed in. The platform setup then sent the login-derived Enterprise Action Auth Token with requests, honouring any proxy, CA bundle or CREWAI_FACTORY (TLS verification off) that .env set. Restore the machine's proxy and CA settings after the import, as `crewai run` and `crewai eval` already do, and also pin the requests-only REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE and CREWAI_FACTORY. This covers `crewai create crew`, `crewai create agent`, and `crewai tool add|setup`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under `python -O` the asserts are stripped, so the platform setup call and the proxy pops would not run. Do them first, then assert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a4752ff. Configure here.
| if platform_token: | ||
| save_platform_token(project_root, platform_token) | ||
| if any(not tool.startswith("custom:") for tool in added): | ||
| _require_tools_extra(project_root / "pyproject.toml") |
There was a problem hiding this comment.
Partial tool add on later failure
Medium Severity
add_tools_to_agent_project writes the agent definition before it saves the AMP token or adds the crewai[tools] extra. A later failure (for example save_platform_token refusing a symlink .env, or _require_tools_extra hitting invalid TOML) leaves new tools in the definition without the matching extra or token, even though the command errors out. AMP setup is correctly done first; these follow-on writes are not.
Reviewed by Cursor Bugbot for commit a4752ff. Configure here.


Resolves OSS-270.
What
crewai create agent(JSON/YAML, interactive terminal) now opens the same tool picker and CrewAI Platform setup ascrewai create crew: accordion picker, per-app action selection, and AMP sign-in plus integration validation. Picking and auth run before any files are written, so a cancelled sign-in leaves no partial project.crewai tool add [TOOLS...]adds tools to an existing agent project. With no arguments it opens the picker; otherwise it takes references such asSerperDevTool,platform:gmail/send-emailorcustom:my_tool. Platform app and action names are checked against the catalog, and new platform apps are validated on AMP before the definition changes.crewai tool setupreads theplatform:tools already in the agent definition, validates them on AMP and savesCREWAI_ENTERPRISE_ACTION_AUTH_TOKENto.env(for example after cloning a project).concepts/cli.mdxandguides/agents/standalone-agent-projects.mdx, synced toar,koandpt-BR.How
The new
crewai_cli/agent_tools.pyreuses the existing onboarding helpers fromcreate_json_crew.py(_select_tools,_select_platform_actions,_setup_platform_auth), so the crew and agent flows share one picker and one AMP setup path. It only adds the code that edits the definition:toolslist; tools already present are skipped.agent.jsonis rewritten with 2-space indentation;agent.yamlkeeps the scaffold's layout (block scalars for multi-line strings, indented lists).crewaidependency becomescrewai[tools]when a non-custom:tool is added, since crewai_tools and platform tools need that extra.Reviewer notes
--format python) skip the picker, andtool addpoints the user toAgent(tools=[...]); editingagent.pysafely is out of scope.CREWAI_DMN) are unchanged forcreate agent;tool addwithout arguments asks for tool names there.tool addtargets standalone agent projects only. Adding tools to an existing JSON crew would need an agent-selection prompt; that could be a follow-up.agent_tools.pyimports underscore-prefixed functions fromcreate_json_crew.pyto keep this diff small. They could move to a shared module later.Testing
lib/cli/tests/test_agent_tools.py(18 tests) covers JSON and YAMLtool add, skipping tools already present, invalid platform references, unparseable definitions, cancelled AMP setup leaving files untouched,tool setup, onboarding duringcreate agent, and the Python-agent paths.test_create_agent,test_create_crew,test_cli,test_create_unified,tests/tools) pass: 392 tests. ruff, ruff-format and mypy are clean.crewai tool add SerperDevTool FileReadTool, and loaded the JSON agent withload_agent_project, which resolved all 5 tools. The interactive picker was opened in a real terminal.🤖 Generated with Claude Code
Note
Medium Risk
Touches CLI auth/platform integration and writes agent definitions plus
.envtokens; changes are well-tested but affect security-sensitive AMP setup paths.Overview
Extends standalone JSON/YAML agent workflows so tool selection and CrewAI Platform setup match
crewai create crew: interactivecrewai create agentnow runs the shared picker and AMP validation before writing files, avoiding partial projects when sign-in is cancelled.Adds
crewai tool addandcrewai tool setupto append tools toagent.json/agent.yaml, bumpcrewai[tools]when needed, validate platform apps/actions, and persistCREWAI_ENTERPRISE_ACTION_AUTH_TOKENin.env. Python agents are excluded from definition editing.Introduces
crewai_cli/agent_tools.pyreusing crew onboarding helpers, plus a fix in_setup_platform_auththat restores machine proxy/CA/TLS settings aftercrewai_toolsimport-timeload_dotenv()so project.envcannot steer AMP requests.Documentation is updated for en, ar, ko, and pt-BR; coverage adds
test_agent_tools.pyand a transport regression test intest_create_crew.py.Reviewed by Cursor Bugbot for commit a4752ff. Bugbot is set up for automated code reviews on this repo. Configure here.