Skip to main content
DSPy builds the prompt in its adapter, and niadra_adapter(conversation) is the adapter you use (ChatAdapter by default, or base=dspy.JSONAdapter) with one change, in format(). NiadraModule runs your program with that adapter and records the turn; history_tools() gives the kit as dspy.Tools. Python only.

Install

The five primitives

Minimal example

The same code is in examples/dspy_program.py.

Agent memory

niadra_adapter(conversation, agent_memory=True), NiadraModule(..., agent_memory=True) and history_tools(conversation, agent_memory=True) put the agent’s own notes before the customer’s context and add the two tools. See Agent memory.

Limits

  • Works with Niadra and AsyncNiadra conversations; with AsyncNiadra, call the program with acall.
  • Nothing here stops the program: with Niadra slow or down, it runs without the pack and a tool answers that the history is unavailable.
  • Tested against dspy 3.4.0 with the LM replaced by a fake and Niadra on the emulator.

Next steps

History navigation

the three tools the agent receives.

LiteLLM

the same usage recording for calls made through LiteLLM directly.