Skip to content
Open
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
9605217
feat(agentcore): added runtime and endpoint
Sep 29, 2025
356c42d
feat(runtime): added integ test
Sep 29, 2025
b124520
feat(runtime): added integ test
Sep 29, 2025
cfad025
feat(runtime): updated integ test and readme
Sep 29, 2025
a4cd8b7
Merge branch 'aws:main' into agentcore-runtime
dineshSajwan Sep 29, 2025
910cf05
feat(runtime): adding integ snapshot and documentation
Sep 30, 2025
7a306af
Merge branch 'aws:main' into agentcore-runtime
dineshSajwan Sep 30, 2025
778e5b0
feat(runtime): updated doc to fix rosetta build issue
Sep 30, 2025
bae6962
Merge branch 'aws:main' into agentcore-runtime
dineshSajwan Sep 30, 2025
e301efd
feat(runtime): updated docs for auth and fix issue in runtime
Sep 30, 2025
150b222
feat(runtime): updated docs for auth and fix issue in runtime
Sep 30, 2025
ea39263
feat(runtime): review comments implemented
Oct 6, 2025
a4a2ccf
Merge branch 'aws:main' into agentcore-runtime
dineshSajwan Oct 6, 2025
0062054
feat(runtime): updated docs
Oct 6, 2025
d20e5a3
Merge branch 'main' into agentcore-runtime
dineshSajwan Oct 6, 2025
4b87383
feat(runtime): removed unwanted method
Oct 7, 2025
8b227b8
Merge branch 'main' into agentcore-runtime
dineshSajwan Oct 7, 2025
f48b7bf
Merge branch 'aws:main' into agentcore-runtime
dineshSajwan Oct 9, 2025
3c058da
feat(runtime): added review comments and fixed integ test
Oct 9, 2025
13ffd1d
feat(agentcore): removed unwanted params from oauth
Oct 9, 2025
a74054f
feat(agentcore): updated runtime
Oct 9, 2025
7f541d5
feat(agentcore): updated runtime with connection object
Oct 9, 2025
2e18add
Merge branch 'aws:main' into agentcore-runtime
dineshSajwan Oct 10, 2025
2bd3112
Merge branch 'aws:main' into agentcore-runtime
dineshSajwan Oct 10, 2025
f724588
feat(runtime): updated test cases
Oct 10, 2025
bab3f14
feat(agenctcore): added vpcconfig for runtime
Oct 10, 2025
028bbaa
Merge branch 'main' into agentcore-runtime
dineshSajwan Oct 10, 2025
8f1e9bb
feat(agenctcore): updated test with test account
Oct 10, 2025
7a69a05
Merge branch 'agentcore-runtime' of https://github.com/dineshSajwan/a…
Oct 10, 2025
3ac39ab
feat(agenctcore): runtime review comment and new policy
Oct 14, 2025
59548d1
Merge branch 'aws:main' into agentcore-runtime
dineshSajwan Oct 14, 2025
400f950
Merge branch 'main' into agentcore-runtime
dineshSajwan Oct 14, 2025
78e18c1
feat(agenctcore): updated docs
Oct 15, 2025
4ed2f90
Merge branch 'agentcore-runtime' of https://github.com/dineshSajwan/a…
Oct 15, 2025
aeabbb7
feat(runtime): new snapshots
Oct 15, 2025
ee3a551
feat(runtime): updated runtime versioning
Oct 15, 2025
d0f8593
Merge branch 'aws:main' into agentcore-runtime
dineshSajwan Oct 15, 2025
a1d0028
Merge branch 'agentcore-runtime' of https://github.com/dineshSajwan/a…
Oct 15, 2025
0be30ac
feat(agentcore): added gateway and target
Oct 17, 2025
7422eb5
Merge branch 'aws:main' into agentcore-gateway
dineshSajwan Oct 17, 2025
220c92a
feat(agentcore): added gatewy and target integ test
Oct 17, 2025
cf415e0
feat(agentcore): mreged the code for gateway
Oct 17, 2025
b9307cf
Merge branch 'main' into agentcore-gateway
dineshSajwan Oct 17, 2025
f307d28
Merge branch 'aws:main' into agentcore-gateway
dineshSajwan Oct 20, 2025
48b815e
Merge branch 'aws:main' into agentcore-gateway
dineshSajwan Oct 21, 2025
8025c75
feat(agentcore): added permission to gateway
Oct 21, 2025
5fd0dae
Merge branch 'main' into agentcore-gateway
dineshSajwan Oct 21, 2025
f162585
feat(agentcore): merge with main
Oct 21, 2025
0bccf0e
Merge branch 'main' into agentcore-gateway
dineshSajwan Oct 22, 2025
2e586c7
feat(agentcore): updated gateway docs and kms permission
Oct 22, 2025
07d6e91
Merge branch 'agentcore-gateway' of https://github.com/dineshSajwan/a…
Oct 22, 2025
f1955ba
feat(agentcore): gateway rfc review comments
Oct 27, 2025
4701e39
feat(agentcore): gateway merge with main
Oct 28, 2025
08f1095
feat(agentcore): added validation for openapi schema gateway
Oct 29, 2025
08d9a42
Merge branch 'main' into agentcore-gateway
dineshSajwan Oct 29, 2025
4cd4d17
feat(agentcore): updated naming for apischema
Oct 29, 2025
9e329f7
chore(gateway): removed vulnerability
Oct 31, 2025
c5dcc8e
chore(gateway): updated readme, target config
Nov 3, 2025
eba7935
Merge branch 'aws:main' into agentcore-gateway
dineshSajwan Nov 3, 2025
3494acb
Merge branch 'agentcore-gateway' of https://github.com/dineshSajwan/a…
Nov 3, 2025
ec8526f
chore(gateway): updated readme
Nov 3, 2025
61600d9
chor(gateway): updated jsdocs
Nov 5, 2025
6cc7adc
Merge branch 'aws:main' into agentcore-gateway
dineshSajwan Nov 5, 2025
34e308c
Merge branch 'agentcore-gateway' of https://github.com/dineshSajwan/a…
Nov 5, 2025
7ffebdf
chore(gateway): removed marker interfaces
Nov 7, 2025
ab59ad0
Merge branch 'aws:main' into agentcore-gateway
dineshSajwan Nov 7, 2025
53e4f05
chore(gateway): removed marker interfaces
Nov 7, 2025
68744a3
chore(gateway): fixed integ test
Nov 7, 2025
039c4aa
Merge branch 'aws:main' into agentcore-gateway
dineshSajwan Nov 12, 2025
fae1b1a
Merge branch 'aws:main' into agentcore-gateway
dineshSajwan Nov 12, 2025
5ef288d
chore(agentcore): impleemented review comments for gateway
Nov 12, 2025
f5defab
Merge branch 'agentcore-gateway' of https://github.com/dineshSajwan/a…
Nov 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
659 changes: 659 additions & 0 deletions packages/@aws-cdk/aws-bedrock-agentcore-alpha/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,339 @@
import { IResource, Resource } from 'aws-cdk-lib';
import { DimensionsMap, Metric, MetricOptions, MetricProps, Stats } from 'aws-cdk-lib/aws-cloudwatch';
import * as iam from 'aws-cdk-lib/aws-iam';
import * as kms from 'aws-cdk-lib/aws-kms';
import { Construct } from 'constructs';
// Internal imports
import { IGatewayAuthorizer } from './inbound-auth/authorizer';
import { GatewayPerms } from './perms';
import { IGatewayProtocol } from './protocol';

/******************************************************************************
* Enums
*****************************************************************************/
/**
* Exception levels for gateway
*/
export enum GatewayExceptionLevel {
/**
* Debug mode for granular exception messages. Allows the return of
* specific error messages related to the gateway target configuration
* to help you with debugging.
*/
DEBUG = 'DEBUG',
}

/******************************************************************************
* Interface
*****************************************************************************/
/**
* Interface for Gateway resources
*/
export interface IGateway extends IResource {
/**
* The ARN of the gateway resource
* @attribute
*/
readonly gatewayArn: string;

/**
* The id of the gateway
* @attribute
*/
readonly gatewayId: string;

/**
* The name of the gateway
*/
readonly name: string;

/**
* The IAM role that provides permissions for the gateway to access AWS services
*/
readonly role: iam.IRole;

/**
* The description of the gateway
*/
readonly description?: string;

/**
* The protocol configuration for the gateway
*/
readonly protocolConfiguration: IGatewayProtocol;

/**
* The authorizer configuration for the gateway
*/
readonly authorizerConfiguration: IGatewayAuthorizer;

/**
* The exception level for the gateway
*/
readonly exceptionLevel?: GatewayExceptionLevel;

/**
* The KMS key used for encryption
*/
readonly kmsKey?: kms.IKey;

/**
* The URL endpoint for the gateway
* @attribute
*/
readonly gatewayUrl?: string;

/**
* The status of the gateway
* @attribute
*/
readonly status?: string;

/**
* The status reasons for the gateway.
* @attribute
*/
readonly statusReason?: string[];

/**
* Timestamp when the gateway was created
* @attribute
*/
readonly createdAt?: string;

/**
* Timestamp when the gateway was last updated
* @attribute
*/
readonly updatedAt?: string;

/**
* Grants IAM actions to the IAM Principal
*/
grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;

/**
* Grants `Get` and `List` actions on the Gateway
*/
grantRead(grantee: iam.IGrantable): iam.Grant;

/**
* Grants `Create`, `Update`, and `Delete` actions on the Gateway
*/
grantManage(grantee: iam.IGrantable): iam.Grant;

/**
* Grants permission to invoke this Gateway
*/
grantInvoke(grantee: iam.IGrantable): iam.Grant;

// ------------------------------------------------------
// Metrics
// ------------------------------------------------------
/**
* Return the given named metric for this gateway.
*/
metric(metricName: string, dimensions: DimensionsMap, props?: MetricOptions): Metric;

/**
* Return a metric containing the total number of invocations for this gateway.
*/
metricInvocations(props?: MetricOptions): Metric;

/**
* Return a metric containing the number of throttled requests (429 status code) for this gateway.
*/
metricThrottles(props?: MetricOptions): Metric;

/**
* Return a metric containing the number of system errors (5xx status code) for this gateway.
*/
metricSystemErrors(props?: MetricOptions): Metric;

/**
* Return a metric containing the number of user errors (4xx status code, excluding 429) for this gateway.
*/
metricUserErrors(props?: MetricOptions): Metric;

/**
* Return a metric measuring the latency of requests for this gateway.
*/
metricLatency(props?: MetricOptions): Metric;

/**
* Return a metric measuring the duration of requests for this gateway.
*/
metricDuration(props?: MetricOptions): Metric;

/**
* Return a metric measuring the target execution time for this gateway.
*/
metricTargetExecutionTime(props?: MetricOptions): Metric;

/**
* Return a metric containing the number of requests served by each target type for this gateway.
*/
metricTargetType(targetType: string, props?: MetricOptions): Metric;
}

/******************************************************************************
* Base Class
*****************************************************************************/

export abstract class GatewayBase extends Resource implements IGateway {
public abstract readonly gatewayArn: string;
public abstract readonly gatewayId: string;
public abstract readonly name: string;
public abstract readonly description?: string;
public abstract readonly protocolConfiguration: IGatewayProtocol;
public abstract readonly authorizerConfiguration: IGatewayAuthorizer;
public abstract readonly exceptionLevel?: GatewayExceptionLevel;
public abstract readonly kmsKey?: kms.IKey;
public abstract readonly role: iam.IRole;
public abstract readonly gatewayUrl?: string;
public abstract readonly status?: string;
public abstract readonly statusReason?: string[];
public abstract readonly createdAt?: string;
public abstract readonly updatedAt?: string;

constructor(scope: Construct, id: string) {
super(scope, id);
}

// ------------------------------------------------------
// Permission Methods
// ------------------------------------------------------
/**
* Grants IAM actions to the IAM Principal
*/
public grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant {
return iam.Grant.addToPrincipal({
grantee: grantee,
resourceArns: [this.gatewayArn],
actions: actions,
});
}

/**
* Grants `Get` and `List` actions on the Gateway
*/
public grantRead(grantee: iam.IGrantable): iam.Grant {
const resourceSpecificGrant = this.grant(grantee, ...GatewayPerms.GET_PERMS);

const allResourceGrant = iam.Grant.addToPrincipal({
grantee: grantee,
resourceArns: ['*'],
actions: [...GatewayPerms.LIST_PERMS],
});
// Return combined grant
return resourceSpecificGrant.combine(allResourceGrant);
}

/**
* Grants `Create`, `Update`, and `Delete` actions on the Gateway
*/
public grantManage(grantee: iam.IGrantable): iam.Grant {
return this.grant(grantee, ...GatewayPerms.MANAGE_PERMS);
}

/**
* Grants permission to invoke this Gateway
*/
public grantInvoke(grantee: iam.IGrantable): iam.Grant {
return this.grant(grantee, ...GatewayPerms.INVOKE_PERMS);
}

// ------------------------------------------------------
// Metric Methods
// ------------------------------------------------------
/**
* Return the given named metric for this gateway. *
* By default, the metric will be calculated as a sum over a period of 5 minutes.
* You can customize this by using the `statistic` and `period` properties.
*/
public metric(metricName: string, dimensions: DimensionsMap, props?: MetricOptions): Metric {
const metricProps: MetricProps = {
namespace: 'AWS/Bedrock-AgentCore',
metricName,
dimensionsMap: { ...dimensions, Resource: this.gatewayArn },
...props,
};
return this.configureMetric(metricProps);
}

/**
* Return a metric containing the total number of invocations for this gateway.
*/
public metricInvocations(props?: MetricOptions): Metric {
return this.metric('Invocations', {}, { statistic: Stats.SUM, ...props });
}

/**
* Return a metric containing the number of throttled requests (429 status code) for this gateway.
*/
public metricThrottles(props?: MetricOptions): Metric {
return this.metric('Throttles', {}, { statistic: Stats.SUM, ...props });
}

/**
* Return a metric containing the number of system errors (5xx status code) for this gateway.
*/
public metricSystemErrors(props?: MetricOptions): Metric {
return this.metric('SystemErrors', {}, { statistic: Stats.SUM, ...props });
}

/**
* Return a metric containing the number of user errors (4xx status code, excluding 429) for this gateway.
*/
public metricUserErrors(props?: MetricOptions): Metric {
return this.metric('UserErrors', {}, { statistic: Stats.SUM, ...props });
}

/**
* Return a metric measuring the latency of requests for this gateway.
*
* The latency metric represents the time elapsed between when the service receives
* the request and when it begins sending the first response token.
*/
public metricLatency(props?: MetricOptions): Metric {
return this.metric('Latency', {}, { statistic: Stats.AVERAGE, ...props });
}

/**
* Return a metric measuring the duration of requests for this gateway.
*
* The duration metric represents the total time elapsed between receiving the request
* and sending the final response token, representing complete end-to-end processing time.
*/
public metricDuration(props?: MetricOptions): Metric {
return this.metric('Duration', {}, { statistic: Stats.AVERAGE, ...props });
}

/**
* Return a metric measuring the target execution time for this gateway.
*
* This metric helps determine the contribution of the target (Lambda, OpenAPI, etc.)
* to the total latency.
*/
public metricTargetExecutionTime(props?: MetricOptions): Metric {
return this.metric('TargetExecutionTime', {}, { statistic: Stats.AVERAGE, ...props });
}

/**
* Return a metric containing the number of requests served by each target type for this gateway.
*/
public metricTargetType(targetType: string, props?: MetricOptions): Metric {
return this.metric('TargetType', { TargetType: targetType }, { statistic: Stats.SUM, ...props });
}

/**
* Internal method to create a metric.
*/
private configureMetric(props: MetricProps) {
return new Metric({
...props,
region: props?.region ?? this.stack.region,
account: props?.account ?? this.stack.account,
});
}
}
Loading
Loading