@aws-cdk/aws-bedrock-agentcore-alpha 2.221.0-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.
Files changed (43) hide show
  1. package/.eslintrc.js +4 -0
  2. package/.jsii +12000 -0
  3. package/.jsii.tabl.json.gz +0 -0
  4. package/.warnings.jsii.js +183 -0
  5. package/LICENSE +201 -0
  6. package/NOTICE +2 -0
  7. package/README.md +796 -0
  8. package/agentcore/index.d.ts +11 -0
  9. package/agentcore/index.js +36 -0
  10. package/agentcore/network/network-configuration.d.ts +152 -0
  11. package/agentcore/network/network-configuration.js +234 -0
  12. package/agentcore/runtime/perms.d.ts +67 -0
  13. package/agentcore/runtime/perms.js +101 -0
  14. package/agentcore/runtime/runtime-artifact.d.ts +42 -0
  15. package/agentcore/runtime/runtime-artifact.js +90 -0
  16. package/agentcore/runtime/runtime-authorizer-configuration.d.ts +62 -0
  17. package/agentcore/runtime/runtime-authorizer-configuration.js +165 -0
  18. package/agentcore/runtime/runtime-base.d.ts +309 -0
  19. package/agentcore/runtime/runtime-base.js +207 -0
  20. package/agentcore/runtime/runtime-endpoint-base.d.ts +130 -0
  21. package/agentcore/runtime/runtime-endpoint-base.js +31 -0
  22. package/agentcore/runtime/runtime-endpoint.d.ts +182 -0
  23. package/agentcore/runtime/runtime-endpoint.js +372 -0
  24. package/agentcore/runtime/runtime.d.ts +230 -0
  25. package/agentcore/runtime/runtime.js +590 -0
  26. package/agentcore/runtime/types.d.ts +16 -0
  27. package/agentcore/runtime/types.js +21 -0
  28. package/agentcore/runtime/validation-helpers.d.ts +37 -0
  29. package/agentcore/runtime/validation-helpers.js +85 -0
  30. package/agentcore/tools/browser.d.ts +519 -0
  31. package/agentcore/tools/browser.js +641 -0
  32. package/agentcore/tools/code-interpreter.d.ts +447 -0
  33. package/agentcore/tools/code-interpreter.js +553 -0
  34. package/agentcore/tools/perms.d.ts +74 -0
  35. package/agentcore/tools/perms.js +122 -0
  36. package/agentcore/tools/validation-helpers.d.ts +37 -0
  37. package/agentcore/tools/validation-helpers.js +85 -0
  38. package/jest.config.js +2 -0
  39. package/lib/index.d.ts +1 -0
  40. package/lib/index.js +22 -0
  41. package/package.json +122 -0
  42. package/rosetta/_generated.ts-fixture +6 -0
  43. package/rosetta/default.ts-fixture +19 -0
@@ -0,0 +1,447 @@
1
+ import { IResource, Resource } from 'aws-cdk-lib';
2
+ import { DimensionsMap, Metric, MetricOptions } from 'aws-cdk-lib/aws-cloudwatch';
3
+ import * as iam from 'aws-cdk-lib/aws-iam';
4
+ import * as ec2 from 'aws-cdk-lib/aws-ec2';
5
+ import { Construct } from 'constructs';
6
+ import { CodeInterpreterNetworkConfiguration } from '../network/network-configuration';
7
+ /******************************************************************************
8
+ * Interface
9
+ *****************************************************************************/
10
+ /**
11
+ * Interface for CodeInterpreterCustom resources
12
+ */
13
+ export interface ICodeInterpreterCustom extends IResource, iam.IGrantable, ec2.IConnectable {
14
+ /**
15
+ * The ARN of the code interpreter resource
16
+ * @attribute
17
+ */
18
+ readonly codeInterpreterArn: string;
19
+ /**
20
+ * The id of the code interpreter
21
+ * @attribute
22
+ */
23
+ readonly codeInterpreterId: string;
24
+ /**
25
+ * The status of the code interpreter
26
+ * @attribute
27
+ */
28
+ readonly status?: string;
29
+ /**
30
+ * Timestamp when the code interpreter was created
31
+ * @attribute
32
+ */
33
+ readonly createdAt?: string;
34
+ /**
35
+ * Timestamp when the code interpreter was last updated
36
+ * @attribute
37
+ */
38
+ readonly lastUpdatedAt?: string;
39
+ /**
40
+ * The IAM role that provides permissions for the code interpreter to access AWS services.
41
+ */
42
+ readonly executionRole: iam.IRole;
43
+ /**
44
+ * Grants IAM actions to the IAM Principal
45
+ */
46
+ grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
47
+ /**
48
+ * Grants `Get` and `List` actions on the Code Interpreter
49
+ */
50
+ grantRead(grantee: iam.IGrantable): iam.Grant;
51
+ /**
52
+ * Grants `Invoke`, `Start`, and `Stop` actions on the Code Interpreter
53
+ */
54
+ grantUse(grantee: iam.IGrantable): iam.Grant;
55
+ /**
56
+ * Return the given named metric for this code interpreter.
57
+ */
58
+ metric(metricName: string, dimensions: DimensionsMap, props?: MetricOptions): Metric;
59
+ /**
60
+ * Return the given named metric related to the API operation performed on this code interpreter.
61
+ */
62
+ metricForApiOperation(metricName: string, operation: string, props?: MetricOptions): Metric;
63
+ /**
64
+ * Return a metric measuring the latency of a specific API operation performed on this code interpreter.
65
+ */
66
+ metricLatencyForApiOperation(operation: string, props?: MetricOptions): Metric;
67
+ /**
68
+ * Return a metric containing the total number of API requests made for a specific code interpreter operation.
69
+ */
70
+ metricInvocationsForApiOperation(operation: string, props?: MetricOptions): Metric;
71
+ /**
72
+ * Return a metric containing the number of errors for a specific API operation performed on this code interpreter.
73
+ */
74
+ metricErrorsForApiOperation(operation: string, props?: MetricOptions): Metric;
75
+ /**
76
+ * Return a metric containing the number of throttled requests for a specific API operation performed on this code interpreter.
77
+ */
78
+ metricThrottlesForApiOperation(operation: string, props?: MetricOptions): Metric;
79
+ /**
80
+ * Return a metric containing the number of system errors for a specific API operation performed on this code interpreter.
81
+ */
82
+ metricSystemErrorsForApiOperation(operation: string, props?: MetricOptions): Metric;
83
+ /**
84
+ * Return a metric containing the number of user errors for a specific API operation performed on this code interpreter.
85
+ */
86
+ metricUserErrorsForApiOperation(operation: string, props?: MetricOptions): Metric;
87
+ /**
88
+ * Return a metric measuring the duration of code interpreter sessions.
89
+ */
90
+ metricSessionDuration(props?: MetricOptions): Metric;
91
+ }
92
+ /******************************************************************************
93
+ * ABSTRACT BASE CLASS
94
+ *****************************************************************************/
95
+ /**
96
+ * Abstract base class for a Code Interpreter.
97
+ * Contains methods and attributes valid for Code Interpreters either created with CDK or imported.
98
+ */
99
+ export declare abstract class CodeInterpreterCustomBase extends Resource implements ICodeInterpreterCustom {
100
+ abstract readonly codeInterpreterArn: string;
101
+ abstract readonly codeInterpreterId: string;
102
+ abstract readonly status?: string;
103
+ abstract readonly createdAt?: string;
104
+ abstract readonly lastUpdatedAt?: string;
105
+ abstract readonly executionRole: iam.IRole;
106
+ /**
107
+ * The principal to grant permissions to
108
+ */
109
+ abstract readonly grantPrincipal: iam.IPrincipal;
110
+ /**
111
+ * An accessor for the Connections object that will fail if this Browser does not have a VPC
112
+ * configured.
113
+ */
114
+ get connections(): ec2.Connections;
115
+ /**
116
+ * The actual Connections object for this Browser. This may be unset in the event that a VPC has not
117
+ * been configured.
118
+ * @internal
119
+ */
120
+ protected _connections: ec2.Connections | undefined;
121
+ constructor(scope: Construct, id: string);
122
+ /**
123
+ * Grants IAM actions to the IAM Principal
124
+ * @param grantee - The IAM principal to grant permissions to
125
+ * @param actions - The actions to grant
126
+ * @returns An IAM Grant object representing the granted permissions
127
+ */
128
+ grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
129
+ /**
130
+ * Grant read permissions on this code interpreter to an IAM principal.
131
+ * This includes both read permissions on the specific code interpreter and list permissions on all code interpreters.
132
+ *
133
+ * @param grantee - The IAM principal to grant read permissions to
134
+ * @default - Default grant configuration:
135
+ * - actions: ['bedrock-agentcore:GetCodeInterpreter', 'bedrock-agentcore:GetCodeInterpreterSession'] on this.codeInterpreterArn
136
+ * - actions: ['bedrock-agentcore:ListCodeInterpreters', 'bedrock-agentcore:ListCodeInterpreterSessions'] on all resources (*)
137
+ * @returns An IAM Grant object representing the granted permissions
138
+ */
139
+ grantRead(grantee: iam.IGrantable): iam.Grant;
140
+ /**
141
+ * Grant invoke permissions on this code interpreter to an IAM principal.
142
+ *
143
+ * @param grantee - The IAM principal to grant invoke permissions to
144
+ * @default - Default grant configuration:
145
+ * - actions: ['bedrock-agentcore:StartCodeInterpreterSession', 'bedrock-agentcore:InvokeCodeInterpreter', 'bedrock-agentcore:StopCodeInterpreterSession']
146
+ * - resourceArns: [this.codeInterpreterArn]
147
+ * @returns An IAM Grant object representing the granted permissions
148
+ */
149
+ grantUse(grantee: iam.IGrantable): iam.Grant;
150
+ /**
151
+ * Grant invoke permissions on this code interpreter to an IAM principal.
152
+ *
153
+ * @param grantee - The IAM principal to grant invoke permissions to
154
+ * @returns An IAM Grant object representing the granted permissions
155
+ * @default - Default grant configuration:
156
+ * - actions: ['bedrock-agentcore:InvokeCodeInterpreter']
157
+ * - resourceArns: [this.codeInterpreterArn]
158
+ */
159
+ grantInvoke(grantee: iam.IGrantable): iam.Grant;
160
+ /**
161
+ * Return the given named metric for this code interpreter.
162
+ *
163
+ * By default, the metric will be calculated as a sum over a period of 5 minutes.
164
+ * You can customize this by using the `statistic` and `period` properties.
165
+ */
166
+ metric(metricName: string, dimensions: DimensionsMap, props?: MetricOptions): Metric;
167
+ /**
168
+ * Creates a CloudWatch metric for tracking code interpreter api operations..
169
+ *
170
+ * @param props - Configuration options for the metric
171
+ * @default - Default metric configuration:
172
+ * - namespace: 'AWS/Bedrock-AgentCore'
173
+ * - metricName: metricName
174
+ * - dimensionsMap: { CodeInterpreterId: this.codeInterpreterId }
175
+ * @returns A CloudWatch Metric configured for code interpreter api operations
176
+ */
177
+ metricForApiOperation(metricName: string, operation: string, props?: MetricOptions): Metric;
178
+ /**
179
+ * Creates a CloudWatch metric for tracking code interpreter latencies.
180
+ *
181
+ * @param props - Configuration options for the metric
182
+ * @default - Default metric configuration:
183
+ * - namespace: 'AWS/Bedrock-AgentCore'
184
+ * - metricName: Latency
185
+ * @returns A CloudWatch Metric configured for code interpreter latencies
186
+ */
187
+ metricLatencyForApiOperation(operation: string, props?: MetricOptions): Metric;
188
+ /**
189
+ * Creates a CloudWatch metric for tracking code interpreter invocations.
190
+ *
191
+ * @param props - Configuration options for the metric
192
+ * @default - Default metric configuration:
193
+ * - namespace: 'AWS/Bedrock-AgentCore'
194
+ * - metricName: Invocations
195
+ * @returns A CloudWatch Metric configured for code interpreter invocations
196
+ */
197
+ metricInvocationsForApiOperation(operation: string, props?: MetricOptions): Metric;
198
+ /**
199
+ * Creates a CloudWatch metric for tracking code interpreter errors.
200
+ *
201
+ * @param props - Configuration options for the metric
202
+ * @default - Default metric configuration:
203
+ * - namespace: 'AWS/Bedrock-AgentCore'
204
+ * - metricName: Errors
205
+ * @returns A CloudWatch Metric configured for code interpreter errors
206
+ */
207
+ metricErrorsForApiOperation(operation: string, props?: MetricOptions): Metric;
208
+ /**
209
+ * Creates a CloudWatch metric for tracking code interpreter throttles.
210
+ *
211
+ * @param props - Configuration options for the metric
212
+ * @default - Default metric configuration:
213
+ * - namespace: 'AWS/Bedrock-AgentCore'
214
+ * - metricName: Throttles
215
+ * @returns A CloudWatch Metric configured for code interpreter throttles
216
+ */
217
+ metricThrottlesForApiOperation(operation: string, props?: MetricOptions): Metric;
218
+ /**
219
+ * Creates a CloudWatch metric for tracking code interpreter system errors.
220
+ *
221
+ * @param props - Configuration options for the metric
222
+ * @default - Default metric configuration:
223
+ * - namespace: 'AWS/Bedrock-AgentCore'
224
+ * - metricName: SystemErrors
225
+ * @returns A CloudWatch Metric configured for code interpreter system errors
226
+ */
227
+ metricSystemErrorsForApiOperation(operation: string, props?: MetricOptions): Metric;
228
+ /**
229
+ * Creates a CloudWatch metric for tracking code interpreter user errors.
230
+ *
231
+ * @param props - Configuration options for the metric
232
+ * @default - Default metric configuration:
233
+ * - namespace: 'AWS/Bedrock-AgentCore'
234
+ * - metricName: UserErrors
235
+ * @returns A CloudWatch Metric configured for code interpreter user errors
236
+ */
237
+ metricUserErrorsForApiOperation(operation: string, props?: MetricOptions): Metric;
238
+ /**
239
+ * Creates a CloudWatch metric for tracking code interpreter session duration.
240
+ *
241
+ * @param props - Configuration options for the metric
242
+ * @default - Default metric configuration:
243
+ * - namespace: 'AWS/Bedrock-AgentCore'
244
+ * - metricName: Duration
245
+ * @returns A CloudWatch Metric configured for code interpreter session duration
246
+ */
247
+ metricSessionDuration(props?: MetricOptions): Metric;
248
+ /**
249
+ * Internal method to create a metric.
250
+ *
251
+ * @param props - Configuration options for the metric
252
+ * @returns A CloudWatch Metric configured for code interpreter api operations
253
+ */
254
+ private configureMetric;
255
+ }
256
+ /******************************************************************************
257
+ * PROPS FOR NEW CONSTRUCT
258
+ *****************************************************************************/
259
+ /**
260
+ * Properties for creating a CodeInterpreter resource
261
+ */
262
+ export interface CodeInterpreterCustomProps {
263
+ /**
264
+ * The name of the code interpreter
265
+ * Valid characters are a-z, A-Z, 0-9, _ (underscore)
266
+ * The name must start with a letter and can be up to 48 characters long
267
+ * Pattern: [a-zA-Z][a-zA-Z0-9_]{0,47}
268
+ * @required - Yes
269
+ */
270
+ readonly codeInterpreterCustomName: string;
271
+ /**
272
+ * Optional description for the code interpreter
273
+ * Valid characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and spaces
274
+ * The description can have up to 200 characters
275
+ * @default - No description
276
+ * @required - No
277
+ */
278
+ readonly description?: string;
279
+ /**
280
+ * The IAM role that provides permissions for the code interpreter to access AWS services.
281
+ *
282
+ * @default - A new role will be created.
283
+ * @required - No
284
+ */
285
+ readonly executionRole?: iam.IRole;
286
+ /**
287
+ * Network configuration for code interpreter
288
+ * @required - No
289
+ * @default - PUBLIC network mode
290
+ */
291
+ readonly networkConfiguration?: CodeInterpreterNetworkConfiguration;
292
+ /**
293
+ * Tags (optional)
294
+ * A list of key:value pairs of tags to apply to this Code Interpreter resource
295
+ *
296
+ * @default {} - no tags
297
+ * @required - No
298
+ */
299
+ readonly tags?: {
300
+ [key: string]: string;
301
+ };
302
+ }
303
+ /******************************************************************************
304
+ * ATTRS FOR IMPORTED CONSTRUCT
305
+ *****************************************************************************/
306
+ /**
307
+ * Attributes for specifying an imported Code Interpreter Custom.
308
+ */
309
+ export interface CodeInterpreterCustomAttributes {
310
+ /**
311
+ * The ARN of the agent.
312
+ * @attribute
313
+ */
314
+ readonly codeInterpreterArn: string;
315
+ /**
316
+ * The ARN of the IAM role associated to the code interpreter.
317
+ * @attribute
318
+ */
319
+ readonly roleArn: string;
320
+ /**
321
+ * When this code interpreter was last updated.
322
+ * @default undefined - No last updated timestamp is provided
323
+ */
324
+ readonly lastUpdatedAt?: string;
325
+ /**
326
+ * The status of the code interpreter.
327
+ * @default undefined - No status is provided
328
+ */
329
+ readonly status?: string;
330
+ /**
331
+ * The created timestamp of the code interpreter.
332
+ * @default undefined - No created timestamp is provided
333
+ */
334
+ readonly createdAt?: string;
335
+ /**
336
+ * The security groups for this code interpreter, if in a VPC.
337
+ *
338
+ * @default - By default, the code interpreter is not in a VPC.
339
+ */
340
+ readonly securityGroups?: ec2.ISecurityGroup[];
341
+ }
342
+ /******************************************************************************
343
+ * Class
344
+ *****************************************************************************/
345
+ /**
346
+ * Custom code interpreter resource for AWS Bedrock Agent Core.
347
+ * Provides a sandboxed environment for code execution with configurable network access.
348
+ *
349
+ * @see https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/code-interpreter.html
350
+ * @resource AWS::BedrockAgentCore::CodeInterpreterCustom
351
+ */
352
+ export declare class CodeInterpreterCustom extends CodeInterpreterCustomBase {
353
+ /** Uniquely identifies this class. */
354
+ static readonly PROPERTY_INJECTION_ID: string;
355
+ /**
356
+ * Static Method for importing an existing Bedrock AgentCore Code Interpreter Custom.
357
+ */
358
+ /**
359
+ * Creates an Code Interpreter Custom reference from an existing code interpreter's attributes.
360
+ *
361
+ * @param scope - The construct scope
362
+ * @param id - Identifier of the construct
363
+ * @param attrs - Attributes of the existing code interpreter custom
364
+ * @returns An ICodeInterpreterCustom reference to the existing code interpreter
365
+ */
366
+ static fromCodeInterpreterCustomAttributes(scope: Construct, id: string, attrs: CodeInterpreterCustomAttributes): ICodeInterpreterCustom;
367
+ /**
368
+ * The ARN of the code interpreter resource
369
+ * @attribute
370
+ */
371
+ readonly codeInterpreterArn: string;
372
+ /**
373
+ * The id of the code interpreter
374
+ * @attribute
375
+ */
376
+ readonly codeInterpreterId: string;
377
+ /**
378
+ * The name of the code interpreter
379
+ */
380
+ readonly name: string;
381
+ /**
382
+ * The description of the code interpreter
383
+ */
384
+ readonly description?: string;
385
+ /**
386
+ * The network configuration of the code interpreter
387
+ */
388
+ readonly networkConfiguration: CodeInterpreterNetworkConfiguration;
389
+ /**
390
+ * The status of the code interpreter
391
+ * @attribute
392
+ */
393
+ readonly status?: string;
394
+ /**
395
+ * The created timestamp of the code interpreter
396
+ * @attribute
397
+ */
398
+ readonly createdAt?: string;
399
+ /**
400
+ * The last updated timestamp of the code interpreter
401
+ * @attribute
402
+ */
403
+ readonly lastUpdatedAt?: string;
404
+ /**
405
+ * The failure reason of the code interpreter
406
+ * @attribute
407
+ */
408
+ readonly failureReason?: string;
409
+ /**
410
+ * The IAM role that provides permissions for the code interpreter to access AWS services.
411
+ */
412
+ readonly executionRole: iam.IRole;
413
+ /**
414
+ * The principal to grant permissions to
415
+ */
416
+ readonly grantPrincipal: iam.IPrincipal;
417
+ /**
418
+ * Tags applied to this code interpreter resource
419
+ * A map of key-value pairs for resource tagging
420
+ * @default - No tags applied
421
+ */
422
+ readonly tags?: {
423
+ [key: string]: string;
424
+ };
425
+ private readonly __resource;
426
+ constructor(scope: Construct, id: string, props: CodeInterpreterCustomProps);
427
+ /**
428
+ * Validates the code interpreter name format
429
+ * @param name The code interpreter name to validate
430
+ * @returns Array of validation error messages, empty if valid
431
+ * @internal This is an internal core function and should not be called directly.
432
+ */
433
+ private _validateCodeInterpreterName;
434
+ /**
435
+ * Validates the code interpreter tags format
436
+ * @param tags The tags object to validate
437
+ * @returns Array of validation error messages, empty if valid
438
+ * @internal This is an internal core function and should not be called directly.
439
+ */
440
+ private _validateCodeInterpreterTags;
441
+ /**
442
+ * Creates execution role needed for the code interpreter to access AWS services
443
+ * @returns The created role
444
+ * @internal This is an internal core function and should not be called directly.
445
+ */
446
+ private _createCodeInterpreterRole;
447
+ }