Skip to content
v2.278.0

GatewayExceptionLevel Class ​

Exception levels for gateway.

Example ​

ts
// Create a KMS key for encryption
const encryptionKey = new kms.Key(this, "GatewayEncryptionKey", {
  enableKeyRotation: true,
  description: "KMS key for gateway encryption",
});

// Create gateway with KMS encryption
const gateway = new agentcore.Gateway(this, "MyGateway", {
  gatewayName: "my-encrypted-gateway",
  description: "Gateway with KMS encryption",
  protocolConfiguration: new agentcore.McpProtocolConfiguration({
    instructions: "Use this gateway to connect to external MCP tools",
    searchType: agentcore.McpGatewaySearchType.SEMANTIC,
    supportedVersions: [agentcore.MCPProtocolVersion.MCP_2025_03_26],
  }),
  authorizerConfiguration: agentcore.GatewayAuthorizer.usingCustomJwt({
    discoveryUrl: "https://auth.example.com/.well-known/openid-configuration",
    allowedAudience: ["my-app"],
    allowedClients: ["my-client-id"],
    allowedScopes: ["read", "write"],
  }),
  kmsKey: encryptionKey,
  exceptionLevel: agentcore.GatewayExceptionLevel.DEBUG,
});
python
# Create a KMS key for encryption
encryption_key = kms.Key(self, "GatewayEncryptionKey",
    enable_key_rotation=True,
    description="KMS key for gateway encryption"
)

# Create gateway with KMS encryption
gateway = agentcore.Gateway(self, "MyGateway",
    gateway_name="my-encrypted-gateway",
    description="Gateway with KMS encryption",
    protocol_configuration=agentcore.McpProtocolConfiguration(
        instructions="Use this gateway to connect to external MCP tools",
        search_type=agentcore.McpGatewaySearchType.SEMANTIC,
        supported_versions=[agentcore.MCPProtocolVersion.MCP_2025_03_26]
    ),
    authorizer_configuration=agentcore.GatewayAuthorizer.using_custom_jwt(
        discovery_url="https://auth.example.com/.well-known/openid-configuration",
        allowed_audience=["my-app"],
        allowed_clients=["my-client-id"],
        allowed_scopes=["read", "write"]
    ),
    kms_key=encryption_key,
    exception_level=agentcore.GatewayExceptionLevel.DEBUG
)
java
// Create a KMS key for encryption
Key encryptionKey = Key.Builder.create(this, "GatewayEncryptionKey")
        .enableKeyRotation(true)
        .description("KMS key for gateway encryption")
        .build();

// Create gateway with KMS encryption
Gateway gateway = Gateway.Builder.create(this, "MyGateway")
        .gatewayName("my-encrypted-gateway")
        .description("Gateway with KMS encryption")
        .protocolConfiguration(McpProtocolConfiguration.Builder.create()
                .instructions("Use this gateway to connect to external MCP tools")
                .searchType(McpGatewaySearchType.SEMANTIC)
                .supportedVersions(List.of(MCPProtocolVersion.MCP_2025_03_26))
                .build())
        .authorizerConfiguration(GatewayAuthorizer.usingCustomJwt(CustomJwtConfiguration.builder()
                .discoveryUrl("https://auth.example.com/.well-known/openid-configuration")
                .allowedAudience(List.of("my-app"))
                .allowedClients(List.of("my-client-id"))
                .allowedScopes(List.of("read", "write"))
                .build()))
        .kmsKey(encryptionKey)
        .exceptionLevel(GatewayExceptionLevel.DEBUG)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// Create a KMS key for encryption
var encryptionKey = new Key(this, "GatewayEncryptionKey", new KeyProps {
    EnableKeyRotation = true,
    Description = "KMS key for gateway encryption"
});

// Create gateway with KMS encryption
var gateway = new Gateway(this, "MyGateway", new GatewayProps {
    GatewayName = "my-encrypted-gateway",
    Description = "Gateway with KMS encryption",
    ProtocolConfiguration = new McpProtocolConfiguration(new McpConfiguration {
        Instructions = "Use this gateway to connect to external MCP tools",
        SearchType = McpGatewaySearchType.SEMANTIC,
        SupportedVersions = new [] { MCPProtocolVersion.MCP_2025_03_26 }
    }),
    AuthorizerConfiguration = GatewayAuthorizer.UsingCustomJwt(new CustomJwtConfiguration {
        DiscoveryUrl = "https://auth.example.com/.well-known/openid-configuration",
        AllowedAudience = new [] { "my-app" },
        AllowedClients = new [] { "my-client-id" },
        AllowedScopes = new [] { "read", "write" }
    }),
    KmsKey = encryptionKey,
    ExceptionLevel = GatewayExceptionLevel.DEBUG
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Create a KMS key for encryption
encryptionKey := kms.NewKey(this, jsii.String("GatewayEncryptionKey"), &KeyProps{
	EnableKeyRotation: jsii.Boolean(true),
	Description: jsii.String("KMS key for gateway encryption"),
})

// Create gateway with KMS encryption
gateway := agentcore.NewGateway(this, jsii.String("MyGateway"), &GatewayProps{
	GatewayName: jsii.String("my-encrypted-gateway"),
	Description: jsii.String("Gateway with KMS encryption"),
	ProtocolConfiguration: agentcore.NewMcpProtocolConfiguration(&McpConfiguration{
		Instructions: jsii.String("Use this gateway to connect to external MCP tools"),
		SearchType: agentcore.McpGatewaySearchType_SEMANTIC(),
		SupportedVersions: []MCPProtocolVersion{
			agentcore.MCPProtocolVersion_MCP_2025_03_26(),
		},
	}),
	AuthorizerConfiguration: agentcore.GatewayAuthorizer_UsingCustomJwt(&CustomJwtConfiguration{
		DiscoveryUrl: jsii.String("https://auth.example.com/.well-known/openid-configuration"),
		AllowedAudience: []*string{
			jsii.String("my-app"),
		},
		AllowedClients: []*string{
			jsii.String("my-client-id"),
		},
		AllowedScopes: []*string{
			jsii.String("read"),
			jsii.String("write"),
		},
	}),
	KmsKey: encryptionKey,
	ExceptionLevel: agentcore.GatewayExceptionLevel_DEBUG(),
})

Properties ​

Debug mode for granular exception messages.

Allows the return of specific error messages related to the gateway target configuration to help you with debugging.

valuestringvaluestrvalueStringValuestringValue*string #
The exception level string value.

Methods ​

of(value: string): GatewayExceptionLevel // chainable@staticmethod def of(value: str) -> GatewayExceptionLevelpublic static GatewayExceptionLevel of(String value)public static GatewayExceptionLevel Of(string value)func Of(Value *string) GatewayExceptionLevel static #
Use a custom exception level not yet defined in this class.
1 parameter

Parameters

  • valuevaluevaluevalueValue — The exception level string value.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string #
Returns the string value.