{
  "id": 10280767,
  "title": "Imp is a full port of DSPy to the BEAM",
  "url": "https://urgent.news/2026/09/27/imp-is-a-full-port-of-dspy-to-the-beam",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-27T19:28:23.000Z",
  "source": {
    "name": "Hacker News",
    "slug": "hacker-news",
    "url": "https://github.com/deepfates/imp"
  },
  "original_language": "en",
  "account": "Imp is a complete port of DSPy, a declarative, self-improving language-model programming framework, to the BEAM, Elixir's virtual machine. In Imp, you specify the input and output of each language-model step, choose how it thinks, and an optimizer refines it using examples of desired behavior. This process occurs within the reliability and concurrency guarantees of OTP. Each model call in DSPy is represented as a typed, declared function in Imp, allowing for measurement and improvement.\n\nIn the BEAM environment, an agent is a self-contained process, managing its own state, receiving messages, and running alongside other application components within a supervisor. This capability enables building a wide range of applications, from single typed calls to extensive, long-running agents, with the ability to enhance each part by measuring its performance. Importantly, there is no need to craft prompts or parse data in Imp, as it automatically generates prompts from signatures, validates replies against them, and provides typed fields.\n\nImp streamlines the reasoning process using the chain_of_thought/2 function and incorporates tools through the react/3 function. The signature for each operation remains consistent, facilitating seamless integration. To guide Imp's learning, provide labeled examples, a metric, and three sets of issues: trainset (for optimization), valset (for selection of programs), and testset (for post-optimization evaluation). These sets are crucial for guiding the optimizer's process.\n\nTo enhance the model's capabilities, use a stronger language model, such as GEPA, which analyzes failures and refines instructions. Other optimizers include approaches that learn from labeled examples, search for optimal instruction-example combinations, improve through rule learning, or fine-tune the model's weights. The outcome is a refined program, complete with readable instructions and examples, which can be saved as JSON and reviewed through a diff.\n\nImp integrates tools as Elixir functions, with its React function building agents that sequentially call these tools to address problems, such as web page reading with Req. The library depends on Req; if your code uses it, ensure to include it in your dependencies list. The call/2 function runs Imp programs within your application process, while call/3 initiates them in a separate, supervised process, offering greater control over execution.\n\nOptimizers in Imp can also refine agents, with GEPA reflecting on entire agent runs and rewriting instructions accordingly. Optimize Anything can modify any text or JSON formatted data based on a defined scoring system. To set up Imp, you need Elixir 1.19 or later, along with a C++ compiler for one dependency, erlexec. Imp currently supports models accessed via ReqLLM, meaning any supported provider will work. Note that Imp 0.5 is experimental, released on Hex, and its API may still evolve. Additionally, the optimizers benefit from extensive benchmarking to ensure optimal performance. Feedback and contributions are welcomed via bug reports and pull requests.",
  "summary": null,
  "key_points": [
    "Imp is DSPy port to BEAM, Elixir's VM",
    "Agents manage state, receive messages in BEAM",
    "Optimizers refine agents using trainset, valset, testset"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}