Agents Working Together

The Prompt Optimizer

Updated Jun 19, 2026 · 2 min read

The optimizer automatically improves an agent's instructions. Instead of you hand-tuning prompts by trial and error, it runs a small internal pipeline of three specialist helper agents — a Planner, a Worker trial stage, and a Closer — that propose a change, test it on a live copy of your agent, and deploy it only if it actually helps.

It's reached through the Agent Orchestration ability (the same one that enables hand-off), and is an advanced, optional feature — most users never need to touch it directly.

How a pass works

1. Planner — proposes a change. The Planner reviews the session (and any feedback you gave) and proposes one concrete change to a single piece of the agent's instructions — its identity, your profile, its skills, its task workflows, or misc context. It also designs the test: who the stand-in "sim user" is, what they will ask, and how to tell whether the agent did well. Nothing is changed yet — it shows you the before/after and waits for your go-ahead.

2. Worker — tests it with parallel trials. When you approve, the Worker stage spins up throwaway copies of your agent with the proposed change applied and runs simulated conversations against them: a stand-in test user chats back and forth with the modified agent for a few rounds, and the agent really uses its tools and gets real results. To stay fast and to smooth out randomness, several of these trials run at the same time rather than one after another. You get back the full transcript of every trial — what the test user asked, what the agent replied, which tools it called, and whether the test user came away satisfied.

3. Closer — judges and deploys. The Closer reads the trial transcripts against the Planner's pass/fail criteria and compares them to the original session, then makes a clear PASS or FAIL call with evidence. On a PASS — and only after you approve — it deploys the change into your real agent. On a FAIL it explains what went wrong and what to try instead, and nothing is deployed.

Every stage pauses for your approval, so the optimizer never changes your agent behind your back. The Planner and Closer are internal helper agents with their own private tools that ordinary agents never see.

Related: Building Your Own Agent, Prompts & Context, Delegation & Hand-off.

#optimizer#self-improvement#prompts