feat(bedrock): Add AWS Bedrock system tools support.#4469
feat(bedrock): Add AWS Bedrock system tools support.#4469sktech730 wants to merge 1 commit intocrewAIInc:mainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| if "text" in content_block: | ||
| text_content += content_block["text"] | ||
|
|
||
| # Handle tool use - corrected structure according to AWS API docs |
There was a problem hiding this comment.
Async acall omits system tools from request body
High Severity
The sync call() method was updated to merge self.system_tools into all_tools alongside the tools parameter before building the tool config, but the async acall() method was not updated — it still only checks if tools: and never includes self.system_tools. This means system tools configured via the constructor are silently omitted from async Bedrock API requests, completely breaking async system tools support. The response handling in _ahandle_converse expects system tool content but the tools are never sent.
Additional Locations (1)
| ) | ||
| else: | ||
| logging.warning("Extracted empty text content from Bedrock response") | ||
| text_content = "I apologize, but I couldn't generate a proper response. Please try again." |
There was a problem hiding this comment.
Empty text fallback overwrites system tool response content
Low Severity
The empty-text fallback at lines 652–666 runs before the system tools dict-return check at line 678 and doesn't consult has_system_tool_content. When a system tool response contains results in citationsContent/toolResult blocks but no text block, text_content is empty, so the fallback replaces it with the ReAct guidance (or generic error) message. That misleading string then becomes processed_text in the returned dict, causing the agent to see a canned fallback instead of the system tool's actual content. The same issue applies in the async _ahandle_converse.


Summary
Adds support for AWS Bedrock system tools (like Nova Web Grounding) to the CrewAI SDK with full agent integration.
Key Features
Motivation
AWS Bedrock recently introduced system tools, including Nova Web Grounding, which allows models to search the web for current information. This feature is essential for:
However, the existing CrewAI SDK doesn't support system tools, preventing users from leveraging this powerful capability.
Related Issue :
Addresses the need for AWS Bedrock system tools support. Alternative to PR #4365 which has breaking changes.
Issue #4363.
Files Modified
lib/crewai/src/crewai/llms/providers/bedrock/completion.py(~200 lines)system_toolsparameterlib/crewai/src/crewai/llms/providers/bedrock/system_tools.py(new file)lib/crewai/src/crewai/agents/crew_agent_executor.py(10 lines)lib/crewai/src/crewai/experimental/crew_agent_executor_flow.py(5 lines)lib/crewai/src/crewai/lite_agent.py(5 lines)Total: ~220 lines added, 0 lines removed, 0 breaking changes
Note
Medium Risk
Changes the Bedrock provider’s tool/request/response behavior and introduces an alternate return type (
strvsdict), which can affect downstream parsing and integrations if not consistently handled (notably across sync/async code paths).Overview
Enables AWS Bedrock system tools to be configured and sent via Converse by extending Bedrock tool typing/serialization to accept
systemToolentries and merging them with regular tools at request time.Updates Bedrock response handling to detect system-tool content (e.g.,
server_tool_use,citationsContent,toolResult) and, when configured, return the full raw Bedrock response augmented with a convenienceprocessed_textfield; agent executors (CrewAgentExecutor, flow executor, andLiteAgent) are updated to accept this dict shape by extractingprocessed_textbefore parsing.Adds a
system_tools.pyhelper for Nova Web Grounding configuration and introduces unit tests around system-tool/citation-style responses.Written by Cursor Bugbot for commit 6358c9f. This will update automatically on new commits. Configure here.