3.1.1

stanfordnlp/dspy3.1.1Jan 19, 2026by okhat

AI Summary

A feature-rich patch release with major improvements to RLMs, GEPA, and adapters. Includes new RLM module, tool optimization, and multiple bug fixes.

Key Highlights

  • New RLM Module with improved PythonInterpreter
  • GEPA tool description optimization for multi-agent systems
  • Upgraded json_repair to fix underscore-style float parsing
  • Fixed streaming to properly yield last chunk
  • Added security fix for LocalProvider subprocess argument injection

New Features

  • New RLM Module implementation
  • Tool description optimization for multi-agent systems
  • Generic type annotations support for StreamListener
  • BAMLAdapter using docstrings for BaseModels
  • Save/load methods for DSPy settings

Full Release Notes

## What's Changed

RLMs
* feat(rlm): Add RLM Module and improve PythonInterpreter by @isaacbmiller in https://github.com/stanfordnlp/dspy/pull/9193
* Use `language` in system instructions for `dspy.Code` fields by @mariusarvinte in https://github.com/stanfordnlp/dspy/pull/9106
* Update dspy.RLM to improve reliability and avoid pydantic warnings by @okhat in https://github.com/stanfordnlp/dspy/pull/9210
* fix(RLM): Change FinalAnswerResult to FinalOutput and remove RLM __call__ by @isaacbmiller in https://github.com/stanfordnlp/dspy/pull/9212


GEPA
* Fix GEPAFeedbackMetric Protocol missing 'self' parameter by @Copilot in https://github.com/stanfordnlp/dspy/pull/9111
* feat(gepa): add tool description optimization for multi-agent systems by @Ju-usc in https://github.com/stanfordnlp/dspy/pull/8928
* Update pyproject.toml to update gepa from 0.0.22 -> 0.0.24 by @LakshyAAAgrawal in https://github.com/stanfordnlp/dspy/pull/9161
* Patch `dspy.gepa` to handle `list[dict]` output from a `dspy.LM` by @mariusarvinte in https://github.com/stanfordnlp/dspy/pull/9169



Adapters
* Upgrade json_repair to fix parsing issue of underscore-style float number by @chenmoneygithub in https://github.com/stanfordnlp/dspy/pull/9088
* Properly yield the last chunk in streaming by @chenmoneygithub in https://github.com/stanfordnlp/dspy/pull/9089
* Avoid unwanted exception chaining when running async tool in sync context by @stevapple in https://github.com/stanfordnlp/dspy/pull/9092
* Enhance StreamListener to support generic type annotations for output by @TomeHirata in https://github.com/stanfordnlp/dspy/pull/9112
* FIX: streamify was appending StatusStreamingCallback directly to the shared settings.callbacks list by @glesperance in https://github.com/stanfordnlp/dspy/pull/9073
* fix(BAMLAdapter): Use docstrings to describe BaseModels by @BenMcH in https://github.com/stanfordnlp/dspy/pull/9125
* Fix Responses API structured outputs by @Olocool17 in https://github.com/stanfordnlp/dspy/pull/9130


Maintenance
* Fix UsageTracker AttributeError when using ParallelExecutor with dspy.context by @Copilot in https://github.com/stanfordnlp/dspy/pull/9095
* Update uv.lock dspy version to match the latest release by @chenmoneygithub in https://github.com/stanfordnlp/dspy/pull/9067
* [docs] Add Google-style docstrings for dspy/adapters/chat_adapter.py ChatAdapter class #9063 by @azai91 in https://github.com/stanfordnlp/dspy/pull/9072
* Fix ContextWindowExceededError after 3 retries in react loop by @Copilot in https://github.com/stanfordnlp/dspy/pull/9110
* fix: skip merging when both usage entry values are None by @chizukicn in https://github.com/stanfordnlp/dspy/pull/9121
* Fix: enforce positive `memory_max_entries` for in-memory cache by @mshr-h in https://github.com/stanfordnlp/dspy/pull/9128
* Add typing to `dspy.datasets.dataset` by @max-muoto in https://github.com/stanfordnlp/dspy/pull/9143
* Increase max_iters for dspy.ReAct by @chenmoneygithub in https://github.com/stanfordnlp/dspy/pull/9162
* fix(dspy): prevent argument injection in LocalProvider subprocess calls by @Copilot in https://github.com/stanfordnlp/dspy/pull/9160
* fix(dspy): populate InputField default values in Predict by @ritsuki1227 in https://github.com/stanfordnlp/dspy/pull/9167
* fix(PythonInterpreter): Remove overly permissive read permissions and add strict allow by @isaacbmiller in https://github.com/stanfordnlp/dspy/pull/9081
* Add save / load methods for DSpy settings by @WeichenXu123 in https://github.com/stanfordnlp/dspy/pull/9165


Docs
* [doc] Correct conversation history tutorial example by @zhiyanliu in https://github.com/stanfordnlp/dspy/pull/9071
* fix: Resolve broken hover-nlp/hover dataset by @vincentkoc in https://github.com/stanfordnlp/dspy/pull/9069
* Fix missing Real-World Examples and Experimental RL Optimization sections on tutorials page by @0xRaduan in https://github.com/stanfordnlp/dspy/pull/8982
* Refactor ReflectiveExample TypedDict documentation by @LakshyAAAgrawal in https://github.com/stanfordnlp/dspy/pull/9133
* [Automatic] Update api reference by @chenmoneygithub in https://github.com/stanfordnlp/dspy/pull/9135
* Replace ujson with orjson in docs by @togimoto in https://github.com/stanfordnlp/dspy/pull/9148



## New Contributors
* @zhiyanliu made their first contribution in https://github.com/stanfordnlp/dspy/pull/9071
* @azai91 made their first contribution in https://github.com/stanfordnlp/dspy/pull/9072
* @0xRaduan made their first contribution in https://github.com/stanfordnlp/dspy/pull/8982
* @Ju-usc made their first contribution in https://github.com/stanfordnlp/dspy/pull/8928
* @mariusarvinte made their first contribution in https://github.com/stanfordnlp/dspy/pull/9106
* @Olocool17 made their first contribution in https://github.com/stanfordnlp/dspy/pull/9130
* @chizukicn made their first contribution in https://github.com/stanfordnlp/dspy/pull/9121
* @mshr-h made their first contribution in https://github.com/stanfordnlp/dspy/pull/9128
* @max-muoto made their first contribution in https://github.com/stanfordnlp/dspy/pull/9143
* @togimoto made their first contribution in https://github.com/stanfordnlp/dspy/pull/9148
* @ritsuki1227 made their first contribution in https://github.com/stanfordnlp/dspy/pull/9167
* @WeichenXu123 made their first contribution in https://github.com/stanfordnlp/dspy/pull/9165

**Full Changelog**: https://github.com/stanfordnlp/dspy/compare/3.1.0...3.1.1