By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
You tweak your agent's system prompt and it suddenly fails at shipping questions even though it got better at refunds. Without measurement, you're flying blind. Every change to prompts, tools, or policies has side effects you won't see until production breaks. You need a structured way to measure quality before and after changes, then validate improvements on real traffic.
Two services work together. Evaluations measures how well your agent performs across dimensions that matter to your business. Optimization takes those measurements and suggests concrete fixes, then runs A/B tests to validate them before full rollout.
Evaluations scores sessions, traces, and individual spans from agents built with Strands Agents or LangGraph and instrumented with OpenTelemetry or OpenInference. It uses an LLM-as-a-judge model that grades outputs against criteria you define. Built-in evaluators cover common qualities like hallucination detection and task completion. You can write custom evaluators for rules specific to your domain.
Run evaluations in three modes. On-demand for quick checks during development. Batch mode in CI before release to catch regressions. Online mode sampling live traffic to catch problems in production.
Scores show up in CloudWatch alongside your other observability data, so you can correlate evaluation results with traces and metrics.
Start with these questions. Did the agent pick the right tool with the right arguments. Is the answer faithful to retrieved data with no hallucination. Did the agent actually complete the goal. Is the response helpful, safe, and on-brand for your users.
Optimization reads your agent's traces and generates improvement recommendations. It might suggest a better system prompt, clearer tool descriptions, or adjusted policies. Each recommendation becomes a versioned configuration bundle you can compare, test, and roll back.
The service runs A/B tests by splitting traffic through the Gateway. A change is validated on real users before you promote it to everyone. If scores drop, you roll back the version in seconds.
Step 1: Collect 30-50 realistic test conversations. Include edge cases and things that should break. Step 2: Run evaluations in CI on every prompt, tool, or policy change so regressions fail the build. Step 3: Ship to a small traffic slice and watch online evaluations. Step 4: Promote if scores hold. Roll back the version if they drop.
LLM judges are useful but imperfect. Spot-check their scores against human review, especially for high-stakes agents. Evaluations and Optimization are newer services: re-read the docs for current limits and supported frameworks.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.