CodeBasedOptions

class aws_cdk.aws_bedrock_agentcore_alpha.CodeBasedOptions(*, lambda_function, timeout=None)

Bases: object

(deprecated) Options for configuring a code-based custom evaluator using a Lambda function.

Uses a Lambda function to implement custom evaluation logic.

Parameters:
  • lambda_function (IFunction) – (deprecated) The Lambda function used for evaluation. The function will be granted invoke permissions for the bedrock-agentcore.amazonaws.com service principal, scoped to this specific evaluator resource.

  • timeout (Optional[Duration]) – (deprecated) The timeout for the Lambda function invocation during evaluation. When not specified, the AgentCore evaluation service uses its default timeout for Lambda-based evaluators. Default: - The AgentCore evaluation service’s default Lambda timeout is used

Deprecated:

Use the equivalent construct from aws-cdk-lib/aws-bedrockagentcore instead.

Stability:

deprecated

ExampleMetadata:

infused

Example:

# Code-based evaluator
# my_eval_function: lambda.IFunction
# LLM-as-a-Judge evaluator
llm_config = agentcore.EvaluatorConfig.llm_as_a_judge(
    instructions="Evaluate whether the agent response is helpful.",
    model_id="us.anthropic.claude-sonnet-4-6",
    rating_scale=agentcore.EvaluatorRatingScale.categorical([label="Good", definition="The response is helpful.", label="Bad", definition="The response is not helpful."
    ])
)
code_config = agentcore.EvaluatorConfig.code_based(
    lambda_function=my_eval_function
)

Attributes

lambda_function

(deprecated) The Lambda function used for evaluation.

The function will be granted invoke permissions for the bedrock-agentcore.amazonaws.com service principal, scoped to this specific evaluator resource.

Stability:

deprecated

timeout

(deprecated) The timeout for the Lambda function invocation during evaluation.

When not specified, the AgentCore evaluation service uses its default timeout for Lambda-based evaluators.

Default:
  • The AgentCore evaluation service’s default Lambda timeout is used

See:

https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/custom-evaluators.html

Stability:

deprecated