Skip to main content

Amazon Bedrock AgentCore + Diagrid

Host your agent on Amazon Bedrock AgentCore. Make its execution durable with Diagrid.

Preview

Amazon Bedrock AgentCore support in Diagrid is in preview. Features and behavior can change before general availability.

Amazon Bedrock AgentCore Runtime runs your agent container in sessions, each in its own microVM, and gives it an endpoint. On AgentCore alone, an agent's progress lives in its session. A session ends when it is idle or reaches its maximum lifetime, and a crash loses the run's progress.

Diagrid gives every agent run durable execution: each model call and tool call is recorded as a step of a workflow. When a session ends or the container crashes, the run picks up where it left off, from its last completed step, once a session of the Runtime is running. Its result stays in Diagrid after the request that started it ends.

An AgentCore agent with Diagrid durable executionAmazon Bedrock AgentCoreDiagridYour clientinvokeAgent containerYour agent + DiagridAmazon BedrockmodelWorkflow engineExecution historyDiagrid CLI and Consoleevery step
An AgentCore agent with Diagrid durable executionThe agent container runs in an AgentCore session, calls its model in Amazon Bedrock itself, and records every step of the run in Diagrid over outbound HTTPS and gRPC.

What each platform provides​

Amazon Bedrock AgentCoreDiagrid
Models and toolsWorks with the model provider your agent callsWorks with the models and tools your agent already uses
Agent runtimeAgentCore Runtime: your container in a session microVM, an invocation endpoint and an execution roleNever runs your agent code. Your agent connects to Diagrid over outbound HTTPS and gRPC
ExecutionStarts and ends sessions, and routes each invocation to its sessionRuns the agent's control loop as a durable workflow and stores its history. Can start and stop AgentCore sessions to run the agent's workflow worker
VisibilityCloudWatch logs and metrics of the RuntimeEvery run as a workflow: status, steps, inputs, outputs and timing

What you can build​

Some agents need more than a session can give them: they run longer than a session lives, they act on events when no one is waiting, or they take actions that you must be able to account for. Run them on AgentCore, and make their execution durable with Diagrid:

Your agentOn AgentCore aloneWith Diagrid
A research or report agent that makes dozens of model and tool calls over an hour or moreA crash, or the end of the session at its maximum lifetime of 8 hours, loses the run's progressThe run resumes on a new session from its last completed step
A back-office agent that triages invoices or tickets as they arriveYou keep a session running, or build what starts one when work arrivesDiagrid starts a worker when work is waiting and stops it when there is none
A support agent whose conversations span daysThe conversation is lost when the session ends, after 15 minutes with no request by defaultThe conversation is stored in Diagrid, under the session ID
An operations agent that issues refunds, opens tickets or changes systemsA run that restarts repeats the steps it had already completed, and nothing records what the agent didCompleted steps aren't run again, and every step's input and output can be inspected

Three ways to run the agent​

  • On your machine, connected to Diagrid. The quickstart runs the agent locally, with the same HTTP contract AgentCore uses.
  • As an AgentCore hosted agent. Your clients invoke the AgentCore Runtime, and each session's container runs the agent and executes its runs. See AgentCore hosted agents.
  • In Diagrid-managed sessions. Your clients start runs through Diagrid. Diagrid starts an AgentCore session to run the agent when there is work, and stops it when there is none. See Diagrid-managed sessions.

Hosted agents or Diagrid-managed sessions?​

The difference is what your app calls: AWS or Diagrid.

Hosted agents: your app calls AWS​

  • Your client invokes the AgentCore Runtime with AWS credentials, as it would any AgentCore agent.
  • AgentCore starts a session for each session ID, and the agent runs inside it.
  • Diagrid records each step of the run, so the run is durable.
  • Your client and AgentCore control the session's lifecycle. A session starts when a client invokes it, and ends after 15 minutes with no request, by default.
  • If a session ends during a run, the run's progress is saved in Diagrid. The run resumes when a session of the Runtime is running. To collect its result, your client invokes the session again with {}, which also starts a session if none is running.

It works as a request and a response: your client sends a task and waits for the answer, for up to 14 minutes.

Diagrid-managed sessions: your app calls Diagrid​

  • Your client starts a run through Diagrid, and doesn't call AWS.
  • When the agent has work waiting and no worker is connected, Diagrid starts an AgentCore session in your AWS account. The session's container connects to Diagrid as the agent's worker and executes the run.
  • When the agent has no work, Diagrid stops the session.
  • If a worker fails, Diagrid starts a new one, and the run continues from its last completed step with no action from your client.

Here AgentCore is compute that Diagrid starts and stops as needed.

Compare​

Hosted agentsDiagrid-managed sessions
Your app callsAWS (the AgentCore Runtime)Diagrid
What starts a sessionYour client's requestDiagrid, when work is waiting and no worker is connected
StyleSend a task and wait for the answer, up to 14 minutesStart a run and collect its result later. No request waits for the run
RecoveryProgress is saved in Diagrid. Your client invokes the session again to collect the resultAutomatic: Diagrid starts a new worker
SessionsOne per session ID. Each ends after its idle timeoutNone while there is no work. Diagrid stops the worker when the agent has no work
AWS setupImage, secret, execution role and RuntimeThe same, plus a role Diagrid can assume, which diagrid agent compute setup generates
Use it whenYour callers use AWS IAM, you want a standard AgentCore agent, and you want the smallest changeWork is driven by events or schedules, runs are long, and you want recovery and scaling without client action

Use hosted agents when your app calls the agent through AgentCore and waits for the answer. Use Diagrid-managed sessions when your app starts runs through Diagrid: Diagrid runs AgentCore sessions only while there is work, and recovers a failed run on its own.

What Diagrid adds to an AgentCore agent​

  • Durable execution with automatic failure recovery. Each model call and tool call runs as a workflow activity. A failed activity is retried, and a run interrupted when AgentCore ends a session resumes from its last completed step on the next worker.
  • Persistent execution history and checkpoints. Diagrid stores the result of every completed step in the project's workflow state store. A resumed run reads those results from the history and doesn't call the model or the tool again for them. Activities run at least once, so keep tools with side effects idempotent.
  • Runs longer than a request. A run isn't tied to one session or one request. When an invocation times out, the run keeps going in Diagrid, and its result stays in the run's output.
  • Conversation across invocations. Invocations with the same AgentCore session ID share one conversation, stored in Diagrid.
  • Workflow-level visibility. Every agent run is a workflow that you can inspect with the Diagrid CLI or in the Diagrid Console, with the input and output of each step.
  • Verifiable execution. In a project with workflow history signing, Diagrid signs every history event, which gives you a tamper-evident record of what ran, and attests results that cross identities. You turn it on when you create the project. See Verifiable execution.
  • Sessions only when there is work. With Diagrid-managed sessions, Diagrid starts an AgentCore session when the agent has pending work and no worker is connected, and stops it when the agent has no work. No AWS credentials are stored in Diagrid.

Supported frameworks​

AgentcoreRunner serves the Diagrid runner of each of these frameworks. The guides use Strands. To use another framework, see Use another framework.

FrameworkDiagrid packageRunner
Strandsdiagrid[awsbedrock,strands]diagrid.agent.strands.DaprWorkflowAgentRunner
LangGraphdiagrid[awsbedrock,langgraph]diagrid.agent.langgraph.DaprWorkflowGraphRunner
Deep Agentsdiagrid[awsbedrock,deepagents]diagrid.agent.deepagents.DaprWorkflowDeepAgentRunner
LangChaindiagrid[awsbedrock,langchain]diagrid.agent.langchain.DaprWorkflowAgentRunner
OpenAI Agentsdiagrid[awsbedrock,openai_agents]diagrid.agent.openai_agents.DaprWorkflowAgentRunner
Pydantic AIdiagrid[awsbedrock,pydantic_ai]diagrid.agent.pydantic_ai.DaprWorkflowAgentRunner
Google ADKdiagrid[awsbedrock,adk]diagrid.agent.adk.DaprWorkflowAgentRunner
Claude Agent SDKdiagrid[awsbedrock,claude_agents]diagrid.agent.claude_agents.DaprWorkflowAgentRunner
CrewAIdiagrid[awsbedrock,crewai]diagrid.agent.crewai.DaprWorkflowAgentRunner
smolagentsdiagrid[awsbedrock,smolagents]diagrid.agent.smolagents.DaprWorkflowAgentRunner

HolmesGPT isn't supported. The reference says why, and what each framework needs for conversation history.

The guides' agent calls Amazon Bedrock with the AWS credentials of its container: the execution role on AgentCore, and your AWS CLI login on your machine. No model API key is stored. An agent in another framework can call Amazon Bedrock the same way, through that framework's Bedrock client, or call another model provider with a key stored in the agent's secret.

Next steps​

Was this page helpful?