New to Claude Skills? Learn how to install them →

aws on GitHub

Agent Optimization

OfficialFree

Enhance your agent's performance and quality metrics.

Get this skill

Free · Opens the source repo

What Agent Optimization does

The Agent Optimization skill is designed to help developers and designers measure and improve the quality and performance of their AgentCore agents. This skill facilitates the setup of evaluators, continuous monitoring, and observability features that are essential for maintaining high-quality responses from AI agents. By utilizing this skill, users can ensure their agents are performing optimally and providing accurate answers, which is crucial for any production environment.

When you invoke this skill, it guides you through a series of steps to assess your agent's performance. It begins by verifying the CLI version and reading the project context to understand the existing configurations. Depending on your goals—whether it's measuring quality, adding evaluators, or setting up observability—you will follow specific workflows outlined in the provided reference files. This structured approach allows for systematic improvements and ensures that all aspects of agent performance are considered.

The skill is particularly beneficial for teams looking to integrate quality gates into their CI/CD pipelines, set up CloudWatch dashboards for monitoring, or analyze cost metrics associated with their agents. It provides a comprehensive view of agent behavior through logs, metrics, and traces, enabling users to make informed decisions about their agent's performance. However, it is important to note that this skill is not intended for debugging specific errors or security hardening, which should be handled by other dedicated skills.

In summary, Agent Optimization is a vital tool for anyone involved in the development and maintenance of AI agents, ensuring that they not only function correctly but also deliver high-quality outputs consistently.

When to use it

Use this skill when you need to measure the quality of your agent, set up continuous monitoring, or add quality gates to your CI/CD pipeline.

When not to use it

Avoid this skill for debugging specific agent errors or for production security hardening, as those tasks require different tools.

What you can build with it

Setting Up Continuous Monitoring

You want to ensure your agent consistently delivers quality responses, so you set up continuous monitoring using CloudWatch.

Adding Quality Gates to CI/CD

Incorporating quality gates into your CI/CD pipeline helps maintain high standards for agent performance before deployment.

Analyzing Agent Costs

Understanding the costs associated with your agent helps in optimizing resource usage and budget management.

How to install Agent Optimization

View source

1. Install with the skills CLI

npx skills add aws/agent-toolkit-for-aws/agents-optimize --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by aws

optimize

Measure and improve your AgentCore agent's quality through evaluation, monitoring, and observability.

When to use

  • You want to know if your agent is giving good answers
  • You want to set up continuous quality monitoring in production
  • You want to add a quality gate to your CI/CD pipeline
  • You want to understand agent behavior through logs, metrics, and traces
  • You want to set up CloudWatch dashboards or X-Ray tracing

Do NOT use for:

  • Debugging a specific broken agent (wrong answers, errors) → use agents-debug
  • Production security hardening (IAM, auth) → use agents-harden

Input

$ARGUMENTS can be:

  • An eval goal: "add a quality gate", "set up monitoring"
  • An observability goal: "set up CloudWatch dashboard", "understand my traces"
  • A specific evaluator: "llm-as-a-judge", "code-based"
  • Empty — the skill will guide based on project context

Process

Step 0: Verify CLI version

Run agentcore --version. This skill requires v0.9.0 or later.

Step 1: Read project context

Read agentcore/agentcore.json to understand existing evaluators, online eval configs, and agent setup.

If agentcore/agentcore.json is not found:

"This skill requires an AgentCore project. Use agents-get-started to create one."

Step 2: Determine the workflow

Developer intentAction
Measure quality, add evaluator, run eval, CI/CD gate, online monitoringLoad references/evals.md and follow its workflow
Set up observability, CloudWatch, X-Ray, logs, metrics, dashboardsLoad references/observability.md and follow its workflow
Understand or reduce AgentCore costsLoad references/cost.md
Both — "I want to understand and improve my agent"Start with observability setup, then add evals

Step 3: Follow the loaded reference

The reference file contains the full procedure. Follow it step by step.

Cross-references

  • After setting up evals, suggest agents-harden for production readiness
  • If eval results reveal agent issues, suggest agents-debug for root cause analysis
  • If the developer needs to add capabilities first, suggest agents-build

Output

Depends on the workflow — see the loaded reference for specific outputs.

Quality criteria

  • Evaluator configuration uses only valid CLI flags
  • Online eval sampling rate is appropriate (not 100% in production without discussion)
  • CI/CD quality gate has a clear pass/fail threshold
  • Observability setup includes both tracing and logging
  • The developer understands the eval data delay: ~10 seconds put-to-get, end-to-end — one ingestion step covers both trace reads and eval queries; there is no separate indexing wait

Frequently asked questions about Agent Optimization

Similar skills