konokenj.cdk-api-mcp-server 0.70.0__py3-none-any.whl → 0.72.0__py3-none-any.whl

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.
Files changed (30) hide show
  1. cdk_api_mcp_server/__about__.py +1 -1
  2. cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-bedrock-agentcore-alpha/README.md +275 -14
  3. cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-eks-v2-alpha/README.md +195 -0
  4. cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-elasticache-alpha/README.md +1 -1
  5. cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-sagemaker-alpha/README.md +25 -0
  6. cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/mixins-preview/README.md +23 -4
  7. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/README.md/README.md +2 -0
  8. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-batch/README.md +54 -34
  9. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-bedrock/README.md +2 -3
  10. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-bedrockagentcore/README.md +24 -0
  11. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/README.md +1 -1
  12. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/README.md +3 -0
  13. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.managedinstances-capacity-provider.ts +1 -0
  14. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/README.md +108 -2
  15. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/integ.eks-cluster-native-oidc.ts +49 -0
  16. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/integ.eks-cluster.ts +1 -0
  17. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/integ.eks-oidc-provider.ts +19 -0
  18. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-iam/README.md +14 -11
  19. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-event-sources/README.md +76 -3
  20. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-event-sources/integ.kafka-observability.ts +90 -0
  21. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/README.md +2 -2
  22. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-sns/README.md +2 -2
  23. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/core/integ.nested-stack-suppress-template-indentation.ts +29 -0
  24. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +25 -0
  25. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/ORIGINAL_API.md +1 -1
  26. {konokenj_cdk_api_mcp_server-0.70.0.dist-info → konokenj_cdk_api_mcp_server-0.72.0.dist-info}/METADATA +2 -2
  27. {konokenj_cdk_api_mcp_server-0.70.0.dist-info → konokenj_cdk_api_mcp_server-0.72.0.dist-info}/RECORD +30 -26
  28. {konokenj_cdk_api_mcp_server-0.70.0.dist-info → konokenj_cdk_api_mcp_server-0.72.0.dist-info}/WHEEL +0 -0
  29. {konokenj_cdk_api_mcp_server-0.70.0.dist-info → konokenj_cdk_api_mcp_server-0.72.0.dist-info}/entry_points.txt +0 -0
  30. {konokenj_cdk_api_mcp_server-0.70.0.dist-info → konokenj_cdk_api_mcp_server-0.72.0.dist-info}/licenses/LICENSE.txt +0 -0
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2025-present Kenji Kono <konoken@amazon.co.jp>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.70.0"
4
+ __version__ = "0.72.0"
@@ -155,7 +155,7 @@ to production by simply updating the endpoint to point to the newer version.
155
155
 
156
156
  | Name | Type | Required | Description |
157
157
  |------|------|----------|-------------|
158
- | `runtimeName` | `string` | Yes | 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 |
158
+ | `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 |
159
159
  | `agentRuntimeArtifact` | `AgentRuntimeArtifact` | Yes | The artifact configuration for the agent runtime containing the container configuration with ECR URI |
160
160
  | `executionRole` | `iam.IRole` | No | The IAM role that provides permissions for the agent runtime. If not provided, a role will be created automatically |
161
161
  | `networkConfiguration` | `NetworkConfiguration` | No | Network configuration for the agent runtime. Defaults to `RuntimeNetworkConfiguration.usingPublicNetwork()` |
@@ -171,7 +171,7 @@ to production by simply updating the endpoint to point to the newer version.
171
171
 
172
172
  | Name | Type | Required | Description |
173
173
  |------|------|----------|-------------|
174
- | `endpointName` | `string` | Yes | 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 |
174
+ | `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 |
175
175
  | `agentRuntimeId` | `string` | Yes | The Agent Runtime ID for this endpoint |
176
176
  | `agentRuntimeVersion` | `string` | Yes | The Agent Runtime version for this endpoint. Must be between 1 and 5 characters long.|
177
177
  | `description` | `string` | No | Optional description for the runtime endpoint |
@@ -469,16 +469,34 @@ const repository = new ecr.Repository(this, "TestRepository", {
469
469
  });
470
470
  const agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, "v1.0.0");
471
471
 
472
+ // Optional: Create custom claims for additional validation
473
+ const customClaims = [
474
+ agentcore.RuntimeCustomClaim.withStringValue('department', 'engineering'),
475
+ agentcore.RuntimeCustomClaim.withStringArrayValue('roles', ['admin'], agentcore.CustomClaimOperator.CONTAINS),
476
+ agentcore.RuntimeCustomClaim.withStringArrayValue('permissions', ['read', 'write'], agentcore.CustomClaimOperator.CONTAINS_ANY),
477
+ ];
478
+
472
479
  const runtime = new agentcore.Runtime(this, "MyAgentRuntime", {
473
480
  runtimeName: "myAgent",
474
481
  agentRuntimeArtifact: agentRuntimeArtifact,
475
482
  authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingCognito(
476
483
  userPool, // User Pool (required)
477
484
  [userPoolClient, anotherUserPoolClient], // User Pool Clients
485
+ ["audience1"], // Allowed Audiences (optional)
486
+ ["read", "write"], // Allowed Scopes (optional)
487
+ customClaims, // Custom claims (optional) - see Custom Claims Validation section
478
488
  ),
479
489
  });
480
490
  ```
481
491
 
492
+ You can configure:
493
+
494
+ - User Pool: The Cognito User Pool that issues JWT tokens
495
+ - User Pool Clients: One or more Cognito User Pool App Clients that are allowed to access the runtime
496
+ - 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
497
+ - Allowed scopes: Allow access only if the token contains at least one of the required scopes configured here
498
+ - Custom claims: A set of rules to match specific claims in the incoming token against predefined values for validating JWT tokens
499
+
482
500
  #### JWT Authentication
483
501
 
484
502
  To configure custom JWT authentication with your own OpenID Connect (OIDC) provider:
@@ -495,13 +513,77 @@ const runtime = new agentcore.Runtime(this, "MyAgentRuntime", {
495
513
  authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingJWT(
496
514
  "https://example.com/.well-known/openid-configuration", // Discovery URL (required)
497
515
  ["client1", "client2"], // Allowed Client IDs (optional)
498
- ["audience1"] // Allowed Audiences (optional)
516
+ ["audience1"], // Allowed Audiences (optional)
517
+ ["read", "write"], // Allowed Scopes (optional)
518
+ // Custom claims (optional) - see Custom Claims Validation section below
499
519
  ),
500
520
  });
501
521
  ```
502
522
 
523
+ You can configure:
524
+
525
+ - 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.
526
+ - 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.
527
+ - 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.
528
+ - Allowed scopes: Allow access only if the token contains at least one of the required scopes configured here.
529
+ - Custom claims: A set of rules to match specific claims in the incoming token against predefined values for validating JWT tokens.
530
+
503
531
  **Note**: The discovery URL must end with `/.well-known/openid-configuration`.
504
532
 
533
+ ##### Custom Claims Validation
534
+
535
+ Custom 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:
536
+
537
+ ```typescript fixture=default
538
+ const repository = new ecr.Repository(this, "TestRepository", {
539
+ repositoryName: "test-agent-runtime",
540
+ });
541
+ const agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, "v1.0.0");
542
+
543
+ // String claim - validates that the claim exactly equals the specified value
544
+ // Uses EQUALS operator automatically
545
+ const departmentClaim = agentcore.RuntimeCustomClaim.withStringValue('department', 'engineering');
546
+
547
+ // String array claim with CONTAINS operator (default)
548
+ // Validates that the claim array contains a specific string value
549
+ // IMPORTANT: CONTAINS requires exactly one value in the array parameter
550
+ const rolesClaim = agentcore.RuntimeCustomClaim.withStringArrayValue('roles', ['admin']);
551
+
552
+ // String array claim with CONTAINS_ANY operator
553
+ // Validates that the claim array contains at least one of the specified values
554
+ // Use this when you want to check for multiple possible values
555
+ const permissionsClaim = agentcore.RuntimeCustomClaim.withStringArrayValue(
556
+ 'permissions',
557
+ ['read', 'write'],
558
+ agentcore.CustomClaimOperator.CONTAINS_ANY
559
+ );
560
+
561
+ // Use custom claims in authorizer configuration
562
+ const runtime = new agentcore.Runtime(this, "MyAgentRuntime", {
563
+ runtimeName: "myAgent",
564
+ agentRuntimeArtifact: agentRuntimeArtifact,
565
+ authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingJWT(
566
+ "https://example.com/.well-known/openid-configuration",
567
+ ["client1", "client2"],
568
+ ["audience1"],
569
+ ["read", "write"],
570
+ [departmentClaim, rolesClaim, permissionsClaim] // Custom claims
571
+ ),
572
+ });
573
+ ```
574
+
575
+ **Custom Claim Rules**:
576
+
577
+ - **String claims**: Must use the `EQUALS` operator (automatically set). The claim value must exactly match the specified string.
578
+ - **String array claims**: Can use `CONTAINS` (default) or `CONTAINS_ANY` operators:
579
+ - **`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'`.
580
+ - **`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'`.
581
+
582
+ **Example Use Cases**:
583
+
584
+ - Use `CONTAINS` when you need to verify a user has a specific role: `RuntimeCustomClaim.withStringArrayValue('roles', ['admin'])`
585
+ - Use `CONTAINS_ANY` when you need to verify a user has any of several permissions: `RuntimeCustomClaim.withStringArrayValue('permissions', ['read', 'write'], CustomClaimOperator.CONTAINS_ANY)`
586
+
505
587
  #### OAuth Authentication
506
588
 
507
589
  To configure OAuth 2.0 authentication:
@@ -516,8 +598,11 @@ const runtime = new agentcore.Runtime(this, "MyAgentRuntime", {
516
598
  runtimeName: "myAgent",
517
599
  agentRuntimeArtifact: agentRuntimeArtifact,
518
600
  authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingOAuth(
519
- "https://github.com/.well-known/openid-configuration",
520
- "oauth_client_123",
601
+ "https://github.com/.well-known/openid-configuration", // Discovery URL (required)
602
+ "oauth_client_123", // OAuth Client ID (required)
603
+ ["audience1"], // Allowed Audiences (optional)
604
+ ["openid", "profile"], // Allowed Scopes (optional)
605
+ // Custom claims (optional) - see Custom Claims Validation section
521
606
  ),
522
607
  });
523
608
  ```
@@ -748,7 +833,7 @@ For more information on VPC connectivity for Amazon Bedrock AgentCore Browser, p
748
833
 
749
834
  | Name | Type | Required | Description |
750
835
  |------|------|----------|-------------|
751
- | `browserCustomName` | `string` | Yes | 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}` |
836
+ | `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 |
752
837
  | `description` | `string` | No | Optional description for the browser. Can have up to 200 characters |
753
838
  | `networkConfiguration` | `BrowserNetworkConfiguration` | No | Network configuration for browser. Defaults to PUBLIC network mode |
754
839
  | `recordingConfig` | `RecordingConfig` | No | Recording configuration for browser. Defaults to no recording |
@@ -959,7 +1044,7 @@ For more information on VPC connectivity for Amazon Bedrock AgentCore Browser, p
959
1044
 
960
1045
  | Name | Type | Required | Description |
961
1046
  |------|------|----------|-------------|
962
- | `codeInterpreterCustomName` | `string` | Yes | 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}` |
1047
+ | `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 |
963
1048
  | `description` | `string` | No | Optional description for the code interpreter. Can have up to 200 characters |
964
1049
  | `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 |
965
1050
  | `networkConfiguration` | `CodeInterpreterNetworkConfiguration` | No | Network configuration for code interpreter. Defaults to PUBLIC network mode |
@@ -1084,7 +1169,7 @@ The Gateway construct provides a way to create Amazon Bedrock Agent Core Gateway
1084
1169
 
1085
1170
  | Name | Type | Required | Description |
1086
1171
  |------|------|----------|-------------|
1087
- | `gatewayName` | `string` | Yes | The name of the gateway. Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen). Maximum 100 characters |
1172
+ | `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 |
1088
1173
  | `description` | `string` | No | Optional description for the gateway. Maximum 200 characters |
1089
1174
  | `protocolConfiguration` | `IGatewayProtocolConfig` | No | The protocol configuration for the gateway. Defaults to MCP protocol |
1090
1175
  | `authorizerConfiguration` | `IGatewayAuthorizerConfig` | No | The authorizer configuration for the gateway. Defaults to Cognito |
@@ -1132,21 +1217,33 @@ your AgentCore gateway. By default, if not provided, the construct will create a
1132
1217
  **JSON Web Token (JWT)** – A secure and compact token used for authorization. After creating the JWT, you specify it as the authorization
1133
1218
  configuration when you create the gateway. You can create a JWT with any of the identity providers at Provider setup and configuration.
1134
1219
 
1135
- You can configure a custom authorization provider using the `inboundAuthorizer` property with `GatewayAuthorizer.usingCustomJwt()`.
1220
+ You can configure a custom authorization provider using the `authorizerConfiguration` property with `GatewayAuthorizer.usingCustomJwt()`.
1136
1221
  You need to specify an OAuth discovery server and client IDs/audiences when you create the gateway. You can specify the following:
1137
1222
 
1138
1223
  - Discovery Url — String that must match the pattern ^.+/\.well-known/openid-configuration$ for OpenID Connect discovery URLs
1139
1224
  - At least one of the below options depending on the chosen identity provider.
1140
1225
  - Allowed audiences — List of allowed audiences for JWT tokens
1141
1226
  - Allowed clients — List of allowed client identifiers
1227
+ - Allowed scopes — List of allowed scopes for JWT tokens
1228
+ - Custom claims — Optional custom claim validations (see Custom Claims Validation section below)
1142
1229
 
1143
1230
  ```typescript fixture=default
1231
+
1232
+ // Optional: Create custom claims (CustomClaimOperator and GatewayCustomClaim from agentcore)
1233
+ const customClaims = [
1234
+ agentcore.GatewayCustomClaim.withStringValue('department', 'engineering'),
1235
+ agentcore.GatewayCustomClaim.withStringArrayValue('roles', ['admin'], agentcore.CustomClaimOperator.CONTAINS),
1236
+ agentcore.GatewayCustomClaim.withStringArrayValue('permissions', ['read', 'write'], agentcore.CustomClaimOperator.CONTAINS_ANY),
1237
+ ];
1238
+
1144
1239
  const gateway = new agentcore.Gateway(this, "MyGateway", {
1145
1240
  gatewayName: "my-gateway",
1146
1241
  authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({
1147
1242
  discoveryUrl: "https://auth.example.com/.well-known/openid-configuration",
1148
1243
  allowedAudience: ["my-app"],
1149
1244
  allowedClients: ["my-client-id"],
1245
+ allowedScopes: ["read", "write"],
1246
+ customClaims: customClaims, // Optional custom claims
1150
1247
  }),
1151
1248
  });
1152
1249
  ```
@@ -1188,6 +1285,31 @@ const oauthScopes = gateway.oauthScopes;
1188
1285
  // oauthScopes are in the format: ['{resourceServerId}/read', '{resourceServerId}/write']
1189
1286
  ```
1190
1287
 
1288
+ **Using Cognito User Pool Explicitly with Custom Claims** – You can also use an existing Cognito User Pool with custom claims:
1289
+
1290
+ ```typescript fixture=default
1291
+ declare const userPool: cognito.UserPool;
1292
+ declare const userPoolClient: cognito.UserPoolClient;
1293
+
1294
+ // Optional: Create custom claims (CustomClaimOperator and GatewayCustomClaim from agentcore)
1295
+ const customClaims = [
1296
+ agentcore.GatewayCustomClaim.withStringValue('department', 'engineering'),
1297
+ agentcore.GatewayCustomClaim.withStringArrayValue('roles', ['admin'], agentcore.CustomClaimOperator.CONTAINS),
1298
+ agentcore.GatewayCustomClaim.withStringArrayValue('permissions', ['read', 'write'], agentcore.CustomClaimOperator.CONTAINS_ANY),
1299
+ ];
1300
+
1301
+ const gateway = new agentcore.Gateway(this, "MyGateway", {
1302
+ gatewayName: "my-gateway",
1303
+ authorizerConfiguration: agentcore.GatewayAuthorizer.usingCognito({
1304
+ userPool: userPool,
1305
+ allowedClients: [userPoolClient],
1306
+ allowedAudiences: ["audience1"],
1307
+ allowedScopes: ["read", "write"],
1308
+ customClaims: customClaims, // Optional custom claims
1309
+ }),
1310
+ });
1311
+ ```
1312
+
1191
1313
  To 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).
1192
1314
 
1193
1315
  The following is an example of a token request using curl:
@@ -1225,6 +1347,7 @@ const gateway = new agentcore.Gateway(this, "MyGateway", {
1225
1347
  discoveryUrl: "https://auth.example.com/.well-known/openid-configuration",
1226
1348
  allowedAudience: ["my-app"],
1227
1349
  allowedClients: ["my-client-id"],
1350
+ allowedScopes: ["read", "write"],
1228
1351
  }),
1229
1352
  kmsKey: encryptionKey,
1230
1353
  exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,
@@ -1255,6 +1378,7 @@ const gateway = new agentcore.Gateway(this, "MyGateway", {
1255
1378
  discoveryUrl: "https://auth.example.com/.well-known/openid-configuration",
1256
1379
  allowedAudience: ["my-app"],
1257
1380
  allowedClients: ["my-client-id"],
1381
+ allowedScopes: ["read", "write"],
1258
1382
  }),
1259
1383
  role: executionRole,
1260
1384
  });
@@ -1278,6 +1402,7 @@ const gateway = new agentcore.Gateway(this, "MyGateway", {
1278
1402
  discoveryUrl: "https://auth.example.com/.well-known/openid-configuration",
1279
1403
  allowedAudience: ["my-app"],
1280
1404
  allowedClients: ["my-client-id"],
1405
+ allowedScopes: ["read", "write"],
1281
1406
  }),
1282
1407
  });
1283
1408
 
@@ -1307,7 +1432,7 @@ credential provider attached enabling you to securely access targets whether the
1307
1432
 
1308
1433
  | Name | Type | Required | Description |
1309
1434
  |------|------|----------|-------------|
1310
- | `gatewayTargetName` | `string` | Yes | The name of the gateway target. Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen) |
1435
+ | `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 |
1311
1436
  | `description` | `string` | No | Optional description for the gateway target. Maximum 200 characters |
1312
1437
  | `gateway` | `IGateway` | Yes | The gateway this target belongs to |
1313
1438
  | `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). |
@@ -1842,6 +1967,124 @@ const target = new agentcore.GatewayTarget(this, "AdvancedTarget", {
1842
1967
 
1843
1968
  This 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.
1844
1969
 
1970
+ ### Gateway Interceptors
1971
+
1972
+ Gateway 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.
1973
+
1974
+ **Interceptor Types:**
1975
+
1976
+ - **REQUEST interceptors**: Execute before the gateway calls the target. Useful for request validation, transformation, or custom authorization
1977
+ - **RESPONSE interceptors**: Execute after the target responds but before the gateway sends the response back. Useful for response transformation, filtering, or adding custom headers
1978
+
1979
+ **Security Best Practices:**
1980
+
1981
+ 1. Keep `passRequestHeaders` disabled unless absolutely necessary (default: false)
1982
+ 2. Implement idempotent Lambda functions (gateway may retry on failures)
1983
+ 3. Restrict gateway execution role to specific Lambda functions
1984
+ 4. Avoid logging sensitive information in your interceptor
1985
+
1986
+ For more information, see the [Gateway Interceptors documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-interceptors.html).
1987
+
1988
+ #### Adding Interceptors via Constructor
1989
+
1990
+ ```typescript fixture=default
1991
+ // Create Lambda functions for interceptors
1992
+ const requestInterceptorFn = new lambda.Function(this, "RequestInterceptor", {
1993
+ runtime: lambda.Runtime.PYTHON_3_12,
1994
+ handler: "index.handler",
1995
+ code: lambda.Code.fromInline(`
1996
+ def handler(event, context):
1997
+ # Validate and transform request
1998
+ return {
1999
+ "interceptorOutputVersion": "1.0",
2000
+ "mcp": {
2001
+ "transformedGatewayRequest": event["mcp"]["gatewayRequest"]
2002
+ }
2003
+ }
2004
+ `),
2005
+ });
2006
+
2007
+ const responseInterceptorFn = new lambda.Function(this, "ResponseInterceptor", {
2008
+ runtime: lambda.Runtime.PYTHON_3_12,
2009
+ handler: "index.handler",
2010
+ code: lambda.Code.fromInline(`
2011
+ def handler(event, context):
2012
+ # Filter or transform response
2013
+ return {
2014
+ "interceptorOutputVersion": "1.0",
2015
+ "mcp": {
2016
+ "transformedGatewayResponse": event["mcp"]["gatewayResponse"]
2017
+ }
2018
+ }
2019
+ `),
2020
+ });
2021
+
2022
+ // Create gateway with interceptors
2023
+ const gateway = new agentcore.Gateway(this, "MyGateway", {
2024
+ gatewayName: "my-gateway",
2025
+ interceptorConfigurations: [
2026
+ agentcore.LambdaInterceptor.forRequest(requestInterceptorFn, {
2027
+ passRequestHeaders: true // Only if you need to inspect headers
2028
+ }),
2029
+ agentcore.LambdaInterceptor.forResponse(responseInterceptorFn)
2030
+ ]
2031
+ });
2032
+ ```
2033
+
2034
+ **Automatic Permission Granting:**
2035
+
2036
+ When 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.
2037
+
2038
+ #### Adding Interceptors Dynamically
2039
+
2040
+ ```typescript fixture=default
2041
+ // Create a gateway first
2042
+ const gateway = new agentcore.Gateway(this, "MyGateway", {
2043
+ gatewayName: "my-gateway",
2044
+ });
2045
+
2046
+ // Create Lambda functions for interceptors
2047
+ const requestInterceptorFn = new lambda.Function(this, "RequestInterceptor", {
2048
+ runtime: lambda.Runtime.PYTHON_3_12,
2049
+ handler: "index.handler",
2050
+ code: lambda.Code.fromInline(`
2051
+ def handler(event, context):
2052
+ # Custom request validation logic
2053
+ return {
2054
+ "interceptorOutputVersion": "1.0",
2055
+ "mcp": {
2056
+ "transformedGatewayRequest": event["mcp"]["gatewayRequest"]
2057
+ }
2058
+ }
2059
+ `),
2060
+ });
2061
+
2062
+ const responseInterceptorFn = new lambda.Function(this, "ResponseInterceptor", {
2063
+ runtime: lambda.Runtime.PYTHON_3_12,
2064
+ handler: "index.handler",
2065
+ code: lambda.Code.fromInline(`
2066
+ def handler(event, context):
2067
+ # Filter sensitive data from response
2068
+ return {
2069
+ "interceptorOutputVersion": "1.0",
2070
+ "mcp": {
2071
+ "transformedGatewayResponse": event["mcp"]["gatewayResponse"]
2072
+ }
2073
+ }
2074
+ `),
2075
+ });
2076
+
2077
+ gateway.addInterceptor(
2078
+ agentcore.LambdaInterceptor.forRequest(requestInterceptorFn, {
2079
+ passRequestHeaders: false // Default, headers not passed for security
2080
+ })
2081
+ );
2082
+
2083
+ gateway.addInterceptor(
2084
+ agentcore.LambdaInterceptor.forResponse(responseInterceptorFn)
2085
+ );
2086
+ ```
2087
+
1845
2088
  ### Gateway Target IAM Permissions
1846
2089
 
1847
2090
  The Gateway Target construct provides convenient methods for granting IAM permissions:
@@ -1901,7 +2144,7 @@ To write to long-term memory, you need to configure extraction strategies which
1901
2144
 
1902
2145
  | Name | Type | Required | Description |
1903
2146
  |------|------|----------|-------------|
1904
- | `memoryName` | `string` | Yes | The name of the memory |
2147
+ | `memoryName` | `string` | No | The name of the memory. If not provided, a unique name will be auto-generated |
1905
2148
  | `expirationDuration` | `Duration` | No | Short-term memory expiration in days (between 7 and 365). Default: 90 days |
1906
2149
  | `description` | `string` | No | Optional description for the memory. Default: no description. |
1907
2150
  | `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 |
@@ -1958,7 +2201,7 @@ You can use built-in extraction strategies for quick setup, or create custom ext
1958
2201
 
1959
2202
  ### Memory with Built-in Strategies
1960
2203
 
1961
- The library provides three built-in LTM strategies. These are default strategies for organizing and extracting memory data,
2204
+ The library provides four built-in LTM strategies. These are default strategies for organizing and extracting memory data,
1962
2205
  each optimized for specific use cases.
1963
2206
 
1964
2207
  For example: An agent helps multiple users with cloud storage setup. From these conversations,
@@ -1985,6 +2228,14 @@ Extracted memory example: User needs clear guidance on cloud storage account con
1985
2228
  - Extracts user behavior patterns from raw conversations
1986
2229
  - Namespace: `/strategies/{memoryStrategyId}/actors/{actorId}`
1987
2230
 
2231
+ 4. **Episodic Memory Strategy** (`MemoryStrategy.usingBuiltInEpisodic()`)
2232
+ Captures meaningful slices of user and system interactions, preserve them into compact records after summarizing.
2233
+ Extracted memory example: User first asked about pricing on Monday, then requested feature comparison on Tuesday, finally made purchase decision on Wednesday.
2234
+
2235
+ - Captures event sequences and temporal relationships
2236
+ - Namespace: `/strategy/{memoryStrategyId}/actor/{actorId}/session/{sessionId}`
2237
+ - Reflections: `/strategy/{memoryStrategyId}/actor/{actorId}`
2238
+
1988
2239
  ```typescript fixture=default
1989
2240
  // Create memory with built-in strategies
1990
2241
  const memory = new agentcore.Memory(this, "MyMemory", {
@@ -1995,6 +2246,7 @@ const memory = new agentcore.Memory(this, "MyMemory", {
1995
2246
  agentcore.MemoryStrategy.usingBuiltInSummarization(),
1996
2247
  agentcore.MemoryStrategy.usingBuiltInSemantic(),
1997
2248
  agentcore.MemoryStrategy.usingBuiltInUserPreference(),
2249
+ agentcore.MemoryStrategy.usingBuiltInEpisodic(),
1998
2250
  ],
1999
2251
  });
2000
2252
  ```
@@ -2004,6 +2256,7 @@ The name generated for each built in memory strategy is as follows:
2004
2256
  - For Summarization: `summary_builtin_cdk001`
2005
2257
  - For Semantic:`semantic_builtin_cdk001>`
2006
2258
  - For User Preferences: `preference_builtin_cdk001`
2259
+ - For Episodic : `episodic_builtin_cdkGen0001`
2007
2260
 
2008
2261
  ### Memory with custom Strategies
2009
2262
 
@@ -2045,12 +2298,13 @@ You can customise the namespace, i.e. where the memories are stored by using the
2045
2298
  1. **Summarization Strategy** (`MemoryStrategy.usingSummarization(props)`)
2046
2299
  1. **Semantic Memory Strategy** (`MemoryStrategy.usingSemantic(props)`)
2047
2300
  1. **User Preference Strategy** (`MemoryStrategy.usingUserPreference(props)`)
2301
+ 1. **Episodic Memory Strategy** (`MemoryStrategy.usingEpisodic(props)`)
2048
2302
 
2049
2303
  ```typescript fixture=default
2050
- // Create memory with built-in strategies
2304
+ // Create memory with custom strategies
2051
2305
  const memory = new agentcore.Memory(this, "MyMemory", {
2052
2306
  memoryName: "my_memory",
2053
- description: "Memory with built-in strategies",
2307
+ description: "Memory with custom strategies",
2054
2308
  expirationDuration: cdk.Duration.days(90),
2055
2309
  memoryStrategies: [
2056
2310
  agentcore.MemoryStrategy.usingUserPreference({
@@ -2061,6 +2315,13 @@ const memory = new agentcore.Memory(this, "MyMemory", {
2061
2315
  name: "CustomerSupportSemantic",
2062
2316
  namespaces: ["support/customer/{actorId}/semantic"]
2063
2317
  }),
2318
+ agentcore.MemoryStrategy.usingEpisodic({
2319
+ name: "customerJourneyEpisodic",
2320
+ namespaces: ["/journey/customer/{actorId}/episodes"],
2321
+ reflectionConfiguration: {
2322
+ namespaces: ["/journey/customer/{actorId}/reflections"]
2323
+ }
2324
+ }),
2064
2325
  ],
2065
2326
  });
2066
2327
  ```