Blog

Runtime Learning for Agents

Sonam Pankaj4 min read

  • Pulsar update
[All Pulsar updates]

Introduction

There's a frustrating pattern that every AI engineering team eventually hits: you spend weeks optimizing your agent's prompts, tune them on curated training examples, deploy to production—and then watch the exact same failures happen again and again.

The problem isn't that your agent is poorly designed. It's that the moment it goes to production, it freezes. All that optimization was done before deployment. Once live, the agent encounters real users, unexpected edge cases, and failures it never saw in training—and it has no mechanism to learn from any of it.

We built Reflect to solve this. It's a runtime learning layer that lets production agents improve from experience without retraining, fine-tuning, or manual prompt engineering.


The Compile-Time vs. Runtime Divide

Most agent optimization today follows a familiar pattern: collect training examples, run an optimizer like MIPROv2 or GEPA, generate improved prompts, and deploy. This works—for day one. But production environments diverge from training data. Users ask unexpected questions. Edge cases emerge. The optimized prompts, frozen at deployment, cannot adapt.

Compile-time optimization treats deployment as the finish line. You bake in assumptions about what users will ask and how tasks will flow. Runtime learning treats deployment as the starting line. The agent encounters real users, real edge cases, real failures—and actually gets smarter from them.

Here's how the two approaches stack up:

Compile-Time Optimization Runtime Learning
Optimization happens before deployment Improvement happens during operation
Requires curated training datasets Learns from live success/failure outcomes
Prompts frozen until recompilation Behavior evolves automatically
Same behavior on day 1 and day 100 Behavior improves continuously
Engineering intervention required to improve Self-improving without manual updates

Why Compile-Time Optimization Falls Short

The limitations of compile-time optimization aren't theoretical—they're documented in the open. Since January 2026, the DSPy community has been requesting multi-turn trajectory-aware agents in GitHub issue #9243, which remains unresolved.

The request captures the fundamental mismatch: "many of the agents I create need to be multi-stage, need to be aware of past turn trajectories." This isn't a feature request for prompt optimization. It's an admission that agents require memory of execution history to learn from it—something no amount of pre-deployment prompt compilation can provide.

When a refund request fails because the agent forgot to check settlement status, compile-time optimization offers no mechanism to remember that lesson for the next similar request. The agent will make the same mistake tomorrow, next week, and next month.

The Complete Stack: DSPy and Reflect

Here's the thing: this isn't an either/or choice. The most effective agent architectures use both.

DSPy ensures your agent starts from the best possible prompt. Reflect ensures every attempt after the first gets better. One optimizes before shipping. One improves after shipping.

DSPy optimizes prompts for the first attempt. But agents need to learn from the second, third, and fourth attempts. Together, they deliver agents that are both optimal on day one and continuously improving on day one hundred.

The gap between optimized first attempts and learning from subsequent attempts is precisely what makes runtime learning essential—even after the best compile-time optimization has been applied.

From Benchmark Failures to ROI: The Economic Case

TAU-Bench has emerged as the industry-standard measure of agent reliability—multi-turn customer service tasks where agents must use tools, follow policies, and interact with simulated users. The benchmark reveals a hard ceiling on static agent performance: even frontier models cap out at 56% success on first attempt.

That 56% success ceiling means 44% of tasks require human escalation—consuming API tokens, support agent time, and customer satisfaction. The static agent ceiling is unbreakable with compile-time optimization alone.

Reflect enables agents to learn from failure. Where static agents remain stuck at 56% month after month, Reflect-enabled agents improve to 77% success by month six—a 21 percentage point gain that cuts the failure rate nearly in half, from 44% to 23%.

The hidden cost of repeated failures is even more striking. Static agents suffer a 38% repeated failure rate that never improves. With Reflect, that drops to just 12% within six months. The agent stops making the same mistake on similar tasks because it remembers what worked and what didn't.

How It Works in Practice

Reflect integrates with your existing agent infrastructure without requiring platform migration:

  • Observability — Captures traces from tools you already use (LangSmith, Langfuse, OpenTelemetry)
  • Evaluation — Grades outcomes through human review, LLM-as-judge, or automatic signals
  • Retrieval — Surfaces relevant, utility-weighted lessons before agent execution

The SDK provides a simple context manager: retrieve memories at task start, submit trace with review at task end. Three lines of code.

Getting Started

Reflect is available today via Python SDK and REST API. Hosted cloud infrastructure includes project isolation, API key management, and audit logging. Self-hosted deployments are available for compliance requirements.

If your agent is frozen in production—seeing failures repeat while your observability and evaluation systems stay disconnected—Reflect closes that loop automatically.

Put Pulsar to work.

Start free on Pulsar Cloud, or book 30 minutes with us to see how it would run in your own environment.