-
Notifications
You must be signed in to change notification settings - Fork 2
DA-690: AWS Bedrock Agents Demo with Couchbase #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…otebook - Updated IAM role and policy creation with more robust error handling - Added bedrock-agent-runtime client for improved agent invocation - Improved document processing with better logging and error tracking - Refactored agent invocation to handle streaming responses - Added error handling for agent interactions
Caution Notebooks or Frontmatter Files Have Been Modified
3 Notebook Files Modified:
3 Frontmatter Files Modified:
|
- Simplified AWS client creation using a single session - Updated IAM role permissions to be more comprehensive - Modified document processing to use vector store directly - Changed default model to Claude 3 Haiku - Updated file path for documents.json - Commented out agent-based document processing
…model invocation - Added robust policy version management in IAM role creation - Implemented error handling for agent creation process - Updated default model to Amazon Nova Pro - Added fallback mechanism for vector store search and direct model invocation - Improved logging and error tracking for agent interactions
- Updated model from Nova Pro to Claude v2 - Modified model invocation parameters for better text formatting - Simplified response parsing for formatted research findings - Removed complex JSON payload in favor of direct prompt-based formatting
- Added support for two agent action group execution strategies: 1. Custom Control with direct function calls 2. Lambda function-based execution - Created Lambda deployment script for agent functions - Updated multi-agent workflow to demonstrate both approaches - Added .gitignore entries for Lambda build artifacts
… mechanism - Added retry logic and exponential backoff for Lambda function deployment - Implemented error handling for various AWS service exceptions - Added role readiness wait time to handle IAM role propagation - Enhanced logging and error tracking during Lambda function packaging and deployment - Added input validation for AWS account ID
…e and reliability - Updated Lambda function code to use Claude 3 Sonnet model with new message-based API - Enhanced Lambda deployment script with: * Increased timeouts and memory allocation * Improved error handling for large payloads * Dependency cleanup to reduce package size - Added more comprehensive IAM permissions for Bedrock and agent interactions - Updated requirements.txt to use latest Couchbase library - Fixed file paths for Lambda deployment and document loading
…dling, and agent preparation - Added comprehensive logging for agent invocation and tracing - Implemented search index setup with robust error handling - Enhanced collection setup with document clearing and improved logging - Added agent preparation steps for researcher and writer agents - Updated Lambda function deployment to handle existing functions - Improved error handling and status tracking for agent action groups - Added more detailed logging for agent interactions and Lambda deployments
- Removed Lambda function deployment from main workflow - Updated action group creation to use "customControl" executor - Simplified action group names and descriptions - Commented out package cleanup steps in Lambda deployment scripts - Added dotenv loading to Lambda function scripts - Removed explicit prompt formatting in writer Lambda function
…handling - Added comprehensive debugging for agent function invocations - Implemented dynamic handling of search_documents and format_content functions - Added detailed logging and error tracing for agent responses - Updated invoke_agent method to support vector store integration - Improved error messages and debugging output for agent interactions - Passed vector_store to both Lambda and Custom Control approaches in main script
…e Integration - Added comprehensive debugging for agent function invocations - Enabled trace logging in invoke_agent method for detailed response tracking - Created .env file generation for Lambda functions with vector store configuration - Updated researcher and writer Lambda functions to support vector store integration - Improved error handling and trace information logging - Added more detailed console output for agent response debugging
…g print statements
@teetangh I see two different notebooks in here. Have you tested this with the developer portal to see if multiple notebooks in a folder are supported? Also, I see two implementations here in the Python files as well as the Jupyter notebooks. I would like to understand the rationale for this.
|
Answering Q1: |
Lambda approach creates AWS Lambda functions that serve as the executors for the agent action groups, deploying separate functions for the researcher and writer agents. When the agent needs to perform an action like searching documents, it invokes the corresponding Lambda function which handles the request, performs the vector search, and returns results. Both implementations achieve the same end result - allowing Bedrock agents to perform vector searches and format content - but through different architectural patterns. |
@ejscribner says It looks like it should work but not 100% sure |
tests will pass, however the frontmatter in main build can be wrong. |
… on custom control and lambda approaches
…and lambda approaches
|
awsbedrock-agents/custom-control-approach/Bedrock_Agents._Custom_Control.ipynb
Outdated
Show resolved
Hide resolved
@nithishr added all explanations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks better but still needs improvement
awsbedrock-agents/custom-control-approach/Bedrock_Agents._Custom_Control.ipynb
Outdated
Show resolved
Hide resolved
awsbedrock-agents/custom-control-approach/Bedrock_Agents._Custom_Control.ipynb
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Same comments as the other one.
- Do you need to handle
returnControl
in the agent invoker? - Adding the default localhost in the connection string could cause problems if the user is running it in lambda env as that will never work
- Why do you need to wait for the collection to be available before querying? That is not a known pattern
MemorySize=1536, # Increased to 1.5GB | ||
Environment={ | ||
'Variables': { | ||
'CB_HOST': os.getenv('CB_HOST', 'couchbase://localhost'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting localhost in lambda env?
with open(lambda_env_path, 'w') as f: | ||
f.write(f"CB_HOST={CB_HOST}\n") | ||
f.write(f"CB_USERNAME={CB_USERNAME}\n") | ||
f.write(f"CB_PASSWORD={CB_PASSWORD}\n") |
Check failure
Code scanning / CodeQL
Clear-text storage of sensitive information High
sensitive data (password)
Copilot Autofix
AI 7 days ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
No description provided.