Optimizing agent system prompts with Amazon Bedrock AgentCore
In a previous launch post, we introduced AgentCore optimization, a capability of Amazon Bedrock AgentCore that can help you improve the quality of your agents. Improving a low-scoring agent has traditionally been a manual process. You review long traces to find where the agent goes wrong, tune individual components such as prompts, tool descriptions, and skills, and rerun evaluations to check for improvement.
With AgentCore optimization, you can use production traces to propose configuration changes, validate them through offline batch evaluation and online A/B testing on live traffic, and promote the winners. AgentCore Observability, a capability of Amazon Bedrock AgentCore, provides visibility into agent behavior, and evaluations provide signals about agent quality. Together, recommendations, configuration bundles, and validation through A/B testing provide a workflow for improving an agent.
The system prompt optimizer in AgentCore uses agent traces recorded in AgentCore Observability together with a reward signal to produce an improved system prompt. For the market trends agent, the recommendation compares an existing system prompt with a revised version and explains the trace patterns that motivated the changes.
Figure 1: A recommendation compares the existing system prompt with a revised prompt for the market trends agent
The recommendation interface also provides an explanation of the proposed changes, so you can review the reasoning before deciding whether to test the recommendation.
Figure 2: An explanation accompanies the recommended system prompt to support review and validation
This post is a technical companion to the launch post. We take a deeper look at the system prompt optimizer and explain how its recommendation engine works. We also share evaluation results for the Single Agent Reflector and the experimental, open source Sub-Agent Reflector on two publicly available benchmarks, alongside GEPA and MIPROv2.
The system prompt optimizer is executed by an agentic reflector, the reasoning component of the optimizer. It reviews evaluated agent behavior, identifies patterns that distinguish successful runs from failures, and proposes targeted changes to the agent configuration. In the system-prompt optimization workflow, its primary output is a revised system prompt accompanied by an explanation of why the proposed changes should improve agent quality.
Agent traces are often lengthy, and even a few dozen can quickly exceed a model’s context window. Passing every trace directly into the reflector prompt is therefore impractical. Instead of truncating or pre-summarizing traces to fit, the complete trace corpus is made available to the reflector through a filesystem.
The design uses a minimal workflow. An evaluator scores a collection of traces and writes them to a directory accessible to the reflector agent. The reflector is given a shell tool, directed to that directory, and instructed to propose updates to the agent configuration by examining patterns of success and failure across the traces.
The reflector can inspect the corpus as needed. It can list files, search with grep, read traces with cat, compare outputs with diff, and selectively examine successful and unsuccessful runs. We don’t impose a fixed signal-extraction or trace-summarization pipeline. Instead, the reflector determines which evidence matters, what comparisons to make, and how to translate those findings into configuration changes.
It then returns proposed edits to the agent configuration. Before any proposal can be applied, it must pass through platform-level guardrails.
Responsible AI considerations are part of this workflow. Recommendations should be reviewed and tested before use, and the guardrails described later in this post screen candidate updates before they can be promoted.
The Single Agent Reflector drives system prompt recommendations in AgentCore optimization today. One reflector agent works through the full trace set in a single pass. It surveys the score distribution, drills into the most informative segments of individual traces, contrasts successes with failures, and returns one coherent set of edits to the agent configuration. Each optimization epoch repeats this cycle: score the traces, reflect, and accept the edits that pass the guardrails. You can run additional epochs to trade optimization time for further quality gains.
Figure 3 shows this flow. Evaluated traces are written to a shared directory, where a single reflector inspects the evidence and produces recommended configuration edits. The guardrails screen those edits before they’re accepted.
Figure 3: The Single Agent Reflector analyzes evaluated traces and returns guarded configuration edits
The Sub-Agent Reflector extends the Single Agent Reflector. It trades some efficiency for a higher quality ceiling by using a swarm of agents to explore different parts of the trace set dynamically. A single reflector pass can focus on patterns in the first 5–10 traces it examines and miss failure modes that appear only in a smaller portion of the corpus.
Each sub-agent performs a three-level analysis on a single trace:
Each sub-agent returns a concise finding and a corrective rule. Because each sub-agent operates in its own context window, it can focus on one trace without being influenced by the others. The orchestrator aggregates the findings, generalizes recurring patterns, removes duplicates, and condenses the resulting insights into configuration changes.
Figure 4 shows the multi-agent flow. The orchestrator delegates individual trace analyses to sub-agents, collects their findings, and synthesizes the findings into a single set of guarded configuration edits.
Figure 4: The Sub-Agent Reflector uses independent trace analyses to inform guarded configuration edits
We have launched this experimental feature as a preliminary release in the Strands open-source GitHub repository.
Naive configuration optimization can drift in predictable ways: prompts can grow longer after optimization, prompts can quote terms from traces as examples, and safety constraints can be relaxed or softened in pursuit of an evaluator score. We apply rubric-based guardrails to every candidate update before it is accepted:
We evaluated the Single Agent Reflector and Sub-Agent Reflector alongside two established baselines, GEPA and MIPROv2, on two public benchmarks: AppWorld and WebShop. For each method, we swept the configuration space and reported the best result with its number of turns and wall-clock optimization time.
Single Agent Reflector offers the best quality-per-cost trade-off. On AppWorld, it reaches 81.55 percent in 6 minutes and 20 turns, an 18× speed-up over GEPA and a 36× speed-up over MIPROv2 for a comparable or better score. On WebShop, it reaches 78.31 percent with 5 turns and 1 minute of wall-clock time. This variant is well suited when you want fast iteration cycles.
Sub-Agent Reflector achieves the highest quality on both benchmarks. On AppWorld, it reaches 95.83 percent, a 23-point lift over the baseline and 16 points above the next-best method. On WebShop, it reaches 79.15 percent, a 4-point lift over the baseline. The per-trace sub-agent analysis has the greatest effect on AppWorld, where failure modes are diverse and a single reflector pass can miss minority patterns.
These results reflect the two designs described earlier. Whole-set reflection gives the Single Agent Reflector its efficiency: it requires far fewer turns and minutes than iterative methods to reach competitive scores. Sub-agent decomposition gives the Sub-Agent Reflector a higher quality ceiling by analyzing each trace independently before aggregating the findings. This approach helps it identify failure modes that a single pass over many traces can miss.
Figure 5 summarizes the AppWorld and WebShop comparison across the four methods. The Sub-Agent Reflector achieves the highest success rate, and, across both AppWorld and WebShop, the Single Agent Reflector and Sub-Agent Reflector outperform the GEPA and MIPROv2.
Figure 5: Performance comparison on AppWorld and WebShop across the four methods
Figure 6 compares the number of turns consumed and the wall-clock optimization time across the four methods. The Single Agent Reflector is the most efficient option, using the fewest turns and the least wall-clock time on both benchmarks. The Sub-Agent Reflector also maintains a competitive optimization cost. On AppWorld, it uses the same 100 turns as GEPA and MIPROv2 and completes faster than MIPROv2. On WebShop, its approximately 20-minute wall-clock time is less than half that of either baseline, despite its more extensive trace analysis.
Figure 6: Turns consumed and wall-clock optimization time on AppWorld and WebShop across the four methods
Table 1: Best result per method on each benchmark, with the configuration that produced it. Baseline scores are shown in parentheses, and bold indicates the highest score per benchmark. For each benchmark, we report the headline metric, the configuration, total turns, and wall-clock optimization time. Configurations are n_samples × epochs for the Single Agent Reflector and Sub-Agent Reflector and n_samples × iterations for GEPA and MIPROv2. We scanned n_samples from 5–50 and epochs or iterations from 1–10. The reflector model was Opus 4.6, and the task model was Sonnet 4.5.
Best practices and looking forward
AgentCore optimization connects trace-based evidence to recommended configuration updates and validation workflows. To get started, visit the Amazon Bedrock AgentCore detail page, read the optimization documentation, open the Amazon Bedrock AgentCore console, and explore the AgentCore samples repository.
Related Stories
Explainers
Photos show widespread damage at US sites from Iranian attacks
1 hour ago
Explainers
Trump administration has cut or frozen $177 billion in grants across every state, analysis shows
5 hours ago
Explainers
MLAs to debate bill aimed at banning conversation practices
1 day ago
Explainers
Analysis: How chronic absenteeism shifted in Canadian kindergarten after COVID
1 day ago
Explainers
St Kitts PM confirms he suffered a stroke, recovering well
1 day ago
Explainers
Researchers: Ryugu asteroid part of ancient celestial body
5 days ago
Explainers
Kiara Agnew’s convicted killer could be extradited to Mexico. Here’s how it works
6 days ago
Explainers
How David Is Making Protein Sexy
6 days ago