# EvaluatorConfig

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.

- Source: [`aws-bedrockagentcore/lib/evaluation/evaluator-config.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-bedrockagentcore/lib/evaluation/evaluator-config.ts#L193)
- Type last changed: v2.255.0 · 19 May 2026

## 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

- `lambdaFunction`: [IFunction](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IFunction.html) — The Lambda function used for code-based evaluation, if applicable.

## Methods

- `codeBased(options: CodeBasedOptions): EvaluatorConfig // chainable` (static) — 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.

  **Parameters**

  - `options` — - The code-based configuration options.

- `llmAsAJudge(options: LlmAsAJudgeOptions): EvaluatorConfig // chainable` (static) — Creates an LLM-as-a-Judge evaluator configuration.

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

  **Parameters**

  - `options` — - The LLM-as-a-Judge configuration options.
