CodeBasedOptions Struct
Options for configuring a code-based custom evaluator using a Lambda function.
Uses a Lambda function to implement custom evaluation logic.
Example
ts
declare const evalFunction: lambda.IFunction;
const codeEvaluator = new agentcore.Evaluator(this, 'CodeEvaluator', {
evaluatorName: 'custom_code_evaluator',
level: agentcore.EvaluationLevel.TOOL_CALL,
description: 'Evaluates tool call accuracy using custom logic',
evaluatorConfig: agentcore.EvaluatorConfig.codeBased({
lambdaFunction: evalFunction,
timeout: cdk.Duration.seconds(30),
}),
});
Properties
lambdaFunctionIFunctionlambda_functionIFunctionlambdaFunctionIFunctionLambdaFunctionIFunctionLambdaFunctionIFunctionrequired#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.
timeoutoptionalDurationtimeoutoptionalDurationtimeoutoptionalDurationTimeoutoptionalDurationTimeoutoptionalDuration#The timeout for the Lambda function invocation during evaluation.
Default: The AgentCore evaluation service's default Lambda timeout is used
When not specified, the AgentCore evaluation service uses its default timeout for Lambda-based evaluators.