Skip to content

Runtime

Source: src/AWS/BedrockAgentCore/Runtime.ts

An Amazon Bedrock AgentCore Runtime — serverless hosting for containerized AI agents.

A runtime deploys an agent (an ECR container image or managed-runtime code bundle) behind the InvokeAgentRuntime data-plane API with session isolation, scaling, and identity built in. Each configuration change publishes a new immutable runtime version.

import * as AgentCore from "alchemy/AWS/BedrockAgentCore";
const runtime = yield* AgentCore.Runtime("MyAgent", {
agentRuntimeArtifact: {
containerConfiguration: {
containerUri: `${account}.dkr.ecr.us-west-2.amazonaws.com/my-agent:latest`,
},
},
roleArn: role.roleArn,
});
// init
const invoke = yield* AgentCore.InvokeAgentRuntime(runtime);
return {
fetch: Effect.gen(function* () {
// runtime
const response = yield* invoke({
runtimeSessionId: "session-0000000000000000000000000000000001",
payload: JSON.stringify({ prompt: "hello" }),
});
return HttpServerResponse.json({ contentType: response.contentType });
}),
};