Help improve this page
To contribute to this user guide, choose the Edit this page on GitHub link that is located in the right pane of every page.
Evaluate agent output on Amazon EKS
Agent output isn’t deterministic. The same prompt can produce a different answer, a different tool call, or a different order of steps, and a model update, a prompt change, or a new tool can shift behavior without any code failing. A passing test run therefore doesn’t guarantee the next release behaves the same way. Evaluation measures behavior instead, by grading what agents actually did.
Most agent output has no single right answer to compare against, so grading usually uses a second model as the judge (LLM-as-judge). The judge reads a turn’s input, output, and trajectory, and scores it against a rubric such as helpfulness, faithfulness to retrieved content, or whether the agent chose the right tool. Evaluation grades the traces that observability already collects (Observe agent workloads on Amazon EKS), so it needs no separate instrumentation.
Adopt evaluation in stages:
-
Grade by hand while an internal agent has a small audience.
-
Add the release gate (Step 2: Gate a release on declared cases) when output reaches a wider audience or you need to block a release. It needs no live traffic and takes less work than online grading.
-
Add online grading when you need coverage of inputs you didn’t anticipate.
The following diagrams show each path.
Open source and AWS services paths
The following table compares how each path provides evaluation. Both paths grade with Strands Evals, an open source evaluation SDK.
| Aspect | Open source | AWS services |
|---|---|---|
|
Release gate |
Strands Evals runner in the cluster, as a suspended CronJob that you run on demand |
Strands Evals runner in the cluster, run on demand |
|
Online grading |
The same runner, as a CronJob that grades sessions after they end |
AgentCore Evaluations, a managed service that you turn on separately, created stopped |
|
Trace source |
Langfuse, which evaluation requires |
Agent spans in Amazon CloudWatch |
|
Where grades go |
Langfuse |
The AgentCore Evaluations result log group in Amazon CloudWatch |
|
Judge model access |
A |
AgentCore Gateway, with a Cedar permit for the judge, and an empty |
|
Sample rate |
|
|
What to evaluate
Evaluate the following, from least to most expensive:
-
Final answer. Whether it is correct, grounded in retrieved content, and within policy. Start here.
-
Trajectory. Whether the agent called the right tools, in a reasonable order, without looping. This requires spans. See Observe agent workloads on Amazon EKS.
-
Safety and policy. Refusals, leaked context, and resistance to prompt injection. Guardrails enforce at request time (Use Amazon Bedrock or self-hosted inference for agents on Amazon EKS). Evaluation measures whether they are configured correctly.
Release gates and online grading
Evaluation runs in two modes, and they answer different questions:
-
A release gate runs a fixed set of declared cases against the deployed agent before you promote a release, and fails the release when too few grades pass. It catches regressions on inputs you anticipated, needs no live traffic, and costs only the judge calls for the cases. See How the release gate works.
-
Online grading samples real sessions after they end and grades them. It covers inputs you didn’t anticipate and shows drift over time, but every sampled session costs judge calls on top of the agent’s own model spend, and grades arrive after the session, so it can’t block a release.
-
Open source path. A runner in the cluster does both, and grades go to Langfuse. To see them, open Langfuse as described in Step 4: View the dashboards.
-
AWS services path. The runner is the release gate, and AgentCore Evaluations, a capability of Amazon Bedrock AgentCore, grades live traffic as a managed service, with results in Amazon CloudWatch.
Don’t run online grading in both places, because each grade would be paid for twice.
What the runner grades
The runner grades at three levels, because a correct final answer can hide a wrong action:
-
Session:
GoalSuccessRate. -
Trace:
HelpfulnessandFaithfulness. -
Tool call:
ToolSelectionAccuracyandToolParameterAccuracy. For a turn with no tool calls, these return not applicable and the runner publishes no score.
None of these require an expected answer, so they also grade live traffic. The release gate also runs Correctness on cases that declare an expected output. To add your own dimensions, write rubrics that define each score, so runs are comparable and reviewers know what a score means.
The runner fetches a turn’s trajectory from the trace backend by session ID. The reference agent accepts session_id on its chat endpoint and sets session.id on its spans. Agents you build must do the same, or their turns cannot be graded.
On the AWS services path, AgentCore online evaluation selects sessions with a query over the span log. If the agent’s telemetry lacks any of the following, the configuration shows as active but grades nothing:
-
session.idon every span. -
The resource attribute
aws.service.type=gen_ai_agent. The AWS Distro for OpenTelemetry SDK sets it; the upstream OpenTelemetry SDK does not. TheAgentobject sets it inOTEL_RESOURCE_ATTRIBUTES. -
Prompts and responses on the spans. Strands Agents records them as span events.
Judge model access
The judge is a model caller, so give it the same controls as an agent. Many teams also give it a different model from the agent’s, so that a model doesn’t grade its own output. In the templates, the judge runs as the runner’s service account, agent-evals, and calls its model through the gateway with its projected service account token. It holds no model credential, and its spend is metered and audited at the gateway with the agents' calls.
A harness that authenticates with a static API key can’t present the short-lived token the gateway requires. Before you adopt a harness, confirm that its credential mechanism meets the gateway’s inbound authentication. Don’t relax the gateway’s authentication to fit a harness. The egress design depends on the gateway verifying every caller.
Plan for the following:
-
On the AWS services path,
enable_evaluationsrequires an emptyallowed_agent_subjects. AgentCore Gateway admits either exactly one subject or every subject its audience accepts. The judge is a second subject, so pinning one agent refuses every judge call. -
On the AWS services path, the judge has its own Cedar permit. The gateway’s policy engine denies by default, and the judge’s service account is a principal like any agent. Terraform generates the judge’s permit when
enable_evaluationsis on. Without a permit, every judge call returns403and nothing is graded. Step 1 shows the permit. -
The release gate calls each agent as a client. Each
Agentadmits the runner’s pods to the agent’s port, in both its network policy and its inbound caller check. The runner presents a token minted for that agent’s audience, and the agent rejects tokens minted for any other audience. Admitting the runner grants it no other authority. On the default runtime, recreate each agent’s pod after turning on evaluation. Otherwise the agent rejects the runner with401. See Step 1: Turn on evaluation.
Sampling and cost
On the open source path, online grading runs every 15 minutes over sessions that ended in the previous window. A session must be idle for 10 minutes before it is graded, so conversations in progress are not graded partway through.
-
Cost. Each graded session makes several judge calls, one per evaluator plus one per tool call for the tool-call evaluators, in addition to the agent’s own model spend. Both paths grade 10% of sessions by default. The sample rate is the main cost control, so raise it for a small project where 10% is too few sessions to show a trend, and lower it for high-volume agents. On the open source path, set
online.samplingPercentageinagent-evals-values.yaml, which changes without rebuilding the image. On the AWS services path, setevaluation_sampling_percentage, which becomes the sampling percentage of the AgentCore online evaluation configuration. -
Latency on the AWS services path. A grade arrives one session timeout after the conversation’s last turn, plus up to five minutes for the service’s next pass.
evaluation_session_timeout_minutessets the timeout, 30 by default. A lower value returns grades sooner, but set it above the longest pause users leave between turns, or one conversation is graded as several. -
Rollout. Run new evaluators in report-only mode first and review what they flag. Gating releases on an untested judge produces failures that teams dispute and stop trusting.
Evaluation in the reference sample
The base setup in the reference sample leaves evaluation off. enable_evaluations turns on the runner and the judge’s model access on both paths.
-
Open source path.
enable_evaluationsalso needsenable_langfuse, which adds Langfuse as the trace and score store, at the cost of a ClickHouse tier, a Keeper quorum, object storage, Postgres, and a cache, plus the ClickHouse operator and cert-manager, which issues the operator’s webhook certificates. -
AWS services path.
enable_online_evaluationturns on AgentCore online evaluation independently of the release gate. It’s created stopped by default so you can validate evaluators on a few sessions before every sampled session becomes a paid judge call.
Both modes grade the spans the collector records, so both require enable_observability. The release gate’s judge calls the gateway, so it also requires enable_gateway.
How the release gate works
The release gate runs a fixed set of inputs with known-good answers against the deployed agent. It catches regressions without live traffic, sampling, or a second bill. The cases live in agent-evals-values.yaml, so changes to them go through code review like any other release criteria. The file ships with no agents, so the gate runs nothing until you add one. The gate is a suspended CronJob, so it runs only when you create a job from it.
For each case, the job sends a turn to the agent, waits for the turn’s spans to reach the trace backend, and grades it. A case with expectedOutput is also graded for correctness. minPassRate is the share of grades that must pass, 0.8 by default. A pipeline can use the job’s exit code:
| Result | Meaning |
|---|---|
|
Exit |
The pass rate meets |
|
Exit |
The pass rate is below |
|
Exit |
Execution failure. A case couldn’t run or its trace never arrived, and it isn’t counted as a zero grade. |
|
Exit |
Configuration error. The runner couldn’t read its configuration or token, the backend isn’t |
|
|
The gateway refused the judge. Check the job’s log for |
Each case includes the turn, the wait for its spans, and one judge call per evaluator.
Prerequisites
-
A shell with
kubectlaccess to the cluster, on the bastion or your workstation. -
PAVED_PATHset toopen-sourceoraws-services, such as withexport PAVED_PATH=open-source. -
Observe agent workloads on Amazon EKS, turned on. Both paths grade the spans it collects.
-
Route agent egress through a gateway, turned on. The judge calls its model through the gateway. Online evaluation alone on the AWS services path doesn’t need it.
-
On the open source path,
platform-secrets. -
A clone of the reference sample on your workstation, to build and push the runner image. The build runs in the stack’s CodeBuild project and needs only the AWS CLI, or Docker or Finch with
enable_image_build = false. -
At least one agent with
expose: clusterorexpose: route, to run the release gate against.
Step 1: Turn on evaluation
This step creates the runner and the judge’s model access, then builds the runner image that Argo CD deploys.
To reproduce this outside the templates, you need a scheduled grader, a model route and identity for the judge, and read access to the trace store.
The apply creates the agents/evals Amazon ECR repository. Build the runner image from apps/evals in the reference sample and push it there before you sync. Tags are immutable, so each rebuild needs a new tag. Set it in agent-evals-values.yaml in the path’s gitops/platform directory before you sync.
The bootstrap script applies the rendered root Application, refreshes and syncs it, and waits for the Applications to converge. With --roll-agents, it then recreates each agent pod whose Sandbox changed, and prints a line for each agent, such as agents/research: recreating (env AGENT_ALLOWED_CALLER_NAMESPACES changed), or current for an agent that didn’t change.
The new Applications report Synced and Healthy. If one stays Progressing after its objects are ready, run the bootstrap script again, because Argo CD can keep the health it computed while they were starting. See Turn on a component later.
A Sandbox doesn’t replace its running pod when its spec changes, and an agent on the default runtime rejects the runner with 401 until its pod is recreated. The --roll-agents on the sync recreates it. If you synced without --roll-agents, run the sync again with it.
Step 2: Gate a release on declared cases
Add your cases to agent-evals-values.yaml in the path’s gitops/platform directory. Each listed agent needs expose: cluster or expose: route:
experiment: minPassRate: 0.8 agents: research: namespace: agents port: 8080 cases: - name: capital-france input: What is the capital of France? expectedOutput: Paris
Then sync. The bootstrap script passes the path’s values files, including agent-evals-values.yaml, to the cluster in the root Application, so the edit needs no commit:
./scripts/run-stack.sh --root terraform/$PAVED_PATH -- ./scripts/bootstrap-gitops.sh --path $PAVED_PATH --sync
Run the gate on demand, wait for the job to finish, and read its result:
JOB=gate-$(date +%s) kubectl -n agent-evals create job --from=cronjob/agent-evals-experiment $JOB kubectl -n agent-evals wait --for=condition=complete --timeout=600s job/$JOB kubectl -n agent-evals logs job/$JOB
You can also run the evals phase of the sample’s exercise script from the agents directory. The job exits with one of the codes in How the release gate works. A job that exits with a code other than 0 never reports complete, so the wait times out. Read its log the same way. A passing job exits 0 and its log reports each evaluator’s grade:
{ "mode": "experiment", "graded": 4, "passRate": 1.0, "byEvaluator": { "CorrectnessEvaluator": { "n": 1, "passRate": 1.0, "meanScore": 1.0 }, "FaithfulnessEvaluator": { "n": 1, "passRate": 1.0, "meanScore": 1.0 }, "GoalSuccessRateEvaluator": { "n": 1, "passRate": 1.0, "meanScore": 1.0 }, "HelpfulnessEvaluator": { "n": 1, "passRate": 1.0, "meanScore": 0.833 } }, "executionFailures": {} }
Clean up
To remove evaluation, turn it off as described in Turn on a component later. Set the variable to false, apply with scripts/apply.sh, and run the bootstrap script with --sync --prune. Set enable_evaluations to false, and on the AWS services path, enable_online_evaluation too.
-
Open source path. The prune removes the
agent-evalschart, its CronJobs, and the judge’s route on the gateway. Grades already written stay in Langfuse until you remove Langfuse. See Clean up. -
AWS services path. The apply deletes the runner’s role and Pod Identity association, the evaluator, and the online evaluation configuration. Results already written stay in their log group until you remove the telemetry layer. See Clean up.
The gateway and observability stay on, because other components use them. Turn them off on their own pages.
Next steps
-
Observe agent workloads on Amazon EKS for the traces evaluation reads.
-
Use Amazon Bedrock or self-hosted inference for agents on Amazon EKS for guardrails, which enforce at request time.