Imp provides a DSPy‑like experience on the BEAM by letting developers declare what each language‑model step takes and returns as a typed signature. A simple example from the repository shows how to create a language‑model request for OpenAI’s GPT‑5.4‑mini, define a signature that maps a GitHub issue to a bug/feature/question classification, and call the predictor to obtain typed fields such as :kind and :summary. This mirrors DSPy’s core idea of treating model calls as functions that can be measured and improved without manually writing prompts or parsers.

Imp project logo showing an imp examining cards with a lens and a smaller imp emerging from its tail
Imp project logo featuring an imp with a lens and a smaller imp from its tailgithub.com

The Imp logo represents the project discussed in the article, which ports DSPy to Elixir/BEAM for building self‑improving language‑model programs.

Imp enables agent‑style workflows via the react/3 construct, which builds a process that iteratively calls tools until it can answer a question. An example demonstrates a researcher agent that fetches a web page with Req, checks the URL against an allow‑list, and extracts the version string from a raw GitHub file. The agent can be launched with start_run/3, supervised by OTP, and its lifecycle events (run started, tool sent, model request, model response, tool result, run finished) can be observed via Imp.Run.events/1, giving the reliability and concurrency primitives of OTP.

For improvement, Imp adopts DSPy’s optimizers: users supply labeled training, validation, and test sets, choose a metric (e.g., exact match on the :kind field), and run an optimizer such as GEPA, which rewrites the program’s instructions based on where it fails. Other optimizers include LabeledFewShot, BootstrapFewShot, MIPROv2, SIMBA, and fine‑tuning approaches, all of which produce a new program whose instructions and examples can be inspected as a diff.

Beyond single calls, Imp integrates with the broader BEAM ecosystem: it can import tools from any MCP server, serve Imp programs as ACP agents for Zed and other clients, and relies on OTP for process isolation, deadline‑cut model requests, and safe reporting of tool outcomes without silent retries. These features position Imp as a way to build LLM‑powered applications that inherit the fault tolerance, concurrency, and observability strengths of the Elixir/OTP platform while retaining DSPy’s declarative, self‑improving programming model.