Lesson 3 of 3 Model Context Protocol and Amazon Bedrock AgentCore

Running Agents in Production with Amazon Bedrock AgentCore

This lesson describes the modular Amazon Bedrock AgentCore services for hosting, memory, tools, identity and observability that let agents built with any framework and model run securely and reliably for many users.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe what AgentCore Runtime provides for long-running agent sessions.
  • Distinguish AgentCore Memory, Gateway and Identity.
  • Identify the built-in tools, observability and policy services.

AgentCore Runtime

Running agents in production raises problems that a simple web service does not have: sessions can last many minutes or hours, agents run code and handle sensitive data on behalf of different users, and agent frameworks change quickly. Amazon Bedrock AgentCore Runtime is a managed service for hosting agents and MCP servers built with any framework, such as Strands Agents or other open-source frameworks, packaged as containers or code.

Each user session runs in its own isolated environment, a dedicated microVM, which prevents data from leaking between sessions or users. Runtime scales automatically, supports long-running sessions of up to several hours and large payloads, streams responses, and supports the HTTP, MCP and Agent2Agent (A2A) protocols. Agents are deployed as versioned runtimes with endpoints, so a new version can be tested before production traffic is moved to it.

Scenario questions

Moving an agent to production

Exam skills 2.1.1 · 2.2.1

Choose the AgentCore capability that meets each production requirement.

Log in to try this activity Interactive activities are free with an account.

AgentCore Memory, Gateway and Identity

AgentCore Memory stores short-term memory as events within a session and builds long-term memory with strategies that extract summaries, user preferences and semantic facts, which agents retrieve in later sessions. AgentCore Gateway converts Lambda functions, OpenAPI and Smithy API definitions and existing MCP servers into MCP tools behind one endpoint, with authentication, and offers semantic search over tools so agents with many tools can find the right one.

AgentCore Identity manages agent identities and credentials: inbound authentication of users and applications through identity providers such as Amazon Cognito or other OAuth providers, and outbound access to AWS resources and third-party services through credential providers and a secure token vault, so agents can act on behalf of users with their consent without embedding secrets in code.

The following diagram maps each shortcut in an agent prototype to the AgentCore service that replaces it in production.

Taking a Strands agent prototype to production with AgentCore. The laptop runtime moves to AgentCore Runtime for per-user session isolation, the local memory file to AgentCore Memory with a user preference strategy, hard-coded API keys to AgentCore Gateway, calendar access to AgentCore Identity tokens, and missing traces to AgentCore Observability.
No secrets remain in the agent's code.
Match the pairs

AgentCore services

Exam skills 2.1.1 · 2.1.7

Match each Amazon Bedrock AgentCore service with what it provides.

Log in to try this activity Interactive activities are free with an account.

Built-in tools, observability and policy

AgentCore also provides managed tools and operational services that agents commonly need. AgentCore Code Interpreter runs code that an agent writes in an isolated sandbox, so the agent can perform calculations and data analysis reliably instead of estimating numbers. AgentCore Browser provides a managed, isolated web browser that an agent controls to read and interact with websites that have no API.

AgentCore Observability emits OpenTelemetry traces, metrics and logs for every step, tool call and model invocation of an agent, which can be viewed in the Amazon CloudWatch generative AI observability dashboards and used to diagnose failures and latency. Newer capabilities add policy controls that allow or deny specific tool calls (AgentCore Policy) and evaluation of agent quality (AgentCore Evaluations).

The following table summarises the services.

ServiceProvides
RuntimeServerless, session-isolated hosting for agents and MCP servers
MemoryShort-term events and long-term extracted memories
GatewayAPIs, Lambda functions and MCP servers exposed as MCP tools, with tool search
IdentityInbound authentication and outbound credentials for agents
Code InterpreterSandboxed code execution
BrowserManaged, isolated web browser for agents
ObservabilityOpenTelemetry traces, metrics and dashboards in CloudWatch
Policy and EvaluationsControls on tool calls; agent quality scoring
Worked example

From prototype to production

A team built a Strands agent prototype on a laptop that calls internal APIs with hard-coded keys and keeps memory in a local file. For production it needs per-user session isolation, user personalisation across sessions, OAuth access to a SaaS calendar on the user's behalf, and traces.

The production design deploys the agent to AgentCore Runtime, stores memory in AgentCore Memory with a user preference strategy, exposes internal APIs through AgentCore Gateway, obtains calendar tokens through AgentCore Identity and monitors with AgentCore Observability, with no hard-coded secrets.

Check yourself

Which AgentCore service keeps user preferences and facts across sessions?

Show answer

AgentCore Memory, through its long-term memory.

Exam Tips

Remember for the exam

  • Runtime: framework-agnostic hosting with per-session isolation.
  • Memory: short-term events plus long-term summaries, preferences and facts.
  • Gateway: Lambda functions and APIs become MCP tools.
  • Identity: OAuth inbound and outbound credentials without hard-coded secrets.
  • Observability: OpenTelemetry traces in CloudWatch.