SchemaDefinition

class aws_cdk.aws_bedrock_agentcore_alpha.SchemaDefinition(*, type, description=None, items=None, properties=None, required=None)

Bases: object

(experimental) Schema definition for tool input/output.

Parameters:
  • type (SchemaDefinitionType) – (experimental) The type of the schema definition. This field specifies the data type of the schema.

  • description (Optional[str]) – (experimental) The description of the schema definition. This description provides information about the purpose and usage of the schema. Default: - No description

  • items (Union[SchemaDefinition, Dict[str, Any], None]) – (experimental) The items in the schema definition. This field is used for array types to define the structure of the array elements. Default: - No items definition

  • properties (Optional[Mapping[str, Union[SchemaDefinition, Dict[str, Any]]]]) – (experimental) The properties of the schema definition. These properties define the fields in the schema. Default: - No properties

  • required (Optional[Sequence[str]]) – (experimental) The required fields in the schema definition. These fields must be provided when using the schema. Default: - No required fields

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

description

(experimental) The description of the schema definition.

This description provides information about the purpose and usage of the schema.

Default:
  • No description

Stability:

experimental

items

(experimental) The items in the schema definition.

This field is used for array types to define the structure of the array elements.

Default:
  • No items definition

Stability:

experimental

properties

(experimental) The properties of the schema definition.

These properties define the fields in the schema.

Default:
  • No properties

Stability:

experimental

required

(experimental) The required fields in the schema definition.

These fields must be provided when using the schema.

Default:
  • No required fields

Stability:

experimental

type

(experimental) The type of the schema definition.

This field specifies the data type of the schema.

Stability:

experimental