Class Evaluator
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.bedrockagentcore.EvaluatorBase
software.amazon.awscdk.services.bedrockagentcore.Evaluator
- All Implemented Interfaces:
IEvaluatorRef,IEnvironmentAware,IResource,IEvaluator,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.130.0 (build 048a5ee)",
date="2026-05-19T19:44:37.072Z")
@Stability(Stable)
public class Evaluator
extends EvaluatorBase
A custom evaluator for Amazon Bedrock AgentCore.
Custom evaluators enable you to define evaluation logic tailored to your specific use cases. Supports two evaluation 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.
Custom evaluators are used with OnlineEvaluationConfig via EvaluatorSelector.custom().
Example:
// Create a custom LLM-as-a-Judge evaluator
Evaluator evaluator = Evaluator.Builder.create(this, "MyEvaluator")
.evaluatorName("my_custom_evaluator")
.level(EvaluationLevel.SESSION)
.evaluatorConfig(EvaluatorConfig.llmAsAJudge(LlmAsAJudgeOptions.builder()
.instructions("Evaluate whether the agent response is helpful and accurate.")
.modelId("us.anthropic.claude-sonnet-4-6")
.ratingScale(EvaluatorRatingScale.categorical(List.of(CategoricalRatingOption.builder().label("Good").definition("The response is helpful and accurate.").build(), CategoricalRatingOption.builder().label("Bad").definition("The response is not helpful or contains errors.").build())))
.build()))
.build();
// Use the custom evaluator in an online evaluation configuration
// Use the custom evaluator in an online evaluation configuration
OnlineEvaluationConfig.Builder.create(this, "MyEvaluation")
.onlineEvaluationConfigName("my_evaluation")
.evaluators(List.of(EvaluatorSelector.builtin(BuiltinEvaluator.HELPFULNESS), EvaluatorSelector.custom(evaluator)))
.dataSource(DataSourceConfig.fromCloudWatchLogs(CloudWatchLogsDataSourceConfig.builder()
.logGroupNames(List.of("/aws/bedrock-agentcore/my-agent"))
.serviceNames(List.of("my-agent.default"))
.build()))
.build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.bedrockagentcore.IEvaluator
IEvaluator.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEvaluator(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedEvaluator(software.amazon.jsii.JsiiObjectRef objRef) Evaluator(software.constructs.Construct scope, String id, EvaluatorProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic IEvaluatorfromEvaluatorArn(software.constructs.Construct scope, String id, String evaluatorArn) Import an existing Evaluator by its ARN.static IEvaluatorfromEvaluatorAttributes(software.constructs.Construct scope, String id, EvaluatorAttributes attrs) Import an existing Evaluator from its attributes.static IEvaluatorfromEvaluatorId(software.constructs.Construct scope, String id, String evaluatorId) Import an existing Evaluator by its ID.The timestamp when the evaluator was created.The ARN of the evaluator.The unique identifier of the evaluator.The name of the evaluator.The lifecycle status of the evaluator.The timestamp when the evaluator was last updated.Methods inherited from class software.amazon.awscdk.services.bedrockagentcore.EvaluatorBase
getEvaluatorRef, grantMethods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResource, withMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNode, withMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
Evaluator
protected Evaluator(software.amazon.jsii.JsiiObjectRef objRef) -
Evaluator
protected Evaluator(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Evaluator
@Stability(Stable) public Evaluator(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull EvaluatorProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromEvaluatorArn
@Stability(Stable) @NotNull public static IEvaluator fromEvaluatorArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String evaluatorArn) Import an existing Evaluator by its ARN.- Parameters:
scope-- The construct scope.
id-- Construct identifier.
evaluatorArn-- The evaluator ARN to import.
- Returns:
- An IEvaluator reference
-
fromEvaluatorAttributes
@Stability(Stable) @NotNull public static IEvaluator fromEvaluatorAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull EvaluatorAttributes attrs) Import an existing Evaluator from its attributes.- Parameters:
scope-- The construct scope.
id-- Construct identifier.
attrs-- The evaluator attributes.
- Returns:
- An IEvaluator reference
-
fromEvaluatorId
@Stability(Stable) @NotNull public static IEvaluator fromEvaluatorId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String evaluatorId) Import an existing Evaluator by its ID.- Parameters:
scope-- The construct scope.
id-- Construct identifier.
evaluatorId-- The evaluator ID to import.
- Returns:
- An IEvaluator reference
-
getEvaluatorArn
The ARN of the evaluator.- Specified by:
getEvaluatorArnin interfaceIEvaluator- Specified by:
getEvaluatorArnin classEvaluatorBase
-
getEvaluatorId
The unique identifier of the evaluator.- Specified by:
getEvaluatorIdin interfaceIEvaluator- Specified by:
getEvaluatorIdin classEvaluatorBase
-
getEvaluatorName
The name of the evaluator.- Specified by:
getEvaluatorNamein interfaceIEvaluator- Specified by:
getEvaluatorNamein classEvaluatorBase
-
getCreatedAt
The timestamp when the evaluator was created.- Specified by:
getCreatedAtin interfaceIEvaluator- Specified by:
getCreatedAtin classEvaluatorBase
-
getStatus
The lifecycle status of the evaluator.- Specified by:
getStatusin interfaceIEvaluator- Specified by:
getStatusin classEvaluatorBase
-
getUpdatedAt
The timestamp when the evaluator was last updated.- Specified by:
getUpdatedAtin interfaceIEvaluator- Specified by:
getUpdatedAtin classEvaluatorBase
-