aws-samples / aws-samples/bedrock-multi-agents-collaboration-workshop
Creating more than one knowledgebase in the same account is not supported with the provided code
- Dominant language
- Python
- Stars
- 170
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
If you try to create TWO knowledgebases in the same account with the provided code and create_or_retrieve_knowledge_base method, the second one will error out
Type:
3. breaking changes
**To Reproduce**
Steps to reproduce the behavior (or some version of this):
Sample code to reproduce:
1. Import necessary utlities
```
import sys
# Add paths to sys.path if necessary
sys.path.insert(0, ".")
sys.path.insert(1, "..")
# Import classes
from utils.bedrock_agent_helper import AgentsForAmazonBedrock
from utils.knowledge_base_helper import KnowledgeBasesForAmazonBedrock
# Instantiate classes
agents = AgentsForAmazonBedrock()
kb = KnowledgeBasesForAmazonBedrock()
```
2. Try creating two KBs (Replace with your unique bucket name)
```
%%time
kb.create_or_retrieve_knowledge_base(
"knowledgebasename1",
"knowledgebasedescription1",
""
)
```
```
%%time
kb.create_or_retrieve_knowledge_base(
"knowledgebasename2",
"knowledgebasedescription2",
""
)
```
**Expected behavior**
Two knowlgebases should be created
**Error**
ValidationException: An error occurred (ValidationException) when calling the CreateKnowledgeBase operation: The knowledge base storage configuration provided is invalid... Request failed: [security_exception] 403 Forbidden
**! Additional context !**
- In def create_oss_policy_attach_bedrock_execution_role from utils/knowledge_base_helper.py when the policy already exists, it simply prints a message without updating the policy’s content. It should either update the content with the new knowledgebase details or create a new a new policy
Contributor guide
Research direction
Start in utils/knowledge_base_helper.py, especially create_or_retrieve_knowledge_base and create_oss_policy_attach_bedrock_execution_role. Run the provided two-knowledgebase reproduction and inspect the existing-policy path. Done means two knowledgebases can be created in one account without the 403 ValidationException, with the policy updated for the new knowledgebase details or a new policy created.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100