Adaptive Email Agents with DSPy: From Static Prompts to Smart Learning

About

Your email AI agent works perfectly in demos but fails in production. It confuses client contexts, suggests outdated meeting times, and drowns in month-old thread history. You manually fix prompts after each failure, but the problems keep evolving.
 
The real issue? Static context management can't handle email's dynamic complexity.
 
In this 50-minute hands-on session, we'll build an email agent that combines context engineering with DSPy's self-optimization. You'll implement the four-move context framework: Write, Select, Compress & Isolate, but supercharged with optimizers that learn from every correction you make.
 
Instead of hardcoding rules for "include last 5 emails" or "summarize threads over 1000 tokens," your agent will learn what context actually matters for YOUR email patterns. When you correct a response, DSPy optimizers automatically adjust how the agent selects, compresses, and isolates context: with minimal prompt engineering.
 
The Adaptive Context Pipeline We'll Build:
 
  • Write + Learn: Persistent memory that evolves—DSPy learns which client details, project states, and communication patterns to remember based on your feedback
  • Select + Optimize: Move beyond static relevance scoring; BootstrapFewShot learns from your "this context was helpful/harmful" ratings to improve email thread selection
  • Compress + Adapt: Smart summarization that improves—MIPRO optimizes compression strategies based on which summaries led to accurate responses
  • Isolate + Protect: Dynamic guardrails that learn which email patterns cause context poisoning and automatically filter them based on past failures

Key Takeaways:

  • Context Engineering Meets DSPy: Master the foundational Write-Select-Compress-Isolate framework while understanding how DSPy transforms each step from static rules to learning systems.
  • Practical Feedback Integration: Build real feedback loops-thumbs up/down on responses, context relevance ratings, and correction annotations that directly improve your agent's context decisions.
  • Email-Specific Implementation: Handle real email challenges with adaptive solutions
  • Measure what matters: Set up dashboards tracking context efficiency, cost optimization, and accuracy improvements with real metrics that guide decisions.

Speaker

Book Tickets
Download Brochure

Download agenda