interface CodeBasedOptions
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Bedrock.Agentcore.Alpha.CodeBasedOptions |
Go | github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2#CodeBasedOptions |
Java | software.amazon.awscdk.services.bedrock.agentcore.alpha.CodeBasedOptions |
Python | aws_cdk.aws_bedrock_agentcore_alpha.CodeBasedOptions |
TypeScript (source) | @aws-cdk/aws-bedrock-agentcore-alpha » CodeBasedOptions |
⚠️ Deprecated: Use the equivalent construct from aws-cdk-lib/aws-bedrockagentcore instead.
Options for configuring a code-based custom evaluator using a Lambda function.
Uses a Lambda function to implement custom evaluation logic.
Example
// LLM-as-a-Judge evaluator
const llmConfig = agentcore.EvaluatorConfig.llmAsAJudge({
instructions: 'Evaluate whether the agent response is helpful.',
modelId: 'us.anthropic.claude-sonnet-4-6',
ratingScale: agentcore.EvaluatorRatingScale.categorical([
{ label: 'Good', definition: 'The response is helpful.' },
{ label: 'Bad', definition: 'The response is not helpful.' },
]),
});
// Code-based evaluator
declare const myEvalFunction: lambda.IFunction;
const codeConfig = agentcore.EvaluatorConfig.codeBased({
lambdaFunction: myEvalFunction,
});
Properties
| Name | Type | Description |
|---|---|---|
| lambda | IFunction | The Lambda function used for evaluation. |
| timeout? | Duration | The timeout for the Lambda function invocation during evaluation. |
lambdaFunction
⚠️ Deprecated: Use the equivalent construct from aws-cdk-lib/aws-bedrockagentcore instead.
Type:
IFunction
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?
⚠️ Deprecated: Use the equivalent construct from aws-cdk-lib/aws-bedrockagentcore instead.
Type:
Duration
(optional, default: The AgentCore evaluation service's default Lambda timeout is used)
The timeout for the Lambda function invocation during evaluation.
When not specified, the AgentCore evaluation service uses its default timeout for Lambda-based evaluators.
See also: https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/custom-evaluators.html

.NET
Go
Java
Python
TypeScript (