Amazon Bedrock AgentCore Construct Library
Version 2.278.0-alpha.0
Separate package
@aws-cdk/aws-bedrock-agentcore-alpha is not part of aws-cdk-lib — install it separately:
npm install @aws-cdk/aws-bedrock-agentcore-alpha
pip install aws-cdk.aws-bedrock-agentcore-alpha
This API may emit warnings. Backward compatibility is not guaranteed.
All constructs moved to aws-cdk-lib/aws-bedrockagentcore.
| Language | Package |
|---|---|
TypeScript | @aws-cdk/aws-bedrock-agentcore-alpha |
Migration to Stable
All constructs in this module, including the Policy submodule, have moved to aws-cdk-lib/aws-bedrockagentcore:
// Before
import * as agentcore from '@aws-cdk/aws-bedrock-agentcore-alpha';
# Before
import aws_cdk.aws_bedrock_agentcore_alpha as agentcore
// Before
import software.amazon.awscdk.services.bedrock.agentcore.alpha.*;
// Before
using Amazon.CDK.AWS.Bedrock.Agentcore.Alpha;
// Before
import agentcore "github.com/aws/aws-cdk-go/awsbedrockagentcorealpha"
// After
import * as agentcore from 'aws-cdk-lib/aws-bedrockagentcore';
# After
import aws_cdk.aws_bedrockagentcore as agentcore
// After
import software.amazon.awscdk.services.bedrockagentcore.*;
// After
using Amazon.CDK.AWS.BedrockAgentCore;
// After
import agentcore "github.com/aws/aws-cdk-go/awscdk"
The following constructs are now in stable:
- Runtime:
Runtime,RuntimeEndpoint,AgentRuntimeArtifact,NetworkConfiguration,Observability - Gateway:
Gateway,GatewayTarget,GatewayAuthorizer,GatewayCredentialProvider,Interceptor - Tools:
BrowserCustom,CodeInterpreterCustom - Memory:
Memory,MemoryStrategy - Evaluation:
OnlineEvaluationConfig,Evaluator,EvaluatorSelector - Identity:
OAuth2CredentialProvider,ApiKeyCredentialProvider,WorkloadIdentity - Policy:
PolicyEngine,Policy,PolicyStatement,PolicyValidationMode,PolicyEngineMode
The stable Policy submodule has API changes from this module:
PolicyStatementis a props object instead of a fluent builder. Conditions are passed as thewhenarray.- A stable
Gatewayassociates a policy engine through thepolicyEngineConfigurationprop, and grants the gateway role evaluate permissions automatically. - The default gateway enforcement mode is
PolicyEngineMode.ENFORCEinstead ofLOG_ONLY.
See the aws-cdk-lib/aws-bedrockagentcore README for the stable Policy documentation.
Policy Engine
A policy engine is a collection of policies that evaluates and authorizes agent tool calls. When associated with a gateway, the policy engine intercepts all agent requests and determines whether to allow or deny each action based on the defined policies.
For more information, see the Policy in Amazon Bedrock AgentCore documentation.
PolicyEngine Properties
| Name | Type | Required | Description |
|---|---|---|---|
policyEngineName | string | No | The name of the policy engine. Valid characters: a-z, A-Z, 0-9, _ (underscore). Must start with a letter, 1-48 characters. If not provided, a unique name will be auto-generated |
description | string | No | Optional description for the policy engine (max 4,096 characters). Default: no description |
kmsKey | IKey | No | Custom KMS key for encryption. IMPORTANT: Once set, cannot be changed (requires replacement). Must be symmetric ENCRYPT_DECRYPT key. If key becomes inaccessible, all authorization decisions will be DENIED. Default: AWS owned key |
tags | { [key: string]: string } | No | Tags for the policy engine (max 50 tags). Default: no tags |
Understanding Cedar Policies in AgentCore
Policies are constructed using Cedar language, an open source language for writing and enforcing authorization policies. Cedar policies in AgentCore follow a specific structure with three main components: Principal, Action, and Resource. Understanding how these components work together is critical for writing effective policies.
Policy Structure
Every Cedar policy has this basic structure:
permit( // or forbid
principal, // Who is making the request
action, // What operation they want to perform
resource // What Gateway/tool they want to access
)
when { // Optional conditions
// Additional constraints
};
Example Policy
permit(
principal,
action == AgentCore::Action::"ApplicationToolTarget___create_application",
resource == AgentCore::Gateway::"<gateway-arn>"
) when {
context.input.coverage_amount <= 1000000
};
Basic PolicyEngine and Policy Creation
Create a policy engine and add policies to it.
Policy Engine Mode
When associating a policy engine with a gateway, you can control the enforcement behavior using PolicyEngineMode:
PolicyEngineMode.LOG_ONLY(default) — evaluates actions and adds traces but does not enforce decisions. Use this mode for testing and validation before enabling enforcement.PolicyEngineMode.ENFORCE— actively allows or denies agent operations based on Cedar policy evaluation.
// Create a Policy engine
const policyEngine = new agentcore.PolicyEngine(this, "MyPolicyEngine", {
policyEngineName: "my_policy_engine",
description: "Policy engine for access control",
});
const gateway = new agentcore.Gateway(this, "MyGateway", {
gatewayName: "my-gateway",
policyEngineConfiguration: {
policyEngine: policyEngine,
mode: agentcore.PolicyEngineMode.ENFORCE, // Default is LOG_ONLY
},
});
// Add policy to policy engine
policyEngine.addPolicy("AllowAllActions", {
definition: `
permit(
principal,
action,
resource == AgentCore::Gateway::"${gateway.gatewayArn}"
);
`,
description: "Allow all actions on specific gateway (development)",
validationMode: agentcore.PolicyValidationMode.IGNORE_ALL_FINDINGS, // This will ignore all cedar warnings
});
// you can add multiple policies to the policy engine
policyEngine.addPolicy("SpecificToolPolicy", {
definition: `
permit(
principal is AgentCore::OAuthUser,
action == AgentCore::Action::"WeatherTool__get_forecast",
resource == AgentCore::Gateway::"${gateway.gatewayArn}"
);
`,
description: "Allow specific weather tool access",
validationMode: agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS, // This will fail policy creation for any cedar warning
});
# Create a Policy engine
policy_engine = agentcore.PolicyEngine(self, "MyPolicyEngine",
policy_engine_name="my_policy_engine",
description="Policy engine for access control"
)
gateway = agentcore.Gateway(self, "MyGateway",
gateway_name="my-gateway",
policy_engine_configuration=agentcore.GatewayPolicyEngineConfig(
policy_engine=policy_engine,
mode=agentcore.PolicyEngineMode.ENFORCE
)
)
# Add policy to policy engine
policy_engine.add_policy("AllowAllActions",
definition=f"""
permit(
principal,
action,
resource == AgentCore::Gateway::\"{gateway.gatewayArn}\"
);
""",
description="Allow all actions on specific gateway (development)",
validation_mode=agentcore.PolicyValidationMode.IGNORE_ALL_FINDINGS
)
# you can add multiple policies to the policy engine
policy_engine.add_policy("SpecificToolPolicy",
definition=f"""
permit(
principal is AgentCore::OAuthUser,
action == AgentCore::Action::\"WeatherTool__get_forecast\",
resource == AgentCore::Gateway::\"{gateway.gatewayArn}\"
);
""",
description="Allow specific weather tool access",
validation_mode=agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS
)
// Create a Policy engine
PolicyEngine policyEngine = PolicyEngine.Builder.create(this, "MyPolicyEngine")
.policyEngineName("my_policy_engine")
.description("Policy engine for access control")
.build();
Gateway gateway = Gateway.Builder.create(this, "MyGateway")
.gatewayName("my-gateway")
.policyEngineConfiguration(GatewayPolicyEngineConfig.builder()
.policyEngine(policyEngine)
.mode(PolicyEngineMode.ENFORCE)
.build())
.build();
// Add policy to policy engine
policyEngine.addPolicy("AllowAllActions", AddPolicyOptions.builder()
.definition(String.format("%n permit(%n principal,%n action,%n resource == AgentCore::Gateway::\"%s\"%n );%n ", gateway.getGatewayArn()))
.description("Allow all actions on specific gateway (development)")
.validationMode(PolicyValidationMode.IGNORE_ALL_FINDINGS)
.build());
// you can add multiple policies to the policy engine
policyEngine.addPolicy("SpecificToolPolicy", AddPolicyOptions.builder()
.definition(String.format("%n permit(%n principal is AgentCore::OAuthUser,%n action == AgentCore::Action::\"WeatherTool__get_forecast\",%n resource == AgentCore::Gateway::\"%s\"%n );%n ", gateway.getGatewayArn()))
.description("Allow specific weather tool access")
.validationMode(PolicyValidationMode.FAIL_ON_ANY_FINDINGS)
.build());
// Create a Policy engine
var policyEngine = new PolicyEngine(this, "MyPolicyEngine", new PolicyEngineProps {
PolicyEngineName = "my_policy_engine",
Description = "Policy engine for access control"
});
var gateway = new Gateway(this, "MyGateway", new GatewayProps {
GatewayName = "my-gateway",
PolicyEngineConfiguration = new GatewayPolicyEngineConfig {
PolicyEngine = policyEngine,
Mode = PolicyEngineMode.ENFORCE
}
});
// Add policy to policy engine
policyEngine.AddPolicy("AllowAllActions", new AddPolicyOptions {
Definition = $@"
permit(
principal,
action,
resource == AgentCore::Gateway::""{gateway.gatewayArn}""
);
",
Description = "Allow all actions on specific gateway (development)",
ValidationMode = PolicyValidationMode.IGNORE_ALL_FINDINGS
});
// you can add multiple policies to the policy engine
policyEngine.AddPolicy("SpecificToolPolicy", new AddPolicyOptions {
Definition = $@"
permit(
principal is AgentCore::OAuthUser,
action == AgentCore::Action::""WeatherTool__get_forecast"",
resource == AgentCore::Gateway::""{gateway.gatewayArn}""
);
",
Description = "Allow specific weather tool access",
ValidationMode = PolicyValidationMode.FAIL_ON_ANY_FINDINGS
});
// Create a Policy engine
policyEngine := agentcore.NewPolicyEngine(this, jsii.String("MyPolicyEngine"), &PolicyEngineProps{
PolicyEngineName: jsii.String("my_policy_engine"),
Description: jsii.String("Policy engine for access control"),
})
gateway := agentcore.NewGateway(this, jsii.String("MyGateway"), &GatewayProps{
GatewayName: jsii.String("my-gateway"),
PolicyEngineConfiguration: &GatewayPolicyEngineConfig{
PolicyEngine: policyEngine,
Mode: agentcore.PolicyEngineMode_ENFORCE(),
},
})
// Add policy to policy engine
policyEngine.AddPolicy(jsii.String("AllowAllActions"), &AddPolicyOptions{
Definition: fmt.Sprintf("\n permit(\n principal,\n action,\n resource == AgentCore::Gateway::\"%v\"\n );\n ", gateway.GatewayArn),
Description: jsii.String("Allow all actions on specific gateway (development)"),
ValidationMode: agentcore.PolicyValidationMode_IGNORE_ALL_FINDINGS(),
})
// you can add multiple policies to the policy engine
policyEngine.AddPolicy(jsii.String("SpecificToolPolicy"), &AddPolicyOptions{
Definition: fmt.Sprintf("\n permit(\n principal is AgentCore::OAuthUser,\n action == AgentCore::Action::\"WeatherTool__get_forecast\",\n resource == AgentCore::Gateway::\"%v\"\n );\n ", gateway.*GatewayArn),
Description: jsii.String("Allow specific weather tool access"),
ValidationMode: agentcore.PolicyValidationMode_FAIL_ON_ANY_FINDINGS(),
})
Type-Safe Policy Builder
For a more type-safe approach, use the PolicyStatement builder instead of writing raw Cedar syntax.
const gateway = new agentcore.Gateway(this, "MyGateway", {
gatewayName: "my-gateway",
});
const policyEngine = new agentcore.PolicyEngine(this, "MyPolicyEngine", {
policyEngineName: "my_policy_engine",
});
const allowAllPolicy = new agentcore.Policy(this, "AllowAllPolicy", {
policyEngine: policyEngine,
policyName: "allow_all",
statement: agentcore.PolicyStatement.permit()
.forAllPrincipals() // ** This will give overly permission to all principals
.onAllActions()
.onResource('AgentCore::Gateway', gateway.gatewayArn),
description: "Allow all actions on specific gateway (development only)",
validationMode: agentcore.PolicyValidationMode.IGNORE_ALL_FINDINGS,
});
// Generated Cedar:
// permit(
// principal,
// action,
// resource == AgentCore::Gateway::"arn:aws:bedrock-agentcore:region:account:gateway/gateway-id"
// );
gateway = agentcore.Gateway(self, "MyGateway",
gateway_name="my-gateway"
)
policy_engine = agentcore.PolicyEngine(self, "MyPolicyEngine",
policy_engine_name="my_policy_engine"
)
allow_all_policy = agentcore.Policy(self, "AllowAllPolicy",
policy_engine=policy_engine,
policy_name="allow_all",
statement=agentcore.PolicyStatement.permit().for_all_principals().on_all_actions().on_resource("AgentCore::Gateway", gateway.gateway_arn),
description="Allow all actions on specific gateway (development only)",
validation_mode=agentcore.PolicyValidationMode.IGNORE_ALL_FINDINGS
)
Gateway gateway = Gateway.Builder.create(this, "MyGateway")
.gatewayName("my-gateway")
.build();
PolicyEngine policyEngine = PolicyEngine.Builder.create(this, "MyPolicyEngine")
.policyEngineName("my_policy_engine")
.build();
Policy allowAllPolicy = Policy.Builder.create(this, "AllowAllPolicy")
.policyEngine(policyEngine)
.policyName("allow_all")
.statement(PolicyStatement.permit().forAllPrincipals().onAllActions().onResource("AgentCore::Gateway", gateway.getGatewayArn()))
.description("Allow all actions on specific gateway (development only)")
.validationMode(PolicyValidationMode.IGNORE_ALL_FINDINGS)
.build();
var gateway = new Gateway(this, "MyGateway", new GatewayProps {
GatewayName = "my-gateway"
});
var policyEngine = new PolicyEngine(this, "MyPolicyEngine", new PolicyEngineProps {
PolicyEngineName = "my_policy_engine"
});
var allowAllPolicy = new Policy(this, "AllowAllPolicy", new PolicyProps {
PolicyEngine = policyEngine,
PolicyName = "allow_all",
Statement = PolicyStatement.Permit().ForAllPrincipals().OnAllActions().OnResource("AgentCore::Gateway", gateway.GatewayArn),
Description = "Allow all actions on specific gateway (development only)",
ValidationMode = PolicyValidationMode.IGNORE_ALL_FINDINGS
});
gateway := agentcore.NewGateway(this, jsii.String("MyGateway"), &GatewayProps{
GatewayName: jsii.String("my-gateway"),
})
policyEngine := agentcore.NewPolicyEngine(this, jsii.String("MyPolicyEngine"), &PolicyEngineProps{
PolicyEngineName: jsii.String("my_policy_engine"),
})
allowAllPolicy := agentcore.NewPolicy(this, jsii.String("AllowAllPolicy"), &PolicyProps{
PolicyEngine: policyEngine,
PolicyName: jsii.String("allow_all"),
Statement: agentcore.PolicyStatement_Permit().ForAllPrincipals().OnAllActions().OnResource(jsii.String("AgentCore::Gateway"), gateway.GatewayArn),
Description: jsii.String("Allow all actions on specific gateway (development only)"),
ValidationMode: agentcore.PolicyValidationMode_IGNORE_ALL_FINDINGS(),
})
Policy with Specific Actions
declare const policyEngine: agentcore.PolicyEngine;
declare const gateway: agentcore.Gateway;
// Allow specific tool actions on specific gateway
// Action names follow pattern: "ToolName__operation"
policyEngine.addPolicy("SpecificToolPolicy", {
statement: agentcore.PolicyStatement.permit()
.forPrincipal('AgentCore::OAuthUser::your-client-id')
.onActions([
'AgentCore::Action::WeatherTool__get_forecast',
'AgentCore::Action::WeatherTool__get_current',
])
.onResource('AgentCore::Gateway', gateway.gatewayArn),
description: "Allow specific weather tool operations",
validationMode: agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS,
});
// Generated Cedar:
// permit(
// principal is AgentCore::OAuthUser,
// action in [
// AgentCore::Action::"WeatherTool__get_forecast",
// AgentCore::Action::"WeatherTool__get_current"
// ],
// resource == AgentCore::Gateway::"arn:aws:bedrock-agentcore:us-east-1:123:gateway/gw-123"
// );
# policy_engine: agentcore.PolicyEngine
# gateway: agentcore.Gateway
# Allow specific tool actions on specific gateway
# Action names follow pattern: "ToolName__operation"
policy_engine.add_policy("SpecificToolPolicy",
statement=agentcore.PolicyStatement.permit().for_principal("AgentCore::OAuthUser::your-client-id").on_actions(["AgentCore::Action::WeatherTool__get_forecast", "AgentCore::Action::WeatherTool__get_current"
]).on_resource("AgentCore::Gateway", gateway.gateway_arn),
description="Allow specific weather tool operations",
validation_mode=agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS
)
PolicyEngine policyEngine;
Gateway gateway;
// Allow specific tool actions on specific gateway
// Action names follow pattern: "ToolName__operation"
policyEngine.addPolicy("SpecificToolPolicy", AddPolicyOptions.builder()
.statement(PolicyStatement.permit().forPrincipal("AgentCore::OAuthUser::your-client-id").onActions(List.of("AgentCore::Action::WeatherTool__get_forecast", "AgentCore::Action::WeatherTool__get_current")).onResource("AgentCore::Gateway", gateway.getGatewayArn()))
.description("Allow specific weather tool operations")
.validationMode(PolicyValidationMode.FAIL_ON_ANY_FINDINGS)
.build());
PolicyEngine policyEngine;
Gateway gateway;
// Allow specific tool actions on specific gateway
// Action names follow pattern: "ToolName__operation"
policyEngine.AddPolicy("SpecificToolPolicy", new AddPolicyOptions {
Statement = PolicyStatement.Permit().ForPrincipal("AgentCore::OAuthUser::your-client-id").OnActions(new [] { "AgentCore::Action::WeatherTool__get_forecast", "AgentCore::Action::WeatherTool__get_current" }).OnResource("AgentCore::Gateway", gateway.GatewayArn),
Description = "Allow specific weather tool operations",
ValidationMode = PolicyValidationMode.FAIL_ON_ANY_FINDINGS
});
var policyEngine PolicyEngine
var gateway Gateway
// Allow specific tool actions on specific gateway
// Action names follow pattern: "ToolName__operation"
policyEngine.AddPolicy(jsii.String("SpecificToolPolicy"), &AddPolicyOptions{
Statement: agentcore.PolicyStatement_Permit().ForPrincipal(jsii.String("AgentCore::OAuthUser::your-client-id")).OnActions([]*string{
jsii.String("AgentCore::Action::WeatherTool__get_forecast"),
jsii.String("AgentCore::Action::WeatherTool__get_current"),
}).OnResource(jsii.String("AgentCore::Gateway"), gateway.GatewayArn),
Description: jsii.String("Allow specific weather tool operations"),
ValidationMode: agentcore.PolicyValidationMode_FAIL_ON_ANY_FINDINGS(),
})
Policy with Conditions
Use when clauses to add advanced conditions based on principal tags (from OAuth token) or context:
declare const policyEngine: agentcore.PolicyEngine;
declare const gateway: agentcore.Gateway;
// Policy with when conditions using principal tags
const conditionalPolicy = new agentcore.Policy(this, "ConditionalPolicy", {
policyEngine: policyEngine,
policyName: "conditional_access",
statement: agentcore.PolicyStatement.permit()
.forPrincipal('AgentCore::OAuthUser') // Type constraint
.onAllActions()
.onResource('AgentCore::Gateway', gateway.gatewayArn) // Specific ARN
.when()
.principalAttribute('department').equalTo('Engineering')
.and()
.contextAttribute('input.priority').equalTo('high')
.done(),
description: "Allow engineers for high-priority requests",
validationMode: agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS,
});
// Generated Cedar:
// permit(
// principal is AgentCore::OAuthUser,
// action,
// resource == AgentCore::Gateway::"arn:..."
// )
// when {
// principal.department == "Engineering" && context.input.priority == "high"
// };
# policy_engine: agentcore.PolicyEngine
# gateway: agentcore.Gateway
# Policy with when conditions using principal tags
conditional_policy = agentcore.Policy(self, "ConditionalPolicy",
policy_engine=policy_engine,
policy_name="conditional_access",
statement=agentcore.PolicyStatement.permit().for_principal("AgentCore::OAuthUser").on_all_actions().on_resource("AgentCore::Gateway", gateway.gateway_arn).when().principal_attribute("department").equal_to("Engineering").and().context_attribute("input.priority").equal_to("high").done(),
description="Allow engineers for high-priority requests",
validation_mode=agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS
)
PolicyEngine policyEngine;
Gateway gateway;
// Policy with when conditions using principal tags
Policy conditionalPolicy = Policy.Builder.create(this, "ConditionalPolicy")
.policyEngine(policyEngine)
.policyName("conditional_access")
.statement(PolicyStatement.permit().forPrincipal("AgentCore::OAuthUser").onAllActions().onResource("AgentCore::Gateway", gateway.gatewayArn).when().principalAttribute("department").equalTo("Engineering").and().contextAttribute("input.priority").equalTo("high").done())
.description("Allow engineers for high-priority requests")
.validationMode(PolicyValidationMode.FAIL_ON_ANY_FINDINGS)
.build();
PolicyEngine policyEngine;
Gateway gateway;
// Policy with when conditions using principal tags
var conditionalPolicy = new Policy(this, "ConditionalPolicy", new PolicyProps {
PolicyEngine = policyEngine,
PolicyName = "conditional_access",
Statement = PolicyStatement.Permit().ForPrincipal("AgentCore::OAuthUser").OnAllActions().OnResource("AgentCore::Gateway", gateway.GatewayArn).When().PrincipalAttribute("department").EqualTo("Engineering").And().ContextAttribute("input.priority").EqualTo("high").Done(),
Description = "Allow engineers for high-priority requests",
ValidationMode = PolicyValidationMode.FAIL_ON_ANY_FINDINGS
});
var policyEngine PolicyEngine
var gateway Gateway
// Policy with when conditions using principal tags
conditionalPolicy := agentcore.NewPolicy(this, jsii.String("ConditionalPolicy"), &PolicyProps{
PolicyEngine: policyEngine,
PolicyName: jsii.String("conditional_access"),
Statement: agentcore.PolicyStatement_Permit().ForPrincipal(jsii.String("AgentCore::OAuthUser")).OnAllActions().OnResource(jsii.String("AgentCore::Gateway"), gateway.GatewayArn).When().PrincipalAttribute(jsii.String("department")).EqualTo(jsii.String("Engineering")).And().ContextAttribute(jsii.String("input.priority")).*EqualTo(jsii.String("high")).Done(),
Description: jsii.String("Allow engineers for high-priority requests"),
ValidationMode: agentcore.PolicyValidationMode_FAIL_ON_ANY_FINDINGS(),
})
Policy with Exclusions (unless)
Use unless clauses to exclude specific conditions from a policy. The policy applies when the unless conditions are NOT met:
declare const policyEngine: agentcore.PolicyEngine;
declare const gateway: agentcore.Gateway;
// Allow access unless the user is suspended
const policyWithUnless = new agentcore.Policy(this, "UnlessPolicy", {
policyEngine: policyEngine,
policyName: "unless_suspended",
statement: agentcore.PolicyStatement.permit()
.forPrincipal('AgentCore::OAuthUser')
.onAllActions()
.onResource('AgentCore::Gateway', gateway.gatewayArn)
.unless()
.principalAttribute('suspended').equalTo(true)
.done(),
description: "Allow all actions unless user is suspended",
validationMode: agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS,
});
// Generated Cedar:
// permit(
// principal is AgentCore::OAuthUser,
// action,
// resource == AgentCore::Gateway::"arn:..."
// )
// unless {
// principal.suspended == true
// };
# policy_engine: agentcore.PolicyEngine
# gateway: agentcore.Gateway
# Allow access unless the user is suspended
policy_with_unless = agentcore.Policy(self, "UnlessPolicy",
policy_engine=policy_engine,
policy_name="unless_suspended",
statement=agentcore.PolicyStatement.permit().for_principal("AgentCore::OAuthUser").on_all_actions().on_resource("AgentCore::Gateway", gateway.gateway_arn).unless().principal_attribute("suspended").equal_to(True).done(),
description="Allow all actions unless user is suspended",
validation_mode=agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS
)
PolicyEngine policyEngine;
Gateway gateway;
// Allow access unless the user is suspended
Policy policyWithUnless = Policy.Builder.create(this, "UnlessPolicy")
.policyEngine(policyEngine)
.policyName("unless_suspended")
.statement(PolicyStatement.permit().forPrincipal("AgentCore::OAuthUser").onAllActions().onResource("AgentCore::Gateway", gateway.gatewayArn).unless().principalAttribute("suspended").equalTo(true).done())
.description("Allow all actions unless user is suspended")
.validationMode(PolicyValidationMode.FAIL_ON_ANY_FINDINGS)
.build();
PolicyEngine policyEngine;
Gateway gateway;
// Allow access unless the user is suspended
var policyWithUnless = new Policy(this, "UnlessPolicy", new PolicyProps {
PolicyEngine = policyEngine,
PolicyName = "unless_suspended",
Statement = PolicyStatement.Permit().ForPrincipal("AgentCore::OAuthUser").OnAllActions().OnResource("AgentCore::Gateway", gateway.GatewayArn).Unless().PrincipalAttribute("suspended").EqualTo(true).Done(),
Description = "Allow all actions unless user is suspended",
ValidationMode = PolicyValidationMode.FAIL_ON_ANY_FINDINGS
});
var policyEngine PolicyEngine
var gateway Gateway
// Allow access unless the user is suspended
policyWithUnless := agentcore.NewPolicy(this, jsii.String("UnlessPolicy"), &PolicyProps{
PolicyEngine: policyEngine,
PolicyName: jsii.String("unless_suspended"),
Statement: agentcore.PolicyStatement_Permit().ForPrincipal(jsii.String("AgentCore::OAuthUser")).OnAllActions().OnResource(jsii.String("AgentCore::Gateway"), gateway.GatewayArn).Unless().PrincipalAttribute(jsii.String("suspended")).EqualTo(jsii.Boolean(true)).Done(),
Description: jsii.String("Allow all actions unless user is suspended"),
ValidationMode: agentcore.PolicyValidationMode_FAIL_ON_ANY_FINDINGS(),
})
You can combine when and unless clauses in the same policy:
declare const policyEngine: agentcore.PolicyEngine;
declare const gateway: agentcore.Gateway;
// Allow engineers unless they are on probation
policyEngine.addPolicy("CombinedConditions", {
statement: agentcore.PolicyStatement.permit()
.forPrincipal('AgentCore::OAuthUser')
.onAllActions()
.onResource('AgentCore::Gateway', gateway.gatewayArn)
.when()
.principalAttribute('department').equalTo('Engineering')
.done()
.unless()
.principalAttribute('status').equalTo('probation')
.done(),
description: "Allow engineers unless on probation",
validationMode: agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS,
});
# policy_engine: agentcore.PolicyEngine
# gateway: agentcore.Gateway
# Allow engineers unless they are on probation
policy_engine.add_policy("CombinedConditions",
statement=agentcore.PolicyStatement.permit().for_principal("AgentCore::OAuthUser").on_all_actions().on_resource("AgentCore::Gateway", gateway.gateway_arn).when().principal_attribute("department").equal_to("Engineering").done().unless().principal_attribute("status").equal_to("probation").done(),
description="Allow engineers unless on probation",
validation_mode=agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS
)
PolicyEngine policyEngine;
Gateway gateway;
// Allow engineers unless they are on probation
policyEngine.addPolicy("CombinedConditions", AddPolicyOptions.builder()
.statement(PolicyStatement.permit().forPrincipal("AgentCore::OAuthUser").onAllActions().onResource("AgentCore::Gateway", gateway.gatewayArn).when().principalAttribute("department").equalTo("Engineering").done().unless().principalAttribute("status").equalTo("probation").done())
.description("Allow engineers unless on probation")
.validationMode(PolicyValidationMode.FAIL_ON_ANY_FINDINGS)
.build());
PolicyEngine policyEngine;
Gateway gateway;
// Allow engineers unless they are on probation
policyEngine.AddPolicy("CombinedConditions", new AddPolicyOptions {
Statement = PolicyStatement.Permit().ForPrincipal("AgentCore::OAuthUser").OnAllActions().OnResource("AgentCore::Gateway", gateway.GatewayArn).When().PrincipalAttribute("department").EqualTo("Engineering").Done().Unless().PrincipalAttribute("status").EqualTo("probation").Done(),
Description = "Allow engineers unless on probation",
ValidationMode = PolicyValidationMode.FAIL_ON_ANY_FINDINGS
});
var policyEngine PolicyEngine
var gateway Gateway
// Allow engineers unless they are on probation
policyEngine.AddPolicy(jsii.String("CombinedConditions"), &AddPolicyOptions{
Statement: agentcore.PolicyStatement_Permit().ForPrincipal(jsii.String("AgentCore::OAuthUser")).OnAllActions().OnResource(jsii.String("AgentCore::Gateway"), gateway.GatewayArn).When().PrincipalAttribute(jsii.String("department")).EqualTo(jsii.String("Engineering")).Done().Unless().*PrincipalAttribute(jsii.String("status")).*EqualTo(jsii.String("probation")).*Done(),
Description: jsii.String("Allow engineers unless on probation"),
ValidationMode: agentcore.PolicyValidationMode_FAIL_ON_ANY_FINDINGS(),
})
Forbid (Deny) Policy
Use forbid to explicitly deny access. Forbid policies override permit policies.
declare const policyEngine: agentcore.PolicyEngine;
declare const gateway: agentcore.Gateway;
// Explicitly deny dangerous tool operations
policyEngine.addPolicy("DenyDangerous", {
statement: agentcore.PolicyStatement.forbid()
.forAllPrincipals()
.onAction('AgentCore::Action::DeleteTool__delete_all')
.onResource('AgentCore::Gateway', gateway.gatewayArn),
description: "Forbid delete_all operation for all users",
validationMode: agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS,
});
// Generated Cedar:
// forbid(
// principal,
// action == AgentCore::Action::"DeleteTool__delete_all",
// resource == AgentCore::Gateway::"arn:..."
// );
# policy_engine: agentcore.PolicyEngine
# gateway: agentcore.Gateway
# Explicitly deny dangerous tool operations
policy_engine.add_policy("DenyDangerous",
statement=agentcore.PolicyStatement.forbid().for_all_principals().on_action("AgentCore::Action::DeleteTool__delete_all").on_resource("AgentCore::Gateway", gateway.gateway_arn),
description="Forbid delete_all operation for all users",
validation_mode=agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS
)
PolicyEngine policyEngine;
Gateway gateway;
// Explicitly deny dangerous tool operations
policyEngine.addPolicy("DenyDangerous", AddPolicyOptions.builder()
.statement(PolicyStatement.forbid().forAllPrincipals().onAction("AgentCore::Action::DeleteTool__delete_all").onResource("AgentCore::Gateway", gateway.getGatewayArn()))
.description("Forbid delete_all operation for all users")
.validationMode(PolicyValidationMode.FAIL_ON_ANY_FINDINGS)
.build());
PolicyEngine policyEngine;
Gateway gateway;
// Explicitly deny dangerous tool operations
policyEngine.AddPolicy("DenyDangerous", new AddPolicyOptions {
Statement = PolicyStatement.Forbid().ForAllPrincipals().OnAction("AgentCore::Action::DeleteTool__delete_all").OnResource("AgentCore::Gateway", gateway.GatewayArn),
Description = "Forbid delete_all operation for all users",
ValidationMode = PolicyValidationMode.FAIL_ON_ANY_FINDINGS
});
var policyEngine PolicyEngine
var gateway Gateway
// Explicitly deny dangerous tool operations
policyEngine.AddPolicy(jsii.String("DenyDangerous"), &AddPolicyOptions{
Statement: agentcore.PolicyStatement_Forbid().ForAllPrincipals().OnAction(jsii.String("AgentCore::Action::DeleteTool__delete_all")).OnResource(jsii.String("AgentCore::Gateway"), gateway.GatewayArn),
Description: jsii.String("Forbid delete_all operation for all users"),
ValidationMode: agentcore.PolicyValidationMode_FAIL_ON_ANY_FINDINGS(),
})
Raw Cedar for Advanced Cases
For advanced Cedar features not supported by the builder, use raw Cedar strings:
declare const policyEngine: agentcore.PolicyEngine;
// Option 1: Using definition property
const advancedPolicy = new agentcore.Policy(this, "AdvancedPolicy", {
policyEngine: policyEngine,
definition: 'permit(principal, action, resource) when { context.custom > 10 };',
description: "Advanced policy with custom Cedar logic",
});
// Option 2: Using fromCedar() with statement property
policyEngine.addPolicy("CustomPolicy", {
statement: agentcore.PolicyStatement.fromCedar(
'forbid(principal, action, resource) when { resource.confidential == true };'
),
description: "Custom policy from Cedar string",
});
# policy_engine: agentcore.PolicyEngine
# Option 1: Using definition property
advanced_policy = agentcore.Policy(self, "AdvancedPolicy",
policy_engine=policy_engine,
definition="permit(principal, action, resource) when { context.custom > 10 };",
description="Advanced policy with custom Cedar logic"
)
# Option 2: Using fromCedar() with statement property
policy_engine.add_policy("CustomPolicy",
statement=agentcore.PolicyStatement.from_cedar("forbid(principal, action, resource) when { resource.confidential == true };"),
description="Custom policy from Cedar string"
)
PolicyEngine policyEngine;
// Option 1: Using definition property
Policy advancedPolicy = Policy.Builder.create(this, "AdvancedPolicy")
.policyEngine(policyEngine)
.definition("permit(principal, action, resource) when { context.custom > 10 };")
.description("Advanced policy with custom Cedar logic")
.build();
// Option 2: Using fromCedar() with statement property
policyEngine.addPolicy("CustomPolicy", AddPolicyOptions.builder()
.statement(PolicyStatement.fromCedar("forbid(principal, action, resource) when { resource.confidential == true };"))
.description("Custom policy from Cedar string")
.build());
PolicyEngine policyEngine;
// Option 1: Using definition property
var advancedPolicy = new Policy(this, "AdvancedPolicy", new PolicyProps {
PolicyEngine = policyEngine,
Definition = "permit(principal, action, resource) when { context.custom > 10 };",
Description = "Advanced policy with custom Cedar logic"
});
// Option 2: Using fromCedar() with statement property
policyEngine.AddPolicy("CustomPolicy", new AddPolicyOptions {
Statement = PolicyStatement.FromCedar("forbid(principal, action, resource) when { resource.confidential == true };"),
Description = "Custom policy from Cedar string"
});
var policyEngine PolicyEngine
// Option 1: Using definition property
advancedPolicy := agentcore.NewPolicy(this, jsii.String("AdvancedPolicy"), &PolicyProps{
PolicyEngine: policyEngine,
Definition: jsii.String("permit(principal, action, resource) when { context.custom > 10 };"),
Description: jsii.String("Advanced policy with custom Cedar logic"),
})
// Option 2: Using fromCedar() with statement property
policyEngine.AddPolicy(jsii.String("CustomPolicy"), &AddPolicyOptions{
Statement: agentcore.PolicyStatement_FromCedar(jsii.String("forbid(principal, action, resource) when { resource.confidential == true };")),
Description: jsii.String("Custom policy from Cedar string"),
})
Note: You must specify either definition (raw Cedar string) or statement (PolicyStatement builder), but not both.
Accessing Policies on PolicyEngine
You can access the list of policies added to a PolicyEngine using policyEngine.policies.
PolicyEngine with KMS Encryption
Encrypt policy data with a custom KMS key.
// Create a custom KMS key
const policyKey = new kms.Key(this, "PolicyEngineKey", {
enableKeyRotation: true,
description: "KMS key for policy engine encryption",
});
// Create policy engine with encryption
const policyEngine = new agentcore.PolicyEngine(this, "EncryptedEngine", {
policyEngineName: "encrypted_engine",
description: "Policy engine with KMS encryption",
kmsKey: policyKey,
});
# Create a custom KMS key
policy_key = kms.Key(self, "PolicyEngineKey",
enable_key_rotation=True,
description="KMS key for policy engine encryption"
)
# Create policy engine with encryption
policy_engine = agentcore.PolicyEngine(self, "EncryptedEngine",
policy_engine_name="encrypted_engine",
description="Policy engine with KMS encryption",
kms_key=policy_key
)
// Create a custom KMS key
Key policyKey = Key.Builder.create(this, "PolicyEngineKey")
.enableKeyRotation(true)
.description("KMS key for policy engine encryption")
.build();
// Create policy engine with encryption
PolicyEngine policyEngine = PolicyEngine.Builder.create(this, "EncryptedEngine")
.policyEngineName("encrypted_engine")
.description("Policy engine with KMS encryption")
.kmsKey(policyKey)
.build();
// Create a custom KMS key
var policyKey = new Key(this, "PolicyEngineKey", new KeyProps {
EnableKeyRotation = true,
Description = "KMS key for policy engine encryption"
});
// Create policy engine with encryption
var policyEngine = new PolicyEngine(this, "EncryptedEngine", new PolicyEngineProps {
PolicyEngineName = "encrypted_engine",
Description = "Policy engine with KMS encryption",
KmsKey = policyKey
});
// Create a custom KMS key
policyKey := kms.NewKey(this, jsii.String("PolicyEngineKey"), &KeyProps{
EnableKeyRotation: jsii.Boolean(true),
Description: jsii.String("KMS key for policy engine encryption"),
})
// Create policy engine with encryption
policyEngine := agentcore.NewPolicyEngine(this, jsii.String("EncryptedEngine"), &PolicyEngineProps{
PolicyEngineName: jsii.String("encrypted_engine"),
Description: jsii.String("Policy engine with KMS encryption"),
KmsKey: policyKey,
})
Importing Existing PolicyEngine
Import an existing policy engine from its ARN:
const importedEngine = agentcore.PolicyEngine.fromPolicyEngineAttributes(
this,
"ImportedEngine",
{
policyEngineArn: "policy-engine-arn",
kmsKeyArn: "kms-arn",
}
);
// Use the imported engine
const policy = new agentcore.Policy(this, "PolicyForImportedEngine", {
policyEngine: importedEngine,
definition: "permit(principal, action, resource);",
});
imported_engine = agentcore.PolicyEngine.from_policy_engine_attributes(self, "ImportedEngine",
policy_engine_arn="policy-engine-arn",
kms_key_arn="kms-arn"
)
# Use the imported engine
policy = agentcore.Policy(self, "PolicyForImportedEngine",
policy_engine=imported_engine,
definition="permit(principal, action, resource);"
)
IPolicyEngine importedEngine = PolicyEngine.fromPolicyEngineAttributes(this, "ImportedEngine", PolicyEngineAttributes.builder()
.policyEngineArn("policy-engine-arn")
.kmsKeyArn("kms-arn")
.build());
// Use the imported engine
Policy policy = Policy.Builder.create(this, "PolicyForImportedEngine")
.policyEngine(importedEngine)
.definition("permit(principal, action, resource);")
.build();
var importedEngine = PolicyEngine.FromPolicyEngineAttributes(this, "ImportedEngine", new PolicyEngineAttributes {
PolicyEngineArn = "policy-engine-arn",
KmsKeyArn = "kms-arn"
});
// Use the imported engine
var policy = new Policy(this, "PolicyForImportedEngine", new PolicyProps {
PolicyEngine = importedEngine,
Definition = "permit(principal, action, resource);"
});
importedEngine := agentcore.PolicyEngine_FromPolicyEngineAttributes(this, jsii.String("ImportedEngine"), &PolicyEngineAttributes{
PolicyEngineArn: jsii.String("policy-engine-arn"),
KmsKeyArn: jsii.String("kms-arn"),
})
// Use the imported engine
policy := agentcore.NewPolicy(this, jsii.String("PolicyForImportedEngine"), &PolicyProps{
PolicyEngine: importedEngine,
Definition: jsii.String("permit(principal, action, resource);"),
})
Importing Existing Policy
Import an existing policy from its ARN:
const importedEngine = agentcore.PolicyEngine.fromPolicyEngineAttributes(
this,
"ImportedEngine",
{
policyEngineArn: "policy-engine/my-engine-id",
}
);
const importedPolicy = agentcore.Policy.fromPolicyAttributes(
this,
"ImportedPolicy",
{
policyArn: "my-policy-arn",
policyEngine: importedEngine,
}
);
// Grant permissions to the imported policy
const role = new iam.Role(this, "PolicyRole", {
assumedBy: new iam.ServicePrincipal("lambda.amazonaws.com"),
});
importedPolicy.grantRead(role);
imported_engine = agentcore.PolicyEngine.from_policy_engine_attributes(self, "ImportedEngine",
policy_engine_arn="policy-engine/my-engine-id"
)
imported_policy = agentcore.Policy.from_policy_attributes(self, "ImportedPolicy",
policy_arn="my-policy-arn",
policy_engine=imported_engine
)
# Grant permissions to the imported policy
role = iam.Role(self, "PolicyRole",
assumed_by=iam.ServicePrincipal("lambda.amazonaws.com")
)
imported_policy.grant_read(role)
IPolicyEngine importedEngine = PolicyEngine.fromPolicyEngineAttributes(this, "ImportedEngine", PolicyEngineAttributes.builder()
.policyEngineArn("policy-engine/my-engine-id")
.build());
IPolicy importedPolicy = Policy.fromPolicyAttributes(this, "ImportedPolicy", PolicyAttributes.builder()
.policyArn("my-policy-arn")
.policyEngine(importedEngine)
.build());
// Grant permissions to the imported policy
Role role = Role.Builder.create(this, "PolicyRole")
.assumedBy(new ServicePrincipal("lambda.amazonaws.com"))
.build();
importedPolicy.grantRead(role);
var importedEngine = PolicyEngine.FromPolicyEngineAttributes(this, "ImportedEngine", new PolicyEngineAttributes {
PolicyEngineArn = "policy-engine/my-engine-id"
});
var importedPolicy = Policy.FromPolicyAttributes(this, "ImportedPolicy", new PolicyAttributes {
PolicyArn = "my-policy-arn",
PolicyEngine = importedEngine
});
// Grant permissions to the imported policy
var role = new Role(this, "PolicyRole", new RoleProps {
AssumedBy = new ServicePrincipal("lambda.amazonaws.com")
});
importedPolicy.GrantRead(role);
importedEngine := agentcore.PolicyEngine_FromPolicyEngineAttributes(this, jsii.String("ImportedEngine"), &PolicyEngineAttributes{
PolicyEngineArn: jsii.String("policy-engine/my-engine-id"),
})
importedPolicy := agentcore.Policy_FromPolicyAttributes(this, jsii.String("ImportedPolicy"), &PolicyAttributes{
PolicyArn: jsii.String("my-policy-arn"),
PolicyEngine: importedEngine,
})
// Grant permissions to the imported policy
role := iam.NewRole(this, jsii.String("PolicyRole"), &RoleProps{
AssumedBy: iam.NewServicePrincipal(jsii.String("lambda.amazonaws.com")),
})
importedPolicy.GrantRead(role)
PolicyEngine IAM Permissions
Grant various levels of access to policy engines:
const policyEngine = new agentcore.PolicyEngine(this, "MyEngine", {
policyEngineName: "my_engine",
});
const lambdaRole = new iam.Role(this, "LambdaRole", {
assumedBy: new iam.ServicePrincipal("lambda.amazonaws.com"),
});
// Grant read permissions
policyEngine.grantRead(lambdaRole);
// Grant evaluation permissions
policyEngine.grantEvaluate(lambdaRole);
policy_engine = agentcore.PolicyEngine(self, "MyEngine",
policy_engine_name="my_engine"
)
lambda_role = iam.Role(self, "LambdaRole",
assumed_by=iam.ServicePrincipal("lambda.amazonaws.com")
)
# Grant read permissions
policy_engine.grant_read(lambda_role)
# Grant evaluation permissions
policy_engine.grant_evaluate(lambda_role)
PolicyEngine policyEngine = PolicyEngine.Builder.create(this, "MyEngine")
.policyEngineName("my_engine")
.build();
Role lambdaRole = Role.Builder.create(this, "LambdaRole")
.assumedBy(new ServicePrincipal("lambda.amazonaws.com"))
.build();
// Grant read permissions
policyEngine.grantRead(lambdaRole);
// Grant evaluation permissions
policyEngine.grantEvaluate(lambdaRole);
var policyEngine = new PolicyEngine(this, "MyEngine", new PolicyEngineProps {
PolicyEngineName = "my_engine"
});
var lambdaRole = new Role(this, "LambdaRole", new RoleProps {
AssumedBy = new ServicePrincipal("lambda.amazonaws.com")
});
// Grant read permissions
policyEngine.GrantRead(lambdaRole);
// Grant evaluation permissions
policyEngine.GrantEvaluate(lambdaRole);
policyEngine := agentcore.NewPolicyEngine(this, jsii.String("MyEngine"), &PolicyEngineProps{
PolicyEngineName: jsii.String("my_engine"),
})
lambdaRole := iam.NewRole(this, jsii.String("LambdaRole"), &RoleProps{
AssumedBy: iam.NewServicePrincipal(jsii.String("lambda.amazonaws.com")),
})
// Grant read permissions
policyEngine.GrantRead(lambdaRole)
// Grant evaluation permissions
policyEngine.GrantEvaluate(lambdaRole)
Types
Constructs (L2)
ApiKeyCredentialProviderConstruct (L2)
L2 construct forAWS::BedrockAgentCore::ApiKeyCredentialProvider.BrowserCustomConstruct (L2)
Browser resource for AWS Bedrock Agent Core.BrowserCustomBaseConstruct (L2)
Abstract base class for a Browser.CodeInterpreterCustomConstruct (L2)
Custom code interpreter resource for AWS Bedrock Agent Core.CodeInterpreterCustomBaseConstruct (L2)
Abstract base class for a Code Interpreter.EvaluatorConstruct (L2)
A custom evaluator for Amazon Bedrock AgentCore.EvaluatorBaseConstruct (L2)
Abstract base class for Evaluator.GatewayConstruct (L2)
Gateway resource for AWS Bedrock Agent Core.GatewayBaseConstruct (L2)
Base class for Gateway constructs.GatewayTargetConstruct (L2)
Defines tools that your gateway will host.GatewayTargetBaseConstruct (L2)
Base class for gateway target implementations.MemoryConstruct (L2)
Long-term memory store for extracted insights like user preferences, semantic facts and summaries.MemoryBaseConstruct (L2)
Abstract base class for a Memory.OAuth2CredentialProviderConstruct (L2)
L2 construct forAWS::BedrockAgentCore::OAuth2CredentialProvider.OnlineEvaluationBaseConstruct (L2)
Abstract base class for OnlineEvaluationConfig.OnlineEvaluationConfigConstruct (L2)
Online evaluation configuration for Amazon Bedrock AgentCore.PolicyConstruct (L2)
Individual Cedar policy defining what agents can access.PolicyBaseConstruct (L2)
Abstract base class for a Policy.PolicyEngineConstruct (L2)
Container that manages Cedar authorization policies associated with gateways.PolicyEngineBaseConstruct (L2)
Abstract base class for a PolicyEngine.RuntimeConstruct (L2)
Bedrock Agent Core Runtime Enables running containerized agents with specific network configurations, security settings, and runtime artifacts.RuntimeBaseConstruct (L2)
Base class for Agent Runtime.RuntimeEndpointConstruct (L2)
Bedrock Agent Core Runtime Endpoint Provides a stable endpoint for invoking agent runtimes with versioning support.RuntimeEndpointBaseConstruct (L2)
Base class for Runtime Endpoint.WorkloadIdentityConstruct (L2)
L2 construct forAWS::BedrockAgentCore::WorkloadIdentity.
Structs
AddApiGatewayTargetOptionsStruct
Options for adding an API Gateway target to a gateway.AddEndpointOptionsStruct
Options for adding an endpoint to the runtime.AddLambdaTargetOptionsStruct
Options for adding a Lambda target to a gateway.AddMcpServerTargetOptionsStruct
Options for adding an MCP Server target to a gateway.AddOpenApiTargetOptionsStruct
Options for adding an OpenAPI target to a gateway.AddPolicyOptionsStruct
Options for adding a policy via PolicyEngine.addPolicy().AddSmithyTargetOptionsStruct
Options for adding a Smithy target to a gateway.AgentRuntimeAttributesStruct
Attributes for importing an existing Agent Runtime.ApiStructGateway Target Configuration Props
Properties for creating an API Gateway target configuration.ApiGatewayToolConfigurationStruct
Configuration for API Gateway tools.ApiGatewayToolFilterStruct
Configuration for filtering API Gateway tools.ApiGatewayToolOverrideStruct
Configuration for overriding API Gateway tool metadata.ApiKeyAdditionalConfigurationStruct
API Key additional configuration.ApiStructKey Credential Provider Attributes
Attributes for importing an existing API key credential provider.ApiKeyCredentialProviderPropsStruct
API key credential provider ARNs for gateway outbound auth (Token Vault identity).ApiStructKey Credential Provider Resource Props
Properties for a new {@link ApiKeyCredentialProvider} (Token Vault resource).AtlassianStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingAtlassian}.BrowserCustomAttributesStruct
Attributes for specifying an imported Browser Custom.BrowserCustomPropsStruct
Properties for creating a Browser resource.CategoricalRatingOptionStruct
A categorical rating scale option for custom evaluators.CloudWatchLogsDataSourceConfigStruct
Configuration for CloudWatch Logs data source.CodeAssetOptionsStruct
Options for configuring an S3 code asset from local files for agent runtime artifact.CodeBasedOptionsStruct
Options for configuring a code-based custom evaluator using a Lambda function.CodeInterpreterCustomAttributesStruct
Attributes for specifying an imported Code Interpreter Custom.CodeInterpreterCustomPropsStruct
Properties for creating a CodeInterpreter resource.CognitoAuthorizerPropsStruct
Properties for configuring a Cognito authorizer.CustomJwtConfigurationStruct
Custom JWT authorizer configuration.CustomStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingCustom}.DataSourceConfigBindResultStruct
The result of binding a DataSourceConfig.DropboxStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingDropbox}.EpisodicReflectionConfigurationStruct
Configuration for episodic memory reflection.EvaluatorAttributesStruct
Attributes for importing an existing Evaluator.EvaluatorInferenceConfigStruct
Inference configuration for a custom LLM-as-a-Judge evaluator.EvaluatorPropsStruct
Properties for creating an Evaluator.EvaluatorReferenceBindResultStruct
The result of binding an EvaluatorReference.FacebookStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingFacebook}.FilterConfigStruct
Filter configuration for online evaluation.FromApiKeyIdentityOptionsStruct
Optional gateway settings when binding an {@link IApiKeyCredentialProvider} to a target.FromOauthIdentityOptionsStruct
OAuth scopes (and optional custom parameters) when binding an {@link IOAuth2CredentialProvider} to a gateway target.GatewayApiKeyIdentityBindingStruct
Provider and secret ARNs for wiring a Token Vault API key identity into a gateway target.GatewayAttributesStruct
Attributes for importing an existing Gateway.GatewayOAuth2IdentityBindingStruct
Provider ARN, secret ARN, and OAuth scopes for wiring a Token Vault OAuth2 identity into a gateway target.GatewayPolicyEngineConfigStruct
Configuration for associating a policy engine with a gateway.GatewayPropsStruct
Properties for defining a Gateway.GatewayTargetApiGatewayPropsStruct
Properties for creating an API Gateway-based Gateway Target.GatewayTargetAttributesStruct
Attributes for importing an existing Gateway Target.GatewayTargetCommonPropsStruct
Common properties for all Gateway Target types.GatewayTargetLambdaPropsStruct
Properties for creating a Lambda-based Gateway Target Convenience interface for the most common use case.GatewayTargetMcpServerPropsStruct
Properties for creating an MCP Server-based Gateway Target.GatewayTargetOpenApiPropsStruct
Properties for creating an OpenAPI-based Gateway Target.GatewayTargetPropsStruct
Properties for creating a Gateway Target resource.GatewayTargetSmithyPropsStruct
Properties for creating a Smithy-based Gateway Target.GithubStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingGithub}.GoogleStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingGoogle}.HubspotStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingHubspot}.IncludedStructOauth2 Tenant Credential Provider Props
Props forIncludedOauth2ProviderConfigIdPs whose outbound documentation requiresissuer,authorizationEndpoint, and/ortokenEndpoint(for example Okta, Auth0, Amazon Cognito, OneLogin, PingOne, CyberArk, FusionAuth).IncludedOauth2TenantEndpointsStruct
Optional tenant OAuth endpoints for IdPs that use CloudFormationIncludedOauth2ProviderConfigwith issuer and/or endpoints per the IdP’s outbound documentation.InterceptorBindConfigStruct
Configuration returned from binding an interceptor to a Gateway.InterceptorOptionsStruct
Options for configuring an interceptor.InvocationConfigurationStruct
Invocation configuration for self managed memory strategy.LifecycleConfigurationStruct
LifecycleConfiguration lets you manage the lifecycle of runtime sessions and resources in AgentCore Runtime.LinkedinStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingLinkedin}.LlmAsAJudgeOptionsStruct
Options for configuring an LLM-as-a-Judge custom evaluator.LoggingConfigStruct
Configuration for logging with log type and destination.ManagedStrategyPropsStruct
Configuration parameters for a memory strategy that can override existing built-in default prompts/models.McpConfigurationStruct
MCP protocol configuration The configuration for the Model Context Protocol (MCP).MemoryAttributesStruct
Attributes for specifying an imported Memory.MemoryPropsStruct
Properties for creating a Memory resource.MemoryStrategyCommonPropsStruct
Configuration parameters common for any memory strategy.MetadataConfigurationStruct
Configuration for passing metadata (headers and query parameters) to the API Gateway target.MicrosoftStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingMicrosoft}.NotionStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingNotion}.NumericalRatingOptionStruct
A numerical rating scale option for custom evaluators.OAuth2StructAuthorization Server Metadata
Static OAuth2 authorization server metadata for custom credential providers.OAuth2ClientCredentialsStruct
OAuth2 client identifier and secret registered with the identity provider (all vendors).OAuth2StructCredential Provider Attributes
Attributes for importing an existing OAuth2 credential provider.OAuth2StructCredential Provider Base Props
Shared properties for OAuth2 credential providers created via {@link OAuth2CredentialProvider} factory methods.OAuth2StructCredential Provider Factory Base Props
Naming, tags, and client credentials shared by every {@link OAuth2CredentialProvider} factory.OAuth2CredentialProviderPropsStruct
Low-level properties when you need full control (prefer {@link OAuth2CredentialProvider.usingSlack} and other factories).OAuthConfigurationStruct
OAuth configuration.OnlineEvaluationBasePropsStruct
Base properties for creating an OnlineEvaluationConfig.OnlineEvaluationConfigAttributesStruct
Attributes for importing an existing OnlineEvaluationConfig.OnlineEvaluationConfigPropsStruct
Properties for creating an OnlineEvaluationConfig.OverrideConfigStruct
Configuration for overriding model and prompt template.PolicyAttributesStruct
Attributes for importing an existing Policy.PolicyEngineAttributesStruct
Attributes for importing an existing PolicyEngine.PolicyEnginePropsStruct
Properties for creating a PolicyEngine resource.PolicyPropsStruct
Properties for creating a Policy resource.RecordingConfigStruct
Recording configuration for browser.RedditStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingReddit}.RequestHeaderConfigurationStruct
Configuration for HTTP request headers that will be passed through to the runtime.RuntimeEndpointAttributesStruct
Attributes for importing an existing Runtime Endpoint.RuntimeEndpointPropsStruct
Properties for creating a Bedrock Agent Core Runtime Endpoint resource.RuntimePropsStruct
Properties for creating a Bedrock Agent Core Runtime resource.SalesforceStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingSalesforce}.SchemaDefinitionStruct
Schema definition for tool input/output.SelfManagedStrategyPropsStruct
Configuration parameters for a self managed memory strategy existing built-in default prompts/models.SlackStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingSlack}.SpotifyStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingSpotify}.TargetConfigurationConfigStruct
Configuration returned by binding a target configuration.ToolDefinitionStruct
Tool definition for inline payload.TriggerConditionsStruct
Trigger conditions for self managed memory strategy When first condition is met, batched payloads are sent to specified S3 bucket.TwitchStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingTwitch}.VpcConfigPropsStruct
VPC configuration properties.WorkloadIdentityAttributesStruct
Attributes for importing an existing workload identity.WorkloadIdentityPropsStruct
Properties for a new {@link WorkloadIdentity}.XOAuth2CredentialProviderPropsStruct
Props for {@link OAuth2CredentialProvider.usingX}.YandexStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingYandex}.ZoomStructOAuth2 Credential Provider Props
Props for {@link OAuth2CredentialProvider.usingZoom}.
Enums
AgentCoreRuntimeEnum
Bedrock AgentCore runtime environment for code execution Allowed values: PYTHON_3_10 | PYTHON_3_11 | PYTHON_3_12 | PYTHON_3_13 | PYTHON_3_14 | NODE_22.ApiGatewayHttpMethodEnum
HTTP methods supported by API Gateway.BrowserSigningEnum
Browser signing.CredentialProviderTypeEnum
Credential provider types supported by gateway target.CustomClaimOperatorEnum
Custom claim match operator.GatewayAuthorizerTypeEnum
Gateway authorizer type.GatewayExceptionLevelEnum
Exception levels for gateway.GatewayTargetProtocolTypeEnum
Protocol types supported by gateway targets.InterceptionPointEnum
The interception point where the interceptor will be invoked.McpGatewaySearchTypeEnum
Search types supported by MCP gateway.MCPProtocolVersionEnum
MCP protocol versions.McpTargetTypeEnum
MCP target types.MemoryStrategyTypeEnum
Long-term memory extraction strategy types.OAuth2CredentialProviderVendorEnum
Built-in OAuth2 vendors supported byAWS::BedrockAgentCore::OAuth2CredentialProvider.ProtocolTypeEnum
Protocol configuration for Agent Runtime.SchemaDefinitionTypeEnum
Schema definition types.
Classes
AgentRuntimeArtifactClass
Abstract base class for agent runtime artifacts.ApiGatewayTargetConfigurationClass
Configuration for API Gateway-based MCP targets.ApiKeyCredentialLocationClass
API Key location within the request.ApiClassKey Credential Provider Identity Perms
IAM actions for AgentCore API key credential providers (Token Vault).ApiSchemaClass
Represents the concept of an API Schema for a Gateway Target.AssetApiSchemaClass
API Schema from a local asset.AssetToolSchemaClass
Tool Schema from a local asset.AttributeAccessorClass
Accessor for building type-safe attribute comparisons.BrowserNetworkConfigurationClass
Network configuration for the Browser tool.BuiltinEvaluatorClass
Built-in evaluators provided by Amazon Bedrock AgentCore.CodeClassInterpreter Network Configuration
Network configuration for the Code Interpreter tool.ConditionalAttributeAccessorClass
Accessor for building type-safe attribute comparisons within conditional statements.ConditionalPolicyStatementClass
Wrapper class for conditionally building policy statements.ConditionBuilderClass
Builder for condition expressions in Cedar policies.CustomJwtAuthorizerClass
Custom JWT authorizer configuration implementation.DataSourceConfigClass
Configuration for the data source used in online evaluation.EvaluationLevelClass
The level at which a custom evaluator assesses agent performance.EvaluatorConfigClass
Configuration for a custom evaluator.EvaluatorRatingScaleClass
Represents a rating scale for custom LLM-as-a-Judge evaluators.EvaluatorReferenceClass
Represents a reference to an evaluator for online evaluation.ExecutionStatusClass
The execution status of an online evaluation configuration.FilterOperatorClass
Filter operators for online evaluation filtering.FilterValueClass
A typed filter value for online evaluation filtering.GatewayAuthorizerClass
Factory class for creating Gateway Authorizers.GatewayCredentialProviderClass
Factory class for creating different Gateway Credential Providers.GatewayCustomClaimClass
Represents a custom claim validation configuration for Gateway JWT authorizers.GatewayProtocolClass
Factory class for instantiating Gateway Protocols.IamAuthorizerClass
AWS IAM authorizer configuration implementation.InlineApiSchemaClass
Class to define an API Schema from an inline string.InlineToolSchemaClass
Class to define a Tool Schema from an inline string.LambdaInterceptorClass
A Lambda-based interceptor for Gateway.LambdaTargetConfigurationClass
Configuration for Lambda-based MCP targets.LoggingDestinationClass
Represents a logging destination for AgentCore Runtime.LogTypeClass
Log types for AgentCore Runtime observability.ManagedMemoryStrategyClass
Managed memory strategy that handles both built-in and override configurations.McpProtocolConfigurationClass
MCP (Model Context Protocol) configuration implementation.McpServerTargetConfigurationClass
Configuration for MCP Server-based targets.McpTargetConfigurationClass
Abstract base class for MCP target configurations Provides common functionality for all MCP target types.MemoryStrategyClass
Factory class for creating memory strategies If you need long-term memory for context recall across sessions, you can setup memory extraction strategies to extract the relevant memory from the raw events.NetworkConfigurationClass
Abstract base class for network configuration.NoAuthAuthorizerClass
No authorization configuration implementation.OAuth2ClassCredential Provider Identity Perms
IAM actions for AgentCore OAuth2 credential providers (Token Vault).OpenApiTargetConfigurationClass
Configuration for OpenAPI-based MCP targets.PolicyEngineModeClass
The enforcement mode for a policy engine associated with a gateway.PolicyStatementClass
Type-safe builder for creating Cedar authorization policy statements.PolicyValidationModeClass
Validation mode for Cedar policy definitions.RuntimeAuthorizerConfigurationClass
Abstract base class for runtime authorizer configurations.RuntimeCustomClaimClass
Represents a custom claim validation configuration for Runtime JWT authorizers.RuntimeNetworkConfigurationClass
Network configuration for the Runtime.S3ApiSchemaClass
Class to define an API Schema from an S3 object.S3ToolSchemaClass
Class to define a Tool Schema from an S3 object.SelfManagedMemoryStrategyClass
Use AgentCore memory for event storage with custom triggers.SmithyTargetConfigurationClass
Configuration for Smithy-based MCP targets.ToolSchemaClass
Defines the schema for tools available to a gateway target.WorkloadIdentityPermsClass
IAM actions for AgentCore workload identities.
Interfaces
IApiKeyCredentialProviderInterface
An API key credential provider registered in AgentCore Token Vault.IBedrockAgentRuntimeInterface
Interface for Agent Runtime resources.IBrowserCustomInterface
Interface for Browser resources.ICodeInterpreterCustomInterface
Interface for CodeInterpreterCustom resources.ICredentialProviderConfigInterface
Abstract interface for gateway credential provider configuration.IEvaluatorInterface
Interface for Evaluator resources.IGatewayInterface
Interface for Gateway resources.IGatewayAuthorizerConfigInterface
Abstract interface for gateway authorizer configuration.IGatewayProtocolConfigInterface
Abstract interface for gateway protocol configuration.IGatewayTargetInterface
Interface for GatewayTarget resources.IInterceptorInterface
Represents an interceptor that can be bound to a Gateway.IMcpGatewayTargetInterface
Interface for MCP gateway targets.IMemoryInterface
Interface for Memory resources.IMemoryStrategyInterface
Interface for Memory strategies.IOAuth2CredentialProviderInterface
An OAuth2 credential provider registered in AgentCore Token Vault.IOnlineEvaluationConfigInterface
Interface for OnlineEvaluationConfig resources.IPolicyInterface
Minimal reference interface for Policy resources.IPolicyEngineInterface
Contains all properties and methods for both created and imported policy engines.IRuntimeEndpointInterface
Interface for Runtime Endpoint resources.ITargetConfigurationInterface
Base interface for target configurations.IWorkloadIdentityInterface
A workload identity for Amazon Bedrock AgentCore.
TypeScript