Skip to content

feat: add Amazon Bedrock Knowledge Base tool#6372

Draft
PVidyadhar wants to merge 1 commit into
google:mainfrom
PVidyadhar:bmkb-managed-kb-support
Draft

feat: add Amazon Bedrock Knowledge Base tool#6372
PVidyadhar wants to merge 1 commit into
google:mainfrom
PVidyadhar:bmkb-managed-kb-support

Conversation

@PVidyadhar

Copy link
Copy Markdown

feat: add Amazon Bedrock Knowledge Base tool

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

N/A — new feature.

2. Or, if no issue exists, describe the change:

Problem:
ADK agents currently have no built-in way to retrieve context from Amazon Bedrock Knowledge Bases, requiring users to write custom tool implementations for RAG workflows.

Solution:
Created BedrockKBTool(BaseTool) subclass that integrates natively with the ADK agent framework. The tool uses _get_declaration() for schema registration and async run_async() for execution, matching the standard ADK tool pattern. Supports both managed and vector KB types with agentic retrieval (query decomposition + managed reranking) and automatic fallback.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

pytest tests/test_bedrock_kb_tool.py — all tests pass with mocked boto3 calls.

Manual End-to-End (E2E) Tests:

Called tool.run_async(args={'query': '...'}) against a managed KB in us-west-2. Returned 3 results with content and scores. Called exactly as ADK agent framework would invoke it.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

  • Required IAM permissions: bedrock:Retrieve, bedrock:AgenticRetrieve
  • SDK requirement: boto3 >= 1.43
  • Google CLA: Approved (P469013198)

- Created BedrockKBTool(BaseTool) subclass with _get_declaration() and async run_async()
- Supports managed and vector knowledge base types
- Agentic retrieval with fallback to standard Retrieve API
- Unit tests included
- Added BEDROCK_MANAGED_KB.md design doc
@google-cla

google-cla Bot commented Jul 11, 2026

Copy link
Copy Markdown

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.

@adk-bot adk-bot added the tools [Component] This issue is related to tools label Jul 11, 2026
@adk-bot

adk-bot commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Response from ADK Triaging Agent

Hello @PVidyadhar, thank you for creating this PR! It's a great addition to the ADK tools library!

To help us move forward with reviewing your pull request, could you please address the following items from our contribution guidelines:

  1. Google CLA check failing: It looks like the cla/google status check has failed. Please visit the CLA portal at https://cla.developers.google.com/ to ensure your CLA is correctly signed and associated with your GitHub account and email address.
  2. Missing License Headers: The header-check status check is currently failing. Please ensure all newly added source files have the Apache 2.0 license header. You can run Google's addlicense tool or set up pre-commit as described in our development setup guide to automatically format and apply license headers before committing.

This will help reviewers review your PR more efficiently. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants