🤖 Lab 2: Bedrock Agent + Coveo Passage Retrieval API
Pattern: Bedrock Agent
Duration: 20 minutes
Objective: Integrate Coveo Passage Retrieval API with AWS Bedrock Agent for conversational AI with grounded responses.
Throughput Notice
If Bedrock doesn't respond immediately, wait 30-60 seconds and retry. This is normal during peak workshop usage.
🎯 Lab Goals¶
By the end of this lab, you will:
- ✅ Understand Bedrock Agent architecture and Coveo Passage Retrieval API tool integration
- ✅ Enable conversation memory in AWS Console
- ✅ Verify system prompt configuration
- ✅ Test single-turn conversations with grounded responses using the Coveo Passage Retrieval API
- ✅ Observe agent decision-making and tool usage
- ✅ Identify when to use Bedrock Agent integration
- ✅ Configure Memory for multi-turn conversations (To be tested in Lab 4)
🏗️ Architecture Overview¶
In this lab, you'll explore the Bedrock Agent Integration pattern:
React Application] end subgraph "AWS Infrastructure" API[API Gateway] Lambda[Bedrock Agent Chat
Lambda] end subgraph "AWS Bedrock" Agent[Bedrock Agent
Nova Lite Model] ActionGroup[Action Group
CoveoPassageRetrieval] Memory[Agent Memory
Session Storage] end subgraph "Tool Integration" Tool[Passage Tool
Lambda Function] end subgraph "External Services" COVEO[Coveo Passages API
Semantic Retrieval] end UI --> API API --> Lambda Lambda --> Agent Agent --> ActionGroup ActionGroup --> Tool Tool --> COVEO Agent --> Memory style UI fill:#e1f5fe style Agent fill:#fff3e0 style Memory fill:#f3e5f5 style COVEO fill:#e8f5e9
🔄 Pattern 2 Sequence Diagram¶
Bedrock Agent is not yet enabled with memory
In this Lab you will learn how to ground your Bedrock Model reponse with Passages retrieved from Coveo Index using it as a tool. Further we dont pass any session id from the UI so it is intentionally designed to be single-turn conversation. You will enable Memory as part of this lab and will test that feature in Lab 4 as part of multi turn conversations in a chatbot.
📋 Lab Exercises¶
Exercise 2.1: Review Bedrock Agent Architecture (5 minutes)¶
Type: Instructor-led + Hands-on
Bedrock Agent architecture

Key Concepts¶
Orchestrates AI interactions with tools
Defines available tools for the agent
Retrieves passages from Coveo
Stores conversation context (after the memory is enabled)
Access Bedrock Console¶
- Login to AWS Console
- Navigate to Amazon Bedrock service
- Click "Agents" in the left navigation
- Find and select
workshop-coveo-agent - Click Edit to open the Agent Builder Page
Bedrock Agent List

- Review Agent Configuration in the Agent Builder Page
AWS Console - Bedrock Agent Details Page

Review Agent Configuration¶
Agent Details:
- Name:
workshop-coveo-agent - Description: Bedrock Agent with Coveo Passage Retrieval for Finance Knowledge Hub
- Foundation Model:
amazon.nova-lite-v1:0
Action Group:
- Name:
CoveoPassageRetrieval - Description: Retrieves relevant passages from Coveo knowledge base
- Lambda Function:
workshop-passage-tool - Status: Enabled
Do not Change anything on this page
We just reviewed the Agent Setup with Tool Configuration. Do not make any changes on this page!
- Stay on this Page to continue to the next Exercise 2.2
Exercise 2.2: Verify System Prompt (5 minutes)¶
Type: Hands-on
Objective¶
Review the agent's system prompt to understand how it's instructed to use the passage retrieval tool.
Step-by-Step Instructions¶
Step 1: View Agent Instructions¶
- In the Bedrock Agent details page, find "Instructions for the Agent" section
- Review the system prompt for better redeability, you can expand the instructions prompt
Bedrock Agent - Instructions Section

Key Instructions to Note:
You are the Finance Knowledge Assistant, providing accurate information from authoritative government and educational sources about financial topics.
## Core Principles
1. **Grounding**: Use ONLY information from the passage retrieval tool for knowledge questions. Never make up information.
2. **Memory**: You have access to conversation history within the current session, and potentially across sessions if memory is enabled. Use this to provide contextual responses.
3. **Formatting**: Provide clean, well-structured answers in markdown format suitable for HTML display with proper headings, lists, and emphasis.
4. **Sources**: Always cite sources with titles and URLs from retrieved passages when answering knowledge questions.
5. **Clarity**: Be concise and direct. Lead with the answer, then provide supporting details.
6. **No Internal Reasoning**: NEVER include <thinking>, <reasoning>, or any XML-style tags in your response. Keep all reasoning internal and invisible to the user.
## CRITICAL: Question Type Detection
Before taking any action, determine the question type:
### Type 1: Memory/History Questions (DO NOT use tools)
**Indicators:**
- Contains phrases like: "what did we discuss", "remind me", "last time", "previous conversation", "earlier", "before", "what were we talking about"
- Asks about past interactions or topics covered
- References "you and I" or "our conversation"
**Action:** Answer directly from conversation memory WITHOUT calling retrieve_passages.
**Important:** You can always recall conversations within the current session. If memory is enabled, you can also recall previous sessions. If you don't have memory of a previous session, politely acknowledge this.
**Examples:**
- "What did we discuss earlier?" → "Earlier in this session, you asked about 401k contribution limits and tax advantages."
- "Remind me what I asked about" → "You asked about ACH payment systems and how they work for direct deposits."
- "What did we talk about last time?" → If memory enabled: "In our previous session, we discussed Roth IRA benefits." If no memory: "I don't have access to our previous conversations, but I'm happy to help with any questions you have now."
### Type 2: Knowledge Questions (USE retrieve_passages tool)
**Indicators:**
- Asks about financial concepts, definitions, or how-to information
- Requests explanations of terms or processes
- Seeks factual information about finance topics
**Action:** Call retrieve_passages tool, then synthesize answer with sources.
Step 2: Understand the Impact¶
This system prompt ensures:
All responses based on retrieved passages
No hallucinations or made-up information
Every response includes sources
Predictable behavior across queries
Key Takeaways¶
What You Learned
- System prompts control agent behavior
- Instructions ensure tool usage for grounding
- Response format and tone are defined
- Accuracy is prioritized over completeness
Exercise 2.3: Test in Bedrock Console (3 minutes)¶
Type: Hands-on
Objective¶
Test the agent directly in the Bedrock Console to see tool invocation and traces.
Step-by-Step Instructions¶
Step 1: Open Test Interface¶
- In the Bedrock Agent details page, click "Test" button (top right)
- Test panel opens on the right side
Bedrock Console - Test Panel

Step 2: Run a Test Query¶
- Enter this query in the test panel:
-
Click "Run" or press Enter
-
Wait for response (takes 2-5 seconds)
Expected Console Behavior on First Run
First Run: You may see [<redacted>__(query="...",k=5)] instead of the full answer. This shows the agent's tool call to retrieve passages.
Why: The Bedrock Console displays intermediate steps (tool invocation) before showing the final answer.
Solution: Simply re-run the same query - the second run will display the complete answer with citations.
Note: The workshop UI handles this correctly and shows the complete answer on the first try. This console behavior is specific to the AWS Bedrock test interface.
Bedrock Console - Test Query Response

Step 3: View Trace¶
- Click "Show trace" link in the response
- Observe the execution flow: Read both Trace Step 1 and Trace Step 2
- Agent receives question
- Agent decides to use retrieve_passages tool
- Tool retrieves passages from Coveo
- Agent generates response based on passages
- Response includes citations
Bedrock Console - Trace View Showing Tool Invocation

Key Observations: - ✅ Agent automatically calls retrieve_passages tool - ✅ Tool returns relevant passages from Coveo - ✅ Agent synthesizes response from passages - ✅ Response includes source citations
Exercise 2.4: Test in Workshop UI (2 minutes)¶
Type: Hands-on
Objective¶
Test the Bedrock Agent integration through the workshop UI.
Step-by-Step Instructions¶
Step 1: Switch Backend Mode¶
- Return to the Workshop UI
- Click the backend selector (top right)
- Select "Bedrock Agent"
Workshop UI - Bedrock Agent Backend Selected

Step 2: Run Sample Queries¶
Test these queries and observe the responses:
Query 1: Basic Question
Expected: Conversational response with passage citations
Query 2: Multi-part Question
Expected: Comprehensive comparison with multiple sourcesQuery 3: Procedural Question
Expected: Step-by-step guidance with authoritative sourcesExercise 2.5: Enable Memory Configuration (5 minutes)¶
Type: Hands-on
Objective¶
Enable conversation memory so the agent can maintain context across multiple turns.
Step-by-Step Instructions¶
Step 1: Navigate to Memory Settings¶
- In the Bedrock Agent builder page, scroll down to find "Memory" section
Bedrock Agent - Memory Section (Before Configuration)

Step 2: Enable Memory¶
- Click "Enabled" button
- Leave Default Settings" for memory duration and maximum number of recent sessions
- Click Save on the top
Bedrock Agent - Memory Configuration Dialog

Step 3: Prepare the Agent¶
After enabling memory, the agent needs to be prepared:
- Click "Prepare" button at the top of the page after the button gets activated
- Wait for preparation (takes 1-2 minutes)
Bedrock Agent - Preparing Status

Agent Preparation
Whenever you make changes to an agent (memory, instructions, action groups), you must prepare it before the changes take effect.
Step 4: Verify Memory is Enabled¶
- Refresh the page
- Scroll to Memory section
- Verify: Memory shows as "Enabled"
- You can now Close the Bedrock service page : We will use the memory feature you just enabled in Lab 4.
🔍 Key Observations¶
Bedrock Agent Strengths¶
💬 Conversational
Natural language understanding and response generation
🧠 Memory
Maintains context across multiple conversation turns (will test this in Lab 4).
🎯 Grounded
Responses based on retrieved passages, not hallucinations
🔗 Source Attribution
Every response includes verifiable citations
💡 When to Use Bedrock Agent with Coveo¶
Ideal Use Cases for Coveo Customers¶
Best for: Conversational AI applications requiring multi-turn context, grounded responses from your Coveo index, and cross-session memory.
💬 Customer Support & Service Chat
Scenario: Multi-turn support conversations where users ask follow-up questions about your indexed content
Why Bedrock Agent: Natural language understanding, session + cross-session memory, grounded in Coveo passages
Coveo Integration: Agent uses passage retrieval tool to query your Coveo index, ensuring accurate, source-backed answers
Example: "I need help with my 401k" → "What are the contribution limits?" → "How do I increase my contribution?"
Memory Benefit: Agent remembers the 401k context across all turns and even across sessions
🎓 Interactive Learning & Training
Scenario: Educational assistant teaching concepts from your knowledge base with progressive depth
Why Bedrock Agent: Conversational flow, adapts to user understanding, maintains learning context
Coveo Integration: Retrieves educational content from your Coveo index, provides source citations for verification
Example: Teaching financial literacy using content from your indexed materials
Memory Benefit: Tracks what user has learned across sessions, personalizes content
🔍 Guided Research & Discovery
Scenario: Help users explore complex topics in your Coveo index through conversational guidance
Why Bedrock Agent: Understands research intent, suggests follow-up questions, synthesizes information
Coveo Integration: Searches your Coveo index intelligently, retrieves relevant passages, provides comprehensive answers
Example: Exploring investment strategies, comparing financial products, understanding regulations
Memory Benefit: Remembers research topics and preferences across sessions
🏦 Financial Advisory & Planning
Scenario: Ongoing financial guidance using authoritative content from your Coveo index
Why Bedrock Agent: Long-term relationship building, personalized advice, context-aware recommendations
Coveo Integration: Grounds all advice in your indexed financial content, ensures compliance
Example: Retirement planning conversations spanning multiple sessions over weeks
Memory Benefit: Remembers user's financial goals, risk tolerance, previous discussions
When to Choose Bedrock Agent Over Direct API (Lab 1)¶
✅ Multi-turn conversations: Users ask follow-up questions
✅ Context retention: Need to remember previous turns
✅ Natural language: Users ask questions conversationally
✅ Cross-session memory: Need to remember across logins
✅ Grounded responses: Answers must cite Coveo sources
When to Choose AgentCore (Lab 3) Over Bedrock Agent¶
Consider AgentCore when you need: - Multiple tools: Beyond just Coveo passage retrieval - MCP protocol: Standardized tool integration - Enhanced observability: Detailed logging and tracing - Complex orchestration: Multi-step tool workflows
✅ Validation Checklist¶
Before proceeding to Lab 3, verify:
- Accessed Bedrock Agent in AWS Console
- Enabled memory configuration
- Agent status is "PREPARED"
- Reviewed system prompt instructions
- Tested agent in Bedrock Console
- Viewed trace showing tool invocation
- Tested in Workshop UI with Bedrock Agent backend
- Observed conversational responses with citations
🎉 Lab 2 Complete!¶
You've successfully:
- ✅ Configured Bedrock Agent with memory
- ✅ Verified system prompt for grounded responses
- ✅ Tested agent with passage retrieval tool
- ✅ Observed agent decision-making in traces
- ✅ Understood when Bedrock Agent is the optimal choice
Key Takeaways¶
- Bedrock Agents provide conversational AI with natural language understanding
- Memory enables multi-turn conversations with context retention
- Tool integration grounds responses in authoritative sources
- System prompts control agent behavior and ensure accuracy
- Traces provide observability into agent decision-making
🚀 Next Steps¶
Ready to explore advanced orchestration with AgentCore and MCP?
In Lab 3, you'll learn about Model Context Protocol and advanced tool orchestration!