Skip to content
v2.274.0

EvaluatorConfig Class ​

Configuration for a custom evaluator.

Defines how an evaluator assesses agent performance. Supports two strategies:

  • LLM-as-a-Judge: Uses a foundation model with custom instructions and a rating scale.
  • Code-based: Uses a Lambda function for custom evaluation logic.

Example ​

ts
// 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 ​

lambdaFunctionmay be undefinedIFunctionlambda_functionmay be undefinedIFunctionlambdaFunctionmay be undefinedIFunctionLambdaFunctionmay be undefinedIFunctionLambdaFunctionmay be undefinedIFunction#
The Lambda function used for code-based evaluation, if applicable.

Methods ​

codeBased(options: CodeBasedOptions): EvaluatorConfig // chainable@staticmethod def code_based(options: CodeBasedOptions) -> EvaluatorConfigpublic static EvaluatorConfig codeBased(CodeBasedOptions options)public static EvaluatorConfig CodeBased(CodeBasedOptions options)func CodeBased(Options CodeBasedOptions) EvaluatorConfigstatic#
Creates a code-based evaluator configuration using a Lambda function.

The Lambda function implements custom evaluation logic. The function will automatically be granted invoke permissions for the bedrock-agentcore service.

1 parameter

Parameters

  • optionsoptionsoptionsoptionsOptions — - The code-based configuration options.
llmAsAJudge(options: LlmAsAJudgeOptions): EvaluatorConfig // chainable@staticmethod def llm_as_a_judge(options: LlmAsAJudgeOptions) -> EvaluatorConfigpublic static EvaluatorConfig llmAsAJudge(LlmAsAJudgeOptions options)public static EvaluatorConfig LlmAsAJudge(LlmAsAJudgeOptions options)func LlmAsAJudge(Options LlmAsAJudgeOptions) EvaluatorConfigstatic#
Creates an LLM-as-a-Judge evaluator configuration.

Uses a foundation model to assess agent performance based on custom instructions and a rating scale.

1 parameter

Parameters

  • optionsoptionsoptionsoptionsOptions — - The LLM-as-a-Judge configuration options.