Skip to main content
skill CX Codex

agents-optimize — Claude Code skill: what it does, install

Measure and improve AgentCore agent quality with evaluators, monitoring, observability, CI/CD gates, and cost checks.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add aws/agent-toolkit-for-aws --skill agents-optimize -a claude-code
Open on GitHub

What agents-optimize does

agents-optimize helps assess an AgentCore agent and investigate slow performance. It sets up evaluators, online monitoring, CI/CD quality gates, logs, metrics, traces, CloudWatch dashboards, and X-Ray tracing. A separate workflow covers AgentCore costs.

The skill first runs agentcore --version, then reads agentcore/agentcore.json to choose an evaluation, observability, or cost workflow. Detailed procedures come from references/evals.md, references/observability.md, and references/cost.md. Its allowed tools are Read, Grep, Glob, and Bash.

The agentcore version requirement of 0.9.0 or later and the agentcore/agentcore.json file are worth checking before you start. This skill is for measuring and improving a working agent, not for fixing crashes or broken answers; use agents-debug for those cases. Evaluation data can take about 10 seconds to become readable after ingestion.

What it helps with

  • measure an agent’s answer quality
  • add an evaluator to a project
  • create a CI/CD quality gate
  • set up logs, metrics, and traces
  • track AgentCore costs

Example prompts for the agent

  • Evaluate my AgentCore agent and add an evaluator.
  • Set up observability with logs, traces, and a CloudWatch dashboard.
  • Review the agent’s cost workflow and add cost monitoring.

How to install agents-optimize

1Skills CLI (Vercel)

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

2Manually: put the files in place

~/.claude/skills/agents-optimize/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/agents-optimize/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about agents-optimize

How do I install agents-optimize in Claude Code?

Run npx skills add aws/agent-toolkit-for-aws --skill agents-optimize -a claude-code, then run npx skills add aws/agent-toolkit-for-aws --skill agents-optimize -a claude-code again. The skill file is at ~/.claude/skills/agents-optimize/SKILL.md.

What does agents-optimize do?

It configures quality evaluation, online monitoring, CI/CD checks, observability, and AgentCore cost workflows. It also covers logs, metrics, traces, CloudWatch, and X-Ray.

What does agents-optimize require?

The project needs agentcore/agentcore.json, and the agentcore CLI must be version 0.9.0 or later. Use agents-debug for broken agents, crashes, or specific errors.

Source text

SKILL.md · Apache-2.0
---
name: agents-optimize
description: >
  Use when measuring or improving agent quality and performance — set up
  evaluators, online monitoring, CI/CD quality gates, observability, or
  cost optimization. Triggers on: "evaluate my agent", "add evaluator",
  "measure quality", "quality gate", "run evals", "agent too slow",
  "why is it slow", "reduce latency", "set up observability", "CloudWatch
  dashboard", "how much does my agent cost", "cost optimization", "logs
  not showing up", "logs missing", "spans not found", "eval failing",
  "eval error", "dev traces", "local traces", "agentcore dev traces",
  "traces to CloudWatch".
  Not for debugging errors or crashes — use agents-debug. Slow but
  correct routes here; broken routes to debug.
allowed-tools: Read Grep Glob Bash
metadata:
  type: skill
  version: "1.0.0"
  author: aws-agentcore
  requires-cli: ">=0.9.0"
---

# 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 intent | Action |
|---|---|
| Measure quality, add evaluator, run eval, CI/CD gate, online monitoring | Load [`references/evals.md`](references/evals.md) and follow its workflow |
| Set up observability, CloudWatch, X-Ray, logs, metrics, dashboards | Load [`references/observability.md`](references/observability.md) and follow its workflow |
| Understand or reduce AgentCore costs | Load [`references/cost.md`](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

© aws-agentcore · Apache-2.0 · aws/agent-toolkit-for-aws

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set137

agents-deploy Validates configuration, deploys AgentCore agents to AWS, and diagnoses CDK, IAM, or quota errors. Useful for releases, canary setups, and rollbacks. CX Codex +1 2,000installs agents-build Adds memory, VPC, multi-agent routing, Browser, Code Interpreter and payments to an agent project that already runs. Built for extending, not scaffolding. CX Codex +1 2,000installs aws-secrets-manager Teaches the agent to avoid plaintext secrets in its context window. Dynamic references resolved by asm-exec replace direct get-secret-value calls. CX Codex +1 1,900installs agents-harden Prepares Bedrock AgentCore agents for production. It audits IAM permissions, configures inbound authentication, and hardens runtime endpoints. CX Codex +1 2,000installs amazon-workspaces-agent-access Guides AI agents in controlling remote Windows apps on Amazon WorkSpaces Applications via MCP. It helps configure streaming sessions and automate GUI actions. CX Codex +1 1,800installs managing-amazon-kinesis-data-streams A skill for Amazon Kinesis Data Streams that sets up delivery from a stream into Iceberg tables on S3 Tables or plain S3 buckets. CX Codex +1 1,800installs aws-sms-voice Walks a coding agent through AWS End User Messaging: a branded RCS test agent or an OTP text via Notify, then carrier registration. CX Codex +1 1,600installs coordinating-multi-space-devops-agent Routes questions to the right AWS DevOps Agent space — prod, staging or knowledge — and compares findings across accounts. CX Codex +1 1,500installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor