/AI1d ago

DSPy Optimizes AI Agents With Tests And Metrics Instead Of Manual Prompts

111911612218.4K
Original postOmar Khattab#158
Drew Breunig@dbreunig

This is the DSPy way.

Prompts are imperfect instructions, always.

Write them yourself as little as possible, but hold them accountable with typing, tests, metrics, and optimizers.

Ryan Lopopolo@_lopopolo

Using agents effectively requires embracing their stochastic nature and setting up a framework for them to reason rather than giving them a pile of rules.

Harness engineering and knowledge base curation does not (and cannot!) rely on all information being pulled into context—and given things like autocompaction over long horizon work, context is constantly getting blitted so you can't really rely on things being in context either.

In general you want to tell agents your expectations on how/when/what type of context they should seek and how the tools in their environment can help them complete their work.

You need to tell the agents what they are working on, what parts of it matter, and how they should approach tasks. Tell them about common tasks for the things you’re working on and where they can learn more about them. Make your agents collapse a prompt they are given into a paved workflow.

4:56 PM · Jun 5, 2026 · 18.4K Views
Sentiment

Users appreciate DSPy for optimizing AI agents with tests and metrics instead of manual prompts because it feels liberating to trust the optimizers over their own instincts.

Pos
100.0%
Neg
0.0%
2 comments with sentiment.
Cluster Engagement
Posts from X
Most Activity
Most Activity
VIEWS450LIKES6
Drew Breunig@dbreunig

Among AI enthusiasts, no one argues about the primacy of specs and tests when using agents to write code.

But when you suggest they apply the same pattern to AI engineering and prompts, people push back. 🤔

1dViews 450Likes 6
REPLIES1
A lazy crab@blue_crab5519

@dbreunig Thanks! Will go through it and report back.

1dViews 30Likes 1
Drew Breunig@dbreunig

@blue_crab5519 Read the brand new “getting started” tutorial. It is designed just for your audience.

If something isn’t clear, ping me directly, please. I want to understand where we could do better.

1dViews 66Likes 2
A lazy crab@blue_crab5519

@dbreunig What's your recommended learning path for DSPy in agentic engineering — coming from an experienced dev background?

1dViews 70
Rugbist@rugbist_

@dbreunig trusting the optimizers more than ur own prompt instincts is honestly liberating

takes a minute to let go tho

1dViews 73Likes 1
Drew Breunig@dbreunig

@blue_crab5519 Forgot the link: https://dspy.ai/getting-started/program-dont-prompt/

1dViews 9Likes 1
Strata@ChainZenit

@dbreunig Optimizing prompts feels like just another form of yield farming at this point.

1dViews 5