AddLambdaTargetOptions
- class aws_cdk.aws_bedrock_agentcore_alpha.AddLambdaTargetOptions(*, gateway_target_name, lambda_function, tool_schema, credential_provider_configurations=None, description=None)
Bases:
object(experimental) Options for adding a Lambda target to a gateway.
- Parameters:
gateway_target_name (
str) – (experimental) The name of the gateway target Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen).lambda_function (
IFunction) – (experimental) The Lambda function to associate with this target.tool_schema (
ToolSchema) – (experimental) The tool schema defining the available tools.credential_provider_configurations (
Optional[Sequence[ICredentialProviderConfig]]) – (experimental) Credential providers for authentication. Default: - [GatewayCredentialProvider.iamRole()]description (
Optional[str]) – (experimental) Optional description for the gateway target. Default: - No description
- Stability:
experimental
- ExampleMetadata:
fixture=default infused
Example:
# Create a gateway first gateway = agentcore.Gateway(self, "MyGateway", gateway_name="my-gateway" ) lambda_function = lambda_.Function(self, "MyFunction", runtime=lambda_.Runtime.NODEJS_22_X, handler="index.handler", code=lambda_.Code.from_inline(""" exports.handler = async (event) => { return { statusCode: 200, body: JSON.stringify({ message: 'Hello from Lambda!' }) }; }; """) ) lambda_target = gateway.add_lambda_target("MyLambdaTarget", gateway_target_name="my-lambda-target", description="Lambda function target", lambda_function=lambda_function, tool_schema=agentcore.ToolSchema.from_inline([ name="hello_world", description="A simple hello world tool", input_schema=agentcore.SchemaDefinition( type=agentcore.SchemaDefinitionType.OBJECT, properties={ "name": agentcore.SchemaDefinition( type=agentcore.SchemaDefinitionType.STRING, description="The name to greet" ) }, required=["name"] ) ]) )
Attributes
- credential_provider_configurations
(experimental) Credential providers for authentication.
- Default:
[GatewayCredentialProvider.iamRole()]
- Stability:
experimental
- description
(experimental) Optional description for the gateway target.
- Default:
No description
- Stability:
experimental
- gateway_target_name
(experimental) The name of the gateway target Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen).
- Stability:
experimental
- lambda_function
(experimental) The Lambda function to associate with this target.
- Stability:
experimental
- tool_schema
(experimental) The tool schema defining the available tools.
- Stability:
experimental