Imp: A Full Port of DSPy to the BEAM for Elixir
Key point
Imp brings DSPy's declarative, self-improving language-model programming paradigm to Elixir, leveraging OTP for reliable, concurrent agent execution.
Details
DSPy Paradigm on the BEAM
Imp is a full port of DSPy to the BEAM (Erlang/Elixir runtime), enabling developers to build declarative, self-improving language-model programs in Elixir. By combining DSPy’s typed function approach with the BEAM’s process model, Imp treats agents as supervised processes that maintain state, receive messages, and run concurrently alongside the rest of the application. This architecture allows for building complex systems ranging from single typed calls to long-running, resilient agent workflows.
Core Features and Workflow
Imp eliminates manual prompt engineering and parsing by using signatures to define input/output types. The library automatically constructs prompts, validates responses, and returns typed fields. Key capabilities include:
- Optimization: Supports multiple optimizers like GEPA (which uses a stronger model to reflect on failures and rewrite instructions), MIPROv2, SIMBA, and fine-tuning methods like GRPO. These tools evaluate programs against labeled datasets (train, validation, test sets) to improve performance.
- Agent Building: Uses Imp.react/3 to create agents that call tools (standard Elixir functions) until they can answer a query. It supports MCP (Model Context Protocol) for importing external tools and ACP (Agent Client Protocol) for serving agents to clients like Zed.
- OTP Integration: Runs are managed as supervised processes, allowing for monitoring, stopping, and authorization controls. Tool calls are handled with strict error reporting, ensuring that side effects are not silently retried.
Availability and Status
Imp is available as an open-source project on GitHub with 36 stars and 2,017 commits. It requires Elixir 1.19 or later and is currently at version 0.5, marked as experimental with ongoing benchmarking and development. The library relies on ReqLLM for model connectivity, supporting any provider compatible with that package.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.