AgentGrad

Stop tuning your agent one failure, one prompt edit at a time.

Train the harness, not the model.

AgentGrad turns production failures into gradients across your prompts, tool definitions, few-shot examples, and sampling parameters, so the entire agent harness improves against the metric that matters, with guardrails that keep your production schemas intact.

01 / The problem

Your model is fine. Your harness is what's failing.

Wiring an agent is easy now. Getting it reliably past demo quality is not. In production, every additional tool, step, and decision creates another way for a long-running task to fail. The model may be capable; the harness around it still falls below the accuracy the product needs.

Most teams respond one failure at a time: append another instruction, rewrite a tool definition, swap a few-shot example, try again. The system prompt becomes a patch log. Tool calls fail on plausible-looking arguments. A fix for today’s edge case quietly breaks behavior that worked yesterday. When the underlying model changes, the cycle starts again.

That is manual gradient descent without batching, attribution, or a reliable way to know whether the system is improving. AgentGrad replaces the patching ritual with a measured optimization loop across the entire harness, so failures improve the prompts, tools, examples, and parameters actually responsible.

02 / How it works

The loop: your failures in, a better pipeline out.

forward · the pipeline runs

03 / What that gets you

Improvements you can measure, ship, and keep.

Optimize the harness, not one prompt.

AgentGrad treats the whole agent runtime as one computation graph. Prompts, tool definitions, few-shot examples, and sampling parameters all become learnable, and feedback reaches the component actually responsible, instead of appending line 1,001 to the system prompt.

Train on simulations, not production bleeding.

Waiting for production failures is the expensive way to find edge cases. AgentGrad generates simulated traffic that explores the branching space your demo never covered, and trains the harness against it before customers see the gap. The legal result below was reached this way: simulated calls across every tool, not just replayed logs.

Learn from patterns, not individual mistakes.

The optimizer accumulates evidence across many failures before touching a parameter, extracts the common failure mode, and discards one-off noise, the same reason large-batch SGD beats noisy updates. No more appending another brittle exception to the prompt.

Decoupled tool calling, discovered by optimization.

Our own harness element for tool-heavy agents: per-tool argument builders the optimizer can train independently. Vendor-neutral by design, no proprietary tool-search API, and it took one legal client’s argument accuracy from 62% to 91%.

Catch regressions before your customers do.

Providers update models silently. AgentGrad tracks harness health on simulated data, catches the drop before production traffic hits it, and re-optimizes to bridge the gap, usually within a day.

Swap models without starting over.

Every vendor now ships its own prompting style guide, which is the real reason teams stay put. Projected gradient descent re-shapes your learned prompts onto the target family’s guidelines, XML for one, markdown for another, so a provider swap is a re-projection, not a rewrite.

04 / Under the hoodPyTorch for agentic pipelines

Your agent is a program. Train it like one.

AgentGrad treats the entire agent harness as an implicit computation graph. Prompts, tool definitions, few-shot examples, and sampling settings become learnable parameters, and your end-to-end KPI becomes the loss. When a run fails, backward() traces the failure through the harness and sends targeted feedback to the components responsible. The optimizer learns from patterns across failures, proposes updates, and keeps them only when held-out and regression performance improves.

The API deliberately mirrors PyTorch: Module, Parameter, backward(), and optimizer.step(). ML engineers get a familiar training loop without having to rewrite their agent around a new framework. Branching pipelines, tool loops, and multi-step workflows remain ordinary application code. To learn more about why we built AgentGrad and how its training model works, read the technical overview.

05 / Results

Proven in real optimization work.

AgentGrad is not a research prototype. It is the optimization engine behind our client engagements and our competition and benchmark work: every result shown against the baseline it had to beat.

Benchmark head-to-head · AIME 2025
Baseline prompt
GEPA-optimized
AgentGrad, prompt only
AgentGrad + skill files

Same task, same student model, two optimizers. From a 48% baseline on AIME 2025, DSPy’s GEPA, the reference point for prompt optimization, took GPT-4.1 mini to 57%. Optimizing the same single system prompt, AgentGrad edged past it at 59%.

Then the lever GEPA does not have: skill-file discovery. GPT-5, as the teacher, diagnosed the reasoning gaps the student kept hitting, and the optimizer wrote a specialized skill file for each mode one prompt could not cover: 64%. The student assembled its own skill library. Full methodology writeup on the way.

Distillation · AIME 2026 · DiffusionGemma 26B
Diffusion baseline
Autoregressive twin
AgentGrad-optimized

Diffusion speed, autoregressive accuracy. DiffusionGemma 26B decodes about 3× faster than its autoregressive twin, and paid for it in accuracy: 70.8% vs 75.0% avg@4 on AIME 2026.

AgentGrad optimized the diffusion model’s system prompt against the AR twin’s reasoning traces, 20 training samples, no weight updates: 75.2%. The gap closed; the speed advantage stayed.

06 / What you can do with it

If it's a parameter, it's trainable.

These are the jobs teams bring us first, all of them shipped and in use.

Tool-call accuracy. Learn tool descriptions and selection prompts against your real traffic until the agent calls the right tool with the right arguments. This took the legal engagement above from 62% to 91%.
Distill capabilities, not just outputs. A teacher model diagnoses what a student model is missing; the student learns reusable reasoning rules and updates its own prompts. Teacher-level quality from the model you actually want to run: no training infra, no weight access needed. This is how DiffusionGemma reached parity with its autoregressive twin.
Skill discovery. AgentGrad discovers the failure modes in your harness, then writes a specialized skill file for each one: the skill library your agent needs, grown from its own failures. This is how the AIME 2025 result was achieved.
Migration and drift. A better model ships every few months, and providers quietly change the one you already run. AgentGrad watches end-to-end accuracy, catches the drop, and patches the prompts and tool definitions to close it; move families outright and it re-projects your harness onto the new guide in hours, not weeks. Chase releases, survive silent updates, keep leverage.
07 / Who it's for

Built for teams shipping agents to production.

Verticals

  • Teams shipping agents where accuracy is a customer-facing KPI
  • Tool-heavy agent products: support, ops, coding, data agents
  • Cost-sensitive deployments that need small models at frontier quality
  • Domains with hard output contracts: legal, finance, healthcare

Roles

  • CTOs and technical founders whose agent quality is the product
  • Heads of AI accountable for an agent accuracy metric
  • ML/agents engineers tired of hand-tuning prompts without measurement

Available to enterprise customers.

AgentGrad powers our optimization engagements today. Bring us one failing agent metric; we'll spend a 30-minute call scoping whether it's a one-week optimization or something deeper, and leave you with a concrete next step either way. Want the library itself? Ask about early access.

The deep dives behind AgentGrad.

From the Optimizing Agents series and the field.