3.2.9

Question Answer & Explanation
### Question 1 - Bedrock Agents Native Session Management

A retail company is deploying an Amazon Bedrock Agent to handle customer service inquiries. The agent must maintain dialogue context within a single ongoing conversation so that a user can ask follow-up questions without repeating themselves. The ML engineering team wants the solution with the least operational overhead.

Which approach should the team use to manage this short-term state? (Select ONE)

- A) Pass a unique sessionId parameter in the InvokeAgent API request for each turn of the same conversation.
- B) Store the entire conversation history in an Amazon S3 bucket and prepend it to the prompt on each invocation.
- C) Use a custom AWS Lambda function to save conversation history to a PostgreSQL database and query it before each invocation.
- D) Configure an Amazon DynamoDB table to store session state and manually inject the history into the agent's prompt template.
Correct Answer: A

Correct Option Analysis:
- A is Correct: Amazon Bedrock Agents natively supports short-term session memory. By passing a sessionId to the InvokeAgent API, Bedrock automatically stores and retrieves the conversation history for that specific session, maintaining context without requiring custom infrastructure or code.

Distractor Analysis:
- B is Incorrect: Storing history in S3 and manually prepending it introduces unnecessary operational overhead and latency compared to native session management.
- C is Incorrect: Using a custom Lambda function and a PostgreSQL database for session state is a high-overhead, custom solution that duplicates functionality already built into Amazon Bedrock.
- D is Incorrect: Manually storing and injecting state from DynamoDB into the prompt template is less efficient and bypasses Bedrock's built-in session state capabilities.

> Exam Tip: For short-term, single-session context in Amazon Bedrock Agents, rely on the native sessionId parameter rather than building custom database-backed memory solutions.
### Question 2 - Multi-Tenant Agent Session Isolation

An enterprise is deploying a multi-tenant generative AI agent using Amazon Bedrock Agents. Compliance requirements dictate strict session isolation so that no tenant can access another tenant's conversational state. The architecture must minimize operational overhead while guaranteeing state isolation.

Which approach securely fulfills this requirement? (Select ONE)

- A) Deploy a separate Amazon Bedrock Agent for each tenant.
- B) Rely on the sessionId parameter, ensuring a cryptographically unique ID is generated per tenant session, which natively isolates state in Amazon Bedrock.
- C) Implement an IAM policy condition that restricts API calls based on the tenant's IP address.
- D) Use a VPC security group policy restricting network access to the agent's state store based on tenant ID.
Correct Answer: B

Correct Option Analysis:
- B is Correct: Amazon Bedrock isolates session state by sessionId. As long as each tenant session uses a unique sessionId, their conversation histories and states are natively isolated and cannot cross-contaminate, requiring no additional infrastructure.

Distractor Analysis:
- A is Incorrect: Deploying a separate Bedrock Agent per tenant creates massive operational overhead and cost, violating the constraint to minimize operations.
- C is Incorrect: IAM IP conditions do not provide logical separation of conversational memory within a single agent.
- D is Incorrect: Security groups control network traffic to compute resources, not logical session state separation within a managed AWS service like Bedrock.

> Exam Tip: Logical session isolation in managed AI services like Bedrock is achieved via unique identifiers (sessionId), not network-level constructs or duplicating resources.
### Question 3 - Persisting Long-Term Memory Across Sessions

A travel booking agent assists users with planning trips. Users frequently return to the agent days later and expect the agent to remember their past preferences (e.g., seating class, dietary restrictions) without repeating them. The architecture requires a persistent, low-latency store for this long-term memory that extracts and saves key facts across sessions.

Which AWS service configuration best meets this requirement? (Select ONE)

- A) Amazon S3 Standard storage class for historical conversation logs.
- B) Amazon DynamoDB with an actor ID partition key to store extracted user preferences.
- C) Amazon EFS mounted to the agent's execution environment.
- D) Amazon RDS for PostgreSQL with a complex relational schema for every conversation turn.
Correct Answer: B

Correct Option Analysis:
- B is Correct: Amazon DynamoDB is ideal for long-term memory that requires low-latency access. By using the actor ID (user ID) as the partition key, the agent can quickly retrieve stored preferences and cross-session context. Bedrock AgentCore Memory also leverages this concept of actor-scoped namespaces.

Distractor Analysis:
- A is Incorrect: Amazon S3 is optimized for object storage, not low-latency key-value lookups required for retrieving user preferences on the fly.
- C is Incorrect: Amazon EFS is a shared file system and does not provide the structured, low-latency querying capabilities needed for targeted user memory retrieval.
- D is Incorrect: While RDS could work, storing every conversation turn in a complex relational schema introduces unnecessary overhead compared to a simple key-value store like DynamoDB.

> Exam Tip: Long-term memory (cross-session) is best stored in a fast key-value store like DynamoDB, keyed by user/actor ID, whereas short-term memory uses sessionId.
### Question 4 - Managing Intermediate State in Action Groups

An internal IT support agent built on Amazon Bedrock uses an action group to create Jira tickets via an API. During a multi-turn session, the user provides a summary, and the agent calls the action group. The system needs to keep track of the Jira ticket ID returned by the API so the agent can reference it in follow-up questions during the same session. The team requires the least operational overhead.

Which state management approach is most appropriate? (Select ONE)

- A) Store the Jira ticket ID in an Amazon DynamoDB table using the sessionId as the partition key.
- B) Return the Jira ticket ID from the Lambda function, and let Bedrock's native session state track it within the ongoing sessionId.
- C) Pass the ticket ID back to the client and require the client to include it in the next InvokeAgent request.
- D) Write the ticket ID to Amazon CloudWatch Logs and retrieve it via a Logs Insights query on the next turn.
Correct Answer: B

Correct Option Analysis:
- B is Correct: When an action group's Lambda function returns data (like a ticket ID), Amazon Bedrock automatically incorporates this into the agent's session context. The agent can then natively reference this returned state in subsequent turns of the same sessionId without external state management.

Distractor Analysis:
- A is Incorrect: While DynamoDB could store the ID, doing so manually for a single session adds unnecessary operational overhead since Bedrock tracks intermediate action group results natively.
- C is Incorrect: Forcing the client to manage state breaks the agent's autonomous flow and degrades the user experience.
- D is Incorrect: CloudWatch Logs is for observability, not for operational state retrieval during an active LLM conversation.

> Exam Tip: Bedrock Agents automatically retain the output of action groups within the current session context, allowing the LLM to reference intermediate API results natively.
### Question 5 - High-Speed State for Custom Agents

A machine learning team is deploying a custom LangChain-based agent on an Amazon SageMaker AI endpoint. The agent requires extremely fast, sub-millisecond read/write access to short-term conversation state for active sessions. The solution must support automatic eviction of stale sessions to manage costs. Which AWS service is best suited for this state management? (Select ONE)

- A) Amazon ElastiCache for Redis.
- B) Amazon S3 Intelligent-Tiering.
- C) Amazon DynamoDB with TTL enabled.
- D) Amazon EBS gp3 volumes attached to the SageMaker instance.
Correct Answer: A

Correct Option Analysis:
- A is Correct: Amazon ElastiCache for Redis provides sub-millisecond read and write latency, making it ideal for high-speed short-term session state. Redis also natively supports Time-To-Live (TTL) keys, allowing automatic eviction of stale sessions.

Distractor Analysis:
- B is Incorrect: Amazon S3 has higher latency (millisecond range) and is not suited for sub-millisecond state lookups.
- C is Incorrect: While DynamoDB with TTL meets the eviction requirement, its latency is typically single-digit milliseconds, which is slower than the sub-millisecond requirement specified.
- D is Incorrect: EBS volumes are attached to a single instance, making state sharing difficult if the endpoint scales out to multiple instances, and it lacks native session eviction.

> Exam Tip: When a scenario demands "sub-millisecond" latency for custom agent state, think Amazon ElastiCache (Redis). For single-digit millisecond latency with massive scale, choose DynamoDB.
### Question 6 - Compliance and Data Retention for State

A healthcare provider runs an AI agent that collects sensitive patient symptoms during triage. To comply with data retention policies, all session state must be automatically purged exactly 24 hours after the session concludes. The solution must minimize operational overhead. Which configuration provides the most efficient way to enforce this? (Select ONE)

- A) Use an Amazon DynamoDB table for session state with a Time-to-Live (TTL) attribute set to 24 hours after the last update.
- B) Write a custom AWS Lambda function triggered by Amazon EventBridge to delete S3 objects older than 24 hours.
- C) Configure an Amazon OpenSearch Service index with an ISM (Index State Management) policy to delete documents after 24 hours.
- D) Manually trigger a daily AWS Batch job to scrub the database.
Correct Answer: A

Correct Option Analysis:
- A is Correct: DynamoDB Time-to-Live (TTL) automatically deletes expired items from a table without consuming write capacity or requiring custom orchestration. Setting the TTL epoch timestamp to 24 hours after the session's last update perfectly meets the low operational overhead requirement.

Distractor Analysis:
- B is Incorrect: Using EventBridge and Lambda to delete S3 objects requires writing and maintaining custom code, adding operational overhead.
- C is Incorrect: While OpenSearch ISM can delete documents, it is significantly more complex and expensive to operate for simple session state than DynamoDB TTL.
- D is Incorrect: A daily AWS Batch job is a high-overhead solution that does not guarantee exactly 24-hour deletion (it would delete in daily batches).

> Exam Tip: For automated data expiration with zero operational overhead, DynamoDB Time-to-Live (TTL) is the standard AWS best practice.
### Question 7 - State Summarization for Context Limits

An enterprise legal agent assists lawyers in drafting contracts. During a long session, the conversation history exceeds the model's context window limit. The team needs to implement a state management strategy that preserves the core intent of the conversation without dropping critical entities, while staying within token limits. Which approach is the most efficient? (Select ONE)

- A) Store the full conversation in Amazon S3 and only retrieve the last 5 messages.
- B) Implement a rolling summary using a smaller, faster LLM to compress previous interactions before injecting them into the current prompt's context.
- C) Restart the session and ask the user to reiterate their constraints.
- D) Increase the model's temperature parameter to generate more diverse outputs that require less context.
Correct Answer: B

Correct Option Analysis:
- B is Correct: Summarization (or memory compression) is a standard state management technique in agent frameworks. By passing older history through a smaller LLM to extract key facts, the agent preserves the context without exceeding token limits.

Distractor Analysis:
- A is Incorrect: Simply retrieving the last 5 messages will abruptly cut off earlier constraints and entities, causing the agent to lose critical legal context.
- C is Incorrect: Restarting the session degrades the user experience and defeats the purpose of an autonomous agent.
- D is Incorrect: The temperature parameter controls output randomness, not the amount of context the model can process.

> Exam Tip: When conversation state exceeds the context window, use an LLM to summarize previous turns into a compact state representation.
### Question 8 - Bedrock AgentCore Strategic Memory

A development team is using Amazon Bedrock AgentCore to host an agentic workflow. They need a memory system that automatically extracts insights from user interactions and saves them to a persistent namespace scoped to the individual user (e.g., /preferences/{actorId}/), without writing custom database provisioning code. Which memory capability meets this requirement? (Select ONE)

- A) Short-term memory (session memory).
- B) Long-term memory (strategic memory).
- C) Action group memory.
- D) Prompt template memory.
Correct Answer: B

Correct Option Analysis:
- B is Correct: Long-term memory in Bedrock AgentCore is explicitly designed to automatically extract and consolidate persistent insights, scoped to an actor namespace (like /preferences/{actorId}/), allowing context to persist across distinct sessions.

Distractor Analysis:
- A is Incorrect: Short-term memory only holds context for the active session (sessionId) and is cleared when the session terminates.
- C is Incorrect: Action group memory refers to the intermediate results of API calls within a session, not cross-session user preferences.
- D is Incorrect: Prompt template memory is not a recognized state management feature in Bedrock AgentCore.

> Exam Tip: Bedrock AgentCore Long-Term Memory (LTM) provides actor-scoped, persistent memory across sessions, whereas Short-Term Memory (STM) is tied to the sessionId.
### Question 9 - DynamoDB Table Design for Agent State

An e-commerce platform has a custom agent orchestrator running on AWS Lambda. The orchestrator manages state by storing session attributes in an Amazon DynamoDB table. To ensure a specific user's cart items and session history are available to the agent during a follow-up query with the lowest latency, how should the DynamoDB table be designed? (Select ONE)

- A) Use the userId as the partition key and sessionId as the sort key.
- B) Use the sessionId as the partition key and timestamp as the sort key.
- C) Use a composite key of productId and userId.
- D) Use a global secondary index (GSI) on the agent's name.
Correct Answer: A

Correct Option Analysis:
- A is Correct: Using userId as the partition key allows the system to quickly retrieve all sessions and state associated with a specific user. Using sessionId as the sort key allows the agent to isolate the specific active session or merge historical sessions for that user efficiently.

Distractor Analysis:
- B is Incorrect: Using only sessionId as the partition key makes it difficult to retrieve all state for a specific user without scanning the whole table or using a GSI.
- C is Incorrect: productId is irrelevant to retrieving user session state.
- D is Incorrect: An index on the agent's name does not help isolate user or session data.

> Exam Tip: When designing a state store that must look up context by user first, and then by session, use userId as the Partition Key and sessionId as the Sort Key.
### Question 10 - Orchestration State in Step Functions

A data processing agent is orchestrated using AWS Step Functions. The workflow requires maintaining the state of several intermediate variables (e.g., extracted entities, confidence scores, API responses) across multiple distributed Lambda function invocations within a single execution. The team requires the most operationally efficient way to pass this state. How should this be achieved? (Select ONE)

- A) Use an external Amazon DynamoDB table to store intermediate variables, queried by each Lambda function.
- B) Use Amazon SQS to queue the intermediate variables between Lambda steps.
- C) Rely on AWS Step Functions native state management by passing JSON payloads between states using ResultPath and InputPath.
- D) Store intermediate variables in an Amazon S3 bucket and pass the S3 URI between Lambda functions.
Correct Answer: C

Correct Option Analysis:
- C is Correct: AWS Step Functions is a state machine service natively designed to maintain state between execution steps. By using InputPath, ResultPath, and OutputPath, the workflow can filter and combine JSON payloads, passing the accumulated state from one Lambda step to the next without external storage.

Distractor Analysis:
- A is Incorrect: Using DynamoDB for intermediate state within a Step Functions workflow adds unnecessary latency and operational overhead, as Step Functions already manages state internally.
- B is Incorrect: Amazon SQS is a messaging queue, not a state management tool for orchestrating variables between distinct steps.
- D is Incorrect: The S3 bucket pattern (passing URIs) is used for large payloads, but for simple intermediate variables, Step Functions' native JSON state passing is far more efficient.

> Exam Tip: For serverless orchestrations using Step Functions, rely on native JSON state passing before introducing external databases like DynamoDB for intermediate variables.