For the complete documentation index, see llms.txt. This page is also available as Markdown.

AWS Bedrock AgentCore

AWS Bedrock AgentCore Code Interpreter provider for ComputeSDK — secure, fully-managed, session-based sandboxes for running code and shell commands, with no infrastructure to provision.

A ComputeSDK sandbox maps onto an AgentCore Code Interpreter session. See compute.sandbox for lifecycle methods and Sandbox (interface) for command, filesystem, and URL behavior.

Installation & Setup

npm install @computesdk/agentcore

There is no API key. The provider uses the standard AWS credential provider chain — the same resolution as the AWS CLI — so environment variables, SSO sessions, named profiles, and instance roles all work, including temporary credentials.

A region is required, via region in config or AWS_REGION / AWS_DEFAULT_REGION.

IAM permissions

bedrock-agentcore:StartCodeInterpreterSession
bedrock-agentcore:InvokeCodeInterpreter
bedrock-agentcore:StopCodeInterpreterSession
bedrock-agentcore:GetCodeInterpreterSession
bedrock-agentcore:ListCodeInterpreterSessions

Usage

import { agentcore } from '@computesdk/agentcore';

const compute = agentcore({ region: 'us-west-2' });

// Create sandbox (an AgentCore Code Interpreter session)
const sandbox = await compute.sandbox.create();

// Run a command
const result = await sandbox.runCommand('echo "Hello from AgentCore!"');
console.log(result.stdout); // "Hello from AgentCore!"

// Run code via the available runtimes (e.g. Python)
const code = await sandbox.runCommand('python3 -c "print(2 + 2)"');
console.log(code.stdout); // "4"

// Work with files (files persist for the life of the session)
await sandbox.filesystem.writeFile('/tmp/hello.py', 'print("Hello World")');
const content = await sandbox.filesystem.readFile('/tmp/hello.py');

// Clean up
await sandbox.destroy();

Named profile

Explicit / temporary credentials

Configuration Options

Limitations

  • No preview URLs / ports. AgentCore Code Interpreter has no inbound network endpoint, so getUrl() throws.

  • No interactive PTY. Commands are request/response.

  • Sessions expire. A session auto-terminates after its idle timeout; create a new sandbox afterward.

  • Filesystem persists, shell environment does not. Files survive across runCommand calls, but each command runs in a fresh shell — cd, export, and shell variables do not carry over. Chain them in one command or use the cwd/env options.

  • Background commands don't outlive the call. { background: true } returns immediately, but AgentCore terminates the process tree when the invocation ends, so the job is killed rather than left running.

Compare this provider with other options on Providers.

  • Use Quick Start for the shared sandbox model and cleanup patterns.

  • Use compute.sandbox for create(), timeout, reconnect, and destroy flows.

  • Use Sandbox (interface) for runCommand(), filesystem, and getUrl() details.

Last updated

Was this helpful?