feat(bedrock): Add AWS Bedrock system tools support.#4469
feat(bedrock): Add AWS Bedrock system tools support.#4469sktech730 wants to merge 3 commits intocrewAIInc:mainfrom
Conversation
Extract citation URLs from citationsContent blocks in both sync and async code paths, appending them as a Sources section to text responses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6358c9f to
0aaaf55
Compare
Exclude system tool blocks (type=server_tool_use) from the tool_uses list so they are never misclassified as client-side tools and returned to the executor before system-tool response parsing runs
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.
|
|
||
| if not text_content or text_content.strip() == "": | ||
| # Skip empty-text fallback when system tools provided content | ||
| if (not text_content or text_content.strip() == "") and not has_system_tool_content: |
There was a problem hiding this comment.
Async path missing stop_reason == "tool_use" handling
Medium Severity
The sync _handle_converse has new logic checking stop_reason == "tool_use" to guide the LLM back to the ReAct pattern when text is empty, but _ahandle_converse lacks this check entirely. Async execution with empty text and a tool_use stop reason returns a generic apology instead of the ReAct guidance, causing different agent behavior between sync and async paths.
Additional Locations (1)
| result_type = tool_result_block.get("type", "") | ||
| if result_type: | ||
| logging.debug( | ||
| f"System tool result: {result_type} (ID: {tool_result_block.get('toolUseId')})" |
There was a problem hiding this comment.
Duplicate toolResult check in sync content loop
Low Severity
In the sync _handle_converse content block loop, "toolResult" in content_block is checked at two separate locations within the same iteration — once to set has_system_tool_content and again for debug logging. This redundancy also doesn't exist in the async _ahandle_converse loop, creating an inconsistency between the two methods.
Additional Locations (1)
|
This PR resolves issue #4363 by enabling CrewAI Agents to leverage Amazon Bedrock's Nova grounding capabilities as a server-side tool. This enhancement provides agents with more enriched responses that include proper citations and grounding support, improving the accuracy and traceability of generated content. Please if you could review and test this branch and provide feedback would be helpful. |


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.
Note on mixed tool scenarios: If a response contains both system tool content (citations) and a regular client tool call, the current behavior is:
This is by design — when the model proposes a tool call, the response is incomplete. The recommended pattern for workflows needing both system tools and client tools is to separate them into sequential CrewAI tasks, where Task 1 (system tools) produces output that flows as context into Task 2 (client tools). This leverages CrewAI'"'"'s built-in task composition and avoids complexity of tracking citations across recursive tool calls.'
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 Bedrock provider response types/flow when system tools are enabled and alters tool-call filtering logic, which could affect downstream integrations relying on prior Bedrock return shapes or tool execution behavior.
Overview
Adds AWS Bedrock system tools support to the Bedrock Converse integration by allowing
system_toolsconfiguration and passingsystemToolentries through tool formatting alongside regular tools.Updates Bedrock response parsing to treat
server_tool_useas Bedrock-executed system tools (not client tool calls), extract/append citation URLs fromcitationsContent, and when system tools are involved return the full raw Bedrock response dict with an addedprocessed_textconvenience field (while keeping string return behavior for non-system-tool calls).Updates
CrewAgentExecutor(sync/async, ReAct and native-tool paths) andLiteAgentto accept dict responses from Bedrock and continue agent processing usingprocessed_text, and adds a helper module (system_tools.py) plus tests covering citation extraction edge cases.Written by Cursor Bugbot for commit 555cec2. This will update automatically on new commits. Configure here.