@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,519 @@
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 { Location } from 'aws-cdk-lib/aws-s3';
6
+ import { Construct } from 'constructs';
7
+ import { BrowserNetworkConfiguration } from '../network/network-configuration';
8
+ /******************************************************************************
9
+ * Interface
10
+ *****************************************************************************/
11
+ /**
12
+ * Interface for Browser resources
13
+ */
14
+ export interface IBrowserCustom extends IResource, iam.IGrantable, ec2.IConnectable {
15
+ /**
16
+ * The ARN of the browser resource
17
+ * @attribute
18
+ */
19
+ readonly browserArn: string;
20
+ /**
21
+ * The id of the browser
22
+ * @attribute
23
+ */
24
+ readonly browserId: string;
25
+ /**
26
+ * The IAM role that provides permissions for the browser to access AWS services
27
+ */
28
+ readonly executionRole: iam.IRole;
29
+ /**
30
+ * Timestamp when the browser was last updated
31
+ * @attribute
32
+ */
33
+ readonly lastUpdatedAt?: string;
34
+ /**
35
+ * The status of the browser
36
+ * @attribute
37
+ */
38
+ readonly status?: string;
39
+ /**
40
+ * Timestamp when the browser was created
41
+ * @attribute
42
+ */
43
+ readonly createdAt?: string;
44
+ /**
45
+ * Grants IAM actions to the IAM Principal
46
+ */
47
+ grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
48
+ /**
49
+ * Grants `Get` and `List` actions on the Browser
50
+ */
51
+ grantRead(grantee: iam.IGrantable): iam.Grant;
52
+ /**
53
+ * Grants `Invoke`, `Start`, and `Update` actions on the Browser
54
+ */
55
+ grantUse(grantee: iam.IGrantable): iam.Grant;
56
+ /**
57
+ * Return the given named metric for this browser.
58
+ */
59
+ metric(metricName: string, dimensions: DimensionsMap, props?: MetricOptions): Metric;
60
+ /**
61
+ * Return the given named metric related to the API operation performed on this browser.
62
+ */
63
+ metricForApiOperation(metricName: string, operation: string, props?: MetricOptions): Metric;
64
+ /**
65
+ * Return a metric measuring the latency of a specific API operation performed on this browser.
66
+ */
67
+ metricLatencyForApiOperation(operation: string, props?: MetricOptions): Metric;
68
+ /**
69
+ * Return a metric containing the total number of API requests made for a specific browser operation.
70
+ */
71
+ metricInvocationsForApiOperation(operation: string, props?: MetricOptions): Metric;
72
+ /**
73
+ * Return a metric containing the number of errors for a specific API operation performed on this browser.
74
+ */
75
+ metricErrorsForApiOperation(operation: string, props?: MetricOptions): Metric;
76
+ /**
77
+ * Return a metric containing the number of throttled requests for a specific API operation performed on this browser.
78
+ */
79
+ metricThrottlesForApiOperation(operation: string, props?: MetricOptions): Metric;
80
+ /**
81
+ * Return a metric containing the number of system errors for a specific API operation performed on this browser.
82
+ */
83
+ metricSystemErrorsForApiOperation(operation: string, props?: MetricOptions): Metric;
84
+ /**
85
+ * Return a metric containing the number of user errors for a specific API operation performed on this browser.
86
+ */
87
+ metricUserErrorsForApiOperation(operation: string, props?: MetricOptions): Metric;
88
+ /**
89
+ * Return a metric measuring the duration of browser sessions.
90
+ */
91
+ metricSessionDuration(props?: MetricOptions): Metric;
92
+ /**
93
+ * Return a metric containing the number of user takeovers.
94
+ */
95
+ metricTakeOverCount(props?: MetricOptions): Metric;
96
+ /**
97
+ * Return a metric containing the number of user takeovers released.
98
+ */
99
+ metricTakeOverReleaseCount(props?: MetricOptions): Metric;
100
+ /**
101
+ * Return a metric measuring the duration of user takeovers.
102
+ */
103
+ metricTakeOverDuration(props?: MetricOptions): Metric;
104
+ }
105
+ /******************************************************************************
106
+ * ABSTRACT BASE CLASS
107
+ *****************************************************************************/
108
+ /**
109
+ * Abstract base class for a Browser.
110
+ * Contains methods and attributes valid for Browsers either created with CDK or imported.
111
+ */
112
+ export declare abstract class BrowserCustomBase extends Resource implements IBrowserCustom {
113
+ abstract readonly browserArn: string;
114
+ abstract readonly browserId: string;
115
+ abstract readonly lastUpdatedAt?: string;
116
+ abstract readonly status?: string;
117
+ abstract readonly createdAt?: string;
118
+ abstract readonly executionRole: iam.IRole;
119
+ /**
120
+ * The principal to grant permissions to
121
+ */
122
+ abstract readonly grantPrincipal: iam.IPrincipal;
123
+ /**
124
+ * An accessor for the Connections object that will fail if this Browser does not have a VPC
125
+ * configured.
126
+ */
127
+ get connections(): ec2.Connections;
128
+ /**
129
+ * The actual Connections object for this Browser. This may be unset in the event that a VPC has not
130
+ * been configured.
131
+ * @internal
132
+ */
133
+ protected _connections: ec2.Connections | undefined;
134
+ constructor(scope: Construct, id: string);
135
+ /**
136
+ * Grants IAM actions to the IAM Principal
137
+ * @param grantee - The IAM principal to grant permissions to
138
+ * @param actions - The actions to grant
139
+ * @returns An IAM Grant object representing the granted permissions
140
+ */
141
+ grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
142
+ /**
143
+ * Grant read permissions on this browser to an IAM principal.
144
+ * This includes both read permissions on the specific browser and list permissions on all browsers.
145
+ *
146
+ * @param grantee - The IAM principal to grant read permissions to
147
+ * @default - Default grant configuration:
148
+ * - actions: ['bedrock-agentcore:GetBrowser', 'bedrock-agentcore:GetBrowserSession'] on this.browserArn
149
+ * - actions: ['bedrock-agentcore:ListBrowsers', 'bedrock-agentcore:ListBrowserSessions'] on all resources (*)
150
+ * @returns An IAM Grant object representing the granted permissions
151
+ */
152
+ grantRead(grantee: iam.IGrantable): iam.Grant;
153
+ /**
154
+ * Grant invoke permissions on this browser to an IAM principal.
155
+ *
156
+ * @param grantee - The IAM principal to grant invoke permissions to
157
+ * @default - Default grant configuration:
158
+ * - actions: ['bedrock-agentcore:StartBrowserSession', 'bedrock-agentcore:UpdateBrowserStream', 'bedrock-agentcore:StopBrowserSession']
159
+ * - resourceArns: [this.browserArn]
160
+ * @returns An IAM Grant object representing the granted permissions
161
+ */
162
+ grantUse(grantee: iam.IGrantable): iam.Grant;
163
+ /**
164
+ * Return the given named metric for this browser.
165
+ *
166
+ * By default, the metric will be calculated as a sum over a period of 5 minutes.
167
+ * You can customize this by using the `statistic` and `period` properties.
168
+ */
169
+ metric(metricName: string, dimensions: DimensionsMap, props?: MetricOptions): Metric;
170
+ /**
171
+ * Creates a CloudWatch metric for tracking browser api operations..
172
+ *
173
+ * @param props - Configuration options for the metric
174
+ * @default - Default metric configuration:
175
+ * - namespace: 'AWS/Bedrock-AgentCore'
176
+ * - metricName: metricName
177
+ * - dimensionsMap: { BrowserId: this.browserId }
178
+ * @returns A CloudWatch Metric configured for browser api operations
179
+ */
180
+ metricForApiOperation(metricName: string, operation: string, props?: MetricOptions): Metric;
181
+ /**
182
+ * Creates a CloudWatch metric for tracking browser latencies.
183
+ *
184
+ * @param props - Configuration options for the metric
185
+ * @default - Default metric configuration:
186
+ * - namespace: 'AWS/Bedrock-AgentCore'
187
+ * - metricName: Latency
188
+ * @returns A CloudWatch Metric configured for browser latencies
189
+ */
190
+ metricLatencyForApiOperation(operation: string, props?: MetricOptions): Metric;
191
+ /**
192
+ * Creates a CloudWatch metric for tracking browser invocations.
193
+ *
194
+ * @param props - Configuration options for the metric
195
+ * @default - Default metric configuration:
196
+ * - namespace: 'AWS/Bedrock-AgentCore'
197
+ * - metricName: Invocations
198
+ * @returns A CloudWatch Metric configured for browser latencies
199
+ */
200
+ metricInvocationsForApiOperation(operation: string, props?: MetricOptions): Metric;
201
+ /**
202
+ * Creates a CloudWatch metric for tracking browser errors.
203
+ *
204
+ * @param props - Configuration options for the metric
205
+ * @default - Default metric configuration:
206
+ * - namespace: 'AWS/Bedrock-AgentCore'
207
+ * - metricName: Errors
208
+ * @returns A CloudWatch Metric configured for browser errors
209
+ */
210
+ metricErrorsForApiOperation(operation: string, props?: MetricOptions): Metric;
211
+ /**
212
+ * Creates a CloudWatch metric for tracking browser throttles.
213
+ *
214
+ * @param props - Configuration options for the metric
215
+ * @default - Default metric configuration:
216
+ * - namespace: 'AWS/Bedrock-AgentCore'
217
+ * - metricName: Throttles
218
+ * @returns A CloudWatch Metric configured for browser throttles
219
+ */
220
+ metricThrottlesForApiOperation(operation: string, props?: MetricOptions): Metric;
221
+ /**
222
+ * Creates a CloudWatch metric for tracking browser system errors.
223
+ *
224
+ * @param props - Configuration options for the metric
225
+ * @default - Default metric configuration:
226
+ * - namespace: 'AWS/Bedrock-AgentCore'
227
+ * - metricName: SystemErrors
228
+ * @returns A CloudWatch Metric configured for browser system errors
229
+ */
230
+ metricSystemErrorsForApiOperation(operation: string, props?: MetricOptions): Metric;
231
+ /**
232
+ * Creates a CloudWatch metric for tracking browser user errors.
233
+ *
234
+ * @param props - Configuration options for the metric
235
+ * @default - Default metric configuration:
236
+ * - namespace: 'AWS/Bedrock-AgentCore'
237
+ * - metricName: UserErrors
238
+ * @returns A CloudWatch Metric configured for browser user errors
239
+ */
240
+ metricUserErrorsForApiOperation(operation: string, props?: MetricOptions): Metric;
241
+ /**
242
+ * Creates a CloudWatch metric for tracking browser session duration.
243
+ *
244
+ * @param props - Configuration options for the metric
245
+ * @default - Default metric configuration:
246
+ * - namespace: 'AWS/Bedrock-AgentCore'
247
+ * - metricName: Duration
248
+ * @returns A CloudWatch Metric configured for browser session duration
249
+ */
250
+ metricSessionDuration(props?: MetricOptions): Metric;
251
+ /**
252
+ * Creates a CloudWatch metric for tracking browser user takeovers.
253
+ *
254
+ * @param props - Configuration options for the metric
255
+ * @default - Default metric configuration:
256
+ * - namespace: 'AWS/Bedrock-AgentCore'
257
+ * - metricName: TakeOverCount
258
+ * @returns A CloudWatch Metric configured for browser user takeovers
259
+ */
260
+ metricTakeOverCount(props?: MetricOptions): Metric;
261
+ /**
262
+ * Creates a CloudWatch metric for tracking browser user takeovers released.
263
+ *
264
+ * @param props - Configuration options for the metric
265
+ * @default - Default metric configuration:
266
+ * - namespace: 'AWS/Bedrock-AgentCore'
267
+ * - metricName: TakeOverReleaseCount
268
+ * @returns A CloudWatch Metric configured for browser user takeovers released
269
+ */
270
+ metricTakeOverReleaseCount(props?: MetricOptions): Metric;
271
+ /**
272
+ * Creates a CloudWatch metric for tracking browser user takeovers duration.
273
+ *
274
+ * @param props - Configuration options for the metric
275
+ * @default - Default metric configuration:
276
+ * - namespace: 'AWS/Bedrock-AgentCore'
277
+ * - metricName: TakeOverDuration
278
+ * @returns A CloudWatch Metric configured for browser user takeovers duration
279
+ */
280
+ metricTakeOverDuration(props?: MetricOptions): Metric;
281
+ /**
282
+ * Internal method to create a metric.
283
+ *
284
+ * @param props - Configuration options for the metric
285
+ * @returns A CloudWatch Metric configured for browser api operations
286
+ */
287
+ private configureMetric;
288
+ }
289
+ /******************************************************************************
290
+ * Recording Configuration
291
+ *****************************************************************************/
292
+ /**
293
+ * Recording configuration for browser
294
+ */
295
+ export interface RecordingConfig {
296
+ /**
297
+ * Whether recording is enabled
298
+ * @default - false
299
+ */
300
+ readonly enabled?: boolean;
301
+ /**
302
+ * S3 Location Configuration
303
+ * @default - undefined
304
+ */
305
+ readonly s3Location?: Location;
306
+ }
307
+ /******************************************************************************
308
+ * PROPS FOR NEW CONSTRUCT
309
+ *****************************************************************************/
310
+ /**
311
+ * Properties for creating a Browser resource
312
+ */
313
+ export interface BrowserCustomProps {
314
+ /**
315
+ * The name of the browser
316
+ * Valid characters are a-z, A-Z, 0-9, _ (underscore)
317
+ * The name must start with a letter and can be up to 48 characters long
318
+ * Pattern: [a-zA-Z][a-zA-Z0-9_]{0,47}
319
+ * @required - Yes
320
+ */
321
+ readonly browserCustomName: string;
322
+ /**
323
+ * Optional description for the browser
324
+ * Valid characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and spaces
325
+ * The description can have up to 200 characters
326
+ * @default - No description
327
+ * @required - No
328
+ */
329
+ readonly description?: string;
330
+ /**
331
+ * Network configuration for browser
332
+ * @required - No
333
+ * @default - PUBLIC network mode
334
+ */
335
+ readonly networkConfiguration?: BrowserNetworkConfiguration;
336
+ /**
337
+ * Recording configuration for browser
338
+ * @required - No
339
+ * @default - No recording configuration
340
+ */
341
+ readonly recordingConfig?: RecordingConfig;
342
+ /**
343
+ * The IAM role that provides permissions for the browser to access AWS services
344
+ * @default - A new role will be created
345
+ * @required - No
346
+ */
347
+ readonly executionRole?: iam.IRole;
348
+ /**
349
+ * Tags (optional)
350
+ * A list of key:value pairs of tags to apply to this Browser resource
351
+ *
352
+ * @default {} - no tags
353
+ * @required - No
354
+ */
355
+ readonly tags?: {
356
+ [key: string]: string;
357
+ };
358
+ }
359
+ /******************************************************************************
360
+ * ATTRS FOR IMPORTED CONSTRUCT
361
+ *****************************************************************************/
362
+ /**
363
+ * Attributes for specifying an imported Browser Custom.
364
+ */
365
+ export interface BrowserCustomAttributes {
366
+ /**
367
+ * The ARN of the agent.
368
+ * @attribute
369
+ */
370
+ readonly browserArn: string;
371
+ /**
372
+ * The ARN of the IAM role associated to the browser.
373
+ * @attribute
374
+ */
375
+ readonly roleArn: string;
376
+ /**
377
+ * When this browser was last updated.
378
+ * @default undefined - No last updated timestamp is provided
379
+ */
380
+ readonly lastUpdatedAt?: string;
381
+ /**
382
+ * The status of the browser.
383
+ * @default undefined - No status is provided
384
+ */
385
+ readonly status?: string;
386
+ /**
387
+ * The created timestamp of the browser.
388
+ * @default undefined - No created timestamp is provided
389
+ */
390
+ readonly createdAt?: string;
391
+ /**
392
+ * The security groups for this browser, if in a VPC.
393
+ *
394
+ * @default - By default, the browser is not in a VPC.
395
+ */
396
+ readonly securityGroups?: ec2.ISecurityGroup[];
397
+ }
398
+ /******************************************************************************
399
+ * Class
400
+ *****************************************************************************/
401
+ /**
402
+ * Browser resource for AWS Bedrock Agent Core.
403
+ * Provides a browser environment for web automation and interaction.
404
+ *
405
+ * @see https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/browser.html
406
+ * @resource AWS::BedrockAgentCore::BrowserCustom
407
+ */
408
+ export declare class BrowserCustom extends BrowserCustomBase {
409
+ /** Uniquely identifies this class. */
410
+ static readonly PROPERTY_INJECTION_ID: string;
411
+ /**
412
+ * Static Method for importing an existing Bedrock AgentCore Browser Custom.
413
+ */
414
+ /**
415
+ * Creates an Browser Custom reference from an existing browser's attributes.
416
+ *
417
+ * @param scope - The construct scope
418
+ * @param id - Identifier of the construct
419
+ * @param attrs - Attributes of the existing browser custom
420
+ * @returns An IBrowserCustom reference to the existing browser
421
+ */
422
+ static fromBrowserCustomAttributes(scope: Construct, id: string, attrs: BrowserCustomAttributes): IBrowserCustom;
423
+ /**
424
+ * The ARN of the browser resource.
425
+ * @attribute
426
+ */
427
+ readonly browserArn: string;
428
+ /**
429
+ * The id of the browser
430
+ * @attribute
431
+ */
432
+ readonly browserId: string;
433
+ /**
434
+ * The name of the browser
435
+ */
436
+ readonly name: string;
437
+ /**
438
+ * The description of the browser
439
+ */
440
+ readonly description?: string;
441
+ /**
442
+ * The last updated timestamp of the browser
443
+ * @attribute
444
+ */
445
+ readonly lastUpdatedAt?: string;
446
+ /**
447
+ * The status of the browser
448
+ * @attribute
449
+ */
450
+ readonly status?: string;
451
+ /**
452
+ * The created timestamp of the browser
453
+ * @attribute
454
+ */
455
+ readonly createdAt?: string;
456
+ /**
457
+ * The failure reason of the browser
458
+ * @attribute
459
+ */
460
+ readonly failureReason?: string;
461
+ /**
462
+ * The IAM role associated to the browser.
463
+ */
464
+ readonly executionRole: iam.IRole;
465
+ /**
466
+ * Tags applied to this browser resource
467
+ * A map of key-value pairs for resource tagging
468
+ * @default - No tags applied
469
+ */
470
+ readonly tags?: {
471
+ [key: string]: string;
472
+ };
473
+ /**
474
+ * The principal to grant permissions to
475
+ */
476
+ readonly grantPrincipal: iam.IPrincipal;
477
+ /**
478
+ * The network configuration of the browser
479
+ */
480
+ readonly networkConfiguration: BrowserNetworkConfiguration;
481
+ /**
482
+ * The recording configuration of the browser
483
+ */
484
+ readonly recordingConfig?: RecordingConfig;
485
+ private readonly __resource;
486
+ constructor(scope: Construct, id: string, props: BrowserCustomProps);
487
+ /**
488
+ * Render the recording configuration.
489
+ *
490
+ * @returns RecordingConfigProperty object in CloudFormation format, or undefined if no recording configuration is defined
491
+ * @default - undefined if no recording configuration is provided
492
+ * @internal This is an internal core function and should not be called directly.
493
+ */
494
+ private _renderRecordingConfig;
495
+ /**
496
+ * Creates execution role needed for the browser to access AWS services
497
+ * @returns The created role
498
+ * @internal This is an internal core function and should not be called directly.
499
+ */
500
+ private _createBrowserRole;
501
+ /**
502
+ * Validates the browser name format
503
+ * @param name The browser name to validate
504
+ * @returns Array of validation error messages, empty if valid
505
+ */
506
+ private _validateBrowserName;
507
+ /**
508
+ * Validates the browser tags format
509
+ * @param tags The tags object to validate
510
+ * @returns Array of validation error messages, empty if valid
511
+ */
512
+ private _validateBrowserTags;
513
+ /**
514
+ * Validates the recording configuration
515
+ * @param recordingConfig The recording configuration to validate
516
+ * @returns Array of validation error messages, empty if valid
517
+ */
518
+ private _validateRecordingConfig;
519
+ }