Skip to content

AWS.BedrockAgentCore reference

Source: src/AWS/BedrockAgentCore/BatchCreateMemoryRecords.ts

Directly inserts long-term memory records, bypassing asynchronous extraction.

Bind a Memory inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.BatchCreateMemoryRecordsHttp on the Function effect to implement the binding.

BatchCreateMemoryRecords: Writing Memory Records

Section titled “BatchCreateMemoryRecords: Writing Memory Records”
// init
const batchCreateMemoryRecords = yield* AgentCore.BatchCreateMemoryRecords(memory);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* batchCreateMemoryRecords({
records: [
{
requestIdentifier: "rec-1",
namespaces: ["facts/user-1"],
content: { text: "The user's favorite color is teal." },
timestamp: new Date(),
},
],
});
return HttpServerResponse.json({
created: result.successfulRecords.length,
});
}),
};

Source: src/AWS/BedrockAgentCore/BatchDeleteMemoryRecords.ts

Deletes long-term memory records in bulk.

Bind a Memory inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.BatchDeleteMemoryRecordsHttp on the Function effect to implement the binding.

BatchDeleteMemoryRecords: Deleting Memory Records

Section titled “BatchDeleteMemoryRecords: Deleting Memory Records”
// init
const batchDeleteMemoryRecords = yield* AgentCore.BatchDeleteMemoryRecords(memory);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* batchDeleteMemoryRecords({
records: [{ memoryRecordId }],
});
return HttpServerResponse.json({
deleted: result.successfulRecords.length,
});
}),
};

Source: src/AWS/BedrockAgentCore/BatchUpdateMemoryRecords.ts

Updates long-term memory records in bulk.

Bind a Memory inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.BatchUpdateMemoryRecordsHttp on the Function effect to implement the binding.

BatchUpdateMemoryRecords: Writing Memory Records

Section titled “BatchUpdateMemoryRecords: Writing Memory Records”
// init
const batchUpdateMemoryRecords = yield* AgentCore.BatchUpdateMemoryRecords(memory);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* batchUpdateMemoryRecords({
records: [
{
memoryRecordId,
timestamp: new Date(),
content: { text: "The user's favorite color is green." },
namespaces: ["facts/user-1"],
},
],
});
return HttpServerResponse.json({
updated: result.successfulRecords.length,
});
}),
};

Source: src/AWS/BedrockAgentCore/BrowserCustom.ts

A custom Amazon Bedrock AgentCore Browser — a managed, isolated cloud browser that agents drive to interact with websites.

A custom browser controls the sandbox’s network mode, execution role, and session recording. All configuration is create-only (the API has no update operation); property changes trigger a replacement.

Public-Egress Browser

import * as AgentCore from "alchemy/AWS/BedrockAgentCore";
const browser = yield* AgentCore.BrowserCustom("AgentBrowser", {});

Browser with Session Recording

const browser = yield* AgentCore.BrowserCustom("RecordedBrowser", {
executionRoleArn: role.roleArn,
recording: {
enabled: true,
s3Location: { bucket: bucket.bucketName, prefix: "sessions/" },
},
});

Source: src/AWS/BedrockAgentCore/CodeInterpreter.ts

A custom Amazon Bedrock AgentCore Code Interpreter — an isolated sandbox where agents execute Python/JavaScript/TypeScript code.

A custom interpreter controls the sandbox’s network mode and execution role. All configuration is create-only (the API has no update operation); property changes trigger a replacement.

CodeInterpreter: Creating Code Interpreters

Section titled “CodeInterpreter: Creating Code Interpreters”

Sandboxed Interpreter (no network egress)

import * as AgentCore from "alchemy/AWS/BedrockAgentCore";
const interpreter = yield* AgentCore.CodeInterpreter("Sandbox", {});

Interpreter with Public Egress

const interpreter = yield* AgentCore.CodeInterpreter("PublicSandbox", {
networkConfiguration: { networkMode: "PUBLIC" },
});

CodeInterpreter: Executing Code from a Function

Section titled “CodeInterpreter: Executing Code from a Function”
// init
const startSession = yield* AgentCore.StartCodeInterpreterSession(interpreter);
const invoke = yield* AgentCore.InvokeCodeInterpreter(interpreter);
const stopSession = yield* AgentCore.StopCodeInterpreterSession(interpreter);
return {
fetch: Effect.gen(function* () {
// runtime
const session = yield* startSession({ sessionTimeout: "5 minutes" });
const result = yield* invoke({
sessionId: session.sessionId,
name: "executeCode",
arguments: { language: "python", code: "print(1 + 1)" },
});
const output = yield* Stream.runCollect(result.stream);
yield* stopSession({ sessionId: session.sessionId });
return HttpServerResponse.json({ output: Array.from(output) });
}),
};

Source: src/AWS/BedrockAgentCore/CreateEvent.ts

Records an interaction event into a memory’s short-term store.

Bind a Memory inside a function runtime to get a callable that appends conversational turns (or binary blobs) to an actor’s session. Provide AgentCore.CreateEventHttp on the Function effect to implement the binding over the AgentCore data-plane API.

import * as AgentCore from "alchemy/AWS/BedrockAgentCore";
export default MyFunction.make(
{ main: import.meta.url, functionUrl: true },
Effect.gen(function* () {
const memory = yield* AgentCore.Memory("AgentMemory", {
eventExpiryDuration: "30 days",
});
// init
const createEvent = yield* AgentCore.CreateEvent(memory);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* createEvent({
actorId: "user-1",
sessionId: "session-1",
eventTimestamp: new Date(),
payload: [
{
conversational: {
role: "USER",
content: { text: "My favorite color is teal." },
},
},
],
});
return HttpServerResponse.json({ eventId: result.event.eventId });
}),
};
}).pipe(Effect.provide(AgentCore.CreateEventHttp)),
);

Source: src/AWS/BedrockAgentCore/DeleteEvent.ts

Deletes a short-term event from an actor’s session.

Bind a Memory inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.DeleteEventHttp on the Function effect to implement the binding.

// init
const deleteEvent = yield* AgentCore.DeleteEvent(memory);
return {
fetch: Effect.gen(function* () {
// runtime
yield* deleteEvent({
actorId: "user-1",
sessionId: "session-1",
eventId,
});
return HttpServerResponse.json({ deleted: true });
}),
};

Source: src/AWS/BedrockAgentCore/DeleteMemoryRecord.ts

Deletes a long-term memory record.

Bind a Memory inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.DeleteMemoryRecordHttp on the Function effect to implement the binding.

DeleteMemoryRecord: Deleting Memory Records

Section titled “DeleteMemoryRecord: Deleting Memory Records”
// init
const deleteMemoryRecord = yield* AgentCore.DeleteMemoryRecord(memory);
return {
fetch: Effect.gen(function* () {
// runtime
yield* deleteMemoryRecord({ memoryRecordId });
return HttpServerResponse.json({ deleted: true });
}),
};

Source: src/AWS/BedrockAgentCore/Gateway.ts

An Amazon Bedrock AgentCore Gateway — a managed MCP endpoint that turns APIs and Lambda functions into agent-callable tools.

A gateway fronts one or more targets (OpenAPI specs, Smithy models, Lambda functions) behind a single MCP URL with centralized authorization (SigV4 or JWT).

IAM-Authorized MCP Gateway

import * as AgentCore from "alchemy/AWS/BedrockAgentCore";
import * as IAM from "alchemy/AWS/IAM";
const role = yield* IAM.Role("GatewayRole", {
assumeRolePolicyDocument: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Principal: { Service: "bedrock-agentcore.amazonaws.com" },
Action: ["sts:AssumeRole"],
},
],
},
});
const gateway = yield* AgentCore.Gateway("ToolGateway", {
roleArn: role.roleArn,
authorizerType: "AWS_IAM",
});

JWT-Authorized Gateway

const gateway = yield* AgentCore.Gateway("JwtGateway", {
roleArn: role.roleArn,
authorizerType: "CUSTOM_JWT",
authorizerConfiguration: {
customJWTAuthorizer: {
discoveryUrl: `https://cognito-idp.us-west-2.amazonaws.com/${userPool.userPoolId}/.well-known/openid-configuration`,
allowedClients: [client.clientId],
},
},
});

Source: src/AWS/BedrockAgentCore/GetAgentCard.ts

Fetches the A2A agent card describing the agent runtime’s capabilities.

Bind a Runtime inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.GetAgentCardHttp on the Function effect to implement the binding.

// init
const getAgentCard = yield* AgentCore.GetAgentCard(runtime);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* getAgentCard({});
return HttpServerResponse.json({ card: result.agentCard });
}),
};

Source: src/AWS/BedrockAgentCore/GetBrowserSession.ts

Reads a browser session’s configuration, status, and stream endpoints.

Bind a BrowserCustom inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.GetBrowserSessionHttp on the Function effect to implement the binding.

// init
const getBrowserSession = yield* AgentCore.GetBrowserSession(browser);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* getBrowserSession({ sessionId });
return HttpServerResponse.json({ status: result.status });
}),
};

Source: src/AWS/BedrockAgentCore/GetCodeInterpreterSession.ts

Reads a code interpreter session’s configuration and status.

Bind a CodeInterpreter inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.GetCodeInterpreterSessionHttp on the Function effect to implement the binding.

GetCodeInterpreterSession: Inspecting Sessions

Section titled “GetCodeInterpreterSession: Inspecting Sessions”
// init
const getCodeInterpreterSession = yield* AgentCore.GetCodeInterpreterSession(codeInterpreter);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* getCodeInterpreterSession({ sessionId });
return HttpServerResponse.json({ status: result.status });
}),
};

Source: src/AWS/BedrockAgentCore/GetEvent.ts

Fetches a single short-term event from an actor’s session.

Bind a Memory inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.GetEventHttp on the Function effect to implement the binding.

// init
const getEvent = yield* AgentCore.GetEvent(memory);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* getEvent({
actorId: "user-1",
sessionId: "session-1",
eventId,
});
return HttpServerResponse.json({ event: result.event });
}),
};

Source: src/AWS/BedrockAgentCore/GetMemoryRecord.ts

Fetches a single extracted long-term memory record.

Bind a Memory inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.GetMemoryRecordHttp on the Function effect to implement the binding.

// init
const getMemoryRecord = yield* AgentCore.GetMemoryRecord(memory);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* getMemoryRecord({ memoryRecordId });
return HttpServerResponse.json({ record: result.memoryRecord });
}),
};

Source: src/AWS/BedrockAgentCore/InvokeAgentRuntime.ts

Sends a request to an agent hosted in an AgentCore Runtime and receives the (optionally streaming) response.

Bind a Runtime inside a function runtime to invoke the hosted agent with session isolation (requests with the same runtimeSessionId land on the same sandbox). Provide AgentCore.InvokeAgentRuntimeHttp on the Function effect to implement the binding.

// 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 });
}),
};

Source: src/AWS/BedrockAgentCore/InvokeAgentRuntimeCommand.ts

Runs a shell command inside an agent hosted in an AgentCore Runtime and streams back the command output.

Bind a Runtime inside a function runtime to execute commands in the hosted agent’s sandbox (requests with the same runtimeSessionId land on the same sandbox). Provide AgentCore.InvokeAgentRuntimeCommandHttp on the Function effect to implement the binding.

InvokeAgentRuntimeCommand: Invoking an Agent

Section titled “InvokeAgentRuntimeCommand: Invoking an Agent”
// init
const invokeCommand = yield* AgentCore.InvokeAgentRuntimeCommand(runtime);
return {
fetch: Effect.gen(function* () {
// runtime
const response = yield* invokeCommand({
runtimeSessionId: "session-0000000000000000000000000000000001",
body: { command: "echo hello" },
});
const chunks = yield* Stream.runCollect(response.stream);
return HttpServerResponse.json({ chunks: Array.from(chunks) });
}),
};

Source: src/AWS/BedrockAgentCore/InvokeBrowser.ts

Performs an OS-level browser action (mouse, keyboard, screenshot) in a session.

OS-level actions cover interactions the Chrome DevTools Protocol cannot reach — print dialogs, context menus, and JavaScript alerts.

Bind a BrowserCustom inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.InvokeBrowserHttp on the Function effect to implement the binding.

// init
const invokeBrowser = yield* AgentCore.InvokeBrowser(browser);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* invokeBrowser({
sessionId,
action: { screenshot: {} },
});
return HttpServerResponse.json({ result: result.result });
}),
};

Source: src/AWS/BedrockAgentCore/InvokeCodeInterpreter.ts

Executes a tool (e.g. executeCode) inside a code interpreter session. The response carries a result stream.

Bind a CodeInterpreter inside a function runtime and call it with a session id obtained from StartCodeInterpreterSession. Provide AgentCore.InvokeCodeInterpreterHttp on the Function effect to implement the binding.

// init
const invoke = yield* AgentCore.InvokeCodeInterpreter(interpreter);
// runtime (inside the handler, with an open session)
const result = yield* invoke({
sessionId: session.sessionId,
name: "executeCode",
arguments: { language: "python", code: "print(21 * 2)" },
});
const chunks = yield* Stream.runCollect(result.stream);

Source: src/AWS/BedrockAgentCore/ListActors.ts

Lists the actors that have recorded events in the memory.

Bind a Memory inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.ListActorsHttp on the Function effect to implement the binding.

// init
const listActors = yield* AgentCore.ListActors(memory);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* listActors({});
return HttpServerResponse.json({
count: result.actorSummaries.length,
});
}),
};

Source: src/AWS/BedrockAgentCore/ListBrowserSessions.ts

Lists the browser’s sessions.

Bind a BrowserCustom inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.ListBrowserSessionsHttp on the Function effect to implement the binding.

// init
const listBrowserSessions = yield* AgentCore.ListBrowserSessions(browser);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* listBrowserSessions({});
return HttpServerResponse.json({ count: result.items?.length ?? 0 });
}),
};

Source: src/AWS/BedrockAgentCore/ListCodeInterpreterSessions.ts

Lists the code interpreter’s sessions.

Bind a CodeInterpreter inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.ListCodeInterpreterSessionsHttp on the Function effect to implement the binding.

ListCodeInterpreterSessions: Inspecting Sessions

Section titled “ListCodeInterpreterSessions: Inspecting Sessions”
// init
const listCodeInterpreterSessions = yield* AgentCore.ListCodeInterpreterSessions(codeInterpreter);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* listCodeInterpreterSessions({});
return HttpServerResponse.json({ count: result.items?.length ?? 0 });
}),
};

Source: src/AWS/BedrockAgentCore/ListEvents.ts

Lists the events of an actor’s session in a memory’s short-term store.

Bind a Memory inside a function runtime to page through the raw events recorded with CreateEvent. Provide AgentCore.ListEventsHttp on the Function effect to implement the binding.

// init
const listEvents = yield* AgentCore.ListEvents(memory);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* listEvents({
actorId: "user-1",
sessionId: "session-1",
});
return HttpServerResponse.json({ count: result.events.length });
}),
};

Source: src/AWS/BedrockAgentCore/ListMemoryExtractionJobs.ts

Lists the memory’s long-term extraction jobs.

Bind a Memory inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.ListMemoryExtractionJobsHttp on the Function effect to implement the binding.

// init
const listMemoryExtractionJobs = yield* AgentCore.ListMemoryExtractionJobs(memory);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* listMemoryExtractionJobs({});
return HttpServerResponse.json({
count: result.jobs.length,
});
}),
};

Source: src/AWS/BedrockAgentCore/ListMemoryRecords.ts

Lists extracted long-term memory records in a namespace.

Bind a Memory inside a function runtime to enumerate the records the memory’s strategies (semantic, summary, user preference, …) have extracted into a namespace. Provide AgentCore.ListMemoryRecordsHttp on the Function effect to implement the binding.

// init
const listMemoryRecords = yield* AgentCore.ListMemoryRecords(memory);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* listMemoryRecords({
namespace: "facts/user-1",
});
return HttpServerResponse.json({
count: result.memoryRecordSummaries.length,
});
}),
};

Source: src/AWS/BedrockAgentCore/ListSessions.ts

Lists an actor’s sessions in a memory.

Bind a Memory inside a function runtime to enumerate the sessions an actor has recorded events under. Provide AgentCore.ListSessionsHttp on the Function effect to implement the binding.

// init
const listSessions = yield* AgentCore.ListSessions(memory);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* listSessions({ actorId: "user-1" });
return HttpServerResponse.json({
count: result.sessionSummaries.length,
});
}),
};

Source: src/AWS/BedrockAgentCore/Memory.ts

An Amazon Bedrock AgentCore Memory — managed short- and long-term memory for AI agents.

Short-term memory stores raw session events (turn-by-turn conversation); optional memoryStrategies asynchronously extract long-term records (semantic facts, summaries, user preferences) into queryable namespaces.

Provisioning is asynchronous: the provider waits for the memory to reach ACTIVE (~2-3 minutes) before returning.

Short-Term Memory Only

import * as AgentCore from "alchemy/AWS/BedrockAgentCore";
const memory = yield* AgentCore.Memory("SessionMemory", {
eventExpiryDuration: "30 days",
});

Memory with a Semantic Long-Term Strategy

const memory = yield* AgentCore.Memory("AgentMemory", {
eventExpiryDuration: "90 days",
memoryStrategies: [
{
semanticMemoryStrategy: {
name: "facts",
namespaces: ["facts/{actorId}"],
},
},
],
});
// init
const createEvent = yield* AgentCore.CreateEvent(memory);
const listEvents = yield* AgentCore.ListEvents(memory);
return {
fetch: Effect.gen(function* () {
// runtime
yield* createEvent({
actorId: "user-1",
sessionId: "session-1",
eventTimestamp: new Date(),
payload: [
{
conversational: {
role: "USER",
content: { text: "My favorite color is teal." },
},
},
],
});
const events = yield* listEvents({
actorId: "user-1",
sessionId: "session-1",
});
return HttpServerResponse.json({ count: events.events.length });
}),
};

Source: src/AWS/BedrockAgentCore/RetrieveMemoryRecords.ts

Semantically searches extracted long-term memory records.

Bind a Memory inside a function runtime to run relevance-ranked queries over the records the memory’s long-term strategies have extracted. Provide AgentCore.RetrieveMemoryRecordsHttp on the Function effect to implement the binding.

RetrieveMemoryRecords: Retrieving Memory Records

Section titled “RetrieveMemoryRecords: Retrieving Memory Records”
// init
const retrieveMemoryRecords = yield* AgentCore.RetrieveMemoryRecords(memory);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* retrieveMemoryRecords({
namespace: "facts/user-1",
searchCriteria: {
searchQuery: "what is the user's favorite color?",
topK: 3,
},
});
return HttpServerResponse.json({
records: result.memoryRecordSummaries,
});
}),
};

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 });
}),
};

Source: src/AWS/BedrockAgentCore/SaveBrowserSessionProfile.ts

Persists a browser session’s state to a reusable browser profile.

Bind a BrowserCustom inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.SaveBrowserSessionProfileHttp on the Function effect to implement the binding.

SaveBrowserSessionProfile: Browser Profiles

Section titled “SaveBrowserSessionProfile: Browser Profiles”
// init
const saveBrowserSessionProfile = yield* AgentCore.SaveBrowserSessionProfile(browser);
return {
fetch: Effect.gen(function* () {
// runtime
yield* saveBrowserSessionProfile({
sessionId,
profileIdentifier,
});
return HttpServerResponse.json({ saved: true });
}),
};

Source: src/AWS/BedrockAgentCore/StartBrowserSession.ts

Starts a managed, sandboxed browser session on a custom browser.

Bind a BrowserCustom inside a function runtime to open cloud browser sessions for web automation; pair with GetBrowserSession, InvokeBrowser, and StopBrowserSession. Provide AgentCore.StartBrowserSessionHttp on the Function effect to implement the binding.

// init
const startBrowserSession = yield* AgentCore.StartBrowserSession(browser);
const stopBrowserSession = yield* AgentCore.StopBrowserSession(browser);
return {
fetch: Effect.gen(function* () {
// runtime
const session = yield* startBrowserSession({
sessionTimeout: "5 minutes",
});
yield* stopBrowserSession({ sessionId: session.sessionId });
return HttpServerResponse.json({ sessionId: session.sessionId });
}),
};

Source: src/AWS/BedrockAgentCore/StartCodeInterpreterSession.ts

Starts an isolated code-execution session on a code interpreter.

Bind a CodeInterpreter inside a function runtime to open sandboxed sessions; pair with InvokeCodeInterpreter to run code in the session and StopCodeInterpreterSession to end it. Provide AgentCore.StartCodeInterpreterSessionHttp on the Function effect to implement the binding.

// init
const startSession = yield* AgentCore.StartCodeInterpreterSession(interpreter);
const invoke = yield* AgentCore.InvokeCodeInterpreter(interpreter);
const stopSession = yield* AgentCore.StopCodeInterpreterSession(interpreter);
return {
fetch: Effect.gen(function* () {
// runtime
const session = yield* startSession({ sessionTimeout: "5 minutes" });
const result = yield* invoke({
sessionId: session.sessionId,
name: "executeCode",
arguments: { language: "python", code: "print(21 * 2)" },
});
const chunks = yield* Stream.runCollect(result.stream);
yield* stopSession({ sessionId: session.sessionId });
return HttpServerResponse.json({ chunks: Array.from(chunks) });
}),
};

Source: src/AWS/BedrockAgentCore/StartMemoryExtractionJob.ts

Starts an on-demand long-term extraction job over recorded events.

Bind a Memory inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.StartMemoryExtractionJobHttp on the Function effect to implement the binding.

// init
const startMemoryExtractionJob = yield* AgentCore.StartMemoryExtractionJob(memory);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* startMemoryExtractionJob({
extractionJob: { jobId },
});
return HttpServerResponse.json({ jobId: result.jobId });
}),
};

Source: src/AWS/BedrockAgentCore/StopBrowserSession.ts

Terminates an active browser session.

Bind a BrowserCustom inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.StopBrowserSessionHttp on the Function effect to implement the binding.

// init
const stopBrowserSession = yield* AgentCore.StopBrowserSession(browser);
return {
fetch: Effect.gen(function* () {
// runtime
yield* stopBrowserSession({ sessionId });
return HttpServerResponse.json({ stopped: true });
}),
};

Source: src/AWS/BedrockAgentCore/StopCodeInterpreterSession.ts

Stops a running code interpreter session.

Bind a CodeInterpreter inside a function runtime to end sessions opened with StartCodeInterpreterSession and release the sandbox. Provide AgentCore.StopCodeInterpreterSessionHttp on the Function effect to implement the binding.

StopCodeInterpreterSession: Stopping Sessions

Section titled “StopCodeInterpreterSession: Stopping Sessions”
// init
const stopSession = yield* AgentCore.StopCodeInterpreterSession(interpreter);
// runtime (inside the handler)
yield* stopSession({ sessionId: session.sessionId });

Source: src/AWS/BedrockAgentCore/StopRuntimeSession.ts

Stops a specific session on the agent runtime.

Bind a Runtime inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.StopRuntimeSessionHttp on the Function effect to implement the binding.

// init
const stopRuntimeSession = yield* AgentCore.StopRuntimeSession(runtime);
return {
fetch: Effect.gen(function* () {
// runtime
yield* stopRuntimeSession({ runtimeSessionId });
return HttpServerResponse.json({ stopped: true });
}),
};

Source: src/AWS/BedrockAgentCore/UpdateBrowserStream.ts

Updates a browser session’s automation stream.

Bind a BrowserCustom inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.UpdateBrowserStreamHttp on the Function effect to implement the binding.

// init
const updateBrowserStream = yield* AgentCore.UpdateBrowserStream(browser);
return {
fetch: Effect.gen(function* () {
// runtime
yield* updateBrowserStream({
sessionId,
streamUpdate: {
automationStreamUpdate: { streamStatus: "ENABLED" },
},
});
return HttpServerResponse.json({ updated: true });
}),
};