evaluate¶
Operation¶
evaluate
async
¶
evaluate(input: EvaluateInput, plugins: list[Plugin] | None = None) -> EvaluateOutput
Performs on-demand evaluation of agent traces using a specified evaluator. This synchronous API accepts traces in OpenTelemetry format and returns immediate scoring results with detailed explanations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
EvaluateInput
|
An instance of |
required |
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
EvaluateOutput
|
An instance of |
Input¶
EvaluateInput
dataclass
¶
Dataclass for EvaluateInput structure.
Attributes¶
evaluation_input
class-attribute
instance-attribute
¶
evaluation_input: EvaluationInput | None = None
The input data containing agent session spans to be evaluated. Includes a list of spans in OpenTelemetry format from supported frameworks like Strands (AgentCore Runtime) or LangGraph with OpenInference instrumentation.
evaluation_reference_inputs
class-attribute
instance-attribute
¶
evaluation_reference_inputs: list[EvaluationReferenceInput] | None = field(repr=False, default=None)
Ground truth data to compare against agent responses during evaluation. Allows to provide expected responses, assertions, and expected tool trajectories at different evaluation levels. Session-level reference inputs apply to the entire conversation, while trace-level reference inputs target specific request-response interactions identified by trace ID.
evaluation_target
class-attribute
instance-attribute
¶
evaluation_target: EvaluationTarget | None = None
The specific trace or span IDs to evaluate within the provided input. Allows targeting evaluation at different levels: individual tool calls, single request-response interactions (traces), or entire conversation sessions.
evaluator_id
class-attribute
instance-attribute
¶
evaluator_id: str | None = None
The unique identifier of the evaluator to use for scoring. Can be a
built-in evaluator (e.g., Builtin.Helpfulness, Builtin.Correctness)
or a custom evaluator Id created through the control plane API.
Output¶
EvaluateOutput
dataclass
¶
Dataclass for EvaluateOutput structure.
Attributes¶
evaluation_results
instance-attribute
¶
evaluation_results: list[EvaluationResultContent]
The detailed evaluation results containing scores, explanations, and metadata. Includes the evaluator information, numerical or categorical ratings based on the evaluator's rating scale, and token usage statistics for the evaluation process.