CodeBasedOptions
- class aws_cdk.aws_bedrock_agentcore_alpha.CodeBasedOptions(*, lambda_function, timeout=None)
Bases:
object(experimental) 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) – (experimental) The Lambda function used for evaluation. The function will be granted invoke permissions for thebedrock-agentcore.amazonaws.com.rproxy.govskope.caservice principal, scoped to this specific evaluator resource.timeout (
Optional[Duration]) – (experimental) 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
- Stability:
experimental
- ExampleMetadata:
fixture=default infused
Example:
# eval_function: lambda.IFunction code_evaluator = agentcore.Evaluator(self, "CodeEvaluator", evaluator_name="custom_code_evaluator", level=agentcore.EvaluationLevel.TOOL_CALL, description="Evaluates tool call accuracy using custom logic", evaluator_config=agentcore.EvaluatorConfig.code_based( lambda_function=eval_function, timeout=cdk.Duration.seconds(30) ) )
Attributes
- lambda_function
(experimental) The Lambda function used for evaluation.
The function will be granted invoke permissions for the
bedrock-agentcore.amazonaws.com.rproxy.govskope.caservice principal, scoped to this specific evaluator resource.- Stability:
experimental
- timeout
(experimental) 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:
- Stability:
experimental