> **Experimental**
>
> `@aws-cdk/aws-bedrock-agentcore-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# CodeBasedOptions

Options for configuring a code-based custom evaluator using a Lambda function.

Uses a Lambda function to implement custom evaluation logic.

- Source: [`lib/evaluation/evaluator-config.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/aws-bedrock-agentcore-alpha/lib/evaluation/evaluator-config.ts#L87)

## 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) (required) — 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`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — 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.
