Skip to content

Skill 3.1.6: Deploy and configure agents for specific tasks, integration with other services and tools, and agent communication protocols.


Question Answer & Explanation
### Question 1 - Agent Deployment for Bursty Traffic

A startup is deploying a conversational AI agent designed to assist users with coding tasks. The agent must maintain session state across multiple turns, invoke custom tools, and handle highly bursty traffic with extended periods of zero usage during nights and weekends. The engineering team has a strict mandate to minimize operational overhead and infrastructure costs.

Which deployment approach best fits these requirements?

- A) Deploy the agent's orchestration logic on an Amazon SageMaker Real-Time Endpoint with auto-scaling, and store session state in Amazon DynamoDB.
- B) Host the agent on an Amazon Elastic Container Service (ECS) cluster with Fargate, scaling to zero based on CloudWatch CPU metrics.
- C) Use Amazon Bedrock AgentCore's serverless runtime to host the agent, leveraging its built-in memory and automatic scaling to zero.
- D) Deploy the agent as an AWS Lambda function triggered by Amazon API Gateway, using an S3 bucket to store conversational history.
Correct Answer: C

Correct Answer Analysis:
C is Correct: Amazon Bedrock AgentCore provides a serverless runtime specifically designed for hosting agents in production. It handles automatic scaling (including scaling to zero during idle periods), provides built-in memory for session state, and requires minimal operational overhead compared to managing containers or endpoints.

Distractor Analysis:
- A is Incorrect: A SageMaker Real-Time Endpoint maintains persistent instances to avoid cold starts, which incurs costs during idle periods. It also requires the team to manually manage session state in DynamoDB, increasing operational overhead.
- B is Incorrect: While ECS with Fargate can scale to zero, managing the container orchestration, auto-scaling policies, and state storage introduces unnecessary operational overhead compared to a managed agent runtime like AgentCore.
- D is Incorrect: AWS Lambda has strict execution time limits and payload size constraints that make it unsuitable for complex, multi-step agent reasoning. Managing conversational history in S3 also introduces high latency.

> Exam Tip: Bedrock AgentCore is the native AWS solution for serverless, stateful agent hosting with minimal operational overhead.
### Question 2 - Exposing Legacy APIs as Agent Tools

An enterprise has hundreds of existing internal REST APIs that a newly deployed Amazon Bedrock Agent needs to invoke. The development team wants to expose these APIs as tools to the agent without writing custom integration code or managing individual OpenAPI schemas for every single endpoint. The solution must support an open agent protocol.

Which AWS service should the engineering team use to achieve this integration?

- A) Manually create an OpenAPI schema for each API and upload them to an Amazon S3 bucket for the Bedrock Agent to consume.
- B) Use Amazon API Gateway to translate all REST APIs into a single GraphQL endpoint, then connect the agent to the GraphQL endpoint.
- C) Deploy an AWS Lambda function that acts as a hardcoded router, mapping agent intents to specific API endpoints.
- D) Use Amazon Bedrock AgentCore Gateway to expose the existing APIs and functions as tools through an open agent protocol like the Model Context Protocol (MCP).
Correct Answer: D

Correct Answer Analysis:
D is Correct: The Amazon Bedrock AgentCore Gateway is specifically designed to expose existing APIs, functions, and other internal tools to agents seamlessly. It supports open agent protocols like the Model Context Protocol (MCP), allowing agents to discover and invoke tools without requiring custom integration code for every endpoint.

Distractor Analysis:
- A is Incorrect: Manually writing and managing OpenAPI schemas for hundreds of APIs introduces massive operational overhead and does not leverage an open agent protocol dynamically.
- B is Incorrect: While API Gateway can aggregate APIs, translating REST to GraphQL does not natively present them as "tools" to a Bedrock Agent via an open agent communication protocol.
- C is Incorrect: Hardcoding routing logic in a Lambda function defeats the purpose of dynamic agent tool usage and creates a brittle, high-maintenance integration layer.

> Exam Tip: Bedrock AgentCore Gateway is the native solution for bridging existing enterprise APIs to agents using open protocols like MCP.
### Question 3 - Agent Identity and Secure Tool Invocation

A financial services company has deployed an AI agent that needs to query an internal Amazon RDS database and create tickets in an external SaaS-based ticketing system. The security team mandates that the agent must use least-privilege access and centralized identity management. The agent must not handle raw credentials.

How should the ML engineer configure the agent's identity?

- A) Pass long-lived database credentials and SaaS API keys as environment variables to the agent's underlying container.
- B) Store credentials in AWS Secrets Manager and fetch them dynamically inside the agent's prompt at runtime.
- C) Configure the Bedrock Agent with an IAM execution role and use Amazon Bedrock AgentCore's identity features to securely authenticate to downstream services.
- D) Create an Amazon Cognito user pool for the agent, requiring the agent to authenticate via OAuth 2.0 before executing tools.
Correct Answer: C

Correct Answer Analysis:
C is Correct: Amazon Bedrock AgentCore provides built-in identity management. By assigning an IAM execution role to the agent and utilizing AgentCore's identity features, the agent can securely assume roles to access AWS services (like RDS via IAM database authentication) and external systems without ever handling raw credentials.

Distractor Analysis:
- A is Incorrect: Passing long-lived credentials as environment variables violates security best practices and the mandate to avoid raw credentials.
- B is Incorrect: Injecting credentials into the agent's prompt risks exposing sensitive data in logs or model outputs, violating the security mandate.
- D is Incorrect: Cognito is designed for user authentication, not for service-to-service (agent-to-tool) identity management and least-privilege access.

> Exam Tip: Use Bedrock AgentCore identity and IAM execution roles to enforce least privilege for agent tool invocations.
### Question 4 - Agent Observability and Debugging

An AI engineer is troubleshooting a production agent that occasionally fails to complete a multi-step booking process. The engineer needs to trace the agent's exact reasoning, the inputs and outputs of each tool invocation, and the latency of each step to identify the failure point. The solution must minimize infrastructure management.

Which approach provides the most detailed agent tracing with the least operational overhead?

- A) Implement custom logging within the agent's application code and forward logs to Amazon CloudWatch Logs.
- B) Enable AWS X-Ray on the underlying API Gateway to trace the HTTP requests made by the client.
- C) Use Amazon Bedrock AgentCore's built-in observability features to capture traces of the agent's reasoning, tool inputs/outputs, and latency.
- D) Deploy a custom LangSmith container on Amazon ECS to monitor and trace the agent's execution.
Correct Answer: C

Correct Answer Analysis:
C is Correct: Amazon Bedrock AgentCore includes native observability features tailored for agents. It automatically captures the agent's thought process (reasoning), tool selections, tool inputs/outputs, and execution latencies, providing deep insights without requiring custom logging code or additional monitoring infrastructure.

Distractor Analysis:
- A is Incorrect: Custom logging is labor-intensive to build, may miss internal agent state transitions, and introduces high operational overhead.
- B is Incorrect: AWS X-Ray on API Gateway only traces the incoming HTTP request to the agent's entry point; it does not trace the internal reasoning, LLM invocations, or tool executions inside the agent.
- D is Incorrect: Deploying a custom monitoring container on ECS introduces unnecessary infrastructure management overhead compared to native observability features.

> Exam Tip: Rely on native Bedrock AgentCore observability for zero-infrastructure tracing of agent reasoning and tool executions.
### Question 5 - Filtering Stale Documents in Agent RAG

An enterprise agent uses an Amazon Bedrock Knowledge Base to answer questions about corporate policies. Employees complain that the agent frequently hallucinates by citing outdated policies that have been superseded. The knowledge base contains documents spanning the last 10 years. The team must ensure the agent only retrieves current, valid policies.

Which retrieval configuration directly addresses this issue?

- A) Increase the number of returned passages (top_k) to give the agent more context to choose from.
- B) Apply metadata filters to the Knowledge Base retrieval to restrict document searches to the current year.
- C) Add a reranking model to reorder the retrieved candidates so the most recent ones appear first.
- D) Switch from semantic vector search to hybrid search to improve exact term matching.
Correct Answer: B

Correct Answer Analysis:
B is Correct: Applying metadata filters restricts the candidate set before similarity search is performed. By filtering on a metadata attribute like "year" or "effective_date", the agent ensures that outdated documents are never retrieved in the first place, directly preventing the citation of stale policies.

Distractor Analysis:
- A is Incorrect: Increasing top_k widens recall and will actually include more outdated documents, exacerbating the hallucination problem.
- C is Incorrect: Reranking only reorders the candidates already retrieved. If the vector search retrieves mostly old documents, reranking will still leave old documents in the context window. It does not filter out stale data.
- D is Incorrect: Hybrid search improves recall of exact terms but does not filter based on temporal relevance (document age).

> Exam Tip: Use metadata filters in Knowledge Bases to restrict the candidate pool (e.g., by date) before vector search runs.
### Question 6 - Multi-Agent Collaboration and Routing

A customer service platform needs an AI system where a central "Supervisor Agent" triages incoming user requests and delegates them to specialized sub-agents (e.g., a "Billing Agent" and a "Technical Support Agent"). The organization requires a managed orchestration mechanism that natively supports agent-to-agent communication and routing.

Which AWS approach best implements this architecture?

- A) Build a custom router using an AWS Lambda function that parses user intent and invokes separate, standalone Bedrock Agents via the InvokeModel API.
- B) Use Amazon Bedrock's native multi-agent collaboration feature to define a supervisor agent that routes tasks to specialized sub-agents.
- C) Deploy all sub-agents on an Amazon EKS cluster and use a Kubernetes Ingress controller to route traffic between them.
- D) Use AWS Step Functions to pass the output of one Bedrock Agent sequentially to the next until the task is resolved.
Correct Answer: B

Correct Answer Analysis:
B is Correct: Amazon Bedrock supports native multi-agent collaboration, allowing a supervisor agent to dynamically break down tasks and route them to specialized sub-agents. This managed feature handles the communication, context passing, and orchestration between agents without requiring custom routing logic.

Distractor Analysis:
- A is Incorrect: Building a custom Lambda router introduces significant operational overhead, custom code maintenance, and lacks the native reasoning capabilities of a managed supervisor agent.
- C is Incorrect: Using EKS and Kubernetes Ingress is for network-level traffic routing, not semantic-level AI task delegation and agent-to-agent collaboration.
- D is Incorrect: Step Functions orchestrate deterministic workflows, whereas agent collaboration requires dynamic, LLM-driven routing based on conversational context.

> Exam Tip: Use Bedrock's native multi-agent collaboration (Supervisor + Sub-agents) for dynamic, LLM-driven task routing instead of custom code or Step Functions.
### Question 7 - Managing Long-Term Agent Memory

An enterprise deployed a financial advisory agent that assists clients over multiple sessions spanning several weeks. The agent must recall specific details from past conversations (e.g., risk tolerance, past portfolio performance) without forcing the user to repeat themselves. The foundation model's context window is insufficient to hold the entire history.

How should the engineer implement memory for this agent?

- A) Increase the foundation model's maximum context window size and pass the full transcript every turn.
- B) Store the full transcript in Amazon S3 and configure the agent to query S3 as a tool at the start of every turn.
- C) Utilize Amazon Bedrock AgentCore memory to automatically store and retrieve short-term session context and long-term user memories.
- D) Summarize the transcript using a smaller model before every new prompt and inject it into the system prompt.
Correct Answer: C

Correct Answer Analysis:
C is Correct: Amazon Bedrock AgentCore provides built-in memory management designed to handle both short-term (within a session) and long-term (across sessions) context. It automatically manages the storage and retrieval of relevant past interactions, preventing context window overflow without requiring custom S3 integrations.

Distractor Analysis:
- A is Incorrect: Even large context windows will eventually be exceeded by weeks of conversation, and passing massive transcripts every turn causes high latency and token costs.
- B is Incorrect: Querying S3 manually as a tool requires the agent to know exactly what file to look for, which doesn't solve semantic recall of past conversational details effectively.
- D is Incorrect: Continuously summarizing transcripts via a secondary model adds significant latency, cost, and potential loss of critical details through summarization.

> Exam Tip: Use Bedrock AgentCore memory for native, long-term context retention that bypasses context window limits.
### Question 8 - Executing Custom Code as an Agent Tool

A data science team is building an agent that needs to perform complex Monte Carlo simulations to answer user queries. The simulation logic is written in Python and requires an isolated, serverless compute environment to execute securely when invoked by the agent.

What is the most appropriate way to expose this simulation to the agent?

- A) Package the Python code inside the agent's prompt and instruct the LLM to execute the logic mentally.
- B) Deploy the Python script on a persistent Amazon EC2 instance and expose it to the agent via a public IP address.
- C) Use Amazon Bedrock AgentCore runtime to execute the custom Python code as a tool in a managed, serverless environment.
- D) Use an Amazon ECS cluster with a dedicated container for the simulation, polling an SQS queue for agent requests.
Correct Answer: C

Correct Answer Analysis:
C is Correct: Amazon Bedrock AgentCore provides a serverless runtime that can securely execute custom code (like Python scripts) as tools invoked by the agent. This offers isolation, automatic scaling, and managed infrastructure without the need to provision EC2 instances or ECS clusters.

Distractor Analysis:
- A is Incorrect: LLMs are text-generation models, not code execution environments; they cannot reliably or securely perform complex mathematical simulations "mentally."
- B is Incorrect: Exposing an EC2 instance via a public IP introduces significant security risks and requires the team to manage the underlying OS and capacity.
- D is Incorrect: Using ECS with SQS is a highly complex, operational-heavy architecture for what should be a simple, event-driven tool execution.

> Exam Tip: Use Bedrock AgentCore's serverless runtime to securely execute custom Python/agent code as tools without managing servers.
### Question 9 - Integrating with the Model Context Protocol (MCP)

A software vendor provides an external tool server that implements the Model Context Protocol (MCP). An enterprise wants their internal Amazon Bedrock Agent to dynamically discover and use the tools exposed by this external MCP server. The integration must adhere to the open protocol natively.

Which AWS service acts as the bridge to connect the Bedrock Agent to the MCP server?

- A) AWS Lambda function acting as a proxy.
- B) Amazon Bedrock AgentCore Gateway.
- C) Amazon API Gateway with HTTP proxy integration.
- D) Amazon SageMaker JumpStart.
Correct Answer: B

Correct Answer Analysis:
B is Correct: The Amazon Bedrock AgentCore Gateway is designed to connect agents to external tools and services using open agent communication protocols like the Model Context Protocol (MCP). It translates the agent's requests into the appropriate protocol format, enabling seamless tool discovery and invocation.

Distractor Analysis:
- A is Incorrect: An AWS Lambda proxy would require custom coding to handle the MCP protocol translation, violating the requirement for native, protocol-compliant integration.
- C is Incorrect: API Gateway is a generic HTTP API manager; it does not natively understand or implement the Model Context Protocol for agent tool discovery.
- D is Incorrect: SageMaker JumpStart is a catalog of pre-trained models, not a tool integration gateway for agents.

> Exam Tip: Bedrock AgentCore Gateway is the native bridge for MCP-compliant tool servers and agent communication protocols.
### Question 10 - Resolving Poor Retrieval Ordering for Agents

An agent retrieves technical manuals from a Bedrock Knowledge Base. Users report that the agent often ignores the correct answer. Upon investigation, the engineer finds that the vector search retrieves the correct passage, but it ranks 5th out of 10 returned passages. The top 4 passages are semantically similar but irrelevant. The model is getting confused by the irrelevant context.

Which configuration change will most directly fix this ordering issue?

- A) Reduce the number of returned passages (top_k) to 4.
- B) Apply a reranking model to reorder the retrieved candidates based on cross-encoder relevance scoring.
- C) Change the underlying embedding model to one with more dimensions.
- D) Switch the vector store from OpenSearch to Pinecone.
Correct Answer: B

Correct Answer Analysis:
B is Correct: A reranking model performs a second-pass evaluation of the retrieved candidates using a cross-encoder, which calculates a deep semantic relevance score between the query and each passage. This directly reorders the list, moving the correct passage from rank 5 to rank 1, preventing the model from being confused by irrelevant top results.

Distractor Analysis:
- A is Incorrect: Reducing top_k to 4 would completely drop the correct passage (currently ranked 5th) from the context window, causing the agent to fail entirely.
- C is Incorrect: While changing embedding models might affect overall search quality, it does not guarantee the specific ordering issue is fixed and requires a costly full re-indexing of the knowledge base.
- D is Incorrect: The vector store itself executes the math based on the embeddings; switching databases does not change the inherent semantic similarity ranking generated by the embedding model.

> Exam Tip: Use a reranking model (cross-encoder) as a second pass to fix semantic ordering issues in retrieved Knowledge Base passages.