@aws-cdk/aws-bedrock-agentcore-alpha 2.236.0-alpha.0 → 2.237.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +663 -173
- package/.jsii.tabl.json.gz +0 -0
- package/.warnings.jsii.js +23 -1
- package/README.md +129 -4
- package/lib/common/types.d.ts +35 -0
- package/lib/common/types.js +41 -0
- package/lib/gateway/gateway-base.js +1 -1
- package/lib/gateway/gateway.js +1 -1
- package/lib/gateway/inbound-auth/authorizer.d.ts +25 -0
- package/lib/gateway/inbound-auth/authorizer.js +17 -7
- package/lib/gateway/inbound-auth/custom-claim.d.ts +50 -0
- package/lib/gateway/inbound-auth/custom-claim.js +127 -0
- package/lib/gateway/interceptor.js +1 -1
- package/lib/gateway/outbound-auth/api-key.js +1 -1
- package/lib/gateway/outbound-auth/credential-provider.js +1 -1
- package/lib/gateway/protocol.js +2 -2
- package/lib/gateway/targets/schema/api-schema.js +7 -6
- package/lib/gateway/targets/schema/tool-schema.js +7 -6
- package/lib/gateway/targets/target-base.js +1 -1
- package/lib/gateway/targets/target-configuration.js +5 -5
- package/lib/gateway/targets/target.js +1 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.js +8 -2
- package/lib/memory/memory-strategy.js +1 -1
- package/lib/memory/memory.js +2 -2
- package/lib/memory/strategies/managed-strategy.js +1 -1
- package/lib/memory/strategies/self-managed-strategy.js +1 -1
- package/lib/network/network-configuration.js +4 -4
- package/lib/runtime/inbound-auth/custom-claim.d.ts +50 -0
- package/lib/runtime/inbound-auth/custom-claim.js +127 -0
- package/lib/runtime/{runtime-authorizer-configuration.d.ts → inbound-auth/runtime-authorizer-configuration.d.ts} +10 -3
- package/lib/runtime/inbound-auth/runtime-authorizer-configuration.js +183 -0
- package/lib/runtime/runtime-artifact.js +1 -1
- package/lib/runtime/runtime-base.js +1 -1
- package/lib/runtime/runtime-endpoint-base.js +1 -1
- package/lib/runtime/runtime-endpoint.js +1 -1
- package/lib/runtime/runtime.d.ts +1 -1
- package/lib/runtime/runtime.js +2 -2
- package/lib/tools/browser.js +2 -2
- package/lib/tools/code-interpreter.js +2 -2
- package/package.json +9 -9
- package/lib/runtime/runtime-authorizer-configuration.js +0 -159
package/.jsii
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"url": "https://aws.amazon.com"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@aws-cdk/aws-bedrock-alpha": "2.
|
|
12
|
-
"aws-cdk-lib": "^2.
|
|
11
|
+
"@aws-cdk/aws-bedrock-alpha": "2.237.1-alpha.0",
|
|
12
|
+
"aws-cdk-lib": "^2.237.1",
|
|
13
13
|
"constructs": "^10.0.0"
|
|
14
14
|
},
|
|
15
15
|
"dependencyClosure": {
|
|
@@ -2638,6 +2638,19 @@
|
|
|
2638
2638
|
}
|
|
2639
2639
|
}
|
|
2640
2640
|
},
|
|
2641
|
+
"aws-cdk-lib.aws_mwaaserverless": {
|
|
2642
|
+
"targets": {
|
|
2643
|
+
"dotnet": {
|
|
2644
|
+
"namespace": "Amazon.CDK.AWS.MWAAServerless"
|
|
2645
|
+
},
|
|
2646
|
+
"java": {
|
|
2647
|
+
"package": "software.amazon.awscdk.services.mwaaserverless"
|
|
2648
|
+
},
|
|
2649
|
+
"python": {
|
|
2650
|
+
"module": "aws_cdk.aws_mwaaserverless"
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
},
|
|
2641
2654
|
"aws-cdk-lib.aws_neptune": {
|
|
2642
2655
|
"targets": {
|
|
2643
2656
|
"dotnet": {
|
|
@@ -6843,6 +6856,22 @@
|
|
|
6843
6856
|
}
|
|
6844
6857
|
}
|
|
6845
6858
|
},
|
|
6859
|
+
"aws-cdk-lib.interfaces.aws_mwaaserverless": {
|
|
6860
|
+
"targets": {
|
|
6861
|
+
"dotnet": {
|
|
6862
|
+
"namespace": "Amazon.CDK.Interfaces.MWAAServerless"
|
|
6863
|
+
},
|
|
6864
|
+
"go": {
|
|
6865
|
+
"packageName": "interfacesawsmwaaserverless"
|
|
6866
|
+
},
|
|
6867
|
+
"java": {
|
|
6868
|
+
"package": "software.amazon.awscdk.interfaces.mwaaserverless"
|
|
6869
|
+
},
|
|
6870
|
+
"python": {
|
|
6871
|
+
"module": "aws_cdk.interfaces.aws_mwaaserverless"
|
|
6872
|
+
}
|
|
6873
|
+
}
|
|
6874
|
+
},
|
|
6846
6875
|
"aws-cdk-lib.interfaces.aws_neptune": {
|
|
6847
6876
|
"targets": {
|
|
6848
6877
|
"dotnet": {
|
|
@@ -8524,7 +8553,7 @@
|
|
|
8524
8553
|
},
|
|
8525
8554
|
"name": "@aws-cdk/aws-bedrock-agentcore-alpha",
|
|
8526
8555
|
"readme": {
|
|
8527
|
-
"markdown": "# Amazon Bedrock AgentCore Construct Library\n\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\n| **Language** | **Package** |\n| :--------------------------------------------------------------------------------------------- | --------------------------------------- |\n|  TypeScript | `@aws-cdk/aws-bedrock-agentcore-alpha` |\n\n[Amazon Bedrock AgentCore](https://aws.amazon.com/bedrock/agentcore/) enables you to deploy and operate highly capable AI agents securely, at scale. It offers infrastructure purpose-built for dynamic agent workloads, powerful tools to enhance agents, and essential controls for real-world deployment. AgentCore services can be used together or independently and work with any framework including CrewAI, LangGraph, LlamaIndex, and Strands Agents, as well as any foundation model in or outside of Amazon Bedrock, giving you ultimate flexibility. AgentCore eliminates the undifferentiated heavy lifting of building specialized agent infrastructure, so you can accelerate agents to production.\n\nThis construct library facilitates the deployment of Bedrock AgentCore primitives, enabling you to create sophisticated AI applications that can interact with your systems and data sources.\n\n> **Note:** Users need to ensure their CDK deployment role has the `iam:CreateServiceLinkedRole` permission for AgentCore service-linked roles.\n\n## Table of contents\n\n- [AgentCore Runtime](#agentcore-runtime)\n - [Runtime Versioning](#runtime-versioning)\n - [Runtime Endpoints](#runtime-endpoints)\n - [AgentCore Runtime Properties](#agentcore-runtime-properties)\n - [Runtime Endpoint Properties](#runtime-endpoint-properties)\n - [Creating a Runtime](#creating-a-runtime)\n - [Option 1: Use an existing image in ECR](#option-1-use-an-existing-image-in-ecr)\n - [Managing Endpoints and Versions](#managing-endpoints-and-versions)\n - [Option 2: Use a local asset](#option-2-use-a-local-asset)\n- [Browser Custom tool](#browser)\n - [Browser properties](#browser-properties)\n - [Browser Network modes](#browser-network-modes)\n - [Basic Browser Creation](#basic-browser-creation)\n - [Browser IAM permissions](#browser-iam-permissions)\n- [Code Interpreter Custom tool](#code-interpreter)\n - [Code Interpreter properties](#code-interpreter-properties)\n - [Code Interpreter Network Modes](#code-interpreter-network-modes)\n - [Basic Code Interpreter Creation](#basic-code-interpreter-creation)\n - [Code Interpreter IAM permissions](#code-interpreter-iam-permissions)\n- [Gateway](#gateway)\n - [Gateway Properties](#gateway-properties)\n - [Basic Gateway Creation](#basic-gateway-creation)\n - [Protocol configuration](#protocol-configuration)\n - [Inbound authorization](#inbound-authorization)\n - [Gateway with KMS Encryption](#gateway-with-kms-encryption)\n - [Gateway with Custom Execution Role](#gateway-with-custom-execution-role)\n - [Gateway IAM Permissions](#gateway-iam-permissions)\n- [Gateway Target](#gateway-target)\n - [Gateway Target Properties](#gateway-target-properties)\n - [Targets types](#targets-types)\n - [Outbound auth](#outbound-auth)\n - [Api schema](#api-schema-for-openapi-and-smithy-target)\n - [Basic Gateway Target Creation](#basic-gateway-target-creation)\n - [Using addTarget methods (Recommended)](#using-addtarget-methods-recommended)\n - [Using static factory methods](#using-static-factory-methods)\n - [Lambda Target with Tool Schema](#tools-schema-for-lambda-target)\n - [Smithy Model Target with OAuth](#api-schema-for-openapi-and-smithy-target)\n - [Gateway Target IAM Permissions](#gateway-target-iam-permissions)\n- [Memory](#memory)\n - [Memory properties](#memory-properties)\n - [Basic Memory Creation](#basic-memory-creation)\n - [LTM Memory Extraction Stategies](#ltm-memory-extraction-stategies)\n - [Memory Strategy Methods](#memory-strategy-methods)\n- [Amazon Bedrock AgentCore Construct Library](#amazon-bedrock-agentcore-construct-library)\n - [Table of contents](#table-of-contents)\n - [AgentCore Runtime](#agentcore-runtime)\n - [Runtime Endpoints](#runtime-endpoints)\n - [AgentCore Runtime Properties](#agentcore-runtime-properties)\n - [Runtime Endpoint Properties](#runtime-endpoint-properties)\n - [Creating a Runtime](#creating-a-runtime)\n - [Option 1: Use an existing image in ECR](#option-1-use-an-existing-image-in-ecr)\n - [Option 2: Use a local asset](#option-2-use-a-local-asset)\n - [Option 3: Use direct code deployment](#option-3-use-direct-code-deployment)\n - [Granting Permissions to Invoke Bedrock Models or Inference Profiles](#granting-permissions-to-invoke-bedrock-models-or-inference-profiles)\n - [Runtime Versioning](#runtime-versioning)\n - [Managing Endpoints and Versions](#managing-endpoints-and-versions)\n - [Step 1: Initial Deployment](#step-1-initial-deployment)\n - [Step 2: Creating Custom Endpoints](#step-2-creating-custom-endpoints)\n - [Step 3: Runtime Update Deployment](#step-3-runtime-update-deployment)\n - [Step 4: Testing with Staging Endpoints](#step-4-testing-with-staging-endpoints)\n - [Step 5: Promoting to Production](#step-5-promoting-to-production)\n - [Creating Standalone Runtime Endpoints](#creating-standalone-runtime-endpoints)\n - [Example: Creating an endpoint for an existing runtime](#example-creating-an-endpoint-for-an-existing-runtime)\n - [Runtime Authentication Configuration](#runtime-authentication-configuration)\n - [IAM Authentication (Default)](#iam-authentication-default)\n - [Cognito Authentication](#cognito-authentication)\n - [JWT Authentication](#jwt-authentication)\n - [OAuth Authentication](#oauth-authentication)\n - [Using a Custom IAM Role](#using-a-custom-iam-role)\n - [Runtime Network Configuration](#runtime-network-configuration)\n - [Public Network Mode (Default)](#public-network-mode-default)\n - [VPC Network Mode](#vpc-network-mode)\n - [Managing Security Groups with VPC Configuration](#managing-security-groups-with-vpc-configuration)\n - [Browser](#browser)\n - [Browser Network modes](#browser-network-modes)\n - [Browser Properties](#browser-properties)\n - [Basic Browser Creation](#basic-browser-creation)\n - [Browser with Tags](#browser-with-tags)\n - [Browser with VPC](#browser-with-vpc)\n - [Browser with Recording Configuration](#browser-with-recording-configuration)\n - [Browser with Custom Execution Role](#browser-with-custom-execution-role)\n - [Browser with S3 Recording and Permissions](#browser-with-s3-recording-and-permissions)\n - [Browser IAM Permissions](#browser-iam-permissions)\n - [Code Interpreter](#code-interpreter)\n - [Code Interpreter Network Modes](#code-interpreter-network-modes)\n - [Code Interpreter Properties](#code-interpreter-properties)\n - [Basic Code Interpreter Creation](#basic-code-interpreter-creation)\n - [Code Interpreter with VPC](#code-interpreter-with-vpc)\n - [Code Interpreter with Sandbox Network Mode](#code-interpreter-with-sandbox-network-mode)\n - [Code Interpreter with Custom Execution Role](#code-interpreter-with-custom-execution-role)\n - [Code Interpreter IAM Permissions](#code-interpreter-iam-permissions)\n - [Code interpreter with tags](#code-interpreter-with-tags)\n - [Memory](#memory)\n - [Memory Properties](#memory-properties)\n - [Basic Memory Creation](#basic-memory-creation)\n - [LTM Memory Extraction Stategies](#ltm-memory-extraction-stategies)\n - [Memory with Built-in Strategies](#memory-with-built-in-strategies)\n - [Memory with custom Strategies](#memory-with-custom-strategies)\n - [Memory with Custom Execution Role](#memory-with-custom-execution-role)\n - [Memory with self-managed Strategies](#memory-with-self-managed-strategies)\n - [Memory Strategy Methods](#memory-strategy-methods)\n\n## AgentCore Runtime\n\nThe AgentCore Runtime construct enables you to deploy containerized agents on Amazon Bedrock AgentCore.\nThis L2 construct simplifies runtime creation just pass your ECR repository name\nand the construct handles all the configuration with sensible defaults.\n\n### Runtime Endpoints\n\nEndpoints provide a stable way to invoke specific versions of your agent runtime, enabling controlled deployments across different environments.\nWhen you create an agent runtime, Amazon Bedrock AgentCore automatically creates a \"DEFAULT\" endpoint which always points to the latest version\nof runtime.\n\nYou can create additional endpoints in two ways:\n\n1. **Using Runtime.addEndpoint()** - Convenient method when creating endpoints alongside the runtime.\n2. **Using RuntimeEndpoint** - Flexible approach for existing runtimes.\n\nFor example, you might keep a \"production\" endpoint on a stable version while testing newer versions\nthrough a \"staging\" endpoint. This separation allows you to test changes thoroughly before promoting them\nto production by simply updating the endpoint to point to the newer version.\n\n### AgentCore Runtime Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `runtimeName` | `string` | No | The name of the agent runtime. Valid characters are a-z, A-Z, 0-9, _ (underscore). Must start with a letter and can be up to 48 characters long. If not provided, a unique name will be auto-generated |\n| `agentRuntimeArtifact` | `AgentRuntimeArtifact` | Yes | The artifact configuration for the agent runtime containing the container configuration with ECR URI |\n| `executionRole` | `iam.IRole` | No | The IAM role that provides permissions for the agent runtime. If not provided, a role will be created automatically |\n| `networkConfiguration` | `NetworkConfiguration` | No | Network configuration for the agent runtime. Defaults to `RuntimeNetworkConfiguration.usingPublicNetwork()` |\n| `description` | `string` | No | Optional description for the agent runtime |\n| `protocolConfiguration` | `ProtocolType` | No | Protocol configuration for the agent runtime. Defaults to `ProtocolType.HTTP` |\n| `authorizerConfiguration` | `RuntimeAuthorizerConfiguration` | No | Authorizer configuration for the agent runtime. Use `RuntimeAuthorizerConfiguration` static methods to create configurations for IAM, Cognito, JWT, or OAuth authentication |\n| `environmentVariables` | `{ [key: string]: string }` | No | Environment variables for the agent runtime. Maximum 50 environment variables |\n| `tags` | `{ [key: string]: string }` | No | Tags for the agent runtime. A list of key:value pairs of tags to apply to this Runtime resource |\n| `lifecycleConfiguration` | LifecycleConfiguration | No | The life cycle configuration for the AgentCore Runtime. Defaults to 900 seconds (15 minutes) for idle, 28800 seconds (8 hours) for max life time |\n| `requestHeaderConfiguration` | RequestHeaderConfiguration | No | Configuration for HTTP request headers that will be passed through to the runtime. Defaults to no configuration |\n\n### Runtime Endpoint Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `endpointName` | `string` | No | The name of the runtime endpoint. Valid characters are a-z, A-Z, 0-9, _ (underscore). Must start with a letter and can be up to 48 characters long. If not provided, a unique name will be auto-generated |\n| `agentRuntimeId` | `string` | Yes | The Agent Runtime ID for this endpoint |\n| `agentRuntimeVersion` | `string` | Yes | The Agent Runtime version for this endpoint. Must be between 1 and 5 characters long.|\n| `description` | `string` | No | Optional description for the runtime endpoint |\n| `tags` | `{ [key: string]: string }` | No | Tags for the runtime endpoint |\n\n### Creating a Runtime\n\n#### Option 1: Use an existing image in ECR\n\nReference an image available within ECR.\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\n// The runtime by default create ECR permission only for the repository available in the account the stack is being deployed\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// Create runtime using the built image\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact\n});\n```\n\n#### Option 2: Use a local asset\n\nReference a local directory containing a Dockerfile.\nImages are built from a local Docker context directory (with a Dockerfile), uploaded to Amazon Elastic Container Registry (ECR)\nby the CDK toolkit,and can be naturally referenced in your CDK app.\n\n```typescript fixture=default\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromAsset(\n path.join(__dirname, \"path to agent dockerfile directory\")\n);\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n});\n```\n\n#### Option 3: Use direct code deployment\n\nWith the container deployment method, developers create a Dockerfile, build ARM-compatible containers, manage ECR repositories, and upload containers for code changes. This works well where container DevOps pipelines have already been established to automate deployments.\n\nHowever, customers looking for fully managed deployments can benefit from direct code deployment, which can significantly improve developer time and productivity. Direct code deployment provides a secure and scalable path forward for rapid prototyping agent capabilities to deploying production workloads at scale.\n\nWith direct code deployment, developers create a zip archive of code and dependencies, upload to Amazon S3, and configure the bucket in the agent configuration. A ZIP archive containing Linux arm64 dependencies needs to be uploaded to S3 as a pre-requisite to Create Agent Runtime.\n\nFor more information, please refer to the [documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-get-started-code-deploy.html).\n\n```typescript fixture=default\n// S3 bucket containing the agent core\nconst codeBucket = new s3.Bucket(this, \"AgentCode\", {\n bucketName: \"my-code-bucket\",\n removalPolicy: RemovalPolicy.DESTROY, // For demo purposes\n});\n\n// the bucket above needs to contain the agent code\n\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromS3(\n {\n bucketName: codeBucket.bucketName,\n objectKey: 'deployment_package.zip',\n },\n agentcore.AgentCoreRuntime.PYTHON_3_12,\n ['opentelemetry-instrument', 'main.py']\n);\n\nconst runtimeInstance = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n});\n```\n\n#### Option 4: Use an ECR container image URI\n\nReference an ECR container image directly by its URI. This is useful when you have a pre-existing ECR image URI from CloudFormation parameters or cross-stack references. No IAM permissions are automatically granted - you must ensure the runtime has ECR pull permissions.\n\n```typescript fixture=default\n// Direct URI reference\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromImageUri(\n \"123456789012.dkr.ecr.us-east-1.amazonaws.com/my-agent:v1.0.0\"\n);\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n});\n```\n\nYou can also use CloudFormation parameters or references:\n\n```typescript fixture=default\n// Using a CloudFormation parameter\nconst imageUriParam = new cdk.CfnParameter(this, \"ImageUri\", {\n type: \"String\",\n description: \"Container image URI for the agent runtime\",\n});\n\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromImageUri(\n imageUriParam.valueAsString\n);\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n});\n```\n\n### Granting Permissions to Invoke Bedrock Models or Inference Profiles\n\nTo grant the runtime permissions to invoke Bedrock models or inference profiles:\n\n```typescript fixture=default\n// Note: This example uses @aws-cdk/aws-bedrock-alpha which must be installed separately\ndeclare const runtime: agentcore.Runtime;\n\n// Define the Bedrock Foundation Model\nconst model = bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_7_SONNET_V1_0;\n\n// Grant the runtime permissions to invoke the model\nmodel.grantInvoke(runtime);\n\n// Create a cross-region inference profile for Claude 3.7 Sonnet\nconst inferenceProfile = bedrock.CrossRegionInferenceProfile.fromConfig({\n geoRegion: bedrock.CrossRegionInferenceProfileRegion.US,\n model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_7_SONNET_V1_0\n});\n\n// Grant the runtime permissions to invoke the inference profile\ninferenceProfile.grantInvoke(runtime);\n```\n\n### Runtime Versioning\n\nAmazon Bedrock AgentCore automatically manages runtime versioning to ensure safe deployments and rollback capabilities.\nWhen you create an agent runtime, AgentCore automatically creates version 1 (V1). Each subsequent update to the\nruntime configuration (such as updating the container image, modifying network settings, or changing protocol configurations)\ncreates a new immutable version. These versions contain complete, self-contained configurations that can be referenced by endpoints,\nallowing you to maintain different versions for different environments or gradually roll out updates.\n\n#### Managing Endpoints and Versions\n\nAmazon Bedrock AgentCore automatically manages runtime versioning to provide safe deployments and rollback capabilities. You can follow\nthe steps below to understand how to use versioning with runtime for controlled deployments across different environments.\n\n##### Step 1: Initial Deployment\n\nWhen you first create an agent runtime, AgentCore automatically creates Version 1 of your runtime. At this point, a DEFAULT endpoint is\nautomatically created that points to Version 1. This DEFAULT endpoint serves as the main access point for your runtime.\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\"),\n});\n```\n\n##### Step 2: Creating Custom Endpoints\n\nAfter the initial deployment, you can create additional endpoints for different environments. For example, you might create a \"production\"\nendpoint that explicitly points to Version 1. This allows you to maintain stable access points for specific environments while keeping the\nflexibility to test newer versions elsewhere.\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\"),\n});\n\nconst prodEndpoint = runtime.addEndpoint(\"production\", {\n version: \"1\",\n description: \"Stable production endpoint - pinned to v1\"\n});\n```\n\n##### Step 3: Runtime Update Deployment\n\nWhen you update the runtime configuration (such as updating the container image, modifying network settings, or changing protocol\nconfigurations), AgentCore automatically creates a new version (Version 2). Upon this update:\n\n- Version 2 is created automatically with the new configuration\n- The DEFAULT endpoint automatically updates to point to Version 2\n- Any explicitly pinned endpoints (like the production endpoint) remain on their specified versions\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst agentRuntimeArtifactNew = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v2.0.0\");\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifactNew,\n});\n```\n\n##### Step 4: Testing with Staging Endpoints\n\nOnce Version 2 exists, you can create a staging endpoint that points to the new version. This staging endpoint allows you to test the\nnew version in a controlled environment before promoting it to production. This separation ensures that production traffic continues\nto use the stable version while you validate the new version.\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst agentRuntimeArtifactNew = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v2.0.0\");\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifactNew,\n});\n\nconst stagingEndpoint = runtime.addEndpoint(\"staging\", {\n version: \"2\",\n description: \"Staging environment for testing new version\"\n});\n```\n\n##### Step 5: Promoting to Production\n\nAfter thoroughly testing the new version through the staging endpoint, you can update the production endpoint to point to Version 2.\nThis controlled promotion process ensures that you can validate changes before they affect production traffic.\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst agentRuntimeArtifactNew = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v2.0.0\");\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifactNew,\n});\n\nconst prodEndpoint = runtime.addEndpoint(\"production\", {\n version: \"2\", // New version added here\n description: \"Stable production endpoint\"\n});\n```\n\n### Creating Standalone Runtime Endpoints\n\nRuntimeEndpoint can also be created as a standalone resource.\n\n#### Example: Creating an endpoint for an existing runtime\n\n```typescript fixture=default\n// Reference an existing runtime by its ID\nconst existingRuntimeId = \"abc123-runtime-id\"; // The ID of an existing runtime\n\n// Create a standalone endpoint\nconst endpoint = new agentcore.RuntimeEndpoint(this, \"MyEndpoint\", {\n endpointName: \"production\",\n agentRuntimeId: existingRuntimeId,\n agentRuntimeVersion: \"1\", // Specify which version to use\n description: \"Production endpoint for existing runtime\"\n});\n```\n\n### Runtime Authentication Configuration\n\nThe AgentCore Runtime supports multiple authentication modes to secure access to your agent endpoints. Authentication is configured during runtime creation using the `RuntimeAuthorizerConfiguration` class's static factory methods.\n\n#### IAM Authentication (Default)\n\nIAM authentication is the default mode, when no authorizerConfiguration is set then the underlying service use IAM.\n\n#### Cognito Authentication\n\nTo configure AWS Cognito User Pool authentication:\n\n```typescript fixture=default\ndeclare const userPool: cognito.UserPool;\ndeclare const userPoolClient: cognito.UserPoolClient;\ndeclare const anotherUserPoolClient: cognito.UserPoolClient;\n\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingCognito(\n userPool, // User Pool (required)\n [userPoolClient, anotherUserPoolClient], // User Pool Clients\n ),\n});\n```\n\n#### JWT Authentication\n\nTo configure custom JWT authentication with your own OpenID Connect (OIDC) provider:\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingJWT(\n \"https://example.com/.well-known/openid-configuration\", // Discovery URL (required)\n [\"client1\", \"client2\"], // Allowed Client IDs (optional)\n [\"audience1\"] // Allowed Audiences (optional)\n ),\n});\n```\n\n**Note**: The discovery URL must end with `/.well-known/openid-configuration`.\n\n#### OAuth Authentication\n\nTo configure OAuth 2.0 authentication:\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingOAuth(\n \"https://github.com/.well-known/openid-configuration\",\n \"oauth_client_123\",\n ),\n});\n```\n\n#### Using a Custom IAM Role\n\nInstead of using the auto-created execution role, you can provide your own IAM role with specific permissions:\nThe auto-created role includes all necessary baseline permissions for ECR access, CloudWatch logging, and X-Ray tracing. When providing a custom role, ensure these permissions are included.\n\n### Runtime Network Configuration\n\nThe AgentCore Runtime supports two network modes for deployment:\n\n#### Public Network Mode (Default)\n\nBy default, runtimes are deployed in PUBLIC network mode, which provides internet access suitable for less sensitive or open-use scenarios:\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// Explicitly using public network (this is the default)\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n networkConfiguration: agentcore.RuntimeNetworkConfiguration.usingPublicNetwork(),\n});\n```\n\n#### VPC Network Mode\n\nFor enhanced security and network isolation, you can deploy your runtime within a VPC:\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// Create or use an existing VPC\nconst vpc = new ec2.Vpc(this, 'MyVpc', {\n maxAzs: 2,\n});\n\n// Configure runtime with VPC\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n networkConfiguration: agentcore.RuntimeNetworkConfiguration.usingVpc(this, {\n vpc: vpc,\n vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },\n // Optionally specify security groups, or one will be created automatically\n // securityGroups: [mySecurityGroup],\n }),\n});\n\n```\n\n#### Managing Security Groups with VPC Configuration\n\nWhen using VPC mode, the Runtime implements `ec2.IConnectable`, allowing you to manage network access using the `connections` property:\n\n```typescript fixture=default\nconst vpc = new ec2.Vpc(this, 'MyVpc', {\n maxAzs: 2,\n});\n\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// Create runtime with VPC configuration\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n networkConfiguration: agentcore.RuntimeNetworkConfiguration.usingVpc(this, {\n vpc: vpc,\n vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },\n }),\n});\n\n// Now you can manage network access using the connections property\n// Allow inbound HTTPS traffic from a specific security group\nconst webServerSecurityGroup = new ec2.SecurityGroup(this, 'WebServerSG', { vpc });\nruntime.connections.allowFrom(webServerSecurityGroup, ec2.Port.tcp(443), 'Allow HTTPS from web servers');\n\n// Allow outbound connections to a database\nconst databaseSecurityGroup = new ec2.SecurityGroup(this, 'DatabaseSG', { vpc });\nruntime.connections.allowTo(databaseSecurityGroup, ec2.Port.tcp(5432), 'Allow PostgreSQL connection');\n\n// Allow outbound HTTPS to anywhere (for external API calls)\nruntime.connections.allowToAnyIpv4(ec2.Port.tcp(443), 'Allow HTTPS outbound');\n```\n\n### Runtime IAM Permissions\n\nThe Runtime construct provides convenient methods for granting IAM permissions to principals that need to invoke the runtime or manage its execution role.\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// Create a runtime\nconst runtime = new agentcore.Runtime(this, \"MyRuntime\", {\n runtimeName: \"my_runtime\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n});\n\n// Create a Lambda function that needs to invoke the runtime\nconst invokerFunction = new lambda.Function(this, \"InvokerFunction\", {\n runtime: lambda.Runtime.PYTHON_3_12,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\nimport boto3\ndef handler(event, context):\n client = boto3.client('bedrock-agentcore')\n # Invoke the runtime...\n `),\n});\n\n// Grant permission to invoke the runtime directly\nruntime.grantInvokeRuntime(invokerFunction);\n\n// Grant permission to invoke the runtime on behalf of a user\n// (requires X-Amzn-Bedrock-AgentCore-Runtime-User-Id header)\nruntime.grantInvokeRuntimeForUser(invokerFunction);\n\n// Grant both invoke permissions (most common use case)\nruntime.grantInvoke(invokerFunction);\n\n// Grant specific custom permissions to the runtime's execution role\nruntime.grant(['bedrock:InvokeModel'], ['arn:aws:bedrock:*:*:*']);\n\n// Add a policy statement to the runtime's execution role\nruntime.addToRolePolicy(new iam.PolicyStatement({\n actions: ['s3:GetObject'],\n resources: ['arn:aws:s3:::my-bucket/*'],\n}));\n```\n\n### Other configuration\n\n#### Lifecycle configuration\n\nThe LifecycleConfiguration input parameter to CreateAgentRuntime lets you manage the lifecycle of runtime sessions and resources in Amazon Bedrock AgentCore Runtime. This configuration helps optimize resource utilization by automatically cleaning up idle sessions and preventing long-running instances from consuming resources indefinitely.\n\nYou can configure:\n\n- idleRuntimeSessionTimeout: Timeout in seconds for idle runtime sessions. When a session remains idle for this duration, it will trigger termination. Termination can last up to 15 seconds due to logging and other process completion. Default: 900 seconds (15 minutes)\n- maxLifetime: Maximum lifetime for the instance in seconds. Once reached, instances will initialize termination. Termination can last up to 15 seconds due to logging and other process completion. Default: 28800 seconds (8 hours)\n\nFor additional information, please refer to the [documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-lifecycle-settings.html).\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\nnew agentcore.Runtime(this, 'test-runtime', {\n runtimeName: 'test_runtime',\n agentRuntimeArtifact: agentRuntimeArtifact,\n lifecycleConfiguration: {\n idleRuntimeSessionTimeout: Duration.minutes(10),\n maxLifetime: Duration.hours(4),\n },\n});\n```\n\n#### Request header configuration\n\nCustom headers let you pass contextual information from your application directly to your agent code without cluttering the main request payload. This includes authentication tokens like JWT (JSON Web Tokens, which contain user identity and authorization claims) through the Authorization header, allowing your agent to make decisions based on who is calling it. You can also pass custom metadata like user preferences, session identifiers, or trace context using headers prefixed with X-Amzn-Bedrock-AgentCore-Runtime-Custom-, giving your agent access to up to 20 pieces of runtime context that travel alongside each request. This information can be also used in downstream systems like AgentCore Memory that you can namespace based on those characteristics like user_id or aud in claims like line of business.\n\nFor additional information, please refer to the [documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-header-allowlist.html).\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\nnew agentcore.Runtime(this, 'test-runtime', {\n runtimeName: 'test_runtime',\n agentRuntimeArtifact: agentRuntimeArtifact,\n requestHeaderConfiguration: {\n allowlistedHeaders: ['X-Amzn-Bedrock-AgentCore-Runtime-Custom-H1'],\n },\n});\n```\n\n## Browser\n\nThe Amazon Bedrock AgentCore Browser provides a secure, cloud-based browser that enables AI agents to interact with websites. It includes security features such as session isolation, built-in observability through live viewing, CloudTrail logging, and session replay capabilities.\n\nAdditional information about the browser tool can be found in the [official documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/browser-tool.html)\n\n### Browser Network modes\n\nThe Browser construct supports the following network modes:\n\n1. **Public Network Mode** (`BrowserNetworkMode.usingPublicNetwork()`) - Default\n\n - Allows internet access for web browsing and external API calls\n - Suitable for scenarios where agents need to interact with publicly available websites\n - Enables full web browsing capabilities\n - VPC mode is not supported with this option\n\n2. **VPC (Virtual Private Cloud)** (`BrowserNetworkMode.usingVpc()`)\n\n - Select whether to run the browser in a virtual private cloud (VPC).\n - By configuring VPC connectivity, you enable secure access to private resources such as databases, internal APIs, and services within your VPC.\n\n While the VPC itself is mandatory, these are optional:\n - Subnets - if not provided, CDK will select appropriate subnets from the VPC\n - Security Groups - if not provided, CDK will create a default security group\n - Specific subnet selection criteria - you can let CDK choose automatically\n\nFor more information on VPC connectivity for Amazon Bedrock AgentCore Browser, please refer to the [official documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-vpc.html).\n\n### Browser Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `browserCustomName` | `string` | No | The name of the browser. Must start with a letter and can be up to 48 characters long. Pattern: `[a-zA-Z][a-zA-Z0-9_]{0,47}`. If not provided, a unique name will be auto-generated |\n| `description` | `string` | No | Optional description for the browser. Can have up to 200 characters |\n| `networkConfiguration` | `BrowserNetworkConfiguration` | No | Network configuration for browser. Defaults to PUBLIC network mode |\n| `recordingConfig` | `RecordingConfig` | No | Recording configuration for browser. Defaults to no recording |\n| `executionRole` | `iam.IRole` | No | The IAM role that provides permissions for the browser to access AWS services. A new role will be created if not provided |\n| `tags` | `{ [key: string]: string }` | No | Tags to apply to the browser resource |\n| `browserSigning` | BrowserSigning | No | Browser signing configuration. Defaults to DISABLED |\n\n### Basic Browser Creation\n\n```typescript fixture=default\n// Create a basic browser with public network access\nconst browser = new agentcore.BrowserCustom(this, \"MyBrowser\", {\n browserCustomName: \"my_browser\",\n description: \"A browser for web automation\",\n});\n```\n\n### Browser with Tags\n\n```typescript fixture=default\n// Create a browser with custom tags\nconst browser = new agentcore.BrowserCustom(this, \"MyBrowser\", {\n browserCustomName: \"my_browser\",\n description: \"A browser for web automation with tags\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingPublicNetwork(),\n tags: {\n Environment: \"Production\",\n Team: \"AI/ML\",\n Project: \"AgentCore\",\n },\n});\n```\n\n### Browser with VPC\n\n```typescript fixture=default\nconst browser = new agentcore.BrowserCustom(this, 'BrowserVpcWithRecording', {\n browserCustomName: 'browser_recording',\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingVpc(this, {\n vpc: new ec2.Vpc(this, 'VPC', { restrictDefaultSecurityGroup: false }),\n }),\n});\n```\n\nBrowser exposes a [connections](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Connections.html) property. This property returns a connections object, which simplifies the process of defining and managing ingress and egress rules for security groups in your AWS CDK applications. Instead of directly manipulating security group rules, you interact with the Connections object of a construct, which then translates your connectivity requirements into the appropriate security group rules. For instance:\n\n```typescript fixture=default\nconst vpc = new ec2.Vpc(this, 'testVPC');\n\nconst browser = new agentcore.BrowserCustom(this, 'test-browser', {\n browserCustomName: 'test_browser',\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingVpc(this, {\n vpc: vpc,\n }),\n});\n\nbrowser.connections.addSecurityGroup(new ec2.SecurityGroup(this, 'AdditionalGroup', { vpc }));\n```\n\nSo security groups can be added after the browser construct creation. You can use methods like allowFrom() and allowTo() to grant ingress access to/egress access from a specified peer over a given portRange. The Connections object automatically adds the necessary ingress or egress rules to the security group(s) associated with the calling construct.\n\n### Browser with Recording Configuration\n\n```typescript fixture=default\n// Create an S3 bucket for recordings\nconst recordingBucket = new s3.Bucket(this, \"RecordingBucket\", {\n bucketName: \"my-browser-recordings\",\n removalPolicy: RemovalPolicy.DESTROY, // For demo purposes\n});\n\n// Create browser with recording enabled\nconst browser = new agentcore.BrowserCustom(this, \"MyBrowser\", {\n browserCustomName: \"my_browser\",\n description: \"Browser with recording enabled\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingPublicNetwork(),\n recordingConfig: {\n enabled: true,\n s3Location: {\n bucketName: recordingBucket.bucketName,\n objectKey: \"browser-recordings/\",\n },\n },\n});\n```\n\n### Browser with Custom Execution Role\n\n```typescript fixture=default\n// Create a custom execution role\nconst executionRole = new iam.Role(this, \"BrowserExecutionRole\", {\n assumedBy: new iam.ServicePrincipal(\"bedrock-agentcore.amazonaws.com\"),\n managedPolicies: [\n iam.ManagedPolicy.fromAwsManagedPolicyName(\"AmazonBedrockAgentCoreBrowserExecutionRolePolicy\"),\n ],\n});\n\n// Create browser with custom execution role\nconst browser = new agentcore.BrowserCustom(this, \"MyBrowser\", {\n browserCustomName: \"my_browser\",\n description: \"Browser with custom execution role\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingPublicNetwork(),\n executionRole: executionRole,\n});\n```\n\n### Browser with S3 Recording and Permissions\n\n```typescript fixture=default\n// Create an S3 bucket for recordings\nconst recordingBucket = new s3.Bucket(this, \"RecordingBucket\", {\n bucketName: \"my-browser-recordings\",\n removalPolicy: RemovalPolicy.DESTROY, // For demo purposes\n});\n\n// Create browser with recording enabled\nconst browser = new agentcore.BrowserCustom(this, \"MyBrowser\", {\n browserCustomName: \"my_browser\",\n description: \"Browser with recording enabled\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingPublicNetwork(),\n recordingConfig: {\n enabled: true,\n s3Location: {\n bucketName: recordingBucket.bucketName,\n objectKey: \"browser-recordings/\",\n },\n },\n});\n\n// The browser construct automatically grants S3 permissions to the execution role\n// when recording is enabled, so no additional IAM configuration is needed\n```\n\n### Browser with Browser signing\n\nAI agents need to browse the web on your behalf. When your agent visits a website to gather information, complete a form, or verify data, it encounters the same defenses designed to stop unwanted bots: CAPTCHAs, rate limits, and outright blocks.\n\nAmazon Bedrock AgentCore Browser supports Web Bot Auth. Web Bot Auth is a draft IETF protocol that gives agents verifiable cryptographic identities. When you enable Web Bot Auth in AgentCore Browser, the service issues cryptographic credentials that websites can verify. The agent presents these credentials with every request. The WAF may now additionally check the signature, confirm it matches a trusted directory, and allow the request through if verified bots are allowed by the domain owner and other WAF checks are clear.\n\nTo enable the browser to sign requests using the Web Bot Auth protocol, create a browser tool with the browserSigning configuration:\n\n```typescript fixture=default\nconst browser = new agentcore.BrowserCustom(this, 'test-browser', {\n browserCustomName: 'test_browser',\n browserSigning: agentcore.BrowserSigning.ENABLED\n});\n```\n\n### Browser IAM Permissions\n\nThe Browser construct provides convenient methods for granting IAM permissions:\n\n```typescript fixture=default\n// Create a browser\nconst browser = new agentcore.BrowserCustom(this, \"MyBrowser\", {\n browserCustomName: \"my_browser\",\n description: \"Browser for web automation\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingPublicNetwork(),\n});\n\n// Create a role that needs access to the browser\nconst userRole = new iam.Role(this, \"UserRole\", {\n assumedBy: new iam.ServicePrincipal(\"lambda.amazonaws.com\"),\n});\n\n// Grant read permissions (Get and List actions)\nbrowser.grantRead(userRole);\n\n// Grant use permissions (Start, Update, Stop actions)\nbrowser.grantUse(userRole);\n\n// Grant specific custom permissions\nbrowser.grant(userRole, \"bedrock-agentcore:GetBrowserSession\");\n```\n\n## Code Interpreter\n\nThe Amazon Bedrock AgentCore Code Interpreter enables AI agents to write and execute code securely in sandbox environments, enhancing their accuracy and expanding their ability to solve complex end-to-end tasks. This is critical in Agentic AI applications where the agents may execute arbitrary code that can lead to data compromise or security risks. The AgentCore Code Interpreter tool provides secure code execution, which helps you avoid running into these issues.\n\nFor more information about code interpreter, please refer to the [official documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/code-interpreter-tool.html)\n\n### Code Interpreter Network Modes\n\nThe Code Interpreter construct supports the following network modes:\n\n1. **Public Network Mode** (`CodeInterpreterNetworkMode.usingPublicNetwork()`) - Default\n\n - Allows internet access for package installation and external API calls\n - Suitable for development and testing environments\n - Enables downloading Python packages from PyPI\n\n2. **Sandbox Network Mode** (`CodeInterpreterNetworkMode.usingSandboxNetwork()`)\n - Isolated network environment with no internet access\n - Suitable for production environments with strict security requirements\n - Only allows access to pre-installed packages and local resources\n\n3. **VPC (Virtual Private Cloud)** (`CodeInterpreterNetworkMode.usingVpc()`)\n - Select whether to run the browser in a virtual private cloud (VPC).\n - By configuring VPC connectivity, you enable secure access to private resources such as databases, internal APIs, and services within your VPC.\n\n While the VPC itself is mandatory, these are optional:\n - Subnets - if not provided, CDK will select appropriate subnets from the VPC\n - Security Groups - if not provided, CDK will create a default security group\n - Specific subnet selection criteria - you can let CDK choose automatically\n\nFor more information on VPC connectivity for Amazon Bedrock AgentCore Browser, please refer to the [official documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-vpc.html).\n\n### Code Interpreter Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `codeInterpreterCustomName` | `string` | No | The name of the code interpreter. Must start with a letter and can be up to 48 characters long. Pattern: `[a-zA-Z][a-zA-Z0-9_]{0,47}`. If not provided, a unique name will be auto-generated |\n| `description` | `string` | No | Optional description for the code interpreter. Can have up to 200 characters |\n| `executionRole` | `iam.IRole` | No | The IAM role that provides permissions for the code interpreter to access AWS services. A new role will be created if not provided |\n| `networkConfiguration` | `CodeInterpreterNetworkConfiguration` | No | Network configuration for code interpreter. Defaults to PUBLIC network mode |\n| `tags` | `{ [key: string]: string }` | No | Tags to apply to the code interpreter resource |\n\n### Basic Code Interpreter Creation\n\n```typescript fixture=default\n// Create a basic code interpreter with public network access\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_code_interpreter\",\n description: \"A code interpreter for Python execution\",\n});\n```\n\n### Code Interpreter with VPC\n\n```typescript fixture=default\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_sandbox_interpreter\",\n description: \"Code interpreter with isolated network access\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingVpc(this, {\n vpc: new ec2.Vpc(this, 'VPC', { restrictDefaultSecurityGroup: false }),\n }),\n});\n```\n\nCode Interpreter exposes a [connections](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Connections.html) property. This property returns a connections object, which simplifies the process of defining and managing ingress and egress rules for security groups in your AWS CDK applications. Instead of directly manipulating security group rules, you interact with the Connections object of a construct, which then translates your connectivity requirements into the appropriate security group rules. For instance:\n\n```typescript fixture=default\nconst vpc = new ec2.Vpc(this, 'testVPC');\n\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_sandbox_interpreter\",\n description: \"Code interpreter with isolated network access\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingVpc(this, {\n vpc: vpc,\n }),\n});\n\ncodeInterpreter.connections.addSecurityGroup(new ec2.SecurityGroup(this, 'AdditionalGroup', { vpc }));\n```\n\nSo security groups can be added after the browser construct creation. You can use methods like allowFrom() and allowTo() to grant ingress access to/egress access from a specified peer over a given portRange. The Connections object automatically adds the necessary ingress or egress rules to the security group(s) associated with the calling construct.\n\n### Code Interpreter with Sandbox Network Mode\n\n```typescript fixture=default\n// Create code interpreter with sandbox network mode (isolated)\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_sandbox_interpreter\",\n description: \"Code interpreter with isolated network access\",\n networkConfiguration: agentcore.CodeInterpreterNetworkConfiguration.usingSandboxNetwork(),\n});\n```\n\n### Code Interpreter with Custom Execution Role\n\n```typescript fixture=default\n// Create a custom execution role\nconst executionRole = new iam.Role(this, \"CodeInterpreterExecutionRole\", {\n assumedBy: new iam.ServicePrincipal(\"bedrock-agentcore.amazonaws.com\"),\n});\n\n// Create code interpreter with custom execution role\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_code_interpreter\",\n description: \"Code interpreter with custom execution role\",\n networkConfiguration: agentcore.CodeInterpreterNetworkConfiguration.usingPublicNetwork(),\n executionRole: executionRole,\n});\n```\n\n### Code Interpreter IAM Permissions\n\nThe Code Interpreter construct provides convenient methods for granting IAM permissions:\n\n```typescript fixture=default\n// Create a code interpreter\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_code_interpreter\",\n description: \"Code interpreter for Python execution\",\n networkConfiguration: agentcore.CodeInterpreterNetworkConfiguration.usingPublicNetwork(),\n});\n\n// Create a role that needs access to the code interpreter\nconst userRole = new iam.Role(this, \"UserRole\", {\n assumedBy: new iam.ServicePrincipal(\"lambda.amazonaws.com\"),\n});\n\n// Grant read permissions (Get and List actions)\ncodeInterpreter.grantRead(userRole);\n\n// Grant use permissions (Start, Invoke, Stop actions)\ncodeInterpreter.grantUse(userRole);\n\n// Grant specific custom permissions\ncodeInterpreter.grant(userRole, \"bedrock-agentcore:GetCodeInterpreterSession\");\n```\n\n### Code interpreter with tags\n\n```typescript fixture=default\n// Create code interpreter with sandbox network mode (isolated)\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_sandbox_interpreter\",\n description: \"Code interpreter with isolated network access\",\n networkConfiguration: agentcore.CodeInterpreterNetworkConfiguration.usingPublicNetwork(),\n tags: {\n Environment: \"Production\",\n Team: \"AI/ML\",\n Project: \"AgentCore\",\n },\n});\n```\n\n## Gateway\n\nThe Gateway construct provides a way to create Amazon Bedrock Agent Core Gateways, which serve as integration points between agents and external services.\n\n### Gateway Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `gatewayName` | `string` | No | The name of the gateway. Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen). Maximum 100 characters. If not provided, a unique name will be auto-generated |\n| `description` | `string` | No | Optional description for the gateway. Maximum 200 characters |\n| `protocolConfiguration` | `IGatewayProtocolConfig` | No | The protocol configuration for the gateway. Defaults to MCP protocol |\n| `authorizerConfiguration` | `IGatewayAuthorizerConfig` | No | The authorizer configuration for the gateway. Defaults to Cognito |\n| `exceptionLevel` | `GatewayExceptionLevel` | No | The verbosity of exception messages. Use DEBUG mode to see granular exception messages |\n| `kmsKey` | `kms.IKey` | No | The AWS KMS key used to encrypt data associated with the gateway |\n| `role` | `iam.IRole` | No | The IAM role that provides permissions for the gateway to access AWS services. A new role will be created if not provided |\n| `tags` | `{ [key: string]: string }` | No | Tags for the gateway. A list of key:value pairs of tags to apply to this Gateway resource |\n\n### Basic Gateway Creation\n\nThe protocol configuration defaults to MCP and the inbound auth configuration uses Cognito (it is automatically created on your behalf).\n\n```typescript fixture=default\n// Create a basic gateway with default MCP protocol and Cognito authorizer\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n```\n\n### Protocol configuration\n\nCurrently MCP is the only protocol available. To configure it, use the `protocol` property with `McpProtocolConfiguration`:\n\n- Instructions: Guidance for how to use the gateway with your tools\n- Semantic search: Smart tool discovery that finds the right tools without typical limits. It improves accuracy by finding relevant tools based on context\n- Supported versions: Which MCP protocol versions the gateway can use\n\n```typescript fixture=default\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n});\n```\n\n### Inbound authorization\n\nBefore you create your gateway, you must set up inbound authorization. Inbound authorization validates users who attempt to access targets through\nyour AgentCore gateway. By default, if not provided, the construct will create and configure Cognito as the default identity provider\n(inbound Auth setup). AgentCore supports the following types of inbound authorization:\n\n**JSON Web Token (JWT)** – A secure and compact token used for authorization. After creating the JWT, you specify it as the authorization\nconfiguration when you create the gateway. You can create a JWT with any of the identity providers at Provider setup and configuration.\n\nYou can configure a custom authorization provider using the `inboundAuthorizer` property with `GatewayAuthorizer.usingCustomJwt()`.\nYou need to specify an OAuth discovery server and client IDs/audiences when you create the gateway. You can specify the following:\n\n- Discovery Url — String that must match the pattern ^.+/\\.well-known/openid-configuration$ for OpenID Connect discovery URLs\n- At least one of the below options depending on the chosen identity provider.\n- Allowed audiences — List of allowed audiences for JWT tokens\n- Allowed clients — List of allowed client identifiers\n\n```typescript fixture=default\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n }),\n});\n```\n\n**IAM** – Authorizes through the credentials of the AWS IAM identity trying to access the gateway.\n\n```typescript fixture=default\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingAwsIam(),\n});\n\n// Grant access to a Lambda function's role\nconst lambdaRole = new iam.Role(this, \"LambdaRole\", {\n assumedBy: new iam.ServicePrincipal(\"lambda.amazonaws.com\"),\n});\n\n// The Lambda needs permission to invoke the gateway\ngateway.grantInvoke(lambdaRole);\n```\n\n**Cognito with M2M (Machine-to-Machine) Authentication (Default)** – When no authorizer is specified, the construct automatically creates a Cognito User Pool configured for OAuth 2.0 client credentials flow. This enables machine-to-machine authentication suitable for AI agents and service-to-service communication.\n\nFor more information, see [Setting up Amazon Cognito for Gateway inbound authorization](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/identity-idp-cognito.html).\n\n```typescript fixture=default\n// Create a gateway with default Cognito M2M authorizer\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\n// Access the Cognito resources for authentication setup\nconst userPool = gateway.userPool;\nconst userPoolClient = gateway.userPoolClient;\n\n// Get the token endpoint URL and OAuth scopes for client credentials flow\nconst tokenEndpointUrl = gateway.tokenEndpointUrl;\nconst oauthScopes = gateway.oauthScopes;\n// oauthScopes are in the format: ['{resourceServerId}/read', '{resourceServerId}/write']\n```\n\nTo authenticate with the gateway, request an access token using the client credentials flow and use it to call Gateway endpoints. For more information about the token endpoint, see [The token issuer endpoint](https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html).\n\nThe following is an example of a token request using curl:\n\n```bash\ncurl -X POST \"${TOKEN_ENDPOINT_URL}\" \\\n -H \"Content-Type: application/x-www-form-urlencoded\" \\\n -d \"grant_type=client_credentials\" \\\n -d \"client_id=${USER_POOL_CLIENT_ID}\" \\\n -d \"client_secret=${CLIENT_SECRET}\" \\\n -d \"scope=${OAUTH_SCOPES}\"\n```\n\n### Gateway with KMS Encryption\n\nYou can provide a KMS key, and configure the authorizer as well as the protocol configuration.\n\n```typescript fixture=default\n// Create a KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"GatewayEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for gateway encryption\",\n});\n\n// Create gateway with KMS encryption\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-encrypted-gateway\",\n description: \"Gateway with KMS encryption\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n }),\n kmsKey: encryptionKey,\n exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,\n});\n```\n\n### Gateway with Custom Execution Role\n\n```typescript fixture=default\n// Create a custom execution role\nconst executionRole = new iam.Role(this, \"GatewayExecutionRole\", {\n assumedBy: new iam.ServicePrincipal(\"bedrock-agentcore.amazonaws.com\"),\n managedPolicies: [\n iam.ManagedPolicy.fromAwsManagedPolicyName(\"AmazonBedrockAgentCoreGatewayExecutionRolePolicy\"),\n ],\n});\n\n// Create gateway with custom execution role\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n description: \"Gateway with custom execution role\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n }),\n role: executionRole,\n});\n```\n\n### Gateway IAM Permissions\n\nThe Gateway construct provides convenient methods for granting IAM permissions:\n\n```typescript fixture=default\n// Create a gateway\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n description: \"Gateway for external service integration\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n }),\n});\n\n// Create a role that needs access to the gateway\nconst userRole = new iam.Role(this, \"UserRole\", {\n assumedBy: new iam.ServicePrincipal(\"lambda.amazonaws.com\"),\n});\n\n// Grant read permissions (Get and List actions)\ngateway.grantRead(userRole);\n\n// Grant manage permissions (Create, Update, Delete actions)\ngateway.grantManage(userRole);\n\n// Grant specific custom permissions\ngateway.grant(userRole, \"bedrock-agentcore:GetGateway\");\n```\n\n## Gateway Target\n\nAfter Creating gateways, you can add targets which define the tools that your gateway will host. Gateway supports multiple target\ntypes including Lambda functions and API specifications (either OpenAPI schemas or Smithy models). Gateway allows you to attach multiple\ntargets to a Gateway and you can change the targets / tools attached to a gateway at any point. Each target can have its own\ncredential provider attached enabling you to securely access targets whether they need IAM, API Key, or OAuth credentials.\n\n### Gateway Target Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `gatewayTargetName` | `string` | No | The name of the gateway target. Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen). If not provided, a unique name will be auto-generated |\n| `description` | `string` | No | Optional description for the gateway target. Maximum 200 characters |\n| `gateway` | `IGateway` | Yes | The gateway this target belongs to |\n| `targetConfiguration` | `ITargetConfiguration` | Yes | The target configuration (Lambda, OpenAPI, or Smithy). **Note:** Users typically don't create this directly. When using convenience methods like `GatewayTarget.forLambda()`, `GatewayTarget.forOpenApi()`, `GatewayTarget.forSmithy()` or the gateway's `addLambdaTarget()`, `addOpenApiTarget()`, `addSmithyTarget()` methods, this configuration is created internally for you. Only needed when using the GatewayTarget constructor directly for [advanced scenarios](#advanced-usage-direct-configuration-for-gateway-target). |\n| `credentialProviderConfigurations` | `IGatewayCredentialProvider[]` | No | Credential providers for authentication. Defaults to `[GatewayCredentialProvider.fromIamRole()]`. Use `GatewayCredentialProvider.fromApiKeyIdentityArn()`, `GatewayCredentialProvider.fromOauthIdentityArn()`, or `GatewayCredentialProvider.fromIamRole()` |\n| `validateOpenApiSchema` | `boolean` | No | (OpenAPI targets only) Whether to validate the OpenAPI schema at synthesis time. Defaults to `true`. Only applies to inline and local asset schemas. For more information refer here <https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-schema-openapi.html> |\n\nThis approach gives you full control over the configuration but is typically not necessary for most use cases.\n\n### Targets types\n\nYou can create the following targets types:\n\n**Lambda Target**: Lambda targets allow you to connect your gateway to AWS Lambda functions that implement your tools. This is useful\nwhen you want to execute custom code in response to tool invocations.\n\n- Supports GATEWAY_IAM_ROLE credential provider only\n- Ideal for custom serverless function integration\n- Need tool schema (tool schema is a blueprint that describes the functions your Lambda provides to AI agents).\n The construct provide [3 ways to upload a tool schema to Lambda target](#tools-schema-for-lambda-target)\n- When using the default IAM authentication (no `credentialProviderConfigurations` specified),\n the construct automatocally grants the gateway role permission to invoke your Lambda function (`lambda:InvokeFunction`).\n\n**OpenAPI Schema Target** : OpenAPI widely used standard for describing RESTful APIs. Gateway supports OpenAPI 3.0\nspecifications for defining API targets. It connects to REST APIs using OpenAPI specifications\n\n- Supports OAUTH and API_KEY credential providers (Do not support IAM, you must provide `credentialProviderConfigurations`)\n- Ideal for integrating with external REST services\n- Need API schema. The construct provide [3 ways to upload a API schema to OpenAPI target](#api-schema-for-openapi-and-smithy-target)\n\n**Smithy Model Target** : Smithy is a language for defining services and software development kits (SDKs). Smithy models provide\na more structured approach to defining APIs compared to OpenAPI, and are particularly useful for connecting to AWS services.\nAgentCore Gateway supports built-in AWS service models only. It connects to services using Smithy model definitions\n\n- Supports OAUTH and API_KEY credential providers\n- Ideal for AWS service integrations\n- Need API schema. The construct provide 3 ways to upload a API schema to Smity target\n- When using the default IAM authentication (no `credentialProviderConfigurations` specified), The construct only\n grants permission to read the Smithy schema file from S3. You MUST manually grant permissions for the gateway\n role to invoke the actual Smithy API endpoints\n\n> Note: For Smithy model targets that access AWS services, your Gateway's execution role needs permissions to access those services.\nFor example, for a DynamoDB target, your execution role needs permissions to perform DynamoDB operations.\nThis is not managed by the construct due to the large number of options. Please refer to\n[Smithy Model Permission](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-prerequisites-permissions.html) for example.\n\n**MCP Server Target**: Model Context Protocol (MCP) servers provide external tools, data access, and custom functions for AI agents.\nMCP servers enable agents to interact with external systems and services through a standardized protocol. Gateway automatically\ndiscovers and indexes available tools from MCP servers through synchronization.\n\n**Key Features:**\n\n- Requires explicit authentication configuration (OAuth2 recommended, empty array for NoAuth)\n- Ideal for connecting to external MCP-compliant servers\n- The endpoint must use HTTPS protocol\n- Supported MCP protocol versions: 2025-06-18, 2025-03-26\n- Automatic tool discovery through synchronization\n\n**Synchronization Behavior:**\n\nMCP Server targets require synchronization to discover and index available tools:\n\n- **Implicit Synchronization (Automatic)**: Tool discovery happens automatically during:\n - Target creation (`CreateGatewayTarget`)\n - Target updates (`UpdateGatewayTarget`)\n - The Gateway calls the MCP server's `tools/list` endpoint and indexes tools without user intervention\n\n- **Explicit Synchronization (Manual)**: When the MCP server's tools change independently (new tools added, schemas modified, tools removed):\n - The Gateway's tool catalog becomes stale\n - Call the `SynchronizeGatewayTargets` API to refresh the catalog\n - Use the `grantSync()` method to grant permissions to Lambda functions, CI/CD pipelines, or scheduled tasks that will trigger synchronization\n\n**Authentication & Permissions:**\n\nWhen using OAuth2, the Gateway service role automatically receives:\n\n- `bedrock-agentcore:GetWorkloadAccessToken`\n- `bedrock-agentcore:GetResourceOauth2Token`\n- `secretsmanager:GetSecretValue`\n- KMS decrypt (if secrets are encrypted)\n\nFor explicit synchronization, use `grantSync()` to grant `bedrock-agentcore:SynchronizeGatewayTargets` permission to your operator roles.\n\n> For more information, refer to the [MCP Server Target documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-target-MCPservers.html).\n\n### Understanding Tool Naming\n\nWhen tools are exposed through gateway targets, AgentCore Gateway prefixes each tool name with the target name to ensure uniqueness across multiple targets. This is important to understand when building your application logic.\n\n**Naming Pattern:**\n\n**Example:**\n\nIf your target is named `my-lambda-target` and provides a tool called `calculate_price`, agents will discover and invoke it as `my-lambda-target__calculate_price`.\n\n**Important Considerations:**\n\n- **For Lambda Targets**: Your Lambda handler must strip the target name prefix before processing the tool request. The full tool name (with prefix) is sent in the event.\n- **For MCP Server Targets**: The MCP server receives tool calls with the prefixed name from the gateway.\n- **For OpenAPI/Smithy Targets**: The gateway handles the prefix automatically when mapping to API operations based on the `operationId`.\n\nThis naming convention ensures that:\n\n- Tools from different targets don't collide even if they have the same name\n- Agents can access tools from multiple targets through a single gateway\n- Tool names remain unique in the unified tool catalog\n\nFor more details, see the [Gateway Tool Naming Documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-tool-naming.html).\n\n### Tools schema For Lambda target\n\nThe lambda target need tools schema to understand the fuunction lambda provides. You can upload the tool schema by following 3 ways:\n\n- From a local asset file\n\n```typescript\nconst toolSchema = agentcore.ToolSchema.fromLocalAsset(\n path.join(__dirname, \"schemas\", \"my-tool-schema.json\")\n );\n```\n\n- From an existing S3 file:\n\n```typescript\n\nconst toolSchema = agentcore.ToolSchema.fromS3File(\n s3.Bucket.fromBucketName(this, \"SchemasBucket\", \"my-schemas-bucket\"),\n \"tools/complex-tool-schema.json\",\n \"123456789012\"\n );\n```\n\n- From Inline:\n\n```typescript\nconst toolSchema = agentcore.ToolSchema.fromInline([{\n name: \"hello_world\",\n description: \"A simple hello world tool\",\n inputSchema: {\n type: agentcore.SchemaDefinitionType.OBJECT,\n properties: {\n name: {\n type: agentcore.SchemaDefinitionType.STRING,\n description: \"The name to greet\",\n },\n },\n required: [\"name\"],\n },\n }]);\n\n```\n\n### Api schema For OpenAPI and Smithy target\n\nThe OpenAPI and Smithy target need API Schema. The Gateway construct provide three ways to upload API schema for your target:\n\n- From a local asset file (requires binding to scope):\n\n```typescript fixture=default\n// When using ApiSchema.fromLocalAsset, you must bind the schema to a scope\nconst schema = agentcore.ApiSchema.fromLocalAsset(path.join(__dirname, \"mySchema.yml\"));\n\nschema.bind(this);\n```\n\n- From an inline schema:\n\n```typescript fixture=default\nconst inlineSchema = agentcore.ApiSchema.fromInline(`\nopenapi: 3.0.3\ninfo:\n title: Library API\n version: 1.0.0\npaths:\n /search:\n get:\n summary: Search for books\n operationId: searchBooks\n parameters:\n - name: query\n in: query\n required: true\n schema:\n type: string\n`);\n```\n\n- From an existing S3 file:\n\n```typescript fixture=default\nconst bucket = s3.Bucket.fromBucketName(this, \"ExistingBucket\", \"my-schema-bucket\");\nconst s3Schema = agentcore.ApiSchema.fromS3File(bucket, \"schemas/action-group.yaml\");\n```\n\n### Outbound auth\n\nOutbound authorization lets Amazon Bedrock AgentCore gateways securely access gateway targets on behalf of users authenticated\nand authorized during Inbound Auth.\n\nAgentCore Gateway supports the following types of outbound authorization:\n\n**IAM-based outbound authorization** – The gateway uses its execution role to authenticate with AWS services. This is the default\n and most common approach for Lambda targets and AWS service integrations.\n\n**2-legged OAuth (OAuth 2LO)** – Use OAuth 2.0 two-legged flow (2LO) for targets that require OAuth authentication.\nThe gateway authenticates on its own behalf, not on behalf of a user.\n\n**API key** – Use the AgentCore service/AWS console to generate an API key to authenticate access to the gateway target.\n\n**Note > You need to set up the outbound identity before you can create a gateway target.\n\n### Basic Gateway Target Creation\n\nYou can create targets in two ways: using the static factory methods on `GatewayTarget` or using the convenient `addTarget` methods on the gateway instance.\n\n#### Using addTarget methods (Recommended)\n\nBelow are the examples on how you can create Lambda , Smity and OpenAPI target using `addTarget` method.\n\n```typescript fixture=default\n// Create a gateway first\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\nconst lambdaFunction = new lambda.Function(this, \"MyFunction\", {\n runtime: lambda.Runtime.NODEJS_22_X,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\n exports.handler = async (event) => {\n return {\n statusCode: 200,\n body: JSON.stringify({ message: 'Hello from Lambda!' })\n };\n };\n `),\n});\n\nconst lambdaTarget = gateway.addLambdaTarget(\"MyLambdaTarget\", {\n gatewayTargetName: \"my-lambda-target\",\n description: \"Lambda function target\",\n lambdaFunction: lambdaFunction,\n toolSchema: agentcore.ToolSchema.fromInline([\n {\n name: \"hello_world\",\n description: \"A simple hello world tool\",\n inputSchema: {\n type: agentcore.SchemaDefinitionType.OBJECT,\n properties: {\n name: {\n type: agentcore.SchemaDefinitionType.STRING,\n description: \"The name to greet\",\n },\n },\n required: [\"name\"],\n },\n },\n ]),\n});\n```\n\n- OpenAPI Target\n\n``` typescript\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\n// These ARNs are returned when creating the API key credential provider via Console or API\nconst apiKeyProviderArn = \"arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/apikeycredentialprovider/my-apikey\"\nconst apiKeySecretArn = \"arn:aws:secretsmanager:us-east-1:123456789012:secret:my-apikey-secret-abc123\"\n\nconst bucket = s3.Bucket.fromBucketName(this, \"ExistingBucket\", \"my-schema-bucket\");\nconst s3mySchema = agentcore.ApiSchema.fromS3File(bucket, \"schemas/myschema.yaml\");\n\n// Add an OpenAPI target directly to the gateway\nconst target = gateway.addOpenApiTarget(\"MyTarget\", {\n gatewayTargetName: \"my-api-target\",\n description: \"Target for external API integration\",\n apiSchema: s3mySchema,\n credentialProviderConfigurations: [\n agentcore.GatewayCredentialProvider.fromApiKeyIdentityArn({\n providerArn: apiKeyProviderArn,\n secretArn: apiKeySecretArn,\n credentialLocation: agentcore.ApiKeyCredentialLocation.header({\n credentialParameterName: \"X-API-Key\",\n }),\n }),\n ],\n});\n\n// This make sure your s3 bucket is available before target\ntarget.node.addDependency(bucket);\n```\n\n- Smithy Target\n\n```typescript fixture=default\n\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\nconst smithySchema = agentcore.ApiSchema.fromLocalAsset(\n path.join(__dirname, \"models\", \"smithy-model.json\")\n);\nsmithySchema.bind(this);\n\nconst smithyTarget = gateway.addSmithyTarget(\"MySmithyTarget\", {\n gatewayTargetName: \"my-smithy-target\",\n description: \"Smithy model target\",\n smithyModel: smithySchema,\n\n});\n```\n\n- MCP Server Target\n\n```typescript fixture=default\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\n// OAuth2 authentication (recommended)\n// Note: Create the OAuth provider using AWS console or Identity L2 construct when available\nconst oauthProviderArn = \"arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/oauth2credentialprovider/my-oauth\";\nconst oauthSecretArn = \"arn:aws:secretsmanager:us-east-1:123456789012:secret:my-oauth-secret-abc123\";\n\n// Add an MCP server target directly to the gateway\nconst mcpTarget = gateway.addMcpServerTarget(\"MyMcpServer\", {\n gatewayTargetName: \"my-mcp-server\",\n description: \"External MCP server integration\",\n endpoint: \"https://my-mcp-server.example.com\",\n credentialProviderConfigurations: [\n agentcore.GatewayCredentialProvider.fromOauthIdentityArn({\n providerArn: oauthProviderArn,\n secretArn: oauthSecretArn,\n scopes:['mcp-runtime-server/invoke']\n }),\n ],\n});\n\n// Grant sync permission to a Lambda function that will trigger synchronization\nconst syncFunction = new lambda.Function(this, \"SyncFunction\", {\n runtime: lambda.Runtime.PYTHON_3_12,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\nimport boto3\n\ndef handler(event, context):\n client = boto3.client('bedrock-agentcore')\n response = client.synchronize_gateway_targets(\n gatewayIdentifier=event['gatewayId'],\n targetIds=[event['targetId']]\n )\n return response\n `),\n});\n\nmcpTarget.grantSync(syncFunction);\n```\n\n#### Using static factory methods\n\nCreate Gateway target using static convienence method.\n\n- Lambda Target\n\n```typescript fixture=default\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\nconst lambdaFunction = new lambda.Function(this, \"MyFunction\", {\n runtime: lambda.Runtime.NODEJS_22_X,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\n exports.handler = async (event) => {\n return {\n statusCode: 200,\n body: JSON.stringify({ message: 'Hello from Lambda!' })\n };\n };\n `),\n});\n\n// Create a gateway target with Lambda and tool schema\nconst target = agentcore.GatewayTarget.forLambda(this, \"MyLambdaTarget\", {\n gatewayTargetName: \"my-lambda-target\",\n description: \"Target for Lambda function integration\",\n gateway: gateway,\n lambdaFunction: lambdaFunction,\n toolSchema: agentcore.ToolSchema.fromLocalAsset(\n path.join(__dirname, \"schemas\", \"my-tool-schema.json\")\n ),\n});\n```\n\n- OpenAPI Target\n\n```typescript fixture=default\n\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\n// outbound auth (Use AWS console to create it, Once Identity L2 construct is available you can use it to create identity)\nconst apiKeyIdentityArn = \"arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/apikeycredentialprovider/my-apikey\"\nconst apiKeySecretArn = \"arn:aws:secretsmanager:us-east-1:123456789012:secret:my-apikey-secret-abc123\"\n\nconst opneapiSchema = agentcore.ApiSchema.fromLocalAsset(path.join(__dirname, \"mySchema.yml\"));\nopneapiSchema.bind(this);\n\n// Create a gateway target with OpenAPI Schema\nconst target = agentcore.GatewayTarget.forOpenApi(this, \"MyTarget\", {\n gatewayTargetName: \"my-api-target\",\n description: \"Target for external API integration\",\n gateway: gateway, // Note: you need to pass the gateway reference\n apiSchema: opneapiSchema,\n credentialProviderConfigurations: [\n agentcore.GatewayCredentialProvider.fromApiKeyIdentityArn({\n providerArn: apiKeyIdentityArn,\n secretArn: apiKeySecretArn\n }),\n ],\n});\n\n```\n\n- Smithy Target\n\n```typescript fixture=default\n\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\nconst smithySchema = agentcore.ApiSchema.fromLocalAsset(\n path.join(__dirname, \"models\", \"smithy-model.json\")\n);\nsmithySchema.bind(this);\n\n// Create a gateway target with Smithy Model and OAuth\nconst target = agentcore.GatewayTarget.forSmithy(this, \"MySmithyTarget\", {\n gatewayTargetName: \"my-smithy-target\",\n description: \"Target for Smithy model integration\",\n gateway: gateway,\n smithyModel: smithySchema,\n});\n\n```\n\n- MCP Server Target\n\n```typescript fixture=default\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\n// OAuth2 authentication (recommended)\n// Note: Create the OAuth provider using AWS console or Identity L2 construct when available\nconst oauthProviderArn = \"arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/oauth2credentialprovider/my-oauth\";\nconst oauthSecretArn = \"arn:aws:secretsmanager:us-east-1:123456789012:secret:my-oauth-secret-abc123\";\n\n// Create a gateway target with MCP Server\nconst mcpTarget = agentcore.GatewayTarget.forMcpServer(this, \"MyMcpServer\", {\n gatewayTargetName: \"my-mcp-server\",\n description: \"External MCP server integration\",\n gateway: gateway,\n endpoint: \"https://my-mcp-server.example.com\",\n credentialProviderConfigurations: [\n agentcore.GatewayCredentialProvider.fromOauthIdentityArn({\n providerArn: oauthProviderArn,\n secretArn: oauthSecretArn,\n scopes:['mcp-runtime-server/invoke']\n }),\n ],\n});\n```\n\n### Advanced Usage: Direct Configuration for gateway target\n\nFor advanced use cases where you need full control over the target configuration, you can create configurations manually using the static factory methods and use the GatewayTarget constructor directly.\n\n#### Configuration Factory Methods\n\nEach target type has a corresponding configuration class with a static `create()` method:\n\n- **Lambda**: `LambdaTargetConfiguration.create(lambdaFunction, toolSchema)`\n- **OpenAPI**: `OpenApiTargetConfiguration.create(apiSchema, validateSchema?)`\n- **Smithy**: `SmithyTargetConfiguration.create(smithyModel)`\n\n#### Example: Lambda Target with Custom Configuration\n\n```typescript\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\nconst myLambdaFunction = new lambda.Function(this, \"MyFunction\", {\n runtime: lambda.Runtime.NODEJS_22_X,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\n exports.handler = async (event) => ({ statusCode: 200 });\n `),\n});\n\nconst myToolSchema = agentcore.ToolSchema.fromInline([{\n name: \"my_tool\",\n description: \"My custom tool\",\n inputSchema: {\n type: agentcore.SchemaDefinitionType.OBJECT,\n properties: {},\n },\n}]);\n\n// Create a custom Lambda configuration\nconst customConfig = agentcore.LambdaTargetConfiguration.create(\n myLambdaFunction,\n myToolSchema\n);\n\n// Use the GatewayTarget constructor directly\nconst target = new agentcore.GatewayTarget(this, \"AdvancedTarget\", {\n gateway: gateway,\n gatewayTargetName: \"advanced-target\",\n targetConfiguration: customConfig, // Manually created configuration\n credentialProviderConfigurations: [\n agentcore.GatewayCredentialProvider.fromIamRole()\n ]\n});\n```\n\nThis approach gives you full control over the configuration but is typically not necessary for most use cases. The convenience methods (`GatewayTarget.forLambda()`, `GatewayTarget.forOpenApi()`, `GatewayTarget.forSmithy()`) handle all of this internally.\n\n### Gateway Interceptors\n\nGateway interceptors allow you to run custom code during each gateway invocation to implement fine-grained access control, transform requests and responses, or implement custom authorization logic. A gateway can have at most one REQUEST interceptor and one RESPONSE interceptor.\n\n**Interceptor Types:**\n\n- **REQUEST interceptors**: Execute before the gateway calls the target. Useful for request validation, transformation, or custom authorization\n- **RESPONSE interceptors**: Execute after the target responds but before the gateway sends the response back. Useful for response transformation, filtering, or adding custom headers\n\n**Security Best Practices:**\n\n1. Keep `passRequestHeaders` disabled unless absolutely necessary (default: false)\n2. Implement idempotent Lambda functions (gateway may retry on failures)\n3. Restrict gateway execution role to specific Lambda functions\n4. Avoid logging sensitive information in your interceptor\n\nFor more information, see the [Gateway Interceptors documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-interceptors.html).\n\n#### Adding Interceptors via Constructor\n\n```typescript fixture=default\n// Create Lambda functions for interceptors\nconst requestInterceptorFn = new lambda.Function(this, \"RequestInterceptor\", {\n runtime: lambda.Runtime.PYTHON_3_12,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\ndef handler(event, context):\n # Validate and transform request\n return {\n \"interceptorOutputVersion\": \"1.0\",\n \"mcp\": {\n \"transformedGatewayRequest\": event[\"mcp\"][\"gatewayRequest\"]\n }\n }\n `),\n});\n\nconst responseInterceptorFn = new lambda.Function(this, \"ResponseInterceptor\", {\n runtime: lambda.Runtime.PYTHON_3_12,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\ndef handler(event, context):\n # Filter or transform response\n return {\n \"interceptorOutputVersion\": \"1.0\",\n \"mcp\": {\n \"transformedGatewayResponse\": event[\"mcp\"][\"gatewayResponse\"]\n }\n }\n `),\n});\n\n// Create gateway with interceptors\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n interceptorConfigurations: [\n agentcore.LambdaInterceptor.forRequest(requestInterceptorFn, {\n passRequestHeaders: true // Only if you need to inspect headers\n }),\n agentcore.LambdaInterceptor.forResponse(responseInterceptorFn)\n ]\n});\n```\n\n**Automatic Permission Granting:**\n\nWhen you add a Lambda interceptor to a gateway (either via constructor or `addInterceptor()`), the gateway's IAM role automatically receives `lambda:InvokeFunction` permission on the Lambda function. This permission grant happens internally during the bind process - you do not need to manually configure these IAM permissions.\n\n#### Adding Interceptors Dynamically\n\n```typescript fixture=default\n// Create a gateway first\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\n// Create Lambda functions for interceptors\nconst requestInterceptorFn = new lambda.Function(this, \"RequestInterceptor\", {\n runtime: lambda.Runtime.PYTHON_3_12,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\ndef handler(event, context):\n # Custom request validation logic\n return {\n \"interceptorOutputVersion\": \"1.0\",\n \"mcp\": {\n \"transformedGatewayRequest\": event[\"mcp\"][\"gatewayRequest\"]\n }\n }\n `),\n});\n\nconst responseInterceptorFn = new lambda.Function(this, \"ResponseInterceptor\", {\n runtime: lambda.Runtime.PYTHON_3_12,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\ndef handler(event, context):\n # Filter sensitive data from response\n return {\n \"interceptorOutputVersion\": \"1.0\",\n \"mcp\": {\n \"transformedGatewayResponse\": event[\"mcp\"][\"gatewayResponse\"]\n }\n }\n `),\n});\n\ngateway.addInterceptor(\n agentcore.LambdaInterceptor.forRequest(requestInterceptorFn, {\n passRequestHeaders: false // Default, headers not passed for security\n })\n);\n\ngateway.addInterceptor(\n agentcore.LambdaInterceptor.forResponse(responseInterceptorFn)\n);\n```\n\n### Gateway Target IAM Permissions\n\nThe Gateway Target construct provides convenient methods for granting IAM permissions:\n\n```typescript fixture=default\n// Create a gateway and target\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\nconst smithySchema = agentcore.ApiSchema.fromLocalAsset(\n path.join(__dirname, \"models\", \"smithy-model.json\")\n);\nsmithySchema.bind(this);\n\n// Create a gateway target with Smithy Model and OAuth\nconst target = agentcore.GatewayTarget.forSmithy(this, \"MySmithyTarget\", {\n gatewayTargetName: \"my-smithy-target\",\n description: \"Target for Smithy model integration\",\n gateway: gateway,\n smithyModel: smithySchema,\n});\n\n// Create a role that needs access to the gateway target\nconst userRole = new iam.Role(this, \"UserRole\", {\n assumedBy: new iam.ServicePrincipal(\"lambda.amazonaws.com\"),\n});\n\n// Grant read permissions (Get and List actions)\ntarget.grantRead(userRole);\n\n// Grant manage permissions (Create, Update, Delete actions)\ntarget.grantManage(userRole);\n\n// Grant specific custom permissions\ntarget.grant(userRole, \"bedrock-agentcore:GetGatewayTarget\");\n\n\n// Grants permission to invoke this Gateway\ngateway.grantInvoke(userRole);\n```\n\n## Memory\n\nMemory is a critical component of intelligence. While Large Language Models (LLMs) have impressive capabilities, they lack persistent memory across conversations. Amazon Bedrock AgentCore Memory addresses this limitation by providing a managed service that enables AI agents to maintain context over time, remember important facts, and deliver consistent, personalized experiences.\n\nAgentCore Memory operates on two levels:\n\n- **Short-Term Memory**: Immediate conversation context and session-based information that provides continuity within a single interaction or closely related sessions.\n- **Long-Term Memory**: Persistent information extracted and stored across multiple conversations, including facts, preferences, and summaries that enable personalized experiences over time.\n\nWhen you interact with the memory via the `CreateEvent` API, you store interactions in Short-Term Memory (STM) instantly. These interactions can include everything from user messages, assistant responses, to tool actions.\n\nTo write to long-term memory, you need to configure extraction strategies which define how and where to store information from conversations for future use. These strategies are asynchronously processed from raw events after every few turns based on the strategy that was selected. You can't create long term memory records directly, as they are extracted asynchronously by AgentCore Memory.\n\n### Memory Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `memoryName` | `string` | No | The name of the memory. If not provided, a unique name will be auto-generated |\n| `expirationDuration` | `Duration` | No | Short-term memory expiration in days (between 7 and 365). Default: 90 days |\n| `description` | `string` | No | Optional description for the memory. Default: no description. |\n| `kmsKey` | `IKey` | No | Custom KMS key to use for encryption. Default: Your data is encrypted with a key that AWS owns and manages for you |\n| `memoryStrategies` | `MemoryStrategyBase[]` | No | Built-in extraction strategies to use for this memory. Default: No extraction strategies (short term memory only) |\n| `executionRole` | `iam.IRole` | No | The IAM role that provides permissions for the memory to access AWS services. Default: A new role will be created. |\n| `tags` | `{ [key: string]: string }` | No | Tags for memory. Default: no tags. |\n\n### Basic Memory Creation\n\nBelow you can find how to configure a simple short-term memory (STM) with no long-term memory extraction strategies.\nNote how you set `expirationDuration`, which defines the time the events will be stored in the short-term memory before they expire.\n\n```typescript fixture=default\n\n// Create a basic memory with default settings, no LTM strategies\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my_memory\",\n description: \"A memory for storing user interactions for a period of 90 days\",\n expirationDuration: cdk.Duration.days(90),\n});\n```\n\nBasic Memory with Custom KMS Encryption\n\n```typescript fixture=default\n// Create a custom KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"MemoryEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for memory encryption\",\n});\n\n// Create memory with custom encryption\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my_encrypted_memory\",\n description: \"Memory with custom KMS encryption\",\n expirationDuration: cdk.Duration.days(90),\n kmsKey: encryptionKey,\n});\n```\n\n### LTM Memory Extraction Stategies\n\nIf you need long-term memory for context recall across sessions, you can setup memory extraction strategies\nto extract the relevant memory from the raw events.\n\nAmazon Bedrock AgentCore Memory has different memory strategies for extracting and organizing information:\n\n- **Summarization**: to summarize interactions to preserve critical context and key insights.\n- **Semantic Memory**: to extract general factual knowledge, concepts and meanings from raw conversations using vector embeddings.\nThis enables similarity-based retrieval of relevant facts and context.\n- **User Preferences**: to extract user behavior patterns from raw conversations.\n\nYou can use built-in extraction strategies for quick setup, or create custom extraction strategies with specific models and prompt templates.\n\n### Memory with Built-in Strategies\n\nThe library provides four built-in LTM strategies. These are default strategies for organizing and extracting memory data,\neach optimized for specific use cases.\n\nFor example: An agent helps multiple users with cloud storage setup. From these conversations,\nsee how each strategy processes users expressing confusion about account connection:\n\n1. **Summarization Strategy** (`MemoryStrategy.usingBuiltInSummarization()`)\nThis strategy compresses conversations into concise overviews, preserving essential context and key insights for quick recall.\nExtracted memory example: Users confused by cloud setup during onboarding.\n\n - Extracts concise summaries to preserve critical context and key insights\n - Namespace: `/strategies/{memoryStrategyId}/actors/{actorId}/sessions/{sessionId}`\n\n2. **Semantic Memory Strategy** (`MemoryStrategy.usingBuiltInSemantic()`)\nDistills general facts, concepts, and underlying meanings from raw conversational data, presenting the information in a context-independent format.\nExtracted memory example: In-context learning = task-solving via examples, no training needed.\n\n - Extracts general factual knowledge, concepts and meanings from raw conversations\n - Namespace: `/strategies/{memoryStrategyId}/actors/{actorId}`\n\n3. **User Preference Strategy** (`MemoryStrategy.usingBuiltInUserPreference()`)\nCaptures individual preferences, interaction patterns, and personalized settings to enhance future experiences.\nExtracted memory example: User needs clear guidance on cloud storage account connection during onboarding.\n\n - Extracts user behavior patterns from raw conversations\n - Namespace: `/strategies/{memoryStrategyId}/actors/{actorId}`\n\n4. **Episodic Memory Strategy** (`MemoryStrategy.usingBuiltInEpisodic()`)\nCaptures meaningful slices of user and system interactions, preserve them into compact records after summarizing.\nExtracted memory example: User first asked about pricing on Monday, then requested feature comparison on Tuesday, finally made purchase decision on Wednesday.\n\n - Captures event sequences and temporal relationships\n - Namespace: `/strategy/{memoryStrategyId}/actor/{actorId}/session/{sessionId}`\n - Reflections: `/strategy/{memoryStrategyId}/actor/{actorId}`\n\n```typescript fixture=default\n// Create memory with built-in strategies\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my_memory\",\n description: \"Memory with built-in strategies\",\n expirationDuration: cdk.Duration.days(90),\n memoryStrategies: [\n agentcore.MemoryStrategy.usingBuiltInSummarization(),\n agentcore.MemoryStrategy.usingBuiltInSemantic(),\n agentcore.MemoryStrategy.usingBuiltInUserPreference(),\n agentcore.MemoryStrategy.usingBuiltInEpisodic(),\n ],\n});\n```\n\nThe name generated for each built in memory strategy is as follows:\n\n- For Summarization: `summary_builtin_cdk001`\n- For Semantic:`semantic_builtin_cdk001>`\n- For User Preferences: `preference_builtin_cdk001`\n- For Episodic : `episodic_builtin_cdkGen0001`\n\n### Memory with custom Strategies\n\nWith Long-Term Memory, organization is managed through Namespaces.\n\nAn `actor` refers to entity such as end users or agent/user combinations. For example, in a coding support chatbot,\nthe actor is usually the developer asking questions. Using the actor ID helps the system know which user the memory belongs to,\nkeeping each user's data separate and organized.\n\nA `session` is usually a single conversation or interaction period between the user and the AI agent.\nIt groups all related messages and events that happen during that conversation.\n\nA `namespace` is used to logically group and organize long-term memories. It ensures data stays neat, separate, and secure.\n\nWith AgentCore Memory, you need to add a namespace when you define a memory strategy. This namespace helps define where the long-term memory\nwill be logically grouped. Every time a new long-term memory is extracted using this memory strategy, it is saved under the namespace you set.\nThis means that all long-term memories are scoped to their specific namespace, keeping them organized and preventing any mix-ups with other\nusers or sessions. You should use a hierarchical format separated by forward slashes /. This helps keep memories organized clearly. As needed,\nyou can choose to use the below pre-defined variables within braces in the namespace based on your applications' organization needs:\n\n- `actorId` – Identifies who the long-term memory belongs to, such as a user\n- `memoryStrategyId` – Shows which memory strategy is being used. This strategy identifier is auto-generated when you create a memory using CreateMemory operation.\n- `sessionId` – Identifies which session or conversation the memory is from.\n\nFor example, if you define the following namespace as the input to your strategy in CreateMemory operation:\n\n```shell\n/strategy/{memoryStrategyId}/actor/{actorId}/session/{sessionId}\n```\n\nAfter memory creation, this namespace might look like:\n\n```shell\n/strategy/summarization-93483043//actor/actor-9830m2w3/session/session-9330sds8\n```\n\nYou can customise the namespace, i.e. where the memories are stored by using the following methods:\n\n1. **Summarization Strategy** (`MemoryStrategy.usingSummarization(props)`)\n1. **Semantic Memory Strategy** (`MemoryStrategy.usingSemantic(props)`)\n1. **User Preference Strategy** (`MemoryStrategy.usingUserPreference(props)`)\n1. **Episodic Memory Strategy** (`MemoryStrategy.usingEpisodic(props)`)\n\n```typescript fixture=default\n// Create memory with custom strategies\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my_memory\",\n description: \"Memory with custom strategies\",\n expirationDuration: cdk.Duration.days(90),\n memoryStrategies: [\n agentcore.MemoryStrategy.usingUserPreference({\n name: \"CustomerPreferences\",\n namespaces: [\"support/customer/{actorId}/preferences\"]\n }),\n agentcore.MemoryStrategy.usingSemantic({\n name: \"CustomerSupportSemantic\",\n namespaces: [\"support/customer/{actorId}/semantic\"]\n }),\n agentcore.MemoryStrategy.usingEpisodic({\n name: \"customerJourneyEpisodic\",\n namespaces: [\"/journey/customer/{actorId}/episodes\"],\n reflectionConfiguration: {\n namespaces: [\"/journey/customer/{actorId}/reflections\"]\n }\n }),\n ],\n});\n```\n\nCustom memory strategies let you tailor memory extraction and consolidation to your specific domain or use case.\nYou can override the prompts for extracting and consolidating semantic, summary, or user preferences.\nYou can also choose the model that you want to use for extraction and consolidation.\n\nThe custom prompts you create are appended to a non-editable system prompt.\n\nSince a custom strategy requires you to invoke certain FMs, you need a role with appropriate permissions. For that, you can:\n\n- Let the L2 construct create a minimum permission role for you when use L2 Bedrock Foundation Models.\n- Use a custom role with the overly permissive `AmazonBedrockAgentCoreMemoryBedrockModelInferenceExecutionRolePolicy` managed policy.\n- Use a custom role with your own custom policies.\n\n#### Memory with Custom Execution Role\n\nKeep in mind that memories that **do not** use custom strategies do not require a service role.\nSo even if you provide it, it will be ignored as it will never be used.\n\n```typescript fixture=default\n// Create a custom execution role\nconst executionRole = new iam.Role(this, \"MemoryExecutionRole\", {\n assumedBy: new iam.ServicePrincipal(\"bedrock-agentcore.amazonaws.com\"),\n managedPolicies: [\n iam.ManagedPolicy.fromAwsManagedPolicyName(\n \"AmazonBedrockAgentCoreMemoryBedrockModelInferenceExecutionRolePolicy\"\n ),\n ],\n});\n\n// Create memory with custom execution role\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my_memory\",\n description: \"Memory with custom execution role\",\n expirationDuration: cdk.Duration.days(90),\n executionRole: executionRole,\n});\n```\n\nIn customConsolidation and customExtraction, the model property uses the [@aws-cdk/aws-bedrock-alph](https://www.npmjs.com/package/@aws-cdk/aws-bedrock-alpha) library which must be installed separately.\n\n```typescript fixture=default\n// Create a custom semantic memory strategy\nconst customSemanticStrategy = agentcore.MemoryStrategy.usingSemantic({\n name: \"customSemanticStrategy\",\n description: \"Custom semantic memory strategy\",\n namespaces: [\"/custom/strategies/{memoryStrategyId}/actors/{actorId}\"],\n customConsolidation: {\n model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0,\n appendToPrompt: \"Custom consolidation prompt for semantic memory\",\n },\n customExtraction: {\n model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0,\n appendToPrompt: \"Custom extraction prompt for semantic memory\",\n },\n});\n\n// Create memory with custom strategy\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my-custom-memory\",\n description: \"Memory with custom strategy\",\n expirationDuration: cdk.Duration.days(90),\n memoryStrategies: [customSemanticStrategy],\n});\n```\n\n### Memory with self-managed Strategies\n\nA self-managed strategy in Amazon Bedrock AgentCore Memory gives you complete control over your memory extraction and consolidation pipelines.\nWith a self-managed strategy, you can build custom memory processing workflows while leveraging Amazon Bedrock AgentCore for storage and retrieval.\n\nFor additional information, you can refer to the [developer guide for self managed strategies](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/memory-self-managed-strategies.html).\n\nCreate the required AWS resources including:\n\n- an S3 bucket in your account where Amazon Bedrock AgentCore will deliver batched event payloads.\n- an SNS topic for job notifications. Use FIFO topics if processing order within sessions is important for your use case.\n\nThe construct will apply the correct permissions to the memory execution role to access these resources.\n\n```typescript fixture=default\n\nconst bucket = new s3.Bucket(this, 'memoryBucket', {\n bucketName: 'test-memory',\n removalPolicy: cdk.RemovalPolicy.DESTROY,\n autoDeleteObjects: true,\n});\n\nconst topic = new sns.Topic(this, 'topic');\n\n// Create a custom semantic memory strategy\nconst selfManagedStrategy = agentcore.MemoryStrategy.usingSelfManaged({\n name: \"selfManagedStrategy\",\n description: \"self managed memory strategy\",\n historicalContextWindowSize: 5,\n invocationConfiguration: {\n topic: topic,\n s3Location: {\n bucketName: bucket.bucketName,\n objectKey: 'memory/',\n }\n },\n triggerConditions: {\n messageBasedTrigger: 1,\n timeBasedTrigger: cdk.Duration.seconds(10),\n tokenBasedTrigger: 100\n }\n});\n\n// Create memory with custom strategy\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my-custom-memory\",\n description: \"Memory with custom strategy\",\n expirationDuration: cdk.Duration.days(90),\n memoryStrategies: [selfManagedStrategy],\n});\n```\n\n### Memory Strategy Methods\n\nYou can add new memory strategies to the memory construct using the `addMemoryStrategy()` method, for instance:\n\n```typescript fixture=default\n// Create memory without initial strategies\nconst memory = new agentcore.Memory(this, \"test-memory\", {\n memoryName: \"test_memory_add_strategy\",\n description: \"A test memory for testing addMemoryStrategy method\",\n expirationDuration: cdk.Duration.days(90),\n});\n\n// Add strategies after instantiation\nmemory.addMemoryStrategy(agentcore.MemoryStrategy.usingBuiltInSummarization());\nmemory.addMemoryStrategy(agentcore.MemoryStrategy.usingBuiltInSemantic());\n```\n"
|
|
8556
|
+
"markdown": "# Amazon Bedrock AgentCore Construct Library\n\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\n| **Language** | **Package** |\n| :--------------------------------------------------------------------------------------------- | --------------------------------------- |\n|  TypeScript | `@aws-cdk/aws-bedrock-agentcore-alpha` |\n\n[Amazon Bedrock AgentCore](https://aws.amazon.com/bedrock/agentcore/) enables you to deploy and operate highly capable AI agents securely, at scale. It offers infrastructure purpose-built for dynamic agent workloads, powerful tools to enhance agents, and essential controls for real-world deployment. AgentCore services can be used together or independently and work with any framework including CrewAI, LangGraph, LlamaIndex, and Strands Agents, as well as any foundation model in or outside of Amazon Bedrock, giving you ultimate flexibility. AgentCore eliminates the undifferentiated heavy lifting of building specialized agent infrastructure, so you can accelerate agents to production.\n\nThis construct library facilitates the deployment of Bedrock AgentCore primitives, enabling you to create sophisticated AI applications that can interact with your systems and data sources.\n\n> **Note:** Users need to ensure their CDK deployment role has the `iam:CreateServiceLinkedRole` permission for AgentCore service-linked roles.\n\n## Table of contents\n\n- [AgentCore Runtime](#agentcore-runtime)\n - [Runtime Versioning](#runtime-versioning)\n - [Runtime Endpoints](#runtime-endpoints)\n - [AgentCore Runtime Properties](#agentcore-runtime-properties)\n - [Runtime Endpoint Properties](#runtime-endpoint-properties)\n - [Creating a Runtime](#creating-a-runtime)\n - [Option 1: Use an existing image in ECR](#option-1-use-an-existing-image-in-ecr)\n - [Managing Endpoints and Versions](#managing-endpoints-and-versions)\n - [Option 2: Use a local asset](#option-2-use-a-local-asset)\n- [Browser Custom tool](#browser)\n - [Browser properties](#browser-properties)\n - [Browser Network modes](#browser-network-modes)\n - [Basic Browser Creation](#basic-browser-creation)\n - [Browser IAM permissions](#browser-iam-permissions)\n- [Code Interpreter Custom tool](#code-interpreter)\n - [Code Interpreter properties](#code-interpreter-properties)\n - [Code Interpreter Network Modes](#code-interpreter-network-modes)\n - [Basic Code Interpreter Creation](#basic-code-interpreter-creation)\n - [Code Interpreter IAM permissions](#code-interpreter-iam-permissions)\n- [Gateway](#gateway)\n - [Gateway Properties](#gateway-properties)\n - [Basic Gateway Creation](#basic-gateway-creation)\n - [Protocol configuration](#protocol-configuration)\n - [Inbound authorization](#inbound-authorization)\n - [Gateway with KMS Encryption](#gateway-with-kms-encryption)\n - [Gateway with Custom Execution Role](#gateway-with-custom-execution-role)\n - [Gateway IAM Permissions](#gateway-iam-permissions)\n- [Gateway Target](#gateway-target)\n - [Gateway Target Properties](#gateway-target-properties)\n - [Targets types](#targets-types)\n - [Outbound auth](#outbound-auth)\n - [Api schema](#api-schema-for-openapi-and-smithy-target)\n - [Basic Gateway Target Creation](#basic-gateway-target-creation)\n - [Using addTarget methods (Recommended)](#using-addtarget-methods-recommended)\n - [Using static factory methods](#using-static-factory-methods)\n - [Lambda Target with Tool Schema](#tools-schema-for-lambda-target)\n - [Smithy Model Target with OAuth](#api-schema-for-openapi-and-smithy-target)\n - [Gateway Target IAM Permissions](#gateway-target-iam-permissions)\n- [Memory](#memory)\n - [Memory properties](#memory-properties)\n - [Basic Memory Creation](#basic-memory-creation)\n - [LTM Memory Extraction Stategies](#ltm-memory-extraction-stategies)\n - [Memory Strategy Methods](#memory-strategy-methods)\n- [Amazon Bedrock AgentCore Construct Library](#amazon-bedrock-agentcore-construct-library)\n - [Table of contents](#table-of-contents)\n - [AgentCore Runtime](#agentcore-runtime)\n - [Runtime Endpoints](#runtime-endpoints)\n - [AgentCore Runtime Properties](#agentcore-runtime-properties)\n - [Runtime Endpoint Properties](#runtime-endpoint-properties)\n - [Creating a Runtime](#creating-a-runtime)\n - [Option 1: Use an existing image in ECR](#option-1-use-an-existing-image-in-ecr)\n - [Option 2: Use a local asset](#option-2-use-a-local-asset)\n - [Option 3: Use direct code deployment](#option-3-use-direct-code-deployment)\n - [Granting Permissions to Invoke Bedrock Models or Inference Profiles](#granting-permissions-to-invoke-bedrock-models-or-inference-profiles)\n - [Runtime Versioning](#runtime-versioning)\n - [Managing Endpoints and Versions](#managing-endpoints-and-versions)\n - [Step 1: Initial Deployment](#step-1-initial-deployment)\n - [Step 2: Creating Custom Endpoints](#step-2-creating-custom-endpoints)\n - [Step 3: Runtime Update Deployment](#step-3-runtime-update-deployment)\n - [Step 4: Testing with Staging Endpoints](#step-4-testing-with-staging-endpoints)\n - [Step 5: Promoting to Production](#step-5-promoting-to-production)\n - [Creating Standalone Runtime Endpoints](#creating-standalone-runtime-endpoints)\n - [Example: Creating an endpoint for an existing runtime](#example-creating-an-endpoint-for-an-existing-runtime)\n - [Runtime Authentication Configuration](#runtime-authentication-configuration)\n - [IAM Authentication (Default)](#iam-authentication-default)\n - [Cognito Authentication](#cognito-authentication)\n - [JWT Authentication](#jwt-authentication)\n - [OAuth Authentication](#oauth-authentication)\n - [Using a Custom IAM Role](#using-a-custom-iam-role)\n - [Runtime Network Configuration](#runtime-network-configuration)\n - [Public Network Mode (Default)](#public-network-mode-default)\n - [VPC Network Mode](#vpc-network-mode)\n - [Managing Security Groups with VPC Configuration](#managing-security-groups-with-vpc-configuration)\n - [Browser](#browser)\n - [Browser Network modes](#browser-network-modes)\n - [Browser Properties](#browser-properties)\n - [Basic Browser Creation](#basic-browser-creation)\n - [Browser with Tags](#browser-with-tags)\n - [Browser with VPC](#browser-with-vpc)\n - [Browser with Recording Configuration](#browser-with-recording-configuration)\n - [Browser with Custom Execution Role](#browser-with-custom-execution-role)\n - [Browser with S3 Recording and Permissions](#browser-with-s3-recording-and-permissions)\n - [Browser IAM Permissions](#browser-iam-permissions)\n - [Code Interpreter](#code-interpreter)\n - [Code Interpreter Network Modes](#code-interpreter-network-modes)\n - [Code Interpreter Properties](#code-interpreter-properties)\n - [Basic Code Interpreter Creation](#basic-code-interpreter-creation)\n - [Code Interpreter with VPC](#code-interpreter-with-vpc)\n - [Code Interpreter with Sandbox Network Mode](#code-interpreter-with-sandbox-network-mode)\n - [Code Interpreter with Custom Execution Role](#code-interpreter-with-custom-execution-role)\n - [Code Interpreter IAM Permissions](#code-interpreter-iam-permissions)\n - [Code interpreter with tags](#code-interpreter-with-tags)\n - [Memory](#memory)\n - [Memory Properties](#memory-properties)\n - [Basic Memory Creation](#basic-memory-creation)\n - [LTM Memory Extraction Stategies](#ltm-memory-extraction-stategies)\n - [Memory with Built-in Strategies](#memory-with-built-in-strategies)\n - [Memory with custom Strategies](#memory-with-custom-strategies)\n - [Memory with Custom Execution Role](#memory-with-custom-execution-role)\n - [Memory with self-managed Strategies](#memory-with-self-managed-strategies)\n - [Memory Strategy Methods](#memory-strategy-methods)\n\n## AgentCore Runtime\n\nThe AgentCore Runtime construct enables you to deploy containerized agents on Amazon Bedrock AgentCore.\nThis L2 construct simplifies runtime creation just pass your ECR repository name\nand the construct handles all the configuration with sensible defaults.\n\n### Runtime Endpoints\n\nEndpoints provide a stable way to invoke specific versions of your agent runtime, enabling controlled deployments across different environments.\nWhen you create an agent runtime, Amazon Bedrock AgentCore automatically creates a \"DEFAULT\" endpoint which always points to the latest version\nof runtime.\n\nYou can create additional endpoints in two ways:\n\n1. **Using Runtime.addEndpoint()** - Convenient method when creating endpoints alongside the runtime.\n2. **Using RuntimeEndpoint** - Flexible approach for existing runtimes.\n\nFor example, you might keep a \"production\" endpoint on a stable version while testing newer versions\nthrough a \"staging\" endpoint. This separation allows you to test changes thoroughly before promoting them\nto production by simply updating the endpoint to point to the newer version.\n\n### AgentCore Runtime Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `runtimeName` | `string` | No | The name of the agent runtime. Valid characters are a-z, A-Z, 0-9, _ (underscore). Must start with a letter and can be up to 48 characters long. If not provided, a unique name will be auto-generated |\n| `agentRuntimeArtifact` | `AgentRuntimeArtifact` | Yes | The artifact configuration for the agent runtime containing the container configuration with ECR URI |\n| `executionRole` | `iam.IRole` | No | The IAM role that provides permissions for the agent runtime. If not provided, a role will be created automatically |\n| `networkConfiguration` | `NetworkConfiguration` | No | Network configuration for the agent runtime. Defaults to `RuntimeNetworkConfiguration.usingPublicNetwork()` |\n| `description` | `string` | No | Optional description for the agent runtime |\n| `protocolConfiguration` | `ProtocolType` | No | Protocol configuration for the agent runtime. Defaults to `ProtocolType.HTTP` |\n| `authorizerConfiguration` | `RuntimeAuthorizerConfiguration` | No | Authorizer configuration for the agent runtime. Use `RuntimeAuthorizerConfiguration` static methods to create configurations for IAM, Cognito, JWT, or OAuth authentication |\n| `environmentVariables` | `{ [key: string]: string }` | No | Environment variables for the agent runtime. Maximum 50 environment variables |\n| `tags` | `{ [key: string]: string }` | No | Tags for the agent runtime. A list of key:value pairs of tags to apply to this Runtime resource |\n| `lifecycleConfiguration` | LifecycleConfiguration | No | The life cycle configuration for the AgentCore Runtime. Defaults to 900 seconds (15 minutes) for idle, 28800 seconds (8 hours) for max life time |\n| `requestHeaderConfiguration` | RequestHeaderConfiguration | No | Configuration for HTTP request headers that will be passed through to the runtime. Defaults to no configuration |\n\n### Runtime Endpoint Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `endpointName` | `string` | No | The name of the runtime endpoint. Valid characters are a-z, A-Z, 0-9, _ (underscore). Must start with a letter and can be up to 48 characters long. If not provided, a unique name will be auto-generated |\n| `agentRuntimeId` | `string` | Yes | The Agent Runtime ID for this endpoint |\n| `agentRuntimeVersion` | `string` | Yes | The Agent Runtime version for this endpoint. Must be between 1 and 5 characters long.|\n| `description` | `string` | No | Optional description for the runtime endpoint |\n| `tags` | `{ [key: string]: string }` | No | Tags for the runtime endpoint |\n\n### Creating a Runtime\n\n#### Option 1: Use an existing image in ECR\n\nReference an image available within ECR.\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\n// The runtime by default create ECR permission only for the repository available in the account the stack is being deployed\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// Create runtime using the built image\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact\n});\n```\n\n#### Option 2: Use a local asset\n\nReference a local directory containing a Dockerfile.\nImages are built from a local Docker context directory (with a Dockerfile), uploaded to Amazon Elastic Container Registry (ECR)\nby the CDK toolkit,and can be naturally referenced in your CDK app.\n\n```typescript fixture=default\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromAsset(\n path.join(__dirname, \"path to agent dockerfile directory\")\n);\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n});\n```\n\n#### Option 3: Use direct code deployment\n\nWith the container deployment method, developers create a Dockerfile, build ARM-compatible containers, manage ECR repositories, and upload containers for code changes. This works well where container DevOps pipelines have already been established to automate deployments.\n\nHowever, customers looking for fully managed deployments can benefit from direct code deployment, which can significantly improve developer time and productivity. Direct code deployment provides a secure and scalable path forward for rapid prototyping agent capabilities to deploying production workloads at scale.\n\nWith direct code deployment, developers create a zip archive of code and dependencies, upload to Amazon S3, and configure the bucket in the agent configuration. A ZIP archive containing Linux arm64 dependencies needs to be uploaded to S3 as a pre-requisite to Create Agent Runtime.\n\nFor more information, please refer to the [documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-get-started-code-deploy.html).\n\n```typescript fixture=default\n// S3 bucket containing the agent core\nconst codeBucket = new s3.Bucket(this, \"AgentCode\", {\n bucketName: \"my-code-bucket\",\n removalPolicy: RemovalPolicy.DESTROY, // For demo purposes\n});\n\n// the bucket above needs to contain the agent code\n\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromS3(\n {\n bucketName: codeBucket.bucketName,\n objectKey: 'deployment_package.zip',\n },\n agentcore.AgentCoreRuntime.PYTHON_3_12,\n ['opentelemetry-instrument', 'main.py']\n);\n\nconst runtimeInstance = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n});\n```\n\n#### Option 4: Use an ECR container image URI\n\nReference an ECR container image directly by its URI. This is useful when you have a pre-existing ECR image URI from CloudFormation parameters or cross-stack references. No IAM permissions are automatically granted - you must ensure the runtime has ECR pull permissions.\n\n```typescript fixture=default\n// Direct URI reference\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromImageUri(\n \"123456789012.dkr.ecr.us-east-1.amazonaws.com/my-agent:v1.0.0\"\n);\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n});\n```\n\nYou can also use CloudFormation parameters or references:\n\n```typescript fixture=default\n// Using a CloudFormation parameter\nconst imageUriParam = new cdk.CfnParameter(this, \"ImageUri\", {\n type: \"String\",\n description: \"Container image URI for the agent runtime\",\n});\n\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromImageUri(\n imageUriParam.valueAsString\n);\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n});\n```\n\n### Granting Permissions to Invoke Bedrock Models or Inference Profiles\n\nTo grant the runtime permissions to invoke Bedrock models or inference profiles:\n\n```typescript fixture=default\n// Note: This example uses @aws-cdk/aws-bedrock-alpha which must be installed separately\ndeclare const runtime: agentcore.Runtime;\n\n// Define the Bedrock Foundation Model\nconst model = bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_7_SONNET_V1_0;\n\n// Grant the runtime permissions to invoke the model\nmodel.grantInvoke(runtime);\n\n// Create a cross-region inference profile for Claude 3.7 Sonnet\nconst inferenceProfile = bedrock.CrossRegionInferenceProfile.fromConfig({\n geoRegion: bedrock.CrossRegionInferenceProfileRegion.US,\n model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_7_SONNET_V1_0\n});\n\n// Grant the runtime permissions to invoke the inference profile\ninferenceProfile.grantInvoke(runtime);\n```\n\n### Runtime Versioning\n\nAmazon Bedrock AgentCore automatically manages runtime versioning to ensure safe deployments and rollback capabilities.\nWhen you create an agent runtime, AgentCore automatically creates version 1 (V1). Each subsequent update to the\nruntime configuration (such as updating the container image, modifying network settings, or changing protocol configurations)\ncreates a new immutable version. These versions contain complete, self-contained configurations that can be referenced by endpoints,\nallowing you to maintain different versions for different environments or gradually roll out updates.\n\n#### Managing Endpoints and Versions\n\nAmazon Bedrock AgentCore automatically manages runtime versioning to provide safe deployments and rollback capabilities. You can follow\nthe steps below to understand how to use versioning with runtime for controlled deployments across different environments.\n\n##### Step 1: Initial Deployment\n\nWhen you first create an agent runtime, AgentCore automatically creates Version 1 of your runtime. At this point, a DEFAULT endpoint is\nautomatically created that points to Version 1. This DEFAULT endpoint serves as the main access point for your runtime.\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\"),\n});\n```\n\n##### Step 2: Creating Custom Endpoints\n\nAfter the initial deployment, you can create additional endpoints for different environments. For example, you might create a \"production\"\nendpoint that explicitly points to Version 1. This allows you to maintain stable access points for specific environments while keeping the\nflexibility to test newer versions elsewhere.\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\"),\n});\n\nconst prodEndpoint = runtime.addEndpoint(\"production\", {\n version: \"1\",\n description: \"Stable production endpoint - pinned to v1\"\n});\n```\n\n##### Step 3: Runtime Update Deployment\n\nWhen you update the runtime configuration (such as updating the container image, modifying network settings, or changing protocol\nconfigurations), AgentCore automatically creates a new version (Version 2). Upon this update:\n\n- Version 2 is created automatically with the new configuration\n- The DEFAULT endpoint automatically updates to point to Version 2\n- Any explicitly pinned endpoints (like the production endpoint) remain on their specified versions\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst agentRuntimeArtifactNew = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v2.0.0\");\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifactNew,\n});\n```\n\n##### Step 4: Testing with Staging Endpoints\n\nOnce Version 2 exists, you can create a staging endpoint that points to the new version. This staging endpoint allows you to test the\nnew version in a controlled environment before promoting it to production. This separation ensures that production traffic continues\nto use the stable version while you validate the new version.\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst agentRuntimeArtifactNew = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v2.0.0\");\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifactNew,\n});\n\nconst stagingEndpoint = runtime.addEndpoint(\"staging\", {\n version: \"2\",\n description: \"Staging environment for testing new version\"\n});\n```\n\n##### Step 5: Promoting to Production\n\nAfter thoroughly testing the new version through the staging endpoint, you can update the production endpoint to point to Version 2.\nThis controlled promotion process ensures that you can validate changes before they affect production traffic.\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst agentRuntimeArtifactNew = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v2.0.0\");\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifactNew,\n});\n\nconst prodEndpoint = runtime.addEndpoint(\"production\", {\n version: \"2\", // New version added here\n description: \"Stable production endpoint\"\n});\n```\n\n### Creating Standalone Runtime Endpoints\n\nRuntimeEndpoint can also be created as a standalone resource.\n\n#### Example: Creating an endpoint for an existing runtime\n\n```typescript fixture=default\n// Reference an existing runtime by its ID\nconst existingRuntimeId = \"abc123-runtime-id\"; // The ID of an existing runtime\n\n// Create a standalone endpoint\nconst endpoint = new agentcore.RuntimeEndpoint(this, \"MyEndpoint\", {\n endpointName: \"production\",\n agentRuntimeId: existingRuntimeId,\n agentRuntimeVersion: \"1\", // Specify which version to use\n description: \"Production endpoint for existing runtime\"\n});\n```\n\n### Runtime Authentication Configuration\n\nThe AgentCore Runtime supports multiple authentication modes to secure access to your agent endpoints. Authentication is configured during runtime creation using the `RuntimeAuthorizerConfiguration` class's static factory methods.\n\n#### IAM Authentication (Default)\n\nIAM authentication is the default mode, when no authorizerConfiguration is set then the underlying service use IAM.\n\n#### Cognito Authentication\n\nTo configure AWS Cognito User Pool authentication:\n\n```typescript fixture=default\ndeclare const userPool: cognito.UserPool;\ndeclare const userPoolClient: cognito.UserPoolClient;\ndeclare const anotherUserPoolClient: cognito.UserPoolClient;\n\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// Optional: Create custom claims for additional validation\nconst customClaims = [\n agentcore.RuntimeCustomClaim.withStringValue('department', 'engineering'),\n agentcore.RuntimeCustomClaim.withStringArrayValue('roles', ['admin'], agentcore.CustomClaimOperator.CONTAINS),\n agentcore.RuntimeCustomClaim.withStringArrayValue('permissions', ['read', 'write'], agentcore.CustomClaimOperator.CONTAINS_ANY),\n];\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingCognito(\n userPool, // User Pool (required)\n [userPoolClient, anotherUserPoolClient], // User Pool Clients\n [\"audience1\"], // Allowed Audiences (optional)\n [\"read\", \"write\"], // Allowed Scopes (optional)\n customClaims, // Custom claims (optional) - see Custom Claims Validation section\n ),\n});\n```\n\nYou can configure:\n\n- User Pool: The Cognito User Pool that issues JWT tokens\n- User Pool Clients: One or more Cognito User Pool App Clients that are allowed to access the runtime\n- Allowed audiences: Used to validate that the audiences specified in the Cognito token match or are a subset of the audiences specified in the AgentCore Runtime\n- Allowed scopes: Allow access only if the token contains at least one of the required scopes configured here\n- Custom claims: A set of rules to match specific claims in the incoming token against predefined values for validating JWT tokens\n\n#### JWT Authentication\n\nTo configure custom JWT authentication with your own OpenID Connect (OIDC) provider:\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingJWT(\n \"https://example.com/.well-known/openid-configuration\", // Discovery URL (required)\n [\"client1\", \"client2\"], // Allowed Client IDs (optional)\n [\"audience1\"], // Allowed Audiences (optional)\n [\"read\", \"write\"], // Allowed Scopes (optional)\n // Custom claims (optional) - see Custom Claims Validation section below\n ),\n});\n```\n\nYou can configure:\n\n- Discovery URL: Enter the Discovery URL from your identity provider (e.g. Okta, Cognito, etc.), typically found in that provider's documentation. This allows your Agent or Tool to fetch login, downstream resource token, and verification settings.\n- Allowed audiences: This is used to validate that the audiences specified for the OAuth token matches or are a subset of the audiences specified in the AgentCore Runtime.\n- Allowed clients: This is used to validate that the public identifier of the client, as specified in the authorization token, is allowed to access the AgentCore Runtime.\n- Allowed scopes: Allow access only if the token contains at least one of the required scopes configured here.\n- Custom claims: A set of rules to match specific claims in the incoming token against predefined values for validating JWT tokens.\n\n**Note**: The discovery URL must end with `/.well-known/openid-configuration`.\n\n##### Custom Claims Validation\n\nCustom claims allow you to validate additional fields in JWT tokens beyond the standard audience, client, and scope validations. You can create custom claims using the `RuntimeCustomClaim` class:\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// String claim - validates that the claim exactly equals the specified value\n// Uses EQUALS operator automatically\nconst departmentClaim = agentcore.RuntimeCustomClaim.withStringValue('department', 'engineering');\n\n// String array claim with CONTAINS operator (default)\n// Validates that the claim array contains a specific string value\n// IMPORTANT: CONTAINS requires exactly one value in the array parameter\nconst rolesClaim = agentcore.RuntimeCustomClaim.withStringArrayValue('roles', ['admin']);\n\n// String array claim with CONTAINS_ANY operator\n// Validates that the claim array contains at least one of the specified values\n// Use this when you want to check for multiple possible values\nconst permissionsClaim = agentcore.RuntimeCustomClaim.withStringArrayValue(\n 'permissions',\n ['read', 'write'],\n agentcore.CustomClaimOperator.CONTAINS_ANY\n);\n\n// Use custom claims in authorizer configuration\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingJWT(\n \"https://example.com/.well-known/openid-configuration\",\n [\"client1\", \"client2\"],\n [\"audience1\"],\n [\"read\", \"write\"],\n [departmentClaim, rolesClaim, permissionsClaim] // Custom claims\n ),\n});\n```\n\n**Custom Claim Rules**:\n\n- **String claims**: Must use the `EQUALS` operator (automatically set). The claim value must exactly match the specified string.\n- **String array claims**: Can use `CONTAINS` (default) or `CONTAINS_ANY` operators:\n - **`CONTAINS`**: Checks if the claim array contains a specific string value. **Requires exactly one value** in the array parameter. For example, `['admin']` will check if the token's claim array contains the string `'admin'`.\n - **`CONTAINS_ANY`**: Checks if the claim array contains at least one of the provided string values. Use this when you want to validate against multiple possible values. For example, `['read', 'write']` will check if the token's claim array contains either `'read'` or `'write'`.\n\n**Example Use Cases**:\n\n- Use `CONTAINS` when you need to verify a user has a specific role: `RuntimeCustomClaim.withStringArrayValue('roles', ['admin'])`\n- Use `CONTAINS_ANY` when you need to verify a user has any of several permissions: `RuntimeCustomClaim.withStringArrayValue('permissions', ['read', 'write'], CustomClaimOperator.CONTAINS_ANY)`\n\n#### OAuth Authentication\n\nTo configure OAuth 2.0 authentication:\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingOAuth(\n \"https://github.com/.well-known/openid-configuration\", // Discovery URL (required)\n \"oauth_client_123\", // OAuth Client ID (required)\n [\"audience1\"], // Allowed Audiences (optional)\n [\"openid\", \"profile\"], // Allowed Scopes (optional)\n // Custom claims (optional) - see Custom Claims Validation section\n ),\n});\n```\n\n#### Using a Custom IAM Role\n\nInstead of using the auto-created execution role, you can provide your own IAM role with specific permissions:\nThe auto-created role includes all necessary baseline permissions for ECR access, CloudWatch logging, and X-Ray tracing. When providing a custom role, ensure these permissions are included.\n\n### Runtime Network Configuration\n\nThe AgentCore Runtime supports two network modes for deployment:\n\n#### Public Network Mode (Default)\n\nBy default, runtimes are deployed in PUBLIC network mode, which provides internet access suitable for less sensitive or open-use scenarios:\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// Explicitly using public network (this is the default)\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n networkConfiguration: agentcore.RuntimeNetworkConfiguration.usingPublicNetwork(),\n});\n```\n\n#### VPC Network Mode\n\nFor enhanced security and network isolation, you can deploy your runtime within a VPC:\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// Create or use an existing VPC\nconst vpc = new ec2.Vpc(this, 'MyVpc', {\n maxAzs: 2,\n});\n\n// Configure runtime with VPC\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n networkConfiguration: agentcore.RuntimeNetworkConfiguration.usingVpc(this, {\n vpc: vpc,\n vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },\n // Optionally specify security groups, or one will be created automatically\n // securityGroups: [mySecurityGroup],\n }),\n});\n\n```\n\n#### Managing Security Groups with VPC Configuration\n\nWhen using VPC mode, the Runtime implements `ec2.IConnectable`, allowing you to manage network access using the `connections` property:\n\n```typescript fixture=default\nconst vpc = new ec2.Vpc(this, 'MyVpc', {\n maxAzs: 2,\n});\n\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// Create runtime with VPC configuration\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n networkConfiguration: agentcore.RuntimeNetworkConfiguration.usingVpc(this, {\n vpc: vpc,\n vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },\n }),\n});\n\n// Now you can manage network access using the connections property\n// Allow inbound HTTPS traffic from a specific security group\nconst webServerSecurityGroup = new ec2.SecurityGroup(this, 'WebServerSG', { vpc });\nruntime.connections.allowFrom(webServerSecurityGroup, ec2.Port.tcp(443), 'Allow HTTPS from web servers');\n\n// Allow outbound connections to a database\nconst databaseSecurityGroup = new ec2.SecurityGroup(this, 'DatabaseSG', { vpc });\nruntime.connections.allowTo(databaseSecurityGroup, ec2.Port.tcp(5432), 'Allow PostgreSQL connection');\n\n// Allow outbound HTTPS to anywhere (for external API calls)\nruntime.connections.allowToAnyIpv4(ec2.Port.tcp(443), 'Allow HTTPS outbound');\n```\n\n### Runtime IAM Permissions\n\nThe Runtime construct provides convenient methods for granting IAM permissions to principals that need to invoke the runtime or manage its execution role.\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// Create a runtime\nconst runtime = new agentcore.Runtime(this, \"MyRuntime\", {\n runtimeName: \"my_runtime\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n});\n\n// Create a Lambda function that needs to invoke the runtime\nconst invokerFunction = new lambda.Function(this, \"InvokerFunction\", {\n runtime: lambda.Runtime.PYTHON_3_12,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\nimport boto3\ndef handler(event, context):\n client = boto3.client('bedrock-agentcore')\n # Invoke the runtime...\n `),\n});\n\n// Grant permission to invoke the runtime directly\nruntime.grantInvokeRuntime(invokerFunction);\n\n// Grant permission to invoke the runtime on behalf of a user\n// (requires X-Amzn-Bedrock-AgentCore-Runtime-User-Id header)\nruntime.grantInvokeRuntimeForUser(invokerFunction);\n\n// Grant both invoke permissions (most common use case)\nruntime.grantInvoke(invokerFunction);\n\n// Grant specific custom permissions to the runtime's execution role\nruntime.grant(['bedrock:InvokeModel'], ['arn:aws:bedrock:*:*:*']);\n\n// Add a policy statement to the runtime's execution role\nruntime.addToRolePolicy(new iam.PolicyStatement({\n actions: ['s3:GetObject'],\n resources: ['arn:aws:s3:::my-bucket/*'],\n}));\n```\n\n### Other configuration\n\n#### Lifecycle configuration\n\nThe LifecycleConfiguration input parameter to CreateAgentRuntime lets you manage the lifecycle of runtime sessions and resources in Amazon Bedrock AgentCore Runtime. This configuration helps optimize resource utilization by automatically cleaning up idle sessions and preventing long-running instances from consuming resources indefinitely.\n\nYou can configure:\n\n- idleRuntimeSessionTimeout: Timeout in seconds for idle runtime sessions. When a session remains idle for this duration, it will trigger termination. Termination can last up to 15 seconds due to logging and other process completion. Default: 900 seconds (15 minutes)\n- maxLifetime: Maximum lifetime for the instance in seconds. Once reached, instances will initialize termination. Termination can last up to 15 seconds due to logging and other process completion. Default: 28800 seconds (8 hours)\n\nFor additional information, please refer to the [documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-lifecycle-settings.html).\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\nnew agentcore.Runtime(this, 'test-runtime', {\n runtimeName: 'test_runtime',\n agentRuntimeArtifact: agentRuntimeArtifact,\n lifecycleConfiguration: {\n idleRuntimeSessionTimeout: Duration.minutes(10),\n maxLifetime: Duration.hours(4),\n },\n});\n```\n\n#### Request header configuration\n\nCustom headers let you pass contextual information from your application directly to your agent code without cluttering the main request payload. This includes authentication tokens like JWT (JSON Web Tokens, which contain user identity and authorization claims) through the Authorization header, allowing your agent to make decisions based on who is calling it. You can also pass custom metadata like user preferences, session identifiers, or trace context using headers prefixed with X-Amzn-Bedrock-AgentCore-Runtime-Custom-, giving your agent access to up to 20 pieces of runtime context that travel alongside each request. This information can be also used in downstream systems like AgentCore Memory that you can namespace based on those characteristics like user_id or aud in claims like line of business.\n\nFor additional information, please refer to the [documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-header-allowlist.html).\n\n```typescript fixture=default\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\n\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\nnew agentcore.Runtime(this, 'test-runtime', {\n runtimeName: 'test_runtime',\n agentRuntimeArtifact: agentRuntimeArtifact,\n requestHeaderConfiguration: {\n allowlistedHeaders: ['X-Amzn-Bedrock-AgentCore-Runtime-Custom-H1'],\n },\n});\n```\n\n## Browser\n\nThe Amazon Bedrock AgentCore Browser provides a secure, cloud-based browser that enables AI agents to interact with websites. It includes security features such as session isolation, built-in observability through live viewing, CloudTrail logging, and session replay capabilities.\n\nAdditional information about the browser tool can be found in the [official documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/browser-tool.html)\n\n### Browser Network modes\n\nThe Browser construct supports the following network modes:\n\n1. **Public Network Mode** (`BrowserNetworkMode.usingPublicNetwork()`) - Default\n\n - Allows internet access for web browsing and external API calls\n - Suitable for scenarios where agents need to interact with publicly available websites\n - Enables full web browsing capabilities\n - VPC mode is not supported with this option\n\n2. **VPC (Virtual Private Cloud)** (`BrowserNetworkMode.usingVpc()`)\n\n - Select whether to run the browser in a virtual private cloud (VPC).\n - By configuring VPC connectivity, you enable secure access to private resources such as databases, internal APIs, and services within your VPC.\n\n While the VPC itself is mandatory, these are optional:\n - Subnets - if not provided, CDK will select appropriate subnets from the VPC\n - Security Groups - if not provided, CDK will create a default security group\n - Specific subnet selection criteria - you can let CDK choose automatically\n\nFor more information on VPC connectivity for Amazon Bedrock AgentCore Browser, please refer to the [official documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-vpc.html).\n\n### Browser Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `browserCustomName` | `string` | No | The name of the browser. Must start with a letter and can be up to 48 characters long. Pattern: `[a-zA-Z][a-zA-Z0-9_]{0,47}`. If not provided, a unique name will be auto-generated |\n| `description` | `string` | No | Optional description for the browser. Can have up to 200 characters |\n| `networkConfiguration` | `BrowserNetworkConfiguration` | No | Network configuration for browser. Defaults to PUBLIC network mode |\n| `recordingConfig` | `RecordingConfig` | No | Recording configuration for browser. Defaults to no recording |\n| `executionRole` | `iam.IRole` | No | The IAM role that provides permissions for the browser to access AWS services. A new role will be created if not provided |\n| `tags` | `{ [key: string]: string }` | No | Tags to apply to the browser resource |\n| `browserSigning` | BrowserSigning | No | Browser signing configuration. Defaults to DISABLED |\n\n### Basic Browser Creation\n\n```typescript fixture=default\n// Create a basic browser with public network access\nconst browser = new agentcore.BrowserCustom(this, \"MyBrowser\", {\n browserCustomName: \"my_browser\",\n description: \"A browser for web automation\",\n});\n```\n\n### Browser with Tags\n\n```typescript fixture=default\n// Create a browser with custom tags\nconst browser = new agentcore.BrowserCustom(this, \"MyBrowser\", {\n browserCustomName: \"my_browser\",\n description: \"A browser for web automation with tags\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingPublicNetwork(),\n tags: {\n Environment: \"Production\",\n Team: \"AI/ML\",\n Project: \"AgentCore\",\n },\n});\n```\n\n### Browser with VPC\n\n```typescript fixture=default\nconst browser = new agentcore.BrowserCustom(this, 'BrowserVpcWithRecording', {\n browserCustomName: 'browser_recording',\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingVpc(this, {\n vpc: new ec2.Vpc(this, 'VPC', { restrictDefaultSecurityGroup: false }),\n }),\n});\n```\n\nBrowser exposes a [connections](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Connections.html) property. This property returns a connections object, which simplifies the process of defining and managing ingress and egress rules for security groups in your AWS CDK applications. Instead of directly manipulating security group rules, you interact with the Connections object of a construct, which then translates your connectivity requirements into the appropriate security group rules. For instance:\n\n```typescript fixture=default\nconst vpc = new ec2.Vpc(this, 'testVPC');\n\nconst browser = new agentcore.BrowserCustom(this, 'test-browser', {\n browserCustomName: 'test_browser',\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingVpc(this, {\n vpc: vpc,\n }),\n});\n\nbrowser.connections.addSecurityGroup(new ec2.SecurityGroup(this, 'AdditionalGroup', { vpc }));\n```\n\nSo security groups can be added after the browser construct creation. You can use methods like allowFrom() and allowTo() to grant ingress access to/egress access from a specified peer over a given portRange. The Connections object automatically adds the necessary ingress or egress rules to the security group(s) associated with the calling construct.\n\n### Browser with Recording Configuration\n\n```typescript fixture=default\n// Create an S3 bucket for recordings\nconst recordingBucket = new s3.Bucket(this, \"RecordingBucket\", {\n bucketName: \"my-browser-recordings\",\n removalPolicy: RemovalPolicy.DESTROY, // For demo purposes\n});\n\n// Create browser with recording enabled\nconst browser = new agentcore.BrowserCustom(this, \"MyBrowser\", {\n browserCustomName: \"my_browser\",\n description: \"Browser with recording enabled\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingPublicNetwork(),\n recordingConfig: {\n enabled: true,\n s3Location: {\n bucketName: recordingBucket.bucketName,\n objectKey: \"browser-recordings/\",\n },\n },\n});\n```\n\n### Browser with Custom Execution Role\n\n```typescript fixture=default\n// Create a custom execution role\nconst executionRole = new iam.Role(this, \"BrowserExecutionRole\", {\n assumedBy: new iam.ServicePrincipal(\"bedrock-agentcore.amazonaws.com\"),\n managedPolicies: [\n iam.ManagedPolicy.fromAwsManagedPolicyName(\"AmazonBedrockAgentCoreBrowserExecutionRolePolicy\"),\n ],\n});\n\n// Create browser with custom execution role\nconst browser = new agentcore.BrowserCustom(this, \"MyBrowser\", {\n browserCustomName: \"my_browser\",\n description: \"Browser with custom execution role\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingPublicNetwork(),\n executionRole: executionRole,\n});\n```\n\n### Browser with S3 Recording and Permissions\n\n```typescript fixture=default\n// Create an S3 bucket for recordings\nconst recordingBucket = new s3.Bucket(this, \"RecordingBucket\", {\n bucketName: \"my-browser-recordings\",\n removalPolicy: RemovalPolicy.DESTROY, // For demo purposes\n});\n\n// Create browser with recording enabled\nconst browser = new agentcore.BrowserCustom(this, \"MyBrowser\", {\n browserCustomName: \"my_browser\",\n description: \"Browser with recording enabled\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingPublicNetwork(),\n recordingConfig: {\n enabled: true,\n s3Location: {\n bucketName: recordingBucket.bucketName,\n objectKey: \"browser-recordings/\",\n },\n },\n});\n\n// The browser construct automatically grants S3 permissions to the execution role\n// when recording is enabled, so no additional IAM configuration is needed\n```\n\n### Browser with Browser signing\n\nAI agents need to browse the web on your behalf. When your agent visits a website to gather information, complete a form, or verify data, it encounters the same defenses designed to stop unwanted bots: CAPTCHAs, rate limits, and outright blocks.\n\nAmazon Bedrock AgentCore Browser supports Web Bot Auth. Web Bot Auth is a draft IETF protocol that gives agents verifiable cryptographic identities. When you enable Web Bot Auth in AgentCore Browser, the service issues cryptographic credentials that websites can verify. The agent presents these credentials with every request. The WAF may now additionally check the signature, confirm it matches a trusted directory, and allow the request through if verified bots are allowed by the domain owner and other WAF checks are clear.\n\nTo enable the browser to sign requests using the Web Bot Auth protocol, create a browser tool with the browserSigning configuration:\n\n```typescript fixture=default\nconst browser = new agentcore.BrowserCustom(this, 'test-browser', {\n browserCustomName: 'test_browser',\n browserSigning: agentcore.BrowserSigning.ENABLED\n});\n```\n\n### Browser IAM Permissions\n\nThe Browser construct provides convenient methods for granting IAM permissions:\n\n```typescript fixture=default\n// Create a browser\nconst browser = new agentcore.BrowserCustom(this, \"MyBrowser\", {\n browserCustomName: \"my_browser\",\n description: \"Browser for web automation\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingPublicNetwork(),\n});\n\n// Create a role that needs access to the browser\nconst userRole = new iam.Role(this, \"UserRole\", {\n assumedBy: new iam.ServicePrincipal(\"lambda.amazonaws.com\"),\n});\n\n// Grant read permissions (Get and List actions)\nbrowser.grantRead(userRole);\n\n// Grant use permissions (Start, Update, Stop actions)\nbrowser.grantUse(userRole);\n\n// Grant specific custom permissions\nbrowser.grant(userRole, \"bedrock-agentcore:GetBrowserSession\");\n```\n\n## Code Interpreter\n\nThe Amazon Bedrock AgentCore Code Interpreter enables AI agents to write and execute code securely in sandbox environments, enhancing their accuracy and expanding their ability to solve complex end-to-end tasks. This is critical in Agentic AI applications where the agents may execute arbitrary code that can lead to data compromise or security risks. The AgentCore Code Interpreter tool provides secure code execution, which helps you avoid running into these issues.\n\nFor more information about code interpreter, please refer to the [official documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/code-interpreter-tool.html)\n\n### Code Interpreter Network Modes\n\nThe Code Interpreter construct supports the following network modes:\n\n1. **Public Network Mode** (`CodeInterpreterNetworkMode.usingPublicNetwork()`) - Default\n\n - Allows internet access for package installation and external API calls\n - Suitable for development and testing environments\n - Enables downloading Python packages from PyPI\n\n2. **Sandbox Network Mode** (`CodeInterpreterNetworkMode.usingSandboxNetwork()`)\n - Isolated network environment with no internet access\n - Suitable for production environments with strict security requirements\n - Only allows access to pre-installed packages and local resources\n\n3. **VPC (Virtual Private Cloud)** (`CodeInterpreterNetworkMode.usingVpc()`)\n - Select whether to run the browser in a virtual private cloud (VPC).\n - By configuring VPC connectivity, you enable secure access to private resources such as databases, internal APIs, and services within your VPC.\n\n While the VPC itself is mandatory, these are optional:\n - Subnets - if not provided, CDK will select appropriate subnets from the VPC\n - Security Groups - if not provided, CDK will create a default security group\n - Specific subnet selection criteria - you can let CDK choose automatically\n\nFor more information on VPC connectivity for Amazon Bedrock AgentCore Browser, please refer to the [official documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-vpc.html).\n\n### Code Interpreter Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `codeInterpreterCustomName` | `string` | No | The name of the code interpreter. Must start with a letter and can be up to 48 characters long. Pattern: `[a-zA-Z][a-zA-Z0-9_]{0,47}`. If not provided, a unique name will be auto-generated |\n| `description` | `string` | No | Optional description for the code interpreter. Can have up to 200 characters |\n| `executionRole` | `iam.IRole` | No | The IAM role that provides permissions for the code interpreter to access AWS services. A new role will be created if not provided |\n| `networkConfiguration` | `CodeInterpreterNetworkConfiguration` | No | Network configuration for code interpreter. Defaults to PUBLIC network mode |\n| `tags` | `{ [key: string]: string }` | No | Tags to apply to the code interpreter resource |\n\n### Basic Code Interpreter Creation\n\n```typescript fixture=default\n// Create a basic code interpreter with public network access\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_code_interpreter\",\n description: \"A code interpreter for Python execution\",\n});\n```\n\n### Code Interpreter with VPC\n\n```typescript fixture=default\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_sandbox_interpreter\",\n description: \"Code interpreter with isolated network access\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingVpc(this, {\n vpc: new ec2.Vpc(this, 'VPC', { restrictDefaultSecurityGroup: false }),\n }),\n});\n```\n\nCode Interpreter exposes a [connections](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Connections.html) property. This property returns a connections object, which simplifies the process of defining and managing ingress and egress rules for security groups in your AWS CDK applications. Instead of directly manipulating security group rules, you interact with the Connections object of a construct, which then translates your connectivity requirements into the appropriate security group rules. For instance:\n\n```typescript fixture=default\nconst vpc = new ec2.Vpc(this, 'testVPC');\n\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_sandbox_interpreter\",\n description: \"Code interpreter with isolated network access\",\n networkConfiguration: agentcore.BrowserNetworkConfiguration.usingVpc(this, {\n vpc: vpc,\n }),\n});\n\ncodeInterpreter.connections.addSecurityGroup(new ec2.SecurityGroup(this, 'AdditionalGroup', { vpc }));\n```\n\nSo security groups can be added after the browser construct creation. You can use methods like allowFrom() and allowTo() to grant ingress access to/egress access from a specified peer over a given portRange. The Connections object automatically adds the necessary ingress or egress rules to the security group(s) associated with the calling construct.\n\n### Code Interpreter with Sandbox Network Mode\n\n```typescript fixture=default\n// Create code interpreter with sandbox network mode (isolated)\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_sandbox_interpreter\",\n description: \"Code interpreter with isolated network access\",\n networkConfiguration: agentcore.CodeInterpreterNetworkConfiguration.usingSandboxNetwork(),\n});\n```\n\n### Code Interpreter with Custom Execution Role\n\n```typescript fixture=default\n// Create a custom execution role\nconst executionRole = new iam.Role(this, \"CodeInterpreterExecutionRole\", {\n assumedBy: new iam.ServicePrincipal(\"bedrock-agentcore.amazonaws.com\"),\n});\n\n// Create code interpreter with custom execution role\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_code_interpreter\",\n description: \"Code interpreter with custom execution role\",\n networkConfiguration: agentcore.CodeInterpreterNetworkConfiguration.usingPublicNetwork(),\n executionRole: executionRole,\n});\n```\n\n### Code Interpreter IAM Permissions\n\nThe Code Interpreter construct provides convenient methods for granting IAM permissions:\n\n```typescript fixture=default\n// Create a code interpreter\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_code_interpreter\",\n description: \"Code interpreter for Python execution\",\n networkConfiguration: agentcore.CodeInterpreterNetworkConfiguration.usingPublicNetwork(),\n});\n\n// Create a role that needs access to the code interpreter\nconst userRole = new iam.Role(this, \"UserRole\", {\n assumedBy: new iam.ServicePrincipal(\"lambda.amazonaws.com\"),\n});\n\n// Grant read permissions (Get and List actions)\ncodeInterpreter.grantRead(userRole);\n\n// Grant use permissions (Start, Invoke, Stop actions)\ncodeInterpreter.grantUse(userRole);\n\n// Grant specific custom permissions\ncodeInterpreter.grant(userRole, \"bedrock-agentcore:GetCodeInterpreterSession\");\n```\n\n### Code interpreter with tags\n\n```typescript fixture=default\n// Create code interpreter with sandbox network mode (isolated)\nconst codeInterpreter = new agentcore.CodeInterpreterCustom(this, \"MyCodeInterpreter\", {\n codeInterpreterCustomName: \"my_sandbox_interpreter\",\n description: \"Code interpreter with isolated network access\",\n networkConfiguration: agentcore.CodeInterpreterNetworkConfiguration.usingPublicNetwork(),\n tags: {\n Environment: \"Production\",\n Team: \"AI/ML\",\n Project: \"AgentCore\",\n },\n});\n```\n\n## Gateway\n\nThe Gateway construct provides a way to create Amazon Bedrock Agent Core Gateways, which serve as integration points between agents and external services.\n\n### Gateway Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `gatewayName` | `string` | No | The name of the gateway. Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen). Maximum 100 characters. If not provided, a unique name will be auto-generated |\n| `description` | `string` | No | Optional description for the gateway. Maximum 200 characters |\n| `protocolConfiguration` | `IGatewayProtocolConfig` | No | The protocol configuration for the gateway. Defaults to MCP protocol |\n| `authorizerConfiguration` | `IGatewayAuthorizerConfig` | No | The authorizer configuration for the gateway. Defaults to Cognito |\n| `exceptionLevel` | `GatewayExceptionLevel` | No | The verbosity of exception messages. Use DEBUG mode to see granular exception messages |\n| `kmsKey` | `kms.IKey` | No | The AWS KMS key used to encrypt data associated with the gateway |\n| `role` | `iam.IRole` | No | The IAM role that provides permissions for the gateway to access AWS services. A new role will be created if not provided |\n| `tags` | `{ [key: string]: string }` | No | Tags for the gateway. A list of key:value pairs of tags to apply to this Gateway resource |\n\n### Basic Gateway Creation\n\nThe protocol configuration defaults to MCP and the inbound auth configuration uses Cognito (it is automatically created on your behalf).\n\n```typescript fixture=default\n// Create a basic gateway with default MCP protocol and Cognito authorizer\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n```\n\n### Protocol configuration\n\nCurrently MCP is the only protocol available. To configure it, use the `protocol` property with `McpProtocolConfiguration`:\n\n- Instructions: Guidance for how to use the gateway with your tools\n- Semantic search: Smart tool discovery that finds the right tools without typical limits. It improves accuracy by finding relevant tools based on context\n- Supported versions: Which MCP protocol versions the gateway can use\n\n```typescript fixture=default\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n});\n```\n\n### Inbound authorization\n\nBefore you create your gateway, you must set up inbound authorization. Inbound authorization validates users who attempt to access targets through\nyour AgentCore gateway. By default, if not provided, the construct will create and configure Cognito as the default identity provider\n(inbound Auth setup). AgentCore supports the following types of inbound authorization:\n\n**JSON Web Token (JWT)** – A secure and compact token used for authorization. After creating the JWT, you specify it as the authorization\nconfiguration when you create the gateway. You can create a JWT with any of the identity providers at Provider setup and configuration.\n\nYou can configure a custom authorization provider using the `authorizerConfiguration` property with `GatewayAuthorizer.usingCustomJwt()`.\nYou need to specify an OAuth discovery server and client IDs/audiences when you create the gateway. You can specify the following:\n\n- Discovery Url — String that must match the pattern ^.+/\\.well-known/openid-configuration$ for OpenID Connect discovery URLs\n- At least one of the below options depending on the chosen identity provider.\n- Allowed audiences — List of allowed audiences for JWT tokens\n- Allowed clients — List of allowed client identifiers\n- Allowed scopes — List of allowed scopes for JWT tokens\n- Custom claims — Optional custom claim validations (see Custom Claims Validation section below)\n\n```typescript fixture=default\n\n// Optional: Create custom claims (CustomClaimOperator and GatewayCustomClaim from agentcore)\nconst customClaims = [\n agentcore.GatewayCustomClaim.withStringValue('department', 'engineering'),\n agentcore.GatewayCustomClaim.withStringArrayValue('roles', ['admin'], agentcore.CustomClaimOperator.CONTAINS),\n agentcore.GatewayCustomClaim.withStringArrayValue('permissions', ['read', 'write'], agentcore.CustomClaimOperator.CONTAINS_ANY),\n];\n\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n allowedScopes: [\"read\", \"write\"],\n customClaims: customClaims, // Optional custom claims\n }),\n});\n```\n\n**IAM** – Authorizes through the credentials of the AWS IAM identity trying to access the gateway.\n\n```typescript fixture=default\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingAwsIam(),\n});\n\n// Grant access to a Lambda function's role\nconst lambdaRole = new iam.Role(this, \"LambdaRole\", {\n assumedBy: new iam.ServicePrincipal(\"lambda.amazonaws.com\"),\n});\n\n// The Lambda needs permission to invoke the gateway\ngateway.grantInvoke(lambdaRole);\n```\n\n**Cognito with M2M (Machine-to-Machine) Authentication (Default)** – When no authorizer is specified, the construct automatically creates a Cognito User Pool configured for OAuth 2.0 client credentials flow. This enables machine-to-machine authentication suitable for AI agents and service-to-service communication.\n\nFor more information, see [Setting up Amazon Cognito for Gateway inbound authorization](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/identity-idp-cognito.html).\n\n```typescript fixture=default\n// Create a gateway with default Cognito M2M authorizer\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\n// Access the Cognito resources for authentication setup\nconst userPool = gateway.userPool;\nconst userPoolClient = gateway.userPoolClient;\n\n// Get the token endpoint URL and OAuth scopes for client credentials flow\nconst tokenEndpointUrl = gateway.tokenEndpointUrl;\nconst oauthScopes = gateway.oauthScopes;\n// oauthScopes are in the format: ['{resourceServerId}/read', '{resourceServerId}/write']\n```\n\n**Using Cognito User Pool Explicitly with Custom Claims** – You can also use an existing Cognito User Pool with custom claims:\n\n```typescript fixture=default\ndeclare const userPool: cognito.UserPool;\ndeclare const userPoolClient: cognito.UserPoolClient;\n\n// Optional: Create custom claims (CustomClaimOperator and GatewayCustomClaim from agentcore)\nconst customClaims = [\n agentcore.GatewayCustomClaim.withStringValue('department', 'engineering'),\n agentcore.GatewayCustomClaim.withStringArrayValue('roles', ['admin'], agentcore.CustomClaimOperator.CONTAINS),\n agentcore.GatewayCustomClaim.withStringArrayValue('permissions', ['read', 'write'], agentcore.CustomClaimOperator.CONTAINS_ANY),\n];\n\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCognito({\n userPool: userPool,\n allowedClients: [userPoolClient],\n allowedAudiences: [\"audience1\"],\n allowedScopes: [\"read\", \"write\"],\n customClaims: customClaims, // Optional custom claims\n }),\n});\n```\n\nTo authenticate with the gateway, request an access token using the client credentials flow and use it to call Gateway endpoints. For more information about the token endpoint, see [The token issuer endpoint](https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html).\n\nThe following is an example of a token request using curl:\n\n```bash\ncurl -X POST \"${TOKEN_ENDPOINT_URL}\" \\\n -H \"Content-Type: application/x-www-form-urlencoded\" \\\n -d \"grant_type=client_credentials\" \\\n -d \"client_id=${USER_POOL_CLIENT_ID}\" \\\n -d \"client_secret=${CLIENT_SECRET}\" \\\n -d \"scope=${OAUTH_SCOPES}\"\n```\n\n### Gateway with KMS Encryption\n\nYou can provide a KMS key, and configure the authorizer as well as the protocol configuration.\n\n```typescript fixture=default\n// Create a KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"GatewayEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for gateway encryption\",\n});\n\n// Create gateway with KMS encryption\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-encrypted-gateway\",\n description: \"Gateway with KMS encryption\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n allowedScopes: [\"read\", \"write\"],\n }),\n kmsKey: encryptionKey,\n exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,\n});\n```\n\n### Gateway with Custom Execution Role\n\n```typescript fixture=default\n// Create a custom execution role\nconst executionRole = new iam.Role(this, \"GatewayExecutionRole\", {\n assumedBy: new iam.ServicePrincipal(\"bedrock-agentcore.amazonaws.com\"),\n managedPolicies: [\n iam.ManagedPolicy.fromAwsManagedPolicyName(\"AmazonBedrockAgentCoreGatewayExecutionRolePolicy\"),\n ],\n});\n\n// Create gateway with custom execution role\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n description: \"Gateway with custom execution role\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n allowedScopes: [\"read\", \"write\"],\n }),\n role: executionRole,\n});\n```\n\n### Gateway IAM Permissions\n\nThe Gateway construct provides convenient methods for granting IAM permissions:\n\n```typescript fixture=default\n// Create a gateway\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n description: \"Gateway for external service integration\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n allowedScopes: [\"read\", \"write\"],\n }),\n});\n\n// Create a role that needs access to the gateway\nconst userRole = new iam.Role(this, \"UserRole\", {\n assumedBy: new iam.ServicePrincipal(\"lambda.amazonaws.com\"),\n});\n\n// Grant read permissions (Get and List actions)\ngateway.grantRead(userRole);\n\n// Grant manage permissions (Create, Update, Delete actions)\ngateway.grantManage(userRole);\n\n// Grant specific custom permissions\ngateway.grant(userRole, \"bedrock-agentcore:GetGateway\");\n```\n\n## Gateway Target\n\nAfter Creating gateways, you can add targets which define the tools that your gateway will host. Gateway supports multiple target\ntypes including Lambda functions and API specifications (either OpenAPI schemas or Smithy models). Gateway allows you to attach multiple\ntargets to a Gateway and you can change the targets / tools attached to a gateway at any point. Each target can have its own\ncredential provider attached enabling you to securely access targets whether they need IAM, API Key, or OAuth credentials.\n\n### Gateway Target Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `gatewayTargetName` | `string` | No | The name of the gateway target. Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen). If not provided, a unique name will be auto-generated |\n| `description` | `string` | No | Optional description for the gateway target. Maximum 200 characters |\n| `gateway` | `IGateway` | Yes | The gateway this target belongs to |\n| `targetConfiguration` | `ITargetConfiguration` | Yes | The target configuration (Lambda, OpenAPI, or Smithy). **Note:** Users typically don't create this directly. When using convenience methods like `GatewayTarget.forLambda()`, `GatewayTarget.forOpenApi()`, `GatewayTarget.forSmithy()` or the gateway's `addLambdaTarget()`, `addOpenApiTarget()`, `addSmithyTarget()` methods, this configuration is created internally for you. Only needed when using the GatewayTarget constructor directly for [advanced scenarios](#advanced-usage-direct-configuration-for-gateway-target). |\n| `credentialProviderConfigurations` | `IGatewayCredentialProvider[]` | No | Credential providers for authentication. Defaults to `[GatewayCredentialProvider.fromIamRole()]`. Use `GatewayCredentialProvider.fromApiKeyIdentityArn()`, `GatewayCredentialProvider.fromOauthIdentityArn()`, or `GatewayCredentialProvider.fromIamRole()` |\n| `validateOpenApiSchema` | `boolean` | No | (OpenAPI targets only) Whether to validate the OpenAPI schema at synthesis time. Defaults to `true`. Only applies to inline and local asset schemas. For more information refer here <https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-schema-openapi.html> |\n\nThis approach gives you full control over the configuration but is typically not necessary for most use cases.\n\n### Targets types\n\nYou can create the following targets types:\n\n**Lambda Target**: Lambda targets allow you to connect your gateway to AWS Lambda functions that implement your tools. This is useful\nwhen you want to execute custom code in response to tool invocations.\n\n- Supports GATEWAY_IAM_ROLE credential provider only\n- Ideal for custom serverless function integration\n- Need tool schema (tool schema is a blueprint that describes the functions your Lambda provides to AI agents).\n The construct provide [3 ways to upload a tool schema to Lambda target](#tools-schema-for-lambda-target)\n- When using the default IAM authentication (no `credentialProviderConfigurations` specified),\n the construct automatocally grants the gateway role permission to invoke your Lambda function (`lambda:InvokeFunction`).\n\n**OpenAPI Schema Target** : OpenAPI widely used standard for describing RESTful APIs. Gateway supports OpenAPI 3.0\nspecifications for defining API targets. It connects to REST APIs using OpenAPI specifications\n\n- Supports OAUTH and API_KEY credential providers (Do not support IAM, you must provide `credentialProviderConfigurations`)\n- Ideal for integrating with external REST services\n- Need API schema. The construct provide [3 ways to upload a API schema to OpenAPI target](#api-schema-for-openapi-and-smithy-target)\n\n**Smithy Model Target** : Smithy is a language for defining services and software development kits (SDKs). Smithy models provide\na more structured approach to defining APIs compared to OpenAPI, and are particularly useful for connecting to AWS services.\nAgentCore Gateway supports built-in AWS service models only. It connects to services using Smithy model definitions\n\n- Supports OAUTH and API_KEY credential providers\n- Ideal for AWS service integrations\n- Need API schema. The construct provide 3 ways to upload a API schema to Smity target\n- When using the default IAM authentication (no `credentialProviderConfigurations` specified), The construct only\n grants permission to read the Smithy schema file from S3. You MUST manually grant permissions for the gateway\n role to invoke the actual Smithy API endpoints\n\n> Note: For Smithy model targets that access AWS services, your Gateway's execution role needs permissions to access those services.\nFor example, for a DynamoDB target, your execution role needs permissions to perform DynamoDB operations.\nThis is not managed by the construct due to the large number of options. Please refer to\n[Smithy Model Permission](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-prerequisites-permissions.html) for example.\n\n**MCP Server Target**: Model Context Protocol (MCP) servers provide external tools, data access, and custom functions for AI agents.\nMCP servers enable agents to interact with external systems and services through a standardized protocol. Gateway automatically\ndiscovers and indexes available tools from MCP servers through synchronization.\n\n**Key Features:**\n\n- Requires explicit authentication configuration (OAuth2 recommended, empty array for NoAuth)\n- Ideal for connecting to external MCP-compliant servers\n- The endpoint must use HTTPS protocol\n- Supported MCP protocol versions: 2025-06-18, 2025-03-26\n- Automatic tool discovery through synchronization\n\n**Synchronization Behavior:**\n\nMCP Server targets require synchronization to discover and index available tools:\n\n- **Implicit Synchronization (Automatic)**: Tool discovery happens automatically during:\n - Target creation (`CreateGatewayTarget`)\n - Target updates (`UpdateGatewayTarget`)\n - The Gateway calls the MCP server's `tools/list` endpoint and indexes tools without user intervention\n\n- **Explicit Synchronization (Manual)**: When the MCP server's tools change independently (new tools added, schemas modified, tools removed):\n - The Gateway's tool catalog becomes stale\n - Call the `SynchronizeGatewayTargets` API to refresh the catalog\n - Use the `grantSync()` method to grant permissions to Lambda functions, CI/CD pipelines, or scheduled tasks that will trigger synchronization\n\n**Authentication & Permissions:**\n\nWhen using OAuth2, the Gateway service role automatically receives:\n\n- `bedrock-agentcore:GetWorkloadAccessToken`\n- `bedrock-agentcore:GetResourceOauth2Token`\n- `secretsmanager:GetSecretValue`\n- KMS decrypt (if secrets are encrypted)\n\nFor explicit synchronization, use `grantSync()` to grant `bedrock-agentcore:SynchronizeGatewayTargets` permission to your operator roles.\n\n> For more information, refer to the [MCP Server Target documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-target-MCPservers.html).\n\n### Understanding Tool Naming\n\nWhen tools are exposed through gateway targets, AgentCore Gateway prefixes each tool name with the target name to ensure uniqueness across multiple targets. This is important to understand when building your application logic.\n\n**Naming Pattern:**\n\n**Example:**\n\nIf your target is named `my-lambda-target` and provides a tool called `calculate_price`, agents will discover and invoke it as `my-lambda-target__calculate_price`.\n\n**Important Considerations:**\n\n- **For Lambda Targets**: Your Lambda handler must strip the target name prefix before processing the tool request. The full tool name (with prefix) is sent in the event.\n- **For MCP Server Targets**: The MCP server receives tool calls with the prefixed name from the gateway.\n- **For OpenAPI/Smithy Targets**: The gateway handles the prefix automatically when mapping to API operations based on the `operationId`.\n\nThis naming convention ensures that:\n\n- Tools from different targets don't collide even if they have the same name\n- Agents can access tools from multiple targets through a single gateway\n- Tool names remain unique in the unified tool catalog\n\nFor more details, see the [Gateway Tool Naming Documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-tool-naming.html).\n\n### Tools schema For Lambda target\n\nThe lambda target need tools schema to understand the fuunction lambda provides. You can upload the tool schema by following 3 ways:\n\n- From a local asset file\n\n```typescript\nconst toolSchema = agentcore.ToolSchema.fromLocalAsset(\n path.join(__dirname, \"schemas\", \"my-tool-schema.json\")\n );\n```\n\n- From an existing S3 file:\n\n```typescript\n\nconst toolSchema = agentcore.ToolSchema.fromS3File(\n s3.Bucket.fromBucketName(this, \"SchemasBucket\", \"my-schemas-bucket\"),\n \"tools/complex-tool-schema.json\",\n \"123456789012\"\n );\n```\n\n- From Inline:\n\n```typescript\nconst toolSchema = agentcore.ToolSchema.fromInline([{\n name: \"hello_world\",\n description: \"A simple hello world tool\",\n inputSchema: {\n type: agentcore.SchemaDefinitionType.OBJECT,\n properties: {\n name: {\n type: agentcore.SchemaDefinitionType.STRING,\n description: \"The name to greet\",\n },\n },\n required: [\"name\"],\n },\n }]);\n\n```\n\n### Api schema For OpenAPI and Smithy target\n\nThe OpenAPI and Smithy target need API Schema. The Gateway construct provide three ways to upload API schema for your target:\n\n- From a local asset file (requires binding to scope):\n\n```typescript fixture=default\n// When using ApiSchema.fromLocalAsset, you must bind the schema to a scope\nconst schema = agentcore.ApiSchema.fromLocalAsset(path.join(__dirname, \"mySchema.yml\"));\n\nschema.bind(this);\n```\n\n- From an inline schema:\n\n```typescript fixture=default\nconst inlineSchema = agentcore.ApiSchema.fromInline(`\nopenapi: 3.0.3\ninfo:\n title: Library API\n version: 1.0.0\npaths:\n /search:\n get:\n summary: Search for books\n operationId: searchBooks\n parameters:\n - name: query\n in: query\n required: true\n schema:\n type: string\n`);\n```\n\n- From an existing S3 file:\n\n```typescript fixture=default\nconst bucket = s3.Bucket.fromBucketName(this, \"ExistingBucket\", \"my-schema-bucket\");\nconst s3Schema = agentcore.ApiSchema.fromS3File(bucket, \"schemas/action-group.yaml\");\n```\n\n### Outbound auth\n\nOutbound authorization lets Amazon Bedrock AgentCore gateways securely access gateway targets on behalf of users authenticated\nand authorized during Inbound Auth.\n\nAgentCore Gateway supports the following types of outbound authorization:\n\n**IAM-based outbound authorization** – The gateway uses its execution role to authenticate with AWS services. This is the default\n and most common approach for Lambda targets and AWS service integrations.\n\n**2-legged OAuth (OAuth 2LO)** – Use OAuth 2.0 two-legged flow (2LO) for targets that require OAuth authentication.\nThe gateway authenticates on its own behalf, not on behalf of a user.\n\n**API key** – Use the AgentCore service/AWS console to generate an API key to authenticate access to the gateway target.\n\n**Note > You need to set up the outbound identity before you can create a gateway target.\n\n### Basic Gateway Target Creation\n\nYou can create targets in two ways: using the static factory methods on `GatewayTarget` or using the convenient `addTarget` methods on the gateway instance.\n\n#### Using addTarget methods (Recommended)\n\nBelow are the examples on how you can create Lambda , Smity and OpenAPI target using `addTarget` method.\n\n```typescript fixture=default\n// Create a gateway first\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\nconst lambdaFunction = new lambda.Function(this, \"MyFunction\", {\n runtime: lambda.Runtime.NODEJS_22_X,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\n exports.handler = async (event) => {\n return {\n statusCode: 200,\n body: JSON.stringify({ message: 'Hello from Lambda!' })\n };\n };\n `),\n});\n\nconst lambdaTarget = gateway.addLambdaTarget(\"MyLambdaTarget\", {\n gatewayTargetName: \"my-lambda-target\",\n description: \"Lambda function target\",\n lambdaFunction: lambdaFunction,\n toolSchema: agentcore.ToolSchema.fromInline([\n {\n name: \"hello_world\",\n description: \"A simple hello world tool\",\n inputSchema: {\n type: agentcore.SchemaDefinitionType.OBJECT,\n properties: {\n name: {\n type: agentcore.SchemaDefinitionType.STRING,\n description: \"The name to greet\",\n },\n },\n required: [\"name\"],\n },\n },\n ]),\n});\n```\n\n- OpenAPI Target\n\n``` typescript\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\n// These ARNs are returned when creating the API key credential provider via Console or API\nconst apiKeyProviderArn = \"arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/apikeycredentialprovider/my-apikey\"\nconst apiKeySecretArn = \"arn:aws:secretsmanager:us-east-1:123456789012:secret:my-apikey-secret-abc123\"\n\nconst bucket = s3.Bucket.fromBucketName(this, \"ExistingBucket\", \"my-schema-bucket\");\nconst s3mySchema = agentcore.ApiSchema.fromS3File(bucket, \"schemas/myschema.yaml\");\n\n// Add an OpenAPI target directly to the gateway\nconst target = gateway.addOpenApiTarget(\"MyTarget\", {\n gatewayTargetName: \"my-api-target\",\n description: \"Target for external API integration\",\n apiSchema: s3mySchema,\n credentialProviderConfigurations: [\n agentcore.GatewayCredentialProvider.fromApiKeyIdentityArn({\n providerArn: apiKeyProviderArn,\n secretArn: apiKeySecretArn,\n credentialLocation: agentcore.ApiKeyCredentialLocation.header({\n credentialParameterName: \"X-API-Key\",\n }),\n }),\n ],\n});\n\n// This make sure your s3 bucket is available before target\ntarget.node.addDependency(bucket);\n```\n\n- Smithy Target\n\n```typescript fixture=default\n\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\nconst smithySchema = agentcore.ApiSchema.fromLocalAsset(\n path.join(__dirname, \"models\", \"smithy-model.json\")\n);\nsmithySchema.bind(this);\n\nconst smithyTarget = gateway.addSmithyTarget(\"MySmithyTarget\", {\n gatewayTargetName: \"my-smithy-target\",\n description: \"Smithy model target\",\n smithyModel: smithySchema,\n\n});\n```\n\n- MCP Server Target\n\n```typescript fixture=default\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\n// OAuth2 authentication (recommended)\n// Note: Create the OAuth provider using AWS console or Identity L2 construct when available\nconst oauthProviderArn = \"arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/oauth2credentialprovider/my-oauth\";\nconst oauthSecretArn = \"arn:aws:secretsmanager:us-east-1:123456789012:secret:my-oauth-secret-abc123\";\n\n// Add an MCP server target directly to the gateway\nconst mcpTarget = gateway.addMcpServerTarget(\"MyMcpServer\", {\n gatewayTargetName: \"my-mcp-server\",\n description: \"External MCP server integration\",\n endpoint: \"https://my-mcp-server.example.com\",\n credentialProviderConfigurations: [\n agentcore.GatewayCredentialProvider.fromOauthIdentityArn({\n providerArn: oauthProviderArn,\n secretArn: oauthSecretArn,\n scopes:['mcp-runtime-server/invoke']\n }),\n ],\n});\n\n// Grant sync permission to a Lambda function that will trigger synchronization\nconst syncFunction = new lambda.Function(this, \"SyncFunction\", {\n runtime: lambda.Runtime.PYTHON_3_12,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\nimport boto3\n\ndef handler(event, context):\n client = boto3.client('bedrock-agentcore')\n response = client.synchronize_gateway_targets(\n gatewayIdentifier=event['gatewayId'],\n targetIds=[event['targetId']]\n )\n return response\n `),\n});\n\nmcpTarget.grantSync(syncFunction);\n```\n\n#### Using static factory methods\n\nCreate Gateway target using static convienence method.\n\n- Lambda Target\n\n```typescript fixture=default\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\nconst lambdaFunction = new lambda.Function(this, \"MyFunction\", {\n runtime: lambda.Runtime.NODEJS_22_X,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\n exports.handler = async (event) => {\n return {\n statusCode: 200,\n body: JSON.stringify({ message: 'Hello from Lambda!' })\n };\n };\n `),\n});\n\n// Create a gateway target with Lambda and tool schema\nconst target = agentcore.GatewayTarget.forLambda(this, \"MyLambdaTarget\", {\n gatewayTargetName: \"my-lambda-target\",\n description: \"Target for Lambda function integration\",\n gateway: gateway,\n lambdaFunction: lambdaFunction,\n toolSchema: agentcore.ToolSchema.fromLocalAsset(\n path.join(__dirname, \"schemas\", \"my-tool-schema.json\")\n ),\n});\n```\n\n- OpenAPI Target\n\n```typescript fixture=default\n\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\n// outbound auth (Use AWS console to create it, Once Identity L2 construct is available you can use it to create identity)\nconst apiKeyIdentityArn = \"arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/apikeycredentialprovider/my-apikey\"\nconst apiKeySecretArn = \"arn:aws:secretsmanager:us-east-1:123456789012:secret:my-apikey-secret-abc123\"\n\nconst opneapiSchema = agentcore.ApiSchema.fromLocalAsset(path.join(__dirname, \"mySchema.yml\"));\nopneapiSchema.bind(this);\n\n// Create a gateway target with OpenAPI Schema\nconst target = agentcore.GatewayTarget.forOpenApi(this, \"MyTarget\", {\n gatewayTargetName: \"my-api-target\",\n description: \"Target for external API integration\",\n gateway: gateway, // Note: you need to pass the gateway reference\n apiSchema: opneapiSchema,\n credentialProviderConfigurations: [\n agentcore.GatewayCredentialProvider.fromApiKeyIdentityArn({\n providerArn: apiKeyIdentityArn,\n secretArn: apiKeySecretArn\n }),\n ],\n});\n\n```\n\n- Smithy Target\n\n```typescript fixture=default\n\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\nconst smithySchema = agentcore.ApiSchema.fromLocalAsset(\n path.join(__dirname, \"models\", \"smithy-model.json\")\n);\nsmithySchema.bind(this);\n\n// Create a gateway target with Smithy Model and OAuth\nconst target = agentcore.GatewayTarget.forSmithy(this, \"MySmithyTarget\", {\n gatewayTargetName: \"my-smithy-target\",\n description: \"Target for Smithy model integration\",\n gateway: gateway,\n smithyModel: smithySchema,\n});\n\n```\n\n- MCP Server Target\n\n```typescript fixture=default\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\n// OAuth2 authentication (recommended)\n// Note: Create the OAuth provider using AWS console or Identity L2 construct when available\nconst oauthProviderArn = \"arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/oauth2credentialprovider/my-oauth\";\nconst oauthSecretArn = \"arn:aws:secretsmanager:us-east-1:123456789012:secret:my-oauth-secret-abc123\";\n\n// Create a gateway target with MCP Server\nconst mcpTarget = agentcore.GatewayTarget.forMcpServer(this, \"MyMcpServer\", {\n gatewayTargetName: \"my-mcp-server\",\n description: \"External MCP server integration\",\n gateway: gateway,\n endpoint: \"https://my-mcp-server.example.com\",\n credentialProviderConfigurations: [\n agentcore.GatewayCredentialProvider.fromOauthIdentityArn({\n providerArn: oauthProviderArn,\n secretArn: oauthSecretArn,\n scopes:['mcp-runtime-server/invoke']\n }),\n ],\n});\n```\n\n### Advanced Usage: Direct Configuration for gateway target\n\nFor advanced use cases where you need full control over the target configuration, you can create configurations manually using the static factory methods and use the GatewayTarget constructor directly.\n\n#### Configuration Factory Methods\n\nEach target type has a corresponding configuration class with a static `create()` method:\n\n- **Lambda**: `LambdaTargetConfiguration.create(lambdaFunction, toolSchema)`\n- **OpenAPI**: `OpenApiTargetConfiguration.create(apiSchema, validateSchema?)`\n- **Smithy**: `SmithyTargetConfiguration.create(smithyModel)`\n\n#### Example: Lambda Target with Custom Configuration\n\n```typescript\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\nconst myLambdaFunction = new lambda.Function(this, \"MyFunction\", {\n runtime: lambda.Runtime.NODEJS_22_X,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\n exports.handler = async (event) => ({ statusCode: 200 });\n `),\n});\n\nconst myToolSchema = agentcore.ToolSchema.fromInline([{\n name: \"my_tool\",\n description: \"My custom tool\",\n inputSchema: {\n type: agentcore.SchemaDefinitionType.OBJECT,\n properties: {},\n },\n}]);\n\n// Create a custom Lambda configuration\nconst customConfig = agentcore.LambdaTargetConfiguration.create(\n myLambdaFunction,\n myToolSchema\n);\n\n// Use the GatewayTarget constructor directly\nconst target = new agentcore.GatewayTarget(this, \"AdvancedTarget\", {\n gateway: gateway,\n gatewayTargetName: \"advanced-target\",\n targetConfiguration: customConfig, // Manually created configuration\n credentialProviderConfigurations: [\n agentcore.GatewayCredentialProvider.fromIamRole()\n ]\n});\n```\n\nThis approach gives you full control over the configuration but is typically not necessary for most use cases. The convenience methods (`GatewayTarget.forLambda()`, `GatewayTarget.forOpenApi()`, `GatewayTarget.forSmithy()`) handle all of this internally.\n\n### Gateway Interceptors\n\nGateway interceptors allow you to run custom code during each gateway invocation to implement fine-grained access control, transform requests and responses, or implement custom authorization logic. A gateway can have at most one REQUEST interceptor and one RESPONSE interceptor.\n\n**Interceptor Types:**\n\n- **REQUEST interceptors**: Execute before the gateway calls the target. Useful for request validation, transformation, or custom authorization\n- **RESPONSE interceptors**: Execute after the target responds but before the gateway sends the response back. Useful for response transformation, filtering, or adding custom headers\n\n**Security Best Practices:**\n\n1. Keep `passRequestHeaders` disabled unless absolutely necessary (default: false)\n2. Implement idempotent Lambda functions (gateway may retry on failures)\n3. Restrict gateway execution role to specific Lambda functions\n4. Avoid logging sensitive information in your interceptor\n\nFor more information, see the [Gateway Interceptors documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-interceptors.html).\n\n#### Adding Interceptors via Constructor\n\n```typescript fixture=default\n// Create Lambda functions for interceptors\nconst requestInterceptorFn = new lambda.Function(this, \"RequestInterceptor\", {\n runtime: lambda.Runtime.PYTHON_3_12,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\ndef handler(event, context):\n # Validate and transform request\n return {\n \"interceptorOutputVersion\": \"1.0\",\n \"mcp\": {\n \"transformedGatewayRequest\": event[\"mcp\"][\"gatewayRequest\"]\n }\n }\n `),\n});\n\nconst responseInterceptorFn = new lambda.Function(this, \"ResponseInterceptor\", {\n runtime: lambda.Runtime.PYTHON_3_12,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\ndef handler(event, context):\n # Filter or transform response\n return {\n \"interceptorOutputVersion\": \"1.0\",\n \"mcp\": {\n \"transformedGatewayResponse\": event[\"mcp\"][\"gatewayResponse\"]\n }\n }\n `),\n});\n\n// Create gateway with interceptors\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n interceptorConfigurations: [\n agentcore.LambdaInterceptor.forRequest(requestInterceptorFn, {\n passRequestHeaders: true // Only if you need to inspect headers\n }),\n agentcore.LambdaInterceptor.forResponse(responseInterceptorFn)\n ]\n});\n```\n\n**Automatic Permission Granting:**\n\nWhen you add a Lambda interceptor to a gateway (either via constructor or `addInterceptor()`), the gateway's IAM role automatically receives `lambda:InvokeFunction` permission on the Lambda function. This permission grant happens internally during the bind process - you do not need to manually configure these IAM permissions.\n\n#### Adding Interceptors Dynamically\n\n```typescript fixture=default\n// Create a gateway first\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\n// Create Lambda functions for interceptors\nconst requestInterceptorFn = new lambda.Function(this, \"RequestInterceptor\", {\n runtime: lambda.Runtime.PYTHON_3_12,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\ndef handler(event, context):\n # Custom request validation logic\n return {\n \"interceptorOutputVersion\": \"1.0\",\n \"mcp\": {\n \"transformedGatewayRequest\": event[\"mcp\"][\"gatewayRequest\"]\n }\n }\n `),\n});\n\nconst responseInterceptorFn = new lambda.Function(this, \"ResponseInterceptor\", {\n runtime: lambda.Runtime.PYTHON_3_12,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\ndef handler(event, context):\n # Filter sensitive data from response\n return {\n \"interceptorOutputVersion\": \"1.0\",\n \"mcp\": {\n \"transformedGatewayResponse\": event[\"mcp\"][\"gatewayResponse\"]\n }\n }\n `),\n});\n\ngateway.addInterceptor(\n agentcore.LambdaInterceptor.forRequest(requestInterceptorFn, {\n passRequestHeaders: false // Default, headers not passed for security\n })\n);\n\ngateway.addInterceptor(\n agentcore.LambdaInterceptor.forResponse(responseInterceptorFn)\n);\n```\n\n### Gateway Target IAM Permissions\n\nThe Gateway Target construct provides convenient methods for granting IAM permissions:\n\n```typescript fixture=default\n// Create a gateway and target\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\nconst smithySchema = agentcore.ApiSchema.fromLocalAsset(\n path.join(__dirname, \"models\", \"smithy-model.json\")\n);\nsmithySchema.bind(this);\n\n// Create a gateway target with Smithy Model and OAuth\nconst target = agentcore.GatewayTarget.forSmithy(this, \"MySmithyTarget\", {\n gatewayTargetName: \"my-smithy-target\",\n description: \"Target for Smithy model integration\",\n gateway: gateway,\n smithyModel: smithySchema,\n});\n\n// Create a role that needs access to the gateway target\nconst userRole = new iam.Role(this, \"UserRole\", {\n assumedBy: new iam.ServicePrincipal(\"lambda.amazonaws.com\"),\n});\n\n// Grant read permissions (Get and List actions)\ntarget.grantRead(userRole);\n\n// Grant manage permissions (Create, Update, Delete actions)\ntarget.grantManage(userRole);\n\n// Grant specific custom permissions\ntarget.grant(userRole, \"bedrock-agentcore:GetGatewayTarget\");\n\n\n// Grants permission to invoke this Gateway\ngateway.grantInvoke(userRole);\n```\n\n## Memory\n\nMemory is a critical component of intelligence. While Large Language Models (LLMs) have impressive capabilities, they lack persistent memory across conversations. Amazon Bedrock AgentCore Memory addresses this limitation by providing a managed service that enables AI agents to maintain context over time, remember important facts, and deliver consistent, personalized experiences.\n\nAgentCore Memory operates on two levels:\n\n- **Short-Term Memory**: Immediate conversation context and session-based information that provides continuity within a single interaction or closely related sessions.\n- **Long-Term Memory**: Persistent information extracted and stored across multiple conversations, including facts, preferences, and summaries that enable personalized experiences over time.\n\nWhen you interact with the memory via the `CreateEvent` API, you store interactions in Short-Term Memory (STM) instantly. These interactions can include everything from user messages, assistant responses, to tool actions.\n\nTo write to long-term memory, you need to configure extraction strategies which define how and where to store information from conversations for future use. These strategies are asynchronously processed from raw events after every few turns based on the strategy that was selected. You can't create long term memory records directly, as they are extracted asynchronously by AgentCore Memory.\n\n### Memory Properties\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `memoryName` | `string` | No | The name of the memory. If not provided, a unique name will be auto-generated |\n| `expirationDuration` | `Duration` | No | Short-term memory expiration in days (between 7 and 365). Default: 90 days |\n| `description` | `string` | No | Optional description for the memory. Default: no description. |\n| `kmsKey` | `IKey` | No | Custom KMS key to use for encryption. Default: Your data is encrypted with a key that AWS owns and manages for you |\n| `memoryStrategies` | `MemoryStrategyBase[]` | No | Built-in extraction strategies to use for this memory. Default: No extraction strategies (short term memory only) |\n| `executionRole` | `iam.IRole` | No | The IAM role that provides permissions for the memory to access AWS services. Default: A new role will be created. |\n| `tags` | `{ [key: string]: string }` | No | Tags for memory. Default: no tags. |\n\n### Basic Memory Creation\n\nBelow you can find how to configure a simple short-term memory (STM) with no long-term memory extraction strategies.\nNote how you set `expirationDuration`, which defines the time the events will be stored in the short-term memory before they expire.\n\n```typescript fixture=default\n\n// Create a basic memory with default settings, no LTM strategies\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my_memory\",\n description: \"A memory for storing user interactions for a period of 90 days\",\n expirationDuration: cdk.Duration.days(90),\n});\n```\n\nBasic Memory with Custom KMS Encryption\n\n```typescript fixture=default\n// Create a custom KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"MemoryEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for memory encryption\",\n});\n\n// Create memory with custom encryption\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my_encrypted_memory\",\n description: \"Memory with custom KMS encryption\",\n expirationDuration: cdk.Duration.days(90),\n kmsKey: encryptionKey,\n});\n```\n\n### LTM Memory Extraction Stategies\n\nIf you need long-term memory for context recall across sessions, you can setup memory extraction strategies\nto extract the relevant memory from the raw events.\n\nAmazon Bedrock AgentCore Memory has different memory strategies for extracting and organizing information:\n\n- **Summarization**: to summarize interactions to preserve critical context and key insights.\n- **Semantic Memory**: to extract general factual knowledge, concepts and meanings from raw conversations using vector embeddings.\nThis enables similarity-based retrieval of relevant facts and context.\n- **User Preferences**: to extract user behavior patterns from raw conversations.\n\nYou can use built-in extraction strategies for quick setup, or create custom extraction strategies with specific models and prompt templates.\n\n### Memory with Built-in Strategies\n\nThe library provides four built-in LTM strategies. These are default strategies for organizing and extracting memory data,\neach optimized for specific use cases.\n\nFor example: An agent helps multiple users with cloud storage setup. From these conversations,\nsee how each strategy processes users expressing confusion about account connection:\n\n1. **Summarization Strategy** (`MemoryStrategy.usingBuiltInSummarization()`)\nThis strategy compresses conversations into concise overviews, preserving essential context and key insights for quick recall.\nExtracted memory example: Users confused by cloud setup during onboarding.\n\n - Extracts concise summaries to preserve critical context and key insights\n - Namespace: `/strategies/{memoryStrategyId}/actors/{actorId}/sessions/{sessionId}`\n\n2. **Semantic Memory Strategy** (`MemoryStrategy.usingBuiltInSemantic()`)\nDistills general facts, concepts, and underlying meanings from raw conversational data, presenting the information in a context-independent format.\nExtracted memory example: In-context learning = task-solving via examples, no training needed.\n\n - Extracts general factual knowledge, concepts and meanings from raw conversations\n - Namespace: `/strategies/{memoryStrategyId}/actors/{actorId}`\n\n3. **User Preference Strategy** (`MemoryStrategy.usingBuiltInUserPreference()`)\nCaptures individual preferences, interaction patterns, and personalized settings to enhance future experiences.\nExtracted memory example: User needs clear guidance on cloud storage account connection during onboarding.\n\n - Extracts user behavior patterns from raw conversations\n - Namespace: `/strategies/{memoryStrategyId}/actors/{actorId}`\n\n4. **Episodic Memory Strategy** (`MemoryStrategy.usingBuiltInEpisodic()`)\nCaptures meaningful slices of user and system interactions, preserve them into compact records after summarizing.\nExtracted memory example: User first asked about pricing on Monday, then requested feature comparison on Tuesday, finally made purchase decision on Wednesday.\n\n - Captures event sequences and temporal relationships\n - Namespace: `/strategy/{memoryStrategyId}/actor/{actorId}/session/{sessionId}`\n - Reflections: `/strategy/{memoryStrategyId}/actor/{actorId}`\n\n```typescript fixture=default\n// Create memory with built-in strategies\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my_memory\",\n description: \"Memory with built-in strategies\",\n expirationDuration: cdk.Duration.days(90),\n memoryStrategies: [\n agentcore.MemoryStrategy.usingBuiltInSummarization(),\n agentcore.MemoryStrategy.usingBuiltInSemantic(),\n agentcore.MemoryStrategy.usingBuiltInUserPreference(),\n agentcore.MemoryStrategy.usingBuiltInEpisodic(),\n ],\n});\n```\n\nThe name generated for each built in memory strategy is as follows:\n\n- For Summarization: `summary_builtin_cdk001`\n- For Semantic:`semantic_builtin_cdk001>`\n- For User Preferences: `preference_builtin_cdk001`\n- For Episodic : `episodic_builtin_cdkGen0001`\n\n### Memory with custom Strategies\n\nWith Long-Term Memory, organization is managed through Namespaces.\n\nAn `actor` refers to entity such as end users or agent/user combinations. For example, in a coding support chatbot,\nthe actor is usually the developer asking questions. Using the actor ID helps the system know which user the memory belongs to,\nkeeping each user's data separate and organized.\n\nA `session` is usually a single conversation or interaction period between the user and the AI agent.\nIt groups all related messages and events that happen during that conversation.\n\nA `namespace` is used to logically group and organize long-term memories. It ensures data stays neat, separate, and secure.\n\nWith AgentCore Memory, you need to add a namespace when you define a memory strategy. This namespace helps define where the long-term memory\nwill be logically grouped. Every time a new long-term memory is extracted using this memory strategy, it is saved under the namespace you set.\nThis means that all long-term memories are scoped to their specific namespace, keeping them organized and preventing any mix-ups with other\nusers or sessions. You should use a hierarchical format separated by forward slashes /. This helps keep memories organized clearly. As needed,\nyou can choose to use the below pre-defined variables within braces in the namespace based on your applications' organization needs:\n\n- `actorId` – Identifies who the long-term memory belongs to, such as a user\n- `memoryStrategyId` – Shows which memory strategy is being used. This strategy identifier is auto-generated when you create a memory using CreateMemory operation.\n- `sessionId` – Identifies which session or conversation the memory is from.\n\nFor example, if you define the following namespace as the input to your strategy in CreateMemory operation:\n\n```shell\n/strategy/{memoryStrategyId}/actor/{actorId}/session/{sessionId}\n```\n\nAfter memory creation, this namespace might look like:\n\n```shell\n/strategy/summarization-93483043//actor/actor-9830m2w3/session/session-9330sds8\n```\n\nYou can customise the namespace, i.e. where the memories are stored by using the following methods:\n\n1. **Summarization Strategy** (`MemoryStrategy.usingSummarization(props)`)\n1. **Semantic Memory Strategy** (`MemoryStrategy.usingSemantic(props)`)\n1. **User Preference Strategy** (`MemoryStrategy.usingUserPreference(props)`)\n1. **Episodic Memory Strategy** (`MemoryStrategy.usingEpisodic(props)`)\n\n```typescript fixture=default\n// Create memory with custom strategies\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my_memory\",\n description: \"Memory with custom strategies\",\n expirationDuration: cdk.Duration.days(90),\n memoryStrategies: [\n agentcore.MemoryStrategy.usingUserPreference({\n name: \"CustomerPreferences\",\n namespaces: [\"support/customer/{actorId}/preferences\"]\n }),\n agentcore.MemoryStrategy.usingSemantic({\n name: \"CustomerSupportSemantic\",\n namespaces: [\"support/customer/{actorId}/semantic\"]\n }),\n agentcore.MemoryStrategy.usingEpisodic({\n name: \"customerJourneyEpisodic\",\n namespaces: [\"/journey/customer/{actorId}/episodes\"],\n reflectionConfiguration: {\n namespaces: [\"/journey/customer/{actorId}/reflections\"]\n }\n }),\n ],\n});\n```\n\nCustom memory strategies let you tailor memory extraction and consolidation to your specific domain or use case.\nYou can override the prompts for extracting and consolidating semantic, summary, or user preferences.\nYou can also choose the model that you want to use for extraction and consolidation.\n\nThe custom prompts you create are appended to a non-editable system prompt.\n\nSince a custom strategy requires you to invoke certain FMs, you need a role with appropriate permissions. For that, you can:\n\n- Let the L2 construct create a minimum permission role for you when use L2 Bedrock Foundation Models.\n- Use a custom role with the overly permissive `AmazonBedrockAgentCoreMemoryBedrockModelInferenceExecutionRolePolicy` managed policy.\n- Use a custom role with your own custom policies.\n\n#### Memory with Custom Execution Role\n\nKeep in mind that memories that **do not** use custom strategies do not require a service role.\nSo even if you provide it, it will be ignored as it will never be used.\n\n```typescript fixture=default\n// Create a custom execution role\nconst executionRole = new iam.Role(this, \"MemoryExecutionRole\", {\n assumedBy: new iam.ServicePrincipal(\"bedrock-agentcore.amazonaws.com\"),\n managedPolicies: [\n iam.ManagedPolicy.fromAwsManagedPolicyName(\n \"AmazonBedrockAgentCoreMemoryBedrockModelInferenceExecutionRolePolicy\"\n ),\n ],\n});\n\n// Create memory with custom execution role\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my_memory\",\n description: \"Memory with custom execution role\",\n expirationDuration: cdk.Duration.days(90),\n executionRole: executionRole,\n});\n```\n\nIn customConsolidation and customExtraction, the model property uses the [@aws-cdk/aws-bedrock-alph](https://www.npmjs.com/package/@aws-cdk/aws-bedrock-alpha) library which must be installed separately.\n\n```typescript fixture=default\n// Create a custom semantic memory strategy\nconst customSemanticStrategy = agentcore.MemoryStrategy.usingSemantic({\n name: \"customSemanticStrategy\",\n description: \"Custom semantic memory strategy\",\n namespaces: [\"/custom/strategies/{memoryStrategyId}/actors/{actorId}\"],\n customConsolidation: {\n model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0,\n appendToPrompt: \"Custom consolidation prompt for semantic memory\",\n },\n customExtraction: {\n model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0,\n appendToPrompt: \"Custom extraction prompt for semantic memory\",\n },\n});\n\n// Create memory with custom strategy\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my-custom-memory\",\n description: \"Memory with custom strategy\",\n expirationDuration: cdk.Duration.days(90),\n memoryStrategies: [customSemanticStrategy],\n});\n```\n\n### Memory with self-managed Strategies\n\nA self-managed strategy in Amazon Bedrock AgentCore Memory gives you complete control over your memory extraction and consolidation pipelines.\nWith a self-managed strategy, you can build custom memory processing workflows while leveraging Amazon Bedrock AgentCore for storage and retrieval.\n\nFor additional information, you can refer to the [developer guide for self managed strategies](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/memory-self-managed-strategies.html).\n\nCreate the required AWS resources including:\n\n- an S3 bucket in your account where Amazon Bedrock AgentCore will deliver batched event payloads.\n- an SNS topic for job notifications. Use FIFO topics if processing order within sessions is important for your use case.\n\nThe construct will apply the correct permissions to the memory execution role to access these resources.\n\n```typescript fixture=default\n\nconst bucket = new s3.Bucket(this, 'memoryBucket', {\n bucketName: 'test-memory',\n removalPolicy: cdk.RemovalPolicy.DESTROY,\n autoDeleteObjects: true,\n});\n\nconst topic = new sns.Topic(this, 'topic');\n\n// Create a custom semantic memory strategy\nconst selfManagedStrategy = agentcore.MemoryStrategy.usingSelfManaged({\n name: \"selfManagedStrategy\",\n description: \"self managed memory strategy\",\n historicalContextWindowSize: 5,\n invocationConfiguration: {\n topic: topic,\n s3Location: {\n bucketName: bucket.bucketName,\n objectKey: 'memory/',\n }\n },\n triggerConditions: {\n messageBasedTrigger: 1,\n timeBasedTrigger: cdk.Duration.seconds(10),\n tokenBasedTrigger: 100\n }\n});\n\n// Create memory with custom strategy\nconst memory = new agentcore.Memory(this, \"MyMemory\", {\n memoryName: \"my-custom-memory\",\n description: \"Memory with custom strategy\",\n expirationDuration: cdk.Duration.days(90),\n memoryStrategies: [selfManagedStrategy],\n});\n```\n\n### Memory Strategy Methods\n\nYou can add new memory strategies to the memory construct using the `addMemoryStrategy()` method, for instance:\n\n```typescript fixture=default\n// Create memory without initial strategies\nconst memory = new agentcore.Memory(this, \"test-memory\", {\n memoryName: \"test_memory_add_strategy\",\n description: \"A test memory for testing addMemoryStrategy method\",\n expirationDuration: cdk.Duration.days(90),\n});\n\n// Add strategies after instantiation\nmemory.addMemoryStrategy(agentcore.MemoryStrategy.usingBuiltInSummarization());\nmemory.addMemoryStrategy(agentcore.MemoryStrategy.usingBuiltInSemantic());\n```\n"
|
|
8528
8557
|
},
|
|
8529
8558
|
"repository": {
|
|
8530
8559
|
"directory": "packages/@aws-cdk/aws-bedrock-agentcore-alpha",
|
|
@@ -8577,7 +8606,7 @@
|
|
|
8577
8606
|
"kind": "interface",
|
|
8578
8607
|
"locationInModule": {
|
|
8579
8608
|
"filename": "lib/runtime/runtime.ts",
|
|
8580
|
-
"line":
|
|
8609
|
+
"line": 130
|
|
8581
8610
|
},
|
|
8582
8611
|
"name": "AddEndpointOptions",
|
|
8583
8612
|
"properties": [
|
|
@@ -8591,7 +8620,7 @@
|
|
|
8591
8620
|
"immutable": true,
|
|
8592
8621
|
"locationInModule": {
|
|
8593
8622
|
"filename": "lib/runtime/runtime.ts",
|
|
8594
|
-
"line":
|
|
8623
|
+
"line": 135
|
|
8595
8624
|
},
|
|
8596
8625
|
"name": "description",
|
|
8597
8626
|
"optional": true,
|
|
@@ -8609,7 +8638,7 @@
|
|
|
8609
8638
|
"immutable": true,
|
|
8610
8639
|
"locationInModule": {
|
|
8611
8640
|
"filename": "lib/runtime/runtime.ts",
|
|
8612
|
-
"line":
|
|
8641
|
+
"line": 140
|
|
8613
8642
|
},
|
|
8614
8643
|
"name": "version",
|
|
8615
8644
|
"optional": true,
|
|
@@ -9099,7 +9128,7 @@
|
|
|
9099
9128
|
"remarks": "Provides methods to reference container images from ECR repositories or local assets.",
|
|
9100
9129
|
"stability": "experimental",
|
|
9101
9130
|
"summary": "Abstract base class for agent runtime artifacts.",
|
|
9102
|
-
"example": "
|
|
9131
|
+
"example": "// S3 bucket containing the agent core\nconst codeBucket = new s3.Bucket(this, \"AgentCode\", {\n bucketName: \"my-code-bucket\",\n removalPolicy: RemovalPolicy.DESTROY, // For demo purposes\n});\n\n// the bucket above needs to contain the agent code\n\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromS3(\n {\n bucketName: codeBucket.bucketName,\n objectKey: 'deployment_package.zip',\n },\n agentcore.AgentCoreRuntime.PYTHON_3_12,\n ['opentelemetry-instrument', 'main.py']\n);\n\nconst runtimeInstance = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n});",
|
|
9103
9132
|
"custom": {
|
|
9104
9133
|
"exampleMetadata": "fixture=default infused"
|
|
9105
9134
|
}
|
|
@@ -9778,7 +9807,7 @@
|
|
|
9778
9807
|
},
|
|
9779
9808
|
"locationInModule": {
|
|
9780
9809
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
9781
|
-
"line":
|
|
9810
|
+
"line": 75
|
|
9782
9811
|
},
|
|
9783
9812
|
"parameters": [
|
|
9784
9813
|
{
|
|
@@ -9808,7 +9837,7 @@
|
|
|
9808
9837
|
"kind": "class",
|
|
9809
9838
|
"locationInModule": {
|
|
9810
9839
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
9811
|
-
"line":
|
|
9840
|
+
"line": 25
|
|
9812
9841
|
},
|
|
9813
9842
|
"methods": [
|
|
9814
9843
|
{
|
|
@@ -9818,7 +9847,7 @@
|
|
|
9818
9847
|
},
|
|
9819
9848
|
"locationInModule": {
|
|
9820
9849
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
9821
|
-
"line":
|
|
9850
|
+
"line": 38
|
|
9822
9851
|
},
|
|
9823
9852
|
"name": "fromInline",
|
|
9824
9853
|
"parameters": [
|
|
@@ -9846,7 +9875,7 @@
|
|
|
9846
9875
|
},
|
|
9847
9876
|
"locationInModule": {
|
|
9848
9877
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
9849
|
-
"line":
|
|
9878
|
+
"line": 30
|
|
9850
9879
|
},
|
|
9851
9880
|
"name": "fromLocalAsset",
|
|
9852
9881
|
"parameters": [
|
|
@@ -9874,7 +9903,7 @@
|
|
|
9874
9903
|
},
|
|
9875
9904
|
"locationInModule": {
|
|
9876
9905
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
9877
|
-
"line":
|
|
9906
|
+
"line": 48
|
|
9878
9907
|
},
|
|
9879
9908
|
"name": "fromS3File",
|
|
9880
9909
|
"parameters": [
|
|
@@ -9966,7 +9995,7 @@
|
|
|
9966
9995
|
"immutable": true,
|
|
9967
9996
|
"locationInModule": {
|
|
9968
9997
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
9969
|
-
"line":
|
|
9998
|
+
"line": 73
|
|
9970
9999
|
},
|
|
9971
10000
|
"name": "bucketOwnerAccountId",
|
|
9972
10001
|
"optional": true,
|
|
@@ -9983,7 +10012,7 @@
|
|
|
9983
10012
|
"immutable": true,
|
|
9984
10013
|
"locationInModule": {
|
|
9985
10014
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
9986
|
-
"line":
|
|
10015
|
+
"line": 68
|
|
9987
10016
|
},
|
|
9988
10017
|
"name": "inlineSchema",
|
|
9989
10018
|
"optional": true,
|
|
@@ -10000,7 +10029,7 @@
|
|
|
10000
10029
|
"immutable": true,
|
|
10001
10030
|
"locationInModule": {
|
|
10002
10031
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
10003
|
-
"line":
|
|
10032
|
+
"line": 62
|
|
10004
10033
|
},
|
|
10005
10034
|
"name": "s3File",
|
|
10006
10035
|
"optional": true,
|
|
@@ -10030,7 +10059,7 @@
|
|
|
10030
10059
|
},
|
|
10031
10060
|
"locationInModule": {
|
|
10032
10061
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
10033
|
-
"line":
|
|
10062
|
+
"line": 98
|
|
10034
10063
|
},
|
|
10035
10064
|
"parameters": [
|
|
10036
10065
|
{
|
|
@@ -10051,7 +10080,7 @@
|
|
|
10051
10080
|
"kind": "class",
|
|
10052
10081
|
"locationInModule": {
|
|
10053
10082
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
10054
|
-
"line":
|
|
10083
|
+
"line": 95
|
|
10055
10084
|
},
|
|
10056
10085
|
"methods": [
|
|
10057
10086
|
{
|
|
@@ -10062,7 +10091,7 @@
|
|
|
10062
10091
|
},
|
|
10063
10092
|
"locationInModule": {
|
|
10064
10093
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
10065
|
-
"line":
|
|
10094
|
+
"line": 117
|
|
10066
10095
|
},
|
|
10067
10096
|
"name": "bind",
|
|
10068
10097
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.ApiSchema",
|
|
@@ -10085,7 +10114,7 @@
|
|
|
10085
10114
|
},
|
|
10086
10115
|
"locationInModule": {
|
|
10087
10116
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
10088
|
-
"line":
|
|
10117
|
+
"line": 149
|
|
10089
10118
|
},
|
|
10090
10119
|
"name": "grantPermissionsToRole",
|
|
10091
10120
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.ApiSchema",
|
|
@@ -10121,7 +10150,7 @@
|
|
|
10121
10150
|
},
|
|
10122
10151
|
"locationInModule": {
|
|
10123
10152
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
10124
|
-
"line":
|
|
10153
|
+
"line": 205
|
|
10125
10154
|
},
|
|
10126
10155
|
"parameters": [
|
|
10127
10156
|
{
|
|
@@ -10142,7 +10171,7 @@
|
|
|
10142
10171
|
"kind": "class",
|
|
10143
10172
|
"locationInModule": {
|
|
10144
10173
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
10145
|
-
"line":
|
|
10174
|
+
"line": 202
|
|
10146
10175
|
},
|
|
10147
10176
|
"methods": [
|
|
10148
10177
|
{
|
|
@@ -10153,7 +10182,7 @@
|
|
|
10153
10182
|
},
|
|
10154
10183
|
"locationInModule": {
|
|
10155
10184
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
10156
|
-
"line":
|
|
10185
|
+
"line": 216
|
|
10157
10186
|
},
|
|
10158
10187
|
"name": "bind",
|
|
10159
10188
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.ToolSchema",
|
|
@@ -10176,7 +10205,7 @@
|
|
|
10176
10205
|
},
|
|
10177
10206
|
"locationInModule": {
|
|
10178
10207
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
10179
|
-
"line":
|
|
10208
|
+
"line": 246
|
|
10180
10209
|
},
|
|
10181
10210
|
"name": "grantPermissionsToRole",
|
|
10182
10211
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.ToolSchema",
|
|
@@ -13151,16 +13180,16 @@
|
|
|
13151
13180
|
"docs": {
|
|
13152
13181
|
"stability": "experimental",
|
|
13153
13182
|
"summary": "**************************************************************************** Factory ***************************************************************************.",
|
|
13154
|
-
"example": "
|
|
13183
|
+
"example": "declare const userPool: cognito.UserPool;\ndeclare const userPoolClient: cognito.UserPoolClient;\n\n// Optional: Create custom claims (CustomClaimOperator and GatewayCustomClaim from agentcore)\nconst customClaims = [\n agentcore.GatewayCustomClaim.withStringValue('department', 'engineering'),\n agentcore.GatewayCustomClaim.withStringArrayValue('roles', ['admin'], agentcore.CustomClaimOperator.CONTAINS),\n agentcore.GatewayCustomClaim.withStringArrayValue('permissions', ['read', 'write'], agentcore.CustomClaimOperator.CONTAINS_ANY),\n];\n\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCognito({\n userPool: userPool,\n allowedClients: [userPoolClient],\n allowedAudiences: [\"audience1\"],\n allowedScopes: [\"read\", \"write\"],\n customClaims: customClaims, // Optional custom claims\n }),\n});",
|
|
13155
13184
|
"custom": {
|
|
13156
|
-
"exampleMetadata": "fixture=
|
|
13185
|
+
"exampleMetadata": "fixture=default infused"
|
|
13157
13186
|
}
|
|
13158
13187
|
},
|
|
13159
13188
|
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.CognitoAuthorizerProps",
|
|
13160
13189
|
"kind": "interface",
|
|
13161
13190
|
"locationInModule": {
|
|
13162
13191
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13163
|
-
"line":
|
|
13192
|
+
"line": 139
|
|
13164
13193
|
},
|
|
13165
13194
|
"name": "CognitoAuthorizerProps",
|
|
13166
13195
|
"properties": [
|
|
@@ -13173,7 +13202,7 @@
|
|
|
13173
13202
|
"immutable": true,
|
|
13174
13203
|
"locationInModule": {
|
|
13175
13204
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13176
|
-
"line":
|
|
13205
|
+
"line": 143
|
|
13177
13206
|
},
|
|
13178
13207
|
"name": "userPool",
|
|
13179
13208
|
"type": {
|
|
@@ -13190,7 +13219,7 @@
|
|
|
13190
13219
|
"immutable": true,
|
|
13191
13220
|
"locationInModule": {
|
|
13192
13221
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13193
|
-
"line":
|
|
13222
|
+
"line": 153
|
|
13194
13223
|
},
|
|
13195
13224
|
"name": "allowedAudiences",
|
|
13196
13225
|
"optional": true,
|
|
@@ -13213,7 +13242,7 @@
|
|
|
13213
13242
|
"immutable": true,
|
|
13214
13243
|
"locationInModule": {
|
|
13215
13244
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13216
|
-
"line":
|
|
13245
|
+
"line": 148
|
|
13217
13246
|
},
|
|
13218
13247
|
"name": "allowedClients",
|
|
13219
13248
|
"optional": true,
|
|
@@ -13225,6 +13254,53 @@
|
|
|
13225
13254
|
"kind": "array"
|
|
13226
13255
|
}
|
|
13227
13256
|
}
|
|
13257
|
+
},
|
|
13258
|
+
{
|
|
13259
|
+
"abstract": true,
|
|
13260
|
+
"docs": {
|
|
13261
|
+
"default": "- No scope validation",
|
|
13262
|
+
"stability": "experimental",
|
|
13263
|
+
"summary": "The allowed scopes for JWT validation."
|
|
13264
|
+
},
|
|
13265
|
+
"immutable": true,
|
|
13266
|
+
"locationInModule": {
|
|
13267
|
+
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13268
|
+
"line": 158
|
|
13269
|
+
},
|
|
13270
|
+
"name": "allowedScopes",
|
|
13271
|
+
"optional": true,
|
|
13272
|
+
"type": {
|
|
13273
|
+
"collection": {
|
|
13274
|
+
"elementtype": {
|
|
13275
|
+
"primitive": "string"
|
|
13276
|
+
},
|
|
13277
|
+
"kind": "array"
|
|
13278
|
+
}
|
|
13279
|
+
}
|
|
13280
|
+
},
|
|
13281
|
+
{
|
|
13282
|
+
"abstract": true,
|
|
13283
|
+
"docs": {
|
|
13284
|
+
"default": "- No custom claim validation",
|
|
13285
|
+
"remarks": "Allows you to validate additional fields in JWT tokens beyond the standard audience, client, and scope validations.",
|
|
13286
|
+
"stability": "experimental",
|
|
13287
|
+
"summary": "Custom claims for additional JWT token validation."
|
|
13288
|
+
},
|
|
13289
|
+
"immutable": true,
|
|
13290
|
+
"locationInModule": {
|
|
13291
|
+
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13292
|
+
"line": 164
|
|
13293
|
+
},
|
|
13294
|
+
"name": "customClaims",
|
|
13295
|
+
"optional": true,
|
|
13296
|
+
"type": {
|
|
13297
|
+
"collection": {
|
|
13298
|
+
"elementtype": {
|
|
13299
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.GatewayCustomClaim"
|
|
13300
|
+
},
|
|
13301
|
+
"kind": "array"
|
|
13302
|
+
}
|
|
13303
|
+
}
|
|
13228
13304
|
}
|
|
13229
13305
|
],
|
|
13230
13306
|
"symbolId": "lib/gateway/inbound-auth/authorizer:CognitoAuthorizerProps"
|
|
@@ -13267,12 +13343,57 @@
|
|
|
13267
13343
|
"name": "CredentialProviderType",
|
|
13268
13344
|
"symbolId": "lib/gateway/outbound-auth/credential-provider:CredentialProviderType"
|
|
13269
13345
|
},
|
|
13346
|
+
"@aws-cdk/aws-bedrock-agentcore-alpha.CustomClaimOperator": {
|
|
13347
|
+
"assembly": "@aws-cdk/aws-bedrock-agentcore-alpha",
|
|
13348
|
+
"docs": {
|
|
13349
|
+
"remarks": "Shared by Runtime and Gateway custom claim implementations.",
|
|
13350
|
+
"stability": "experimental",
|
|
13351
|
+
"summary": "Custom claim match operator.",
|
|
13352
|
+
"example": "declare const userPool: cognito.UserPool;\ndeclare const userPoolClient: cognito.UserPoolClient;\n\n// Optional: Create custom claims (CustomClaimOperator and GatewayCustomClaim from agentcore)\nconst customClaims = [\n agentcore.GatewayCustomClaim.withStringValue('department', 'engineering'),\n agentcore.GatewayCustomClaim.withStringArrayValue('roles', ['admin'], agentcore.CustomClaimOperator.CONTAINS),\n agentcore.GatewayCustomClaim.withStringArrayValue('permissions', ['read', 'write'], agentcore.CustomClaimOperator.CONTAINS_ANY),\n];\n\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCognito({\n userPool: userPool,\n allowedClients: [userPoolClient],\n allowedAudiences: [\"audience1\"],\n allowedScopes: [\"read\", \"write\"],\n customClaims: customClaims, // Optional custom claims\n }),\n});",
|
|
13353
|
+
"custom": {
|
|
13354
|
+
"exampleMetadata": "fixture=default infused"
|
|
13355
|
+
}
|
|
13356
|
+
},
|
|
13357
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.CustomClaimOperator",
|
|
13358
|
+
"kind": "enum",
|
|
13359
|
+
"locationInModule": {
|
|
13360
|
+
"filename": "lib/common/types.ts",
|
|
13361
|
+
"line": 30
|
|
13362
|
+
},
|
|
13363
|
+
"members": [
|
|
13364
|
+
{
|
|
13365
|
+
"docs": {
|
|
13366
|
+
"stability": "experimental",
|
|
13367
|
+
"summary": "Equals operator - used for STRING type claims."
|
|
13368
|
+
},
|
|
13369
|
+
"name": "EQUALS"
|
|
13370
|
+
},
|
|
13371
|
+
{
|
|
13372
|
+
"docs": {
|
|
13373
|
+
"remarks": "Checks if the claim array contains a specific string value.",
|
|
13374
|
+
"stability": "experimental",
|
|
13375
|
+
"summary": "Contains operator - used for STRING_ARRAY type claims."
|
|
13376
|
+
},
|
|
13377
|
+
"name": "CONTAINS"
|
|
13378
|
+
},
|
|
13379
|
+
{
|
|
13380
|
+
"docs": {
|
|
13381
|
+
"remarks": "Checks if the claim array contains any of the provided string values.",
|
|
13382
|
+
"stability": "experimental",
|
|
13383
|
+
"summary": "ContainsAny operator - used for STRING_ARRAY type claims."
|
|
13384
|
+
},
|
|
13385
|
+
"name": "CONTAINS_ANY"
|
|
13386
|
+
}
|
|
13387
|
+
],
|
|
13388
|
+
"name": "CustomClaimOperator",
|
|
13389
|
+
"symbolId": "lib/common/types:CustomClaimOperator"
|
|
13390
|
+
},
|
|
13270
13391
|
"@aws-cdk/aws-bedrock-agentcore-alpha.CustomJwtAuthorizer": {
|
|
13271
13392
|
"assembly": "@aws-cdk/aws-bedrock-agentcore-alpha",
|
|
13272
13393
|
"docs": {
|
|
13273
13394
|
"stability": "experimental",
|
|
13274
13395
|
"summary": "Custom JWT authorizer configuration implementation.",
|
|
13275
|
-
"example": "// The code below shows an example of how to instantiate this type.\n// The values are placeholders you should change.\nimport * as bedrock_agentcore_alpha from '@aws-cdk/aws-bedrock-agentcore-alpha';\nconst customJwtAuthorizer = new bedrock_agentcore_alpha.CustomJwtAuthorizer({\n discoveryUrl: 'discoveryUrl',\n\n // the properties below are optional\n allowedAudience: ['allowedAudience'],\n allowedClients: ['allowedClients'],\n});",
|
|
13396
|
+
"example": "// The code below shows an example of how to instantiate this type.\n// The values are placeholders you should change.\nimport * as bedrock_agentcore_alpha from '@aws-cdk/aws-bedrock-agentcore-alpha';\n\ndeclare const gatewayCustomClaim: bedrock_agentcore_alpha.GatewayCustomClaim;\nconst customJwtAuthorizer = new bedrock_agentcore_alpha.CustomJwtAuthorizer({\n discoveryUrl: 'discoveryUrl',\n\n // the properties below are optional\n allowedAudience: ['allowedAudience'],\n allowedClients: ['allowedClients'],\n allowedScopes: ['allowedScopes'],\n customClaims: [gatewayCustomClaim],\n});",
|
|
13276
13397
|
"custom": {
|
|
13277
13398
|
"exampleMetadata": "fixture=_generated"
|
|
13278
13399
|
}
|
|
@@ -13284,7 +13405,7 @@
|
|
|
13284
13405
|
},
|
|
13285
13406
|
"locationInModule": {
|
|
13286
13407
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13287
|
-
"line":
|
|
13408
|
+
"line": 88
|
|
13288
13409
|
},
|
|
13289
13410
|
"parameters": [
|
|
13290
13411
|
{
|
|
@@ -13301,7 +13422,7 @@
|
|
|
13301
13422
|
"kind": "class",
|
|
13302
13423
|
"locationInModule": {
|
|
13303
13424
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13304
|
-
"line":
|
|
13425
|
+
"line": 80
|
|
13305
13426
|
},
|
|
13306
13427
|
"name": "CustomJwtAuthorizer",
|
|
13307
13428
|
"properties": [
|
|
@@ -13313,7 +13434,7 @@
|
|
|
13313
13434
|
"immutable": true,
|
|
13314
13435
|
"locationInModule": {
|
|
13315
13436
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13316
|
-
"line":
|
|
13437
|
+
"line": 81
|
|
13317
13438
|
},
|
|
13318
13439
|
"name": "authorizerType",
|
|
13319
13440
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.IGatewayAuthorizerConfig",
|
|
@@ -13330,7 +13451,7 @@
|
|
|
13330
13451
|
"docs": {
|
|
13331
13452
|
"stability": "experimental",
|
|
13332
13453
|
"summary": "Custom JWT authorizer configuration.",
|
|
13333
|
-
"example": "// Create a
|
|
13454
|
+
"example": "// Create a custom execution role\nconst executionRole = new iam.Role(this, \"GatewayExecutionRole\", {\n assumedBy: new iam.ServicePrincipal(\"bedrock-agentcore.amazonaws.com\"),\n managedPolicies: [\n iam.ManagedPolicy.fromAwsManagedPolicyName(\"AmazonBedrockAgentCoreGatewayExecutionRolePolicy\"),\n ],\n});\n\n// Create gateway with custom execution role\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n description: \"Gateway with custom execution role\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n allowedScopes: [\"read\", \"write\"],\n }),\n role: executionRole,\n});",
|
|
13334
13455
|
"custom": {
|
|
13335
13456
|
"exampleMetadata": "fixture=default infused"
|
|
13336
13457
|
}
|
|
@@ -13339,7 +13460,7 @@
|
|
|
13339
13460
|
"kind": "interface",
|
|
13340
13461
|
"locationInModule": {
|
|
13341
13462
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13342
|
-
"line":
|
|
13463
|
+
"line": 41
|
|
13343
13464
|
},
|
|
13344
13465
|
"name": "CustomJwtConfiguration",
|
|
13345
13466
|
"properties": [
|
|
@@ -13353,7 +13474,7 @@
|
|
|
13353
13474
|
"immutable": true,
|
|
13354
13475
|
"locationInModule": {
|
|
13355
13476
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13356
|
-
"line":
|
|
13477
|
+
"line": 49
|
|
13357
13478
|
},
|
|
13358
13479
|
"name": "discoveryUrl",
|
|
13359
13480
|
"type": {
|
|
@@ -13370,7 +13491,7 @@
|
|
|
13370
13491
|
"immutable": true,
|
|
13371
13492
|
"locationInModule": {
|
|
13372
13493
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13373
|
-
"line":
|
|
13494
|
+
"line": 55
|
|
13374
13495
|
},
|
|
13375
13496
|
"name": "allowedAudience",
|
|
13376
13497
|
"optional": true,
|
|
@@ -13393,7 +13514,7 @@
|
|
|
13393
13514
|
"immutable": true,
|
|
13394
13515
|
"locationInModule": {
|
|
13395
13516
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13396
|
-
"line":
|
|
13517
|
+
"line": 61
|
|
13397
13518
|
},
|
|
13398
13519
|
"name": "allowedClients",
|
|
13399
13520
|
"optional": true,
|
|
@@ -13405,6 +13526,53 @@
|
|
|
13405
13526
|
"kind": "array"
|
|
13406
13527
|
}
|
|
13407
13528
|
}
|
|
13529
|
+
},
|
|
13530
|
+
{
|
|
13531
|
+
"abstract": true,
|
|
13532
|
+
"docs": {
|
|
13533
|
+
"default": "- No scope validation",
|
|
13534
|
+
"stability": "experimental",
|
|
13535
|
+
"summary": "Represents individual scopes that are validated in the incoming JWT token validation process."
|
|
13536
|
+
},
|
|
13537
|
+
"immutable": true,
|
|
13538
|
+
"locationInModule": {
|
|
13539
|
+
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13540
|
+
"line": 67
|
|
13541
|
+
},
|
|
13542
|
+
"name": "allowedScopes",
|
|
13543
|
+
"optional": true,
|
|
13544
|
+
"type": {
|
|
13545
|
+
"collection": {
|
|
13546
|
+
"elementtype": {
|
|
13547
|
+
"primitive": "string"
|
|
13548
|
+
},
|
|
13549
|
+
"kind": "array"
|
|
13550
|
+
}
|
|
13551
|
+
}
|
|
13552
|
+
},
|
|
13553
|
+
{
|
|
13554
|
+
"abstract": true,
|
|
13555
|
+
"docs": {
|
|
13556
|
+
"default": "- No custom claim validation",
|
|
13557
|
+
"remarks": "Allows you to validate additional fields in JWT tokens beyond the standard audience, client, and scope validations.",
|
|
13558
|
+
"stability": "experimental",
|
|
13559
|
+
"summary": "Custom claims for additional JWT token validation."
|
|
13560
|
+
},
|
|
13561
|
+
"immutable": true,
|
|
13562
|
+
"locationInModule": {
|
|
13563
|
+
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
13564
|
+
"line": 74
|
|
13565
|
+
},
|
|
13566
|
+
"name": "customClaims",
|
|
13567
|
+
"optional": true,
|
|
13568
|
+
"type": {
|
|
13569
|
+
"collection": {
|
|
13570
|
+
"elementtype": {
|
|
13571
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.GatewayCustomClaim"
|
|
13572
|
+
},
|
|
13573
|
+
"kind": "array"
|
|
13574
|
+
}
|
|
13575
|
+
}
|
|
13408
13576
|
}
|
|
13409
13577
|
],
|
|
13410
13578
|
"symbolId": "lib/gateway/inbound-auth/authorizer:CustomJwtConfiguration"
|
|
@@ -14218,7 +14386,7 @@
|
|
|
14218
14386
|
"docs": {
|
|
14219
14387
|
"stability": "experimental",
|
|
14220
14388
|
"summary": "Factory class for creating Gateway Authorizers.",
|
|
14221
|
-
"example": "// Create a KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"GatewayEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for gateway encryption\",\n});\n\n// Create gateway with KMS encryption\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-encrypted-gateway\",\n description: \"Gateway with KMS encryption\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n }),\n kmsKey: encryptionKey,\n exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,\n});",
|
|
14389
|
+
"example": "// Create a KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"GatewayEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for gateway encryption\",\n});\n\n// Create gateway with KMS encryption\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-encrypted-gateway\",\n description: \"Gateway with KMS encryption\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n allowedScopes: [\"read\", \"write\"],\n }),\n kmsKey: encryptionKey,\n exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,\n});",
|
|
14222
14390
|
"custom": {
|
|
14223
14391
|
"exampleMetadata": "fixture=default infused"
|
|
14224
14392
|
}
|
|
@@ -14232,7 +14400,7 @@
|
|
|
14232
14400
|
"kind": "class",
|
|
14233
14401
|
"locationInModule": {
|
|
14234
14402
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
14235
|
-
"line":
|
|
14403
|
+
"line": 169
|
|
14236
14404
|
},
|
|
14237
14405
|
"methods": [
|
|
14238
14406
|
{
|
|
@@ -14242,7 +14410,7 @@
|
|
|
14242
14410
|
},
|
|
14243
14411
|
"locationInModule": {
|
|
14244
14412
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
14245
|
-
"line":
|
|
14413
|
+
"line": 173
|
|
14246
14414
|
},
|
|
14247
14415
|
"name": "usingAwsIam",
|
|
14248
14416
|
"returns": {
|
|
@@ -14260,7 +14428,7 @@
|
|
|
14260
14428
|
},
|
|
14261
14429
|
"locationInModule": {
|
|
14262
14430
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
14263
|
-
"line":
|
|
14431
|
+
"line": 195
|
|
14264
14432
|
},
|
|
14265
14433
|
"name": "usingCognito",
|
|
14266
14434
|
"parameters": [
|
|
@@ -14289,7 +14457,7 @@
|
|
|
14289
14457
|
},
|
|
14290
14458
|
"locationInModule": {
|
|
14291
14459
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
14292
|
-
"line":
|
|
14460
|
+
"line": 182
|
|
14293
14461
|
},
|
|
14294
14462
|
"name": "usingCustomJwt",
|
|
14295
14463
|
"parameters": [
|
|
@@ -14324,7 +14492,7 @@
|
|
|
14324
14492
|
"kind": "enum",
|
|
14325
14493
|
"locationInModule": {
|
|
14326
14494
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
14327
|
-
"line":
|
|
14495
|
+
"line": 12
|
|
14328
14496
|
},
|
|
14329
14497
|
"members": [
|
|
14330
14498
|
{
|
|
@@ -15150,64 +15318,180 @@
|
|
|
15150
15318
|
"name": "GatewayCredentialProvider",
|
|
15151
15319
|
"symbolId": "lib/gateway/outbound-auth/credential-provider:GatewayCredentialProvider"
|
|
15152
15320
|
},
|
|
15153
|
-
"@aws-cdk/aws-bedrock-agentcore-alpha.
|
|
15321
|
+
"@aws-cdk/aws-bedrock-agentcore-alpha.GatewayCustomClaim": {
|
|
15154
15322
|
"assembly": "@aws-cdk/aws-bedrock-agentcore-alpha",
|
|
15155
15323
|
"docs": {
|
|
15324
|
+
"remarks": "Custom claims allow you to validate additional fields in JWT tokens beyond\nthe standard audience, client, and scope validations.",
|
|
15156
15325
|
"stability": "experimental",
|
|
15157
|
-
"summary": "
|
|
15158
|
-
"example": "// Create
|
|
15326
|
+
"summary": "Represents a custom claim validation configuration for Gateway JWT authorizers.",
|
|
15327
|
+
"example": "\n// Optional: Create custom claims (CustomClaimOperator and GatewayCustomClaim from agentcore)\nconst customClaims = [\n agentcore.GatewayCustomClaim.withStringValue('department', 'engineering'),\n agentcore.GatewayCustomClaim.withStringArrayValue('roles', ['admin'], agentcore.CustomClaimOperator.CONTAINS),\n agentcore.GatewayCustomClaim.withStringArrayValue('permissions', ['read', 'write'], agentcore.CustomClaimOperator.CONTAINS_ANY),\n];\n\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n allowedScopes: [\"read\", \"write\"],\n customClaims: customClaims, // Optional custom claims\n }),\n});",
|
|
15159
15328
|
"custom": {
|
|
15160
15329
|
"exampleMetadata": "fixture=default infused"
|
|
15161
15330
|
}
|
|
15162
15331
|
},
|
|
15163
|
-
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.
|
|
15164
|
-
"kind": "
|
|
15332
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.GatewayCustomClaim",
|
|
15333
|
+
"kind": "class",
|
|
15165
15334
|
"locationInModule": {
|
|
15166
|
-
"filename": "lib/gateway/
|
|
15167
|
-
"line":
|
|
15335
|
+
"filename": "lib/gateway/inbound-auth/custom-claim.ts",
|
|
15336
|
+
"line": 24
|
|
15168
15337
|
},
|
|
15169
|
-
"
|
|
15338
|
+
"methods": [
|
|
15170
15339
|
{
|
|
15171
15340
|
"docs": {
|
|
15172
|
-
"remarks": "
|
|
15341
|
+
"remarks": "String array claims can use CONTAINS (default) or CONTAINS_ANY operator.",
|
|
15342
|
+
"returns": "A GatewayCustomClaim configured for string array validation",
|
|
15173
15343
|
"stability": "experimental",
|
|
15174
|
-
"summary": "
|
|
15344
|
+
"summary": "Create a custom claim with a string array value."
|
|
15175
15345
|
},
|
|
15176
|
-
"
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
|
|
15200
|
-
|
|
15346
|
+
"locationInModule": {
|
|
15347
|
+
"filename": "lib/gateway/inbound-auth/custom-claim.ts",
|
|
15348
|
+
"line": 46
|
|
15349
|
+
},
|
|
15350
|
+
"name": "withStringArrayValue",
|
|
15351
|
+
"parameters": [
|
|
15352
|
+
{
|
|
15353
|
+
"docs": {
|
|
15354
|
+
"summary": "The name of the claim in the JWT token."
|
|
15355
|
+
},
|
|
15356
|
+
"name": "name",
|
|
15357
|
+
"type": {
|
|
15358
|
+
"primitive": "string"
|
|
15359
|
+
}
|
|
15360
|
+
},
|
|
15361
|
+
{
|
|
15362
|
+
"docs": {
|
|
15363
|
+
"remarks": "For CONTAINS operator, must contain exactly one value.",
|
|
15364
|
+
"summary": "The array of string values to match."
|
|
15365
|
+
},
|
|
15366
|
+
"name": "values",
|
|
15367
|
+
"type": {
|
|
15368
|
+
"collection": {
|
|
15369
|
+
"elementtype": {
|
|
15370
|
+
"primitive": "string"
|
|
15371
|
+
},
|
|
15372
|
+
"kind": "array"
|
|
15373
|
+
}
|
|
15374
|
+
}
|
|
15375
|
+
},
|
|
15376
|
+
{
|
|
15377
|
+
"docs": {
|
|
15378
|
+
"summary": "The match operator (defaults to CONTAINS)."
|
|
15379
|
+
},
|
|
15380
|
+
"name": "operator",
|
|
15381
|
+
"optional": true,
|
|
15382
|
+
"type": {
|
|
15383
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.CustomClaimOperator"
|
|
15384
|
+
}
|
|
15385
|
+
}
|
|
15386
|
+
],
|
|
15387
|
+
"returns": {
|
|
15388
|
+
"type": {
|
|
15389
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.GatewayCustomClaim"
|
|
15390
|
+
}
|
|
15391
|
+
},
|
|
15392
|
+
"static": true
|
|
15393
|
+
},
|
|
15201
15394
|
{
|
|
15202
|
-
"abstract": true,
|
|
15203
15395
|
"docs": {
|
|
15204
|
-
"
|
|
15396
|
+
"remarks": "String claims must use the EQUALS operator.",
|
|
15397
|
+
"returns": "A GatewayCustomClaim configured for string validation",
|
|
15205
15398
|
"stability": "experimental",
|
|
15206
|
-
"summary": "
|
|
15399
|
+
"summary": "Create a custom claim with a string value."
|
|
15207
15400
|
},
|
|
15208
|
-
"immutable": true,
|
|
15209
15401
|
"locationInModule": {
|
|
15210
|
-
"filename": "lib/gateway/
|
|
15402
|
+
"filename": "lib/gateway/inbound-auth/custom-claim.ts",
|
|
15403
|
+
"line": 33
|
|
15404
|
+
},
|
|
15405
|
+
"name": "withStringValue",
|
|
15406
|
+
"parameters": [
|
|
15407
|
+
{
|
|
15408
|
+
"docs": {
|
|
15409
|
+
"summary": "The name of the claim in the JWT token."
|
|
15410
|
+
},
|
|
15411
|
+
"name": "name",
|
|
15412
|
+
"type": {
|
|
15413
|
+
"primitive": "string"
|
|
15414
|
+
}
|
|
15415
|
+
},
|
|
15416
|
+
{
|
|
15417
|
+
"docs": {
|
|
15418
|
+
"summary": "The string value to match (must exactly equal)."
|
|
15419
|
+
},
|
|
15420
|
+
"name": "value",
|
|
15421
|
+
"type": {
|
|
15422
|
+
"primitive": "string"
|
|
15423
|
+
}
|
|
15424
|
+
}
|
|
15425
|
+
],
|
|
15426
|
+
"returns": {
|
|
15427
|
+
"type": {
|
|
15428
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.GatewayCustomClaim"
|
|
15429
|
+
}
|
|
15430
|
+
},
|
|
15431
|
+
"static": true
|
|
15432
|
+
}
|
|
15433
|
+
],
|
|
15434
|
+
"name": "GatewayCustomClaim",
|
|
15435
|
+
"symbolId": "lib/gateway/inbound-auth/custom-claim:GatewayCustomClaim"
|
|
15436
|
+
},
|
|
15437
|
+
"@aws-cdk/aws-bedrock-agentcore-alpha.GatewayExceptionLevel": {
|
|
15438
|
+
"assembly": "@aws-cdk/aws-bedrock-agentcore-alpha",
|
|
15439
|
+
"docs": {
|
|
15440
|
+
"stability": "experimental",
|
|
15441
|
+
"summary": "Exception levels for gateway.",
|
|
15442
|
+
"example": "// Create a KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"GatewayEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for gateway encryption\",\n});\n\n// Create gateway with KMS encryption\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-encrypted-gateway\",\n description: \"Gateway with KMS encryption\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n allowedScopes: [\"read\", \"write\"],\n }),\n kmsKey: encryptionKey,\n exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,\n});",
|
|
15443
|
+
"custom": {
|
|
15444
|
+
"exampleMetadata": "fixture=default infused"
|
|
15445
|
+
}
|
|
15446
|
+
},
|
|
15447
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.GatewayExceptionLevel",
|
|
15448
|
+
"kind": "enum",
|
|
15449
|
+
"locationInModule": {
|
|
15450
|
+
"filename": "lib/gateway/gateway-base.ts",
|
|
15451
|
+
"line": 17
|
|
15452
|
+
},
|
|
15453
|
+
"members": [
|
|
15454
|
+
{
|
|
15455
|
+
"docs": {
|
|
15456
|
+
"remarks": "Allows the return of\nspecific error messages related to the gateway target configuration\nto help you with debugging.",
|
|
15457
|
+
"stability": "experimental",
|
|
15458
|
+
"summary": "Debug mode for granular exception messages."
|
|
15459
|
+
},
|
|
15460
|
+
"name": "DEBUG"
|
|
15461
|
+
}
|
|
15462
|
+
],
|
|
15463
|
+
"name": "GatewayExceptionLevel",
|
|
15464
|
+
"symbolId": "lib/gateway/gateway-base:GatewayExceptionLevel"
|
|
15465
|
+
},
|
|
15466
|
+
"@aws-cdk/aws-bedrock-agentcore-alpha.GatewayProps": {
|
|
15467
|
+
"assembly": "@aws-cdk/aws-bedrock-agentcore-alpha",
|
|
15468
|
+
"datatype": true,
|
|
15469
|
+
"docs": {
|
|
15470
|
+
"stability": "experimental",
|
|
15471
|
+
"summary": "Properties for defining a Gateway.",
|
|
15472
|
+
"example": "const gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-gateway\",\n});\n\nconst lambdaFunction = new lambda.Function(this, \"MyFunction\", {\n runtime: lambda.Runtime.NODEJS_22_X,\n handler: \"index.handler\",\n code: lambda.Code.fromInline(`\n exports.handler = async (event) => {\n return {\n statusCode: 200,\n body: JSON.stringify({ message: 'Hello from Lambda!' })\n };\n };\n `),\n});\n\n// Create a gateway target with Lambda and tool schema\nconst target = agentcore.GatewayTarget.forLambda(this, \"MyLambdaTarget\", {\n gatewayTargetName: \"my-lambda-target\",\n description: \"Target for Lambda function integration\",\n gateway: gateway,\n lambdaFunction: lambdaFunction,\n toolSchema: agentcore.ToolSchema.fromLocalAsset(\n path.join(__dirname, \"schemas\", \"my-tool-schema.json\")\n ),\n});",
|
|
15473
|
+
"custom": {
|
|
15474
|
+
"exampleMetadata": "fixture=default infused"
|
|
15475
|
+
}
|
|
15476
|
+
},
|
|
15477
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.GatewayProps",
|
|
15478
|
+
"kind": "interface",
|
|
15479
|
+
"locationInModule": {
|
|
15480
|
+
"filename": "lib/gateway/gateway.ts",
|
|
15481
|
+
"line": 165
|
|
15482
|
+
},
|
|
15483
|
+
"name": "GatewayProps",
|
|
15484
|
+
"properties": [
|
|
15485
|
+
{
|
|
15486
|
+
"abstract": true,
|
|
15487
|
+
"docs": {
|
|
15488
|
+
"default": "- A default authorizer will be created using Cognito",
|
|
15489
|
+
"stability": "experimental",
|
|
15490
|
+
"summary": "The authorizer configuration for the gateway."
|
|
15491
|
+
},
|
|
15492
|
+
"immutable": true,
|
|
15493
|
+
"locationInModule": {
|
|
15494
|
+
"filename": "lib/gateway/gateway.ts",
|
|
15211
15495
|
"line": 195
|
|
15212
15496
|
},
|
|
15213
15497
|
"name": "authorizerConfiguration",
|
|
@@ -19501,7 +19785,7 @@
|
|
|
19501
19785
|
"kind": "interface",
|
|
19502
19786
|
"locationInModule": {
|
|
19503
19787
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
19504
|
-
"line":
|
|
19788
|
+
"line": 22
|
|
19505
19789
|
},
|
|
19506
19790
|
"name": "IGatewayAuthorizerConfig",
|
|
19507
19791
|
"properties": [
|
|
@@ -19514,7 +19798,7 @@
|
|
|
19514
19798
|
"immutable": true,
|
|
19515
19799
|
"locationInModule": {
|
|
19516
19800
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
19517
|
-
"line":
|
|
19801
|
+
"line": 26
|
|
19518
19802
|
},
|
|
19519
19803
|
"name": "authorizerType",
|
|
19520
19804
|
"type": {
|
|
@@ -20977,7 +21261,7 @@
|
|
|
20977
21261
|
"kind": "class",
|
|
20978
21262
|
"locationInModule": {
|
|
20979
21263
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
20980
|
-
"line":
|
|
21264
|
+
"line": 122
|
|
20981
21265
|
},
|
|
20982
21266
|
"name": "IamAuthorizer",
|
|
20983
21267
|
"properties": [
|
|
@@ -20989,7 +21273,7 @@
|
|
|
20989
21273
|
"immutable": true,
|
|
20990
21274
|
"locationInModule": {
|
|
20991
21275
|
"filename": "lib/gateway/inbound-auth/authorizer.ts",
|
|
20992
|
-
"line":
|
|
21276
|
+
"line": 123
|
|
20993
21277
|
},
|
|
20994
21278
|
"name": "authorizerType",
|
|
20995
21279
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.IGatewayAuthorizerConfig",
|
|
@@ -21019,7 +21303,7 @@
|
|
|
21019
21303
|
},
|
|
21020
21304
|
"locationInModule": {
|
|
21021
21305
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
21022
|
-
"line":
|
|
21306
|
+
"line": 163
|
|
21023
21307
|
},
|
|
21024
21308
|
"parameters": [
|
|
21025
21309
|
{
|
|
@@ -21033,7 +21317,7 @@
|
|
|
21033
21317
|
"kind": "class",
|
|
21034
21318
|
"locationInModule": {
|
|
21035
21319
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
21036
|
-
"line":
|
|
21320
|
+
"line": 162
|
|
21037
21321
|
},
|
|
21038
21322
|
"methods": [
|
|
21039
21323
|
{
|
|
@@ -21043,7 +21327,7 @@
|
|
|
21043
21327
|
},
|
|
21044
21328
|
"locationInModule": {
|
|
21045
21329
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
21046
|
-
"line":
|
|
21330
|
+
"line": 180
|
|
21047
21331
|
},
|
|
21048
21332
|
"name": "bind",
|
|
21049
21333
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.ApiSchema",
|
|
@@ -21063,7 +21347,7 @@
|
|
|
21063
21347
|
},
|
|
21064
21348
|
"locationInModule": {
|
|
21065
21349
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
21066
|
-
"line":
|
|
21350
|
+
"line": 176
|
|
21067
21351
|
},
|
|
21068
21352
|
"name": "grantPermissionsToRole",
|
|
21069
21353
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.ApiSchema",
|
|
@@ -21099,7 +21383,7 @@
|
|
|
21099
21383
|
},
|
|
21100
21384
|
"locationInModule": {
|
|
21101
21385
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
21102
|
-
"line":
|
|
21386
|
+
"line": 263
|
|
21103
21387
|
},
|
|
21104
21388
|
"parameters": [
|
|
21105
21389
|
{
|
|
@@ -21118,7 +21402,7 @@
|
|
|
21118
21402
|
"kind": "class",
|
|
21119
21403
|
"locationInModule": {
|
|
21120
21404
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
21121
|
-
"line":
|
|
21405
|
+
"line": 262
|
|
21122
21406
|
},
|
|
21123
21407
|
"methods": [
|
|
21124
21408
|
{
|
|
@@ -21128,7 +21412,7 @@
|
|
|
21128
21412
|
},
|
|
21129
21413
|
"locationInModule": {
|
|
21130
21414
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
21131
|
-
"line":
|
|
21415
|
+
"line": 276
|
|
21132
21416
|
},
|
|
21133
21417
|
"name": "bind",
|
|
21134
21418
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.ToolSchema",
|
|
@@ -21148,7 +21432,7 @@
|
|
|
21148
21432
|
},
|
|
21149
21433
|
"locationInModule": {
|
|
21150
21434
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
21151
|
-
"line":
|
|
21435
|
+
"line": 282
|
|
21152
21436
|
},
|
|
21153
21437
|
"name": "grantPermissionsToRole",
|
|
21154
21438
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.ToolSchema",
|
|
@@ -21746,7 +22030,7 @@
|
|
|
21746
22030
|
"remarks": "The Model Context Protocol uses string-based version identifiers following the format YYYY-MM-DD,\nto indicate the last date backwards incompatible changes were made.\nVersions are available at https://github.com/modelcontextprotocol/modelcontextprotocol/releases",
|
|
21747
22031
|
"stability": "experimental",
|
|
21748
22032
|
"summary": "MCP protocol versions.",
|
|
21749
|
-
"example": "// Create a KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"GatewayEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for gateway encryption\",\n});\n\n// Create gateway with KMS encryption\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-encrypted-gateway\",\n description: \"Gateway with KMS encryption\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n }),\n kmsKey: encryptionKey,\n exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,\n});",
|
|
22033
|
+
"example": "// Create a KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"GatewayEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for gateway encryption\",\n});\n\n// Create gateway with KMS encryption\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-encrypted-gateway\",\n description: \"Gateway with KMS encryption\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n allowedScopes: [\"read\", \"write\"],\n }),\n kmsKey: encryptionKey,\n exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,\n});",
|
|
21750
22034
|
"custom": {
|
|
21751
22035
|
"exampleMetadata": "fixture=default infused"
|
|
21752
22036
|
}
|
|
@@ -22109,7 +22393,7 @@
|
|
|
22109
22393
|
"remarks": "This protocol enables communication between Amazon Bedrock Agent and external tools.",
|
|
22110
22394
|
"stability": "experimental",
|
|
22111
22395
|
"summary": "MCP protocol configuration The configuration for the Model Context Protocol (MCP).",
|
|
22112
|
-
"example": "// Create a KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"GatewayEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for gateway encryption\",\n});\n\n// Create gateway with KMS encryption\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-encrypted-gateway\",\n description: \"Gateway with KMS encryption\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n }),\n kmsKey: encryptionKey,\n exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,\n});",
|
|
22396
|
+
"example": "// Create a KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"GatewayEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for gateway encryption\",\n});\n\n// Create gateway with KMS encryption\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-encrypted-gateway\",\n description: \"Gateway with KMS encryption\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n allowedScopes: [\"read\", \"write\"],\n }),\n kmsKey: encryptionKey,\n exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,\n});",
|
|
22113
22397
|
"custom": {
|
|
22114
22398
|
"exampleMetadata": "fixture=default infused"
|
|
22115
22399
|
}
|
|
@@ -22192,7 +22476,7 @@
|
|
|
22192
22476
|
"docs": {
|
|
22193
22477
|
"stability": "experimental",
|
|
22194
22478
|
"summary": "Search types supported by MCP gateway.",
|
|
22195
|
-
"example": "// Create a KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"GatewayEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for gateway encryption\",\n});\n\n// Create gateway with KMS encryption\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-encrypted-gateway\",\n description: \"Gateway with KMS encryption\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n }),\n kmsKey: encryptionKey,\n exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,\n});",
|
|
22479
|
+
"example": "// Create a KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"GatewayEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for gateway encryption\",\n});\n\n// Create gateway with KMS encryption\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-encrypted-gateway\",\n description: \"Gateway with KMS encryption\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n allowedScopes: [\"read\", \"write\"],\n }),\n kmsKey: encryptionKey,\n exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,\n});",
|
|
22196
22480
|
"custom": {
|
|
22197
22481
|
"exampleMetadata": "fixture=default infused"
|
|
22198
22482
|
}
|
|
@@ -22221,7 +22505,7 @@
|
|
|
22221
22505
|
"docs": {
|
|
22222
22506
|
"stability": "experimental",
|
|
22223
22507
|
"summary": "MCP (Model Context Protocol) configuration implementation.",
|
|
22224
|
-
"example": "// Create a KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"GatewayEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for gateway encryption\",\n});\n\n// Create gateway with KMS encryption\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-encrypted-gateway\",\n description: \"Gateway with KMS encryption\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n }),\n kmsKey: encryptionKey,\n exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,\n});",
|
|
22508
|
+
"example": "// Create a KMS key for encryption\nconst encryptionKey = new kms.Key(this, \"GatewayEncryptionKey\", {\n enableKeyRotation: true,\n description: \"KMS key for gateway encryption\",\n});\n\n// Create gateway with KMS encryption\nconst gateway = new agentcore.Gateway(this, \"MyGateway\", {\n gatewayName: \"my-encrypted-gateway\",\n description: \"Gateway with KMS encryption\",\n protocolConfiguration: new agentcore.McpProtocolConfiguration({\n instructions: \"Use this gateway to connect to external MCP tools\",\n searchType: agentcore.McpGatewaySearchType.SEMANTIC,\n supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],\n }),\n authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({\n discoveryUrl: \"https://auth.example.com/.well-known/openid-configuration\",\n allowedAudience: [\"my-app\"],\n allowedClients: [\"my-client-id\"],\n allowedScopes: [\"read\", \"write\"],\n }),\n kmsKey: encryptionKey,\n exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,\n});",
|
|
22225
22509
|
"custom": {
|
|
22226
22510
|
"exampleMetadata": "fixture=default infused"
|
|
22227
22511
|
}
|
|
@@ -25018,7 +25302,7 @@
|
|
|
25018
25302
|
"see": "https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime.html",
|
|
25019
25303
|
"stability": "experimental",
|
|
25020
25304
|
"summary": "Bedrock Agent Core Runtime Enables running containerized agents with specific network configurations, security settings, and runtime artifacts.",
|
|
25021
|
-
"example": "
|
|
25305
|
+
"example": "// S3 bucket containing the agent core\nconst codeBucket = new s3.Bucket(this, \"AgentCode\", {\n bucketName: \"my-code-bucket\",\n removalPolicy: RemovalPolicy.DESTROY, // For demo purposes\n});\n\n// the bucket above needs to contain the agent code\n\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromS3(\n {\n bucketName: codeBucket.bucketName,\n objectKey: 'deployment_package.zip',\n },\n agentcore.AgentCoreRuntime.PYTHON_3_12,\n ['opentelemetry-instrument', 'main.py']\n);\n\nconst runtimeInstance = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n});"
|
|
25022
25306
|
},
|
|
25023
25307
|
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.Runtime",
|
|
25024
25308
|
"initializer": {
|
|
@@ -25027,7 +25311,7 @@
|
|
|
25027
25311
|
},
|
|
25028
25312
|
"locationInModule": {
|
|
25029
25313
|
"filename": "lib/runtime/runtime.ts",
|
|
25030
|
-
"line":
|
|
25314
|
+
"line": 260
|
|
25031
25315
|
},
|
|
25032
25316
|
"parameters": [
|
|
25033
25317
|
{
|
|
@@ -25053,7 +25337,7 @@
|
|
|
25053
25337
|
"kind": "class",
|
|
25054
25338
|
"locationInModule": {
|
|
25055
25339
|
"filename": "lib/runtime/runtime.ts",
|
|
25056
|
-
"line":
|
|
25340
|
+
"line": 155
|
|
25057
25341
|
},
|
|
25058
25342
|
"methods": [
|
|
25059
25343
|
{
|
|
@@ -25064,7 +25348,7 @@
|
|
|
25064
25348
|
},
|
|
25065
25349
|
"locationInModule": {
|
|
25066
25350
|
"filename": "lib/runtime/runtime.ts",
|
|
25067
|
-
"line":
|
|
25351
|
+
"line": 169
|
|
25068
25352
|
},
|
|
25069
25353
|
"name": "fromAgentRuntimeAttributes",
|
|
25070
25354
|
"parameters": [
|
|
@@ -25111,7 +25395,7 @@
|
|
|
25111
25395
|
},
|
|
25112
25396
|
"locationInModule": {
|
|
25113
25397
|
"filename": "lib/runtime/runtime.ts",
|
|
25114
|
-
"line":
|
|
25398
|
+
"line": 827
|
|
25115
25399
|
},
|
|
25116
25400
|
"name": "addEndpoint",
|
|
25117
25401
|
"parameters": [
|
|
@@ -25153,7 +25437,7 @@
|
|
|
25153
25437
|
"immutable": true,
|
|
25154
25438
|
"locationInModule": {
|
|
25155
25439
|
"filename": "lib/runtime/runtime.ts",
|
|
25156
|
-
"line":
|
|
25440
|
+
"line": 158
|
|
25157
25441
|
},
|
|
25158
25442
|
"name": "PROPERTY_INJECTION_ID",
|
|
25159
25443
|
"static": true,
|
|
@@ -25173,7 +25457,7 @@
|
|
|
25173
25457
|
"immutable": true,
|
|
25174
25458
|
"locationInModule": {
|
|
25175
25459
|
"filename": "lib/runtime/runtime.ts",
|
|
25176
|
-
"line":
|
|
25460
|
+
"line": 207
|
|
25177
25461
|
},
|
|
25178
25462
|
"name": "agentRuntimeArn",
|
|
25179
25463
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeBase",
|
|
@@ -25189,7 +25473,7 @@
|
|
|
25189
25473
|
"immutable": true,
|
|
25190
25474
|
"locationInModule": {
|
|
25191
25475
|
"filename": "lib/runtime/runtime.ts",
|
|
25192
|
-
"line":
|
|
25476
|
+
"line": 254
|
|
25193
25477
|
},
|
|
25194
25478
|
"name": "agentRuntimeArtifact",
|
|
25195
25479
|
"type": {
|
|
@@ -25208,7 +25492,7 @@
|
|
|
25208
25492
|
"immutable": true,
|
|
25209
25493
|
"locationInModule": {
|
|
25210
25494
|
"filename": "lib/runtime/runtime.ts",
|
|
25211
|
-
"line":
|
|
25495
|
+
"line": 213
|
|
25212
25496
|
},
|
|
25213
25497
|
"name": "agentRuntimeId",
|
|
25214
25498
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeBase",
|
|
@@ -25228,7 +25512,7 @@
|
|
|
25228
25512
|
"immutable": true,
|
|
25229
25513
|
"locationInModule": {
|
|
25230
25514
|
"filename": "lib/runtime/runtime.ts",
|
|
25231
|
-
"line":
|
|
25515
|
+
"line": 219
|
|
25232
25516
|
},
|
|
25233
25517
|
"name": "agentRuntimeName",
|
|
25234
25518
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeBase",
|
|
@@ -25244,7 +25528,7 @@
|
|
|
25244
25528
|
"immutable": true,
|
|
25245
25529
|
"locationInModule": {
|
|
25246
25530
|
"filename": "lib/runtime/runtime.ts",
|
|
25247
|
-
"line":
|
|
25531
|
+
"line": 249
|
|
25248
25532
|
},
|
|
25249
25533
|
"name": "grantPrincipal",
|
|
25250
25534
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeBase",
|
|
@@ -25260,7 +25544,7 @@
|
|
|
25260
25544
|
"immutable": true,
|
|
25261
25545
|
"locationInModule": {
|
|
25262
25546
|
"filename": "lib/runtime/runtime.ts",
|
|
25263
|
-
"line":
|
|
25547
|
+
"line": 220
|
|
25264
25548
|
},
|
|
25265
25549
|
"name": "role",
|
|
25266
25550
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeBase",
|
|
@@ -25280,7 +25564,7 @@
|
|
|
25280
25564
|
"immutable": true,
|
|
25281
25565
|
"locationInModule": {
|
|
25282
25566
|
"filename": "lib/runtime/runtime.ts",
|
|
25283
|
-
"line":
|
|
25567
|
+
"line": 226
|
|
25284
25568
|
},
|
|
25285
25569
|
"name": "agentRuntimeVersion",
|
|
25286
25570
|
"optional": true,
|
|
@@ -25301,7 +25585,7 @@
|
|
|
25301
25585
|
"immutable": true,
|
|
25302
25586
|
"locationInModule": {
|
|
25303
25587
|
"filename": "lib/runtime/runtime.ts",
|
|
25304
|
-
"line":
|
|
25588
|
+
"line": 232
|
|
25305
25589
|
},
|
|
25306
25590
|
"name": "agentStatus",
|
|
25307
25591
|
"optional": true,
|
|
@@ -25322,7 +25606,7 @@
|
|
|
25322
25606
|
"immutable": true,
|
|
25323
25607
|
"locationInModule": {
|
|
25324
25608
|
"filename": "lib/runtime/runtime.ts",
|
|
25325
|
-
"line":
|
|
25609
|
+
"line": 242
|
|
25326
25610
|
},
|
|
25327
25611
|
"name": "createdAt",
|
|
25328
25612
|
"optional": true,
|
|
@@ -25339,7 +25623,7 @@
|
|
|
25339
25623
|
"immutable": true,
|
|
25340
25624
|
"locationInModule": {
|
|
25341
25625
|
"filename": "lib/runtime/runtime.ts",
|
|
25342
|
-
"line":
|
|
25626
|
+
"line": 236
|
|
25343
25627
|
},
|
|
25344
25628
|
"name": "description",
|
|
25345
25629
|
"optional": true,
|
|
@@ -25359,7 +25643,7 @@
|
|
|
25359
25643
|
"immutable": true,
|
|
25360
25644
|
"locationInModule": {
|
|
25361
25645
|
"filename": "lib/runtime/runtime.ts",
|
|
25362
|
-
"line":
|
|
25646
|
+
"line": 248
|
|
25363
25647
|
},
|
|
25364
25648
|
"name": "lastUpdatedAt",
|
|
25365
25649
|
"optional": true,
|
|
@@ -25378,7 +25662,7 @@
|
|
|
25378
25662
|
"remarks": "Provides static factory methods to create different authentication types.",
|
|
25379
25663
|
"stability": "experimental",
|
|
25380
25664
|
"summary": "Abstract base class for runtime authorizer configurations.",
|
|
25381
|
-
"example": "const repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.
|
|
25665
|
+
"example": "const repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// String claim - validates that the claim exactly equals the specified value\n// Uses EQUALS operator automatically\nconst departmentClaim = agentcore.RuntimeCustomClaim.withStringValue('department', 'engineering');\n\n// String array claim with CONTAINS operator (default)\n// Validates that the claim array contains a specific string value\n// IMPORTANT: CONTAINS requires exactly one value in the array parameter\nconst rolesClaim = agentcore.RuntimeCustomClaim.withStringArrayValue('roles', ['admin']);\n\n// String array claim with CONTAINS_ANY operator\n// Validates that the claim array contains at least one of the specified values\n// Use this when you want to check for multiple possible values\nconst permissionsClaim = agentcore.RuntimeCustomClaim.withStringArrayValue(\n 'permissions',\n ['read', 'write'],\n agentcore.CustomClaimOperator.CONTAINS_ANY\n);\n\n// Use custom claims in authorizer configuration\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingJWT(\n \"https://example.com/.well-known/openid-configuration\",\n [\"client1\", \"client2\"],\n [\"audience1\"],\n [\"read\", \"write\"],\n [departmentClaim, rolesClaim, permissionsClaim] // Custom claims\n ),\n});",
|
|
25382
25666
|
"custom": {
|
|
25383
25667
|
"exampleMetadata": "fixture=default infused"
|
|
25384
25668
|
}
|
|
@@ -25391,8 +25675,8 @@
|
|
|
25391
25675
|
},
|
|
25392
25676
|
"kind": "class",
|
|
25393
25677
|
"locationInModule": {
|
|
25394
|
-
"filename": "lib/runtime/runtime-authorizer-configuration.ts",
|
|
25395
|
-
"line":
|
|
25678
|
+
"filename": "lib/runtime/inbound-auth/runtime-authorizer-configuration.ts",
|
|
25679
|
+
"line": 24
|
|
25396
25680
|
},
|
|
25397
25681
|
"methods": [
|
|
25398
25682
|
{
|
|
@@ -25403,8 +25687,8 @@
|
|
|
25403
25687
|
"summary": "Use AWS Cognito User Pool authentication."
|
|
25404
25688
|
},
|
|
25405
25689
|
"locationInModule": {
|
|
25406
|
-
"filename": "lib/runtime/runtime-authorizer-configuration.ts",
|
|
25407
|
-
"line":
|
|
25690
|
+
"filename": "lib/runtime/inbound-auth/runtime-authorizer-configuration.ts",
|
|
25691
|
+
"line": 70
|
|
25408
25692
|
},
|
|
25409
25693
|
"name": "usingCognito",
|
|
25410
25694
|
"parameters": [
|
|
@@ -25445,6 +25729,36 @@
|
|
|
25445
25729
|
"kind": "array"
|
|
25446
25730
|
}
|
|
25447
25731
|
}
|
|
25732
|
+
},
|
|
25733
|
+
{
|
|
25734
|
+
"docs": {
|
|
25735
|
+
"summary": "Optional array of allowed scopes."
|
|
25736
|
+
},
|
|
25737
|
+
"name": "allowedScopes",
|
|
25738
|
+
"optional": true,
|
|
25739
|
+
"type": {
|
|
25740
|
+
"collection": {
|
|
25741
|
+
"elementtype": {
|
|
25742
|
+
"primitive": "string"
|
|
25743
|
+
},
|
|
25744
|
+
"kind": "array"
|
|
25745
|
+
}
|
|
25746
|
+
}
|
|
25747
|
+
},
|
|
25748
|
+
{
|
|
25749
|
+
"docs": {
|
|
25750
|
+
"summary": "Optional array of custom claim validations."
|
|
25751
|
+
},
|
|
25752
|
+
"name": "customClaims",
|
|
25753
|
+
"optional": true,
|
|
25754
|
+
"type": {
|
|
25755
|
+
"collection": {
|
|
25756
|
+
"elementtype": {
|
|
25757
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeCustomClaim"
|
|
25758
|
+
},
|
|
25759
|
+
"kind": "array"
|
|
25760
|
+
}
|
|
25761
|
+
}
|
|
25448
25762
|
}
|
|
25449
25763
|
],
|
|
25450
25764
|
"returns": {
|
|
@@ -25462,8 +25776,8 @@
|
|
|
25462
25776
|
"summary": "Use IAM authentication (default)."
|
|
25463
25777
|
},
|
|
25464
25778
|
"locationInModule": {
|
|
25465
|
-
"filename": "lib/runtime/runtime-authorizer-configuration.ts",
|
|
25466
|
-
"line":
|
|
25779
|
+
"filename": "lib/runtime/inbound-auth/runtime-authorizer-configuration.ts",
|
|
25780
|
+
"line": 31
|
|
25467
25781
|
},
|
|
25468
25782
|
"name": "usingIAM",
|
|
25469
25783
|
"returns": {
|
|
@@ -25481,8 +25795,8 @@
|
|
|
25481
25795
|
"summary": "Use custom JWT authentication."
|
|
25482
25796
|
},
|
|
25483
25797
|
"locationInModule": {
|
|
25484
|
-
"filename": "lib/runtime/runtime-authorizer-configuration.ts",
|
|
25485
|
-
"line":
|
|
25798
|
+
"filename": "lib/runtime/inbound-auth/runtime-authorizer-configuration.ts",
|
|
25799
|
+
"line": 46
|
|
25486
25800
|
},
|
|
25487
25801
|
"name": "usingJWT",
|
|
25488
25802
|
"parameters": [
|
|
@@ -25524,6 +25838,36 @@
|
|
|
25524
25838
|
"kind": "array"
|
|
25525
25839
|
}
|
|
25526
25840
|
}
|
|
25841
|
+
},
|
|
25842
|
+
{
|
|
25843
|
+
"docs": {
|
|
25844
|
+
"summary": "Optional array of allowed scopes."
|
|
25845
|
+
},
|
|
25846
|
+
"name": "allowedScopes",
|
|
25847
|
+
"optional": true,
|
|
25848
|
+
"type": {
|
|
25849
|
+
"collection": {
|
|
25850
|
+
"elementtype": {
|
|
25851
|
+
"primitive": "string"
|
|
25852
|
+
},
|
|
25853
|
+
"kind": "array"
|
|
25854
|
+
}
|
|
25855
|
+
}
|
|
25856
|
+
},
|
|
25857
|
+
{
|
|
25858
|
+
"docs": {
|
|
25859
|
+
"summary": "Optional array of custom claim validations."
|
|
25860
|
+
},
|
|
25861
|
+
"name": "customClaims",
|
|
25862
|
+
"optional": true,
|
|
25863
|
+
"type": {
|
|
25864
|
+
"collection": {
|
|
25865
|
+
"elementtype": {
|
|
25866
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeCustomClaim"
|
|
25867
|
+
},
|
|
25868
|
+
"kind": "array"
|
|
25869
|
+
}
|
|
25870
|
+
}
|
|
25527
25871
|
}
|
|
25528
25872
|
],
|
|
25529
25873
|
"returns": {
|
|
@@ -25540,8 +25884,8 @@
|
|
|
25540
25884
|
"summary": "Use OAuth 2.0 authentication. Supports various OAuth providers."
|
|
25541
25885
|
},
|
|
25542
25886
|
"locationInModule": {
|
|
25543
|
-
"filename": "lib/runtime/runtime-authorizer-configuration.ts",
|
|
25544
|
-
"line":
|
|
25887
|
+
"filename": "lib/runtime/inbound-auth/runtime-authorizer-configuration.ts",
|
|
25888
|
+
"line": 91
|
|
25545
25889
|
},
|
|
25546
25890
|
"name": "usingOAuth",
|
|
25547
25891
|
"parameters": [
|
|
@@ -25577,6 +25921,36 @@
|
|
|
25577
25921
|
"kind": "array"
|
|
25578
25922
|
}
|
|
25579
25923
|
}
|
|
25924
|
+
},
|
|
25925
|
+
{
|
|
25926
|
+
"docs": {
|
|
25927
|
+
"summary": "Optional array of allowed scopes."
|
|
25928
|
+
},
|
|
25929
|
+
"name": "allowedScopes",
|
|
25930
|
+
"optional": true,
|
|
25931
|
+
"type": {
|
|
25932
|
+
"collection": {
|
|
25933
|
+
"elementtype": {
|
|
25934
|
+
"primitive": "string"
|
|
25935
|
+
},
|
|
25936
|
+
"kind": "array"
|
|
25937
|
+
}
|
|
25938
|
+
}
|
|
25939
|
+
},
|
|
25940
|
+
{
|
|
25941
|
+
"docs": {
|
|
25942
|
+
"summary": "Optional array of custom claim validations."
|
|
25943
|
+
},
|
|
25944
|
+
"name": "customClaims",
|
|
25945
|
+
"optional": true,
|
|
25946
|
+
"type": {
|
|
25947
|
+
"collection": {
|
|
25948
|
+
"elementtype": {
|
|
25949
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeCustomClaim"
|
|
25950
|
+
},
|
|
25951
|
+
"kind": "array"
|
|
25952
|
+
}
|
|
25953
|
+
}
|
|
25580
25954
|
}
|
|
25581
25955
|
],
|
|
25582
25956
|
"returns": {
|
|
@@ -25588,7 +25962,7 @@
|
|
|
25588
25962
|
}
|
|
25589
25963
|
],
|
|
25590
25964
|
"name": "RuntimeAuthorizerConfiguration",
|
|
25591
|
-
"symbolId": "lib/runtime/runtime-authorizer-configuration:RuntimeAuthorizerConfiguration"
|
|
25965
|
+
"symbolId": "lib/runtime/inbound-auth/runtime-authorizer-configuration:RuntimeAuthorizerConfiguration"
|
|
25592
25966
|
},
|
|
25593
25967
|
"@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeBase": {
|
|
25594
25968
|
"abstract": true,
|
|
@@ -26261,6 +26635,122 @@
|
|
|
26261
26635
|
],
|
|
26262
26636
|
"symbolId": "lib/runtime/runtime-base:RuntimeBase"
|
|
26263
26637
|
},
|
|
26638
|
+
"@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeCustomClaim": {
|
|
26639
|
+
"assembly": "@aws-cdk/aws-bedrock-agentcore-alpha",
|
|
26640
|
+
"docs": {
|
|
26641
|
+
"remarks": "Custom claims allow you to validate additional fields in JWT tokens beyond\nthe standard audience, client, and scope validations.",
|
|
26642
|
+
"stability": "experimental",
|
|
26643
|
+
"summary": "Represents a custom claim validation configuration for Runtime JWT authorizers.",
|
|
26644
|
+
"example": "declare const userPool: cognito.UserPool;\ndeclare const userPoolClient: cognito.UserPoolClient;\ndeclare const anotherUserPoolClient: cognito.UserPoolClient;\n\nconst repository = new ecr.Repository(this, \"TestRepository\", {\n repositoryName: \"test-agent-runtime\",\n});\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, \"v1.0.0\");\n\n// Optional: Create custom claims for additional validation\nconst customClaims = [\n agentcore.RuntimeCustomClaim.withStringValue('department', 'engineering'),\n agentcore.RuntimeCustomClaim.withStringArrayValue('roles', ['admin'], agentcore.CustomClaimOperator.CONTAINS),\n agentcore.RuntimeCustomClaim.withStringArrayValue('permissions', ['read', 'write'], agentcore.CustomClaimOperator.CONTAINS_ANY),\n];\n\nconst runtime = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingCognito(\n userPool, // User Pool (required)\n [userPoolClient, anotherUserPoolClient], // User Pool Clients\n [\"audience1\"], // Allowed Audiences (optional)\n [\"read\", \"write\"], // Allowed Scopes (optional)\n customClaims, // Custom claims (optional) - see Custom Claims Validation section\n ),\n});",
|
|
26645
|
+
"custom": {
|
|
26646
|
+
"exampleMetadata": "fixture=default infused"
|
|
26647
|
+
}
|
|
26648
|
+
},
|
|
26649
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeCustomClaim",
|
|
26650
|
+
"kind": "class",
|
|
26651
|
+
"locationInModule": {
|
|
26652
|
+
"filename": "lib/runtime/inbound-auth/custom-claim.ts",
|
|
26653
|
+
"line": 24
|
|
26654
|
+
},
|
|
26655
|
+
"methods": [
|
|
26656
|
+
{
|
|
26657
|
+
"docs": {
|
|
26658
|
+
"remarks": "String array claims can use CONTAINS (default) or CONTAINS_ANY operator.",
|
|
26659
|
+
"returns": "A RuntimeCustomClaim configured for string array validation",
|
|
26660
|
+
"stability": "experimental",
|
|
26661
|
+
"summary": "Create a custom claim with a string array value."
|
|
26662
|
+
},
|
|
26663
|
+
"locationInModule": {
|
|
26664
|
+
"filename": "lib/runtime/inbound-auth/custom-claim.ts",
|
|
26665
|
+
"line": 46
|
|
26666
|
+
},
|
|
26667
|
+
"name": "withStringArrayValue",
|
|
26668
|
+
"parameters": [
|
|
26669
|
+
{
|
|
26670
|
+
"docs": {
|
|
26671
|
+
"summary": "The name of the claim in the JWT token."
|
|
26672
|
+
},
|
|
26673
|
+
"name": "name",
|
|
26674
|
+
"type": {
|
|
26675
|
+
"primitive": "string"
|
|
26676
|
+
}
|
|
26677
|
+
},
|
|
26678
|
+
{
|
|
26679
|
+
"docs": {
|
|
26680
|
+
"remarks": "For CONTAINS operator, must contain exactly one value.",
|
|
26681
|
+
"summary": "The array of string values to match."
|
|
26682
|
+
},
|
|
26683
|
+
"name": "values",
|
|
26684
|
+
"type": {
|
|
26685
|
+
"collection": {
|
|
26686
|
+
"elementtype": {
|
|
26687
|
+
"primitive": "string"
|
|
26688
|
+
},
|
|
26689
|
+
"kind": "array"
|
|
26690
|
+
}
|
|
26691
|
+
}
|
|
26692
|
+
},
|
|
26693
|
+
{
|
|
26694
|
+
"docs": {
|
|
26695
|
+
"summary": "The match operator (defaults to CONTAINS)."
|
|
26696
|
+
},
|
|
26697
|
+
"name": "operator",
|
|
26698
|
+
"optional": true,
|
|
26699
|
+
"type": {
|
|
26700
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.CustomClaimOperator"
|
|
26701
|
+
}
|
|
26702
|
+
}
|
|
26703
|
+
],
|
|
26704
|
+
"returns": {
|
|
26705
|
+
"type": {
|
|
26706
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeCustomClaim"
|
|
26707
|
+
}
|
|
26708
|
+
},
|
|
26709
|
+
"static": true
|
|
26710
|
+
},
|
|
26711
|
+
{
|
|
26712
|
+
"docs": {
|
|
26713
|
+
"remarks": "String claims must use the EQUALS operator.",
|
|
26714
|
+
"returns": "A RuntimeCustomClaim configured for string validation",
|
|
26715
|
+
"stability": "experimental",
|
|
26716
|
+
"summary": "Create a custom claim with a string value."
|
|
26717
|
+
},
|
|
26718
|
+
"locationInModule": {
|
|
26719
|
+
"filename": "lib/runtime/inbound-auth/custom-claim.ts",
|
|
26720
|
+
"line": 33
|
|
26721
|
+
},
|
|
26722
|
+
"name": "withStringValue",
|
|
26723
|
+
"parameters": [
|
|
26724
|
+
{
|
|
26725
|
+
"docs": {
|
|
26726
|
+
"summary": "The name of the claim in the JWT token."
|
|
26727
|
+
},
|
|
26728
|
+
"name": "name",
|
|
26729
|
+
"type": {
|
|
26730
|
+
"primitive": "string"
|
|
26731
|
+
}
|
|
26732
|
+
},
|
|
26733
|
+
{
|
|
26734
|
+
"docs": {
|
|
26735
|
+
"summary": "The string value to match (must exactly equal)."
|
|
26736
|
+
},
|
|
26737
|
+
"name": "value",
|
|
26738
|
+
"type": {
|
|
26739
|
+
"primitive": "string"
|
|
26740
|
+
}
|
|
26741
|
+
}
|
|
26742
|
+
],
|
|
26743
|
+
"returns": {
|
|
26744
|
+
"type": {
|
|
26745
|
+
"fqn": "@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeCustomClaim"
|
|
26746
|
+
}
|
|
26747
|
+
},
|
|
26748
|
+
"static": true
|
|
26749
|
+
}
|
|
26750
|
+
],
|
|
26751
|
+
"name": "RuntimeCustomClaim",
|
|
26752
|
+
"symbolId": "lib/runtime/inbound-auth/custom-claim:RuntimeCustomClaim"
|
|
26753
|
+
},
|
|
26264
26754
|
"@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeEndpoint": {
|
|
26265
26755
|
"assembly": "@aws-cdk/aws-bedrock-agentcore-alpha",
|
|
26266
26756
|
"base": "@aws-cdk/aws-bedrock-agentcore-alpha.RuntimeEndpointBase",
|
|
@@ -27236,7 +27726,7 @@
|
|
|
27236
27726
|
"docs": {
|
|
27237
27727
|
"stability": "experimental",
|
|
27238
27728
|
"summary": "Properties for creating a Bedrock Agent Core Runtime resource.",
|
|
27239
|
-
"example": "
|
|
27729
|
+
"example": "// S3 bucket containing the agent core\nconst codeBucket = new s3.Bucket(this, \"AgentCode\", {\n bucketName: \"my-code-bucket\",\n removalPolicy: RemovalPolicy.DESTROY, // For demo purposes\n});\n\n// the bucket above needs to contain the agent code\n\nconst agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromS3(\n {\n bucketName: codeBucket.bucketName,\n objectKey: 'deployment_package.zip',\n },\n agentcore.AgentCoreRuntime.PYTHON_3_12,\n ['opentelemetry-instrument', 'main.py']\n);\n\nconst runtimeInstance = new agentcore.Runtime(this, \"MyAgentRuntime\", {\n runtimeName: \"myAgent\",\n agentRuntimeArtifact: agentRuntimeArtifact,\n});",
|
|
27240
27730
|
"custom": {
|
|
27241
27731
|
"exampleMetadata": "fixture=default infused"
|
|
27242
27732
|
}
|
|
@@ -27245,7 +27735,7 @@
|
|
|
27245
27735
|
"kind": "interface",
|
|
27246
27736
|
"locationInModule": {
|
|
27247
27737
|
"filename": "lib/runtime/runtime.ts",
|
|
27248
|
-
"line":
|
|
27738
|
+
"line": 49
|
|
27249
27739
|
},
|
|
27250
27740
|
"name": "RuntimeProps",
|
|
27251
27741
|
"properties": [
|
|
@@ -27258,7 +27748,7 @@
|
|
|
27258
27748
|
"immutable": true,
|
|
27259
27749
|
"locationInModule": {
|
|
27260
27750
|
"filename": "lib/runtime/runtime.ts",
|
|
27261
|
-
"line":
|
|
27751
|
+
"line": 63
|
|
27262
27752
|
},
|
|
27263
27753
|
"name": "agentRuntimeArtifact",
|
|
27264
27754
|
"type": {
|
|
@@ -27275,7 +27765,7 @@
|
|
|
27275
27765
|
"immutable": true,
|
|
27276
27766
|
"locationInModule": {
|
|
27277
27767
|
"filename": "lib/runtime/runtime.ts",
|
|
27278
|
-
"line":
|
|
27768
|
+
"line": 105
|
|
27279
27769
|
},
|
|
27280
27770
|
"name": "authorizerConfiguration",
|
|
27281
27771
|
"optional": true,
|
|
@@ -27293,7 +27783,7 @@
|
|
|
27293
27783
|
"immutable": true,
|
|
27294
27784
|
"locationInModule": {
|
|
27295
27785
|
"filename": "lib/runtime/runtime.ts",
|
|
27296
|
-
"line":
|
|
27786
|
+
"line": 83
|
|
27297
27787
|
},
|
|
27298
27788
|
"name": "description",
|
|
27299
27789
|
"optional": true,
|
|
@@ -27311,7 +27801,7 @@
|
|
|
27311
27801
|
"immutable": true,
|
|
27312
27802
|
"locationInModule": {
|
|
27313
27803
|
"filename": "lib/runtime/runtime.ts",
|
|
27314
|
-
"line":
|
|
27804
|
+
"line": 98
|
|
27315
27805
|
},
|
|
27316
27806
|
"name": "environmentVariables",
|
|
27317
27807
|
"optional": true,
|
|
@@ -27334,7 +27824,7 @@
|
|
|
27334
27824
|
"immutable": true,
|
|
27335
27825
|
"locationInModule": {
|
|
27336
27826
|
"filename": "lib/runtime/runtime.ts",
|
|
27337
|
-
"line":
|
|
27827
|
+
"line": 70
|
|
27338
27828
|
},
|
|
27339
27829
|
"name": "executionRole",
|
|
27340
27830
|
"optional": true,
|
|
@@ -27352,7 +27842,7 @@
|
|
|
27352
27842
|
"immutable": true,
|
|
27353
27843
|
"locationInModule": {
|
|
27354
27844
|
"filename": "lib/runtime/runtime.ts",
|
|
27355
|
-
"line":
|
|
27845
|
+
"line": 124
|
|
27356
27846
|
},
|
|
27357
27847
|
"name": "lifecycleConfiguration",
|
|
27358
27848
|
"optional": true,
|
|
@@ -27370,7 +27860,7 @@
|
|
|
27370
27860
|
"immutable": true,
|
|
27371
27861
|
"locationInModule": {
|
|
27372
27862
|
"filename": "lib/runtime/runtime.ts",
|
|
27373
|
-
"line":
|
|
27863
|
+
"line": 76
|
|
27374
27864
|
},
|
|
27375
27865
|
"name": "networkConfiguration",
|
|
27376
27866
|
"optional": true,
|
|
@@ -27388,7 +27878,7 @@
|
|
|
27388
27878
|
"immutable": true,
|
|
27389
27879
|
"locationInModule": {
|
|
27390
27880
|
"filename": "lib/runtime/runtime.ts",
|
|
27391
|
-
"line":
|
|
27881
|
+
"line": 89
|
|
27392
27882
|
},
|
|
27393
27883
|
"name": "protocolConfiguration",
|
|
27394
27884
|
"optional": true,
|
|
@@ -27406,7 +27896,7 @@
|
|
|
27406
27896
|
"immutable": true,
|
|
27407
27897
|
"locationInModule": {
|
|
27408
27898
|
"filename": "lib/runtime/runtime.ts",
|
|
27409
|
-
"line":
|
|
27899
|
+
"line": 118
|
|
27410
27900
|
},
|
|
27411
27901
|
"name": "requestHeaderConfiguration",
|
|
27412
27902
|
"optional": true,
|
|
@@ -27424,7 +27914,7 @@
|
|
|
27424
27914
|
"immutable": true,
|
|
27425
27915
|
"locationInModule": {
|
|
27426
27916
|
"filename": "lib/runtime/runtime.ts",
|
|
27427
|
-
"line":
|
|
27917
|
+
"line": 57
|
|
27428
27918
|
},
|
|
27429
27919
|
"name": "runtimeName",
|
|
27430
27920
|
"optional": true,
|
|
@@ -27442,7 +27932,7 @@
|
|
|
27442
27932
|
"immutable": true,
|
|
27443
27933
|
"locationInModule": {
|
|
27444
27934
|
"filename": "lib/runtime/runtime.ts",
|
|
27445
|
-
"line":
|
|
27935
|
+
"line": 112
|
|
27446
27936
|
},
|
|
27447
27937
|
"name": "tags",
|
|
27448
27938
|
"optional": true,
|
|
@@ -27476,7 +27966,7 @@
|
|
|
27476
27966
|
},
|
|
27477
27967
|
"locationInModule": {
|
|
27478
27968
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
27479
|
-
"line":
|
|
27969
|
+
"line": 195
|
|
27480
27970
|
},
|
|
27481
27971
|
"parameters": [
|
|
27482
27972
|
{
|
|
@@ -27500,7 +27990,7 @@
|
|
|
27500
27990
|
"kind": "class",
|
|
27501
27991
|
"locationInModule": {
|
|
27502
27992
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
27503
|
-
"line":
|
|
27993
|
+
"line": 194
|
|
27504
27994
|
},
|
|
27505
27995
|
"methods": [
|
|
27506
27996
|
{
|
|
@@ -27510,7 +28000,7 @@
|
|
|
27510
28000
|
},
|
|
27511
28001
|
"locationInModule": {
|
|
27512
28002
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
27513
|
-
"line":
|
|
28003
|
+
"line": 210
|
|
27514
28004
|
},
|
|
27515
28005
|
"name": "bind",
|
|
27516
28006
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.ApiSchema",
|
|
@@ -27530,7 +28020,7 @@
|
|
|
27530
28020
|
},
|
|
27531
28021
|
"locationInModule": {
|
|
27532
28022
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
27533
|
-
"line":
|
|
28023
|
+
"line": 216
|
|
27534
28024
|
},
|
|
27535
28025
|
"name": "grantPermissionsToRole",
|
|
27536
28026
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.ApiSchema",
|
|
@@ -27554,7 +28044,7 @@
|
|
|
27554
28044
|
"immutable": true,
|
|
27555
28045
|
"locationInModule": {
|
|
27556
28046
|
"filename": "lib/gateway/targets/schema/api-schema.ts",
|
|
27557
|
-
"line":
|
|
28047
|
+
"line": 195
|
|
27558
28048
|
},
|
|
27559
28049
|
"name": "bucketOwnerAccountId",
|
|
27560
28050
|
"optional": true,
|
|
@@ -27584,7 +28074,7 @@
|
|
|
27584
28074
|
},
|
|
27585
28075
|
"locationInModule": {
|
|
27586
28076
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
27587
|
-
"line":
|
|
28077
|
+
"line": 294
|
|
27588
28078
|
},
|
|
27589
28079
|
"parameters": [
|
|
27590
28080
|
{
|
|
@@ -27608,7 +28098,7 @@
|
|
|
27608
28098
|
"kind": "class",
|
|
27609
28099
|
"locationInModule": {
|
|
27610
28100
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
27611
|
-
"line":
|
|
28101
|
+
"line": 293
|
|
27612
28102
|
},
|
|
27613
28103
|
"methods": [
|
|
27614
28104
|
{
|
|
@@ -27618,7 +28108,7 @@
|
|
|
27618
28108
|
},
|
|
27619
28109
|
"locationInModule": {
|
|
27620
28110
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
27621
|
-
"line":
|
|
28111
|
+
"line": 309
|
|
27622
28112
|
},
|
|
27623
28113
|
"name": "bind",
|
|
27624
28114
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.ToolSchema",
|
|
@@ -27638,7 +28128,7 @@
|
|
|
27638
28128
|
},
|
|
27639
28129
|
"locationInModule": {
|
|
27640
28130
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
27641
|
-
"line":
|
|
28131
|
+
"line": 315
|
|
27642
28132
|
},
|
|
27643
28133
|
"name": "grantPermissionsToRole",
|
|
27644
28134
|
"overrides": "@aws-cdk/aws-bedrock-agentcore-alpha.ToolSchema",
|
|
@@ -27662,7 +28152,7 @@
|
|
|
27662
28152
|
"immutable": true,
|
|
27663
28153
|
"locationInModule": {
|
|
27664
28154
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
27665
|
-
"line":
|
|
28155
|
+
"line": 294
|
|
27666
28156
|
},
|
|
27667
28157
|
"name": "bucketOwnerAccountId",
|
|
27668
28158
|
"optional": true,
|
|
@@ -27689,7 +28179,7 @@
|
|
|
27689
28179
|
"kind": "interface",
|
|
27690
28180
|
"locationInModule": {
|
|
27691
28181
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
27692
|
-
"line":
|
|
28182
|
+
"line": 50
|
|
27693
28183
|
},
|
|
27694
28184
|
"name": "SchemaDefinition",
|
|
27695
28185
|
"properties": [
|
|
@@ -27703,7 +28193,7 @@
|
|
|
27703
28193
|
"immutable": true,
|
|
27704
28194
|
"locationInModule": {
|
|
27705
28195
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
27706
|
-
"line":
|
|
28196
|
+
"line": 54
|
|
27707
28197
|
},
|
|
27708
28198
|
"name": "type",
|
|
27709
28199
|
"type": {
|
|
@@ -27721,7 +28211,7 @@
|
|
|
27721
28211
|
"immutable": true,
|
|
27722
28212
|
"locationInModule": {
|
|
27723
28213
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
27724
|
-
"line":
|
|
28214
|
+
"line": 63
|
|
27725
28215
|
},
|
|
27726
28216
|
"name": "description",
|
|
27727
28217
|
"optional": true,
|
|
@@ -27740,7 +28230,7 @@
|
|
|
27740
28230
|
"immutable": true,
|
|
27741
28231
|
"locationInModule": {
|
|
27742
28232
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
27743
|
-
"line":
|
|
28233
|
+
"line": 72
|
|
27744
28234
|
},
|
|
27745
28235
|
"name": "items",
|
|
27746
28236
|
"optional": true,
|
|
@@ -27759,7 +28249,7 @@
|
|
|
27759
28249
|
"immutable": true,
|
|
27760
28250
|
"locationInModule": {
|
|
27761
28251
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
27762
|
-
"line":
|
|
28252
|
+
"line": 81
|
|
27763
28253
|
},
|
|
27764
28254
|
"name": "properties",
|
|
27765
28255
|
"optional": true,
|
|
@@ -27783,7 +28273,7 @@
|
|
|
27783
28273
|
"immutable": true,
|
|
27784
28274
|
"locationInModule": {
|
|
27785
28275
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
27786
|
-
"line":
|
|
28276
|
+
"line": 87
|
|
27787
28277
|
},
|
|
27788
28278
|
"name": "required",
|
|
27789
28279
|
"optional": true,
|
|
@@ -27813,7 +28303,7 @@
|
|
|
27813
28303
|
"kind": "enum",
|
|
27814
28304
|
"locationInModule": {
|
|
27815
28305
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
27816
|
-
"line":
|
|
28306
|
+
"line": 32
|
|
27817
28307
|
},
|
|
27818
28308
|
"members": [
|
|
27819
28309
|
{
|
|
@@ -28345,7 +28835,7 @@
|
|
|
28345
28835
|
"kind": "interface",
|
|
28346
28836
|
"locationInModule": {
|
|
28347
28837
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
28348
|
-
"line":
|
|
28838
|
+
"line": 93
|
|
28349
28839
|
},
|
|
28350
28840
|
"name": "ToolDefinition",
|
|
28351
28841
|
"properties": [
|
|
@@ -28359,7 +28849,7 @@
|
|
|
28359
28849
|
"immutable": true,
|
|
28360
28850
|
"locationInModule": {
|
|
28361
28851
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
28362
|
-
"line":
|
|
28852
|
+
"line": 102
|
|
28363
28853
|
},
|
|
28364
28854
|
"name": "description",
|
|
28365
28855
|
"type": {
|
|
@@ -28376,7 +28866,7 @@
|
|
|
28376
28866
|
"immutable": true,
|
|
28377
28867
|
"locationInModule": {
|
|
28378
28868
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
28379
|
-
"line":
|
|
28869
|
+
"line": 107
|
|
28380
28870
|
},
|
|
28381
28871
|
"name": "inputSchema",
|
|
28382
28872
|
"type": {
|
|
@@ -28393,7 +28883,7 @@
|
|
|
28393
28883
|
"immutable": true,
|
|
28394
28884
|
"locationInModule": {
|
|
28395
28885
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
28396
|
-
"line":
|
|
28886
|
+
"line": 97
|
|
28397
28887
|
},
|
|
28398
28888
|
"name": "name",
|
|
28399
28889
|
"type": {
|
|
@@ -28411,7 +28901,7 @@
|
|
|
28411
28901
|
"immutable": true,
|
|
28412
28902
|
"locationInModule": {
|
|
28413
28903
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
28414
|
-
"line":
|
|
28904
|
+
"line": 116
|
|
28415
28905
|
},
|
|
28416
28906
|
"name": "outputSchema",
|
|
28417
28907
|
"optional": true,
|
|
@@ -28440,7 +28930,7 @@
|
|
|
28440
28930
|
},
|
|
28441
28931
|
"locationInModule": {
|
|
28442
28932
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
28443
|
-
"line":
|
|
28933
|
+
"line": 182
|
|
28444
28934
|
},
|
|
28445
28935
|
"parameters": [
|
|
28446
28936
|
{
|
|
@@ -28475,7 +28965,7 @@
|
|
|
28475
28965
|
"kind": "class",
|
|
28476
28966
|
"locationInModule": {
|
|
28477
28967
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
28478
|
-
"line":
|
|
28968
|
+
"line": 132
|
|
28479
28969
|
},
|
|
28480
28970
|
"methods": [
|
|
28481
28971
|
{
|
|
@@ -28485,7 +28975,7 @@
|
|
|
28485
28975
|
},
|
|
28486
28976
|
"locationInModule": {
|
|
28487
28977
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
28488
|
-
"line":
|
|
28978
|
+
"line": 145
|
|
28489
28979
|
},
|
|
28490
28980
|
"name": "fromInline",
|
|
28491
28981
|
"parameters": [
|
|
@@ -28518,7 +29008,7 @@
|
|
|
28518
29008
|
},
|
|
28519
29009
|
"locationInModule": {
|
|
28520
29010
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
28521
|
-
"line":
|
|
29011
|
+
"line": 137
|
|
28522
29012
|
},
|
|
28523
29013
|
"name": "fromLocalAsset",
|
|
28524
29014
|
"parameters": [
|
|
@@ -28546,7 +29036,7 @@
|
|
|
28546
29036
|
},
|
|
28547
29037
|
"locationInModule": {
|
|
28548
29038
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
28549
|
-
"line":
|
|
29039
|
+
"line": 155
|
|
28550
29040
|
},
|
|
28551
29041
|
"name": "fromS3File",
|
|
28552
29042
|
"parameters": [
|
|
@@ -28638,7 +29128,7 @@
|
|
|
28638
29128
|
"immutable": true,
|
|
28639
29129
|
"locationInModule": {
|
|
28640
29130
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
28641
|
-
"line":
|
|
29131
|
+
"line": 180
|
|
28642
29132
|
},
|
|
28643
29133
|
"name": "bucketOwnerAccountId",
|
|
28644
29134
|
"optional": true,
|
|
@@ -28655,7 +29145,7 @@
|
|
|
28655
29145
|
"immutable": true,
|
|
28656
29146
|
"locationInModule": {
|
|
28657
29147
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
28658
|
-
"line":
|
|
29148
|
+
"line": 175
|
|
28659
29149
|
},
|
|
28660
29150
|
"name": "inlineSchema",
|
|
28661
29151
|
"optional": true,
|
|
@@ -28677,7 +29167,7 @@
|
|
|
28677
29167
|
"immutable": true,
|
|
28678
29168
|
"locationInModule": {
|
|
28679
29169
|
"filename": "lib/gateway/targets/schema/tool-schema.ts",
|
|
28680
|
-
"line":
|
|
29170
|
+
"line": 169
|
|
28681
29171
|
},
|
|
28682
29172
|
"name": "s3File",
|
|
28683
29173
|
"optional": true,
|
|
@@ -28867,6 +29357,6 @@
|
|
|
28867
29357
|
"symbolId": "lib/network/network-configuration:VpcConfigProps"
|
|
28868
29358
|
}
|
|
28869
29359
|
},
|
|
28870
|
-
"version": "2.
|
|
29360
|
+
"version": "2.237.1-alpha.0",
|
|
28871
29361
|
"fingerprint": "**********"
|
|
28872
29362
|
}
|