Imp is a framework for typed, optimizable language-model programs on the BEAM. Declare a task as named inputs and outputs, call it like any other Elixir program, measure it on examples, compile it with an optimizer, and run the selected program under OTP.
This release fixes bugs found after 0.5.0: failures that were reported as
success, credentials that reached reports and checkpoints, requests that could
be sent twice, and checkpoints that could not be resumed. It is 0.6.0 rather
than a patch because several of those fixes change what a caller receives:
Imp.collect/3 returns a prediction; a ReActV2 turn whose model fails returns
a StepError; examples without declared inputs are refused; a reply that
answers no output is a parse error; ReqLLMBatch no longer resends a request
that may have run; an MCP 503 or 529 is :refused; Imp.Datasets.csv/3
refuses some files 0.5.0 loaded; an Imp.react signature may not have a
tools field; and GEPA and Imp.Observability report errors where they
reported :ok or :failed.
Install
{:imp, "~> 0.6"}Every dependency comes from Hex. Use a path dependency only while developing against a local checkout.
ExMCP and erlexec are declared runtime: false, so an OTP release that uses
Imp.ACP or Imp.MCP must list applications: [ex_mcp: :load, erlexec: :load]
in its release definition; see releases that use MCP or
ACP.
Ordinary Imp startup starts no protocol endpoint.
mix deps.get and mix hex.audit report two cowlib advisories
(CVE-2026-43966, CVE-2026-43969). cowlib arrives only through ExMCP's
Cowboy server, and Imp's HTTP goes through Req, Finch and Mint. The first is
fixed one layer up: Cowboy 2.16.0 and later refuse a response header
containing CR or LF, and a fresh mix deps.get resolves Cowboy 2.19.0. The second is in the encoder
for an outgoing Cookie request header, which nothing in Imp's dependency
tree calls, and no cowlib release fixes it yet.
Imp declares mint ~> 1.8, as Finch does, and a fresh mix deps.get resolves mint
1.11.0. That release fixes three advisories but reuses HTTP/1 connections
that timed out; Imp's own lock holds 1.10.1. See Known limits for the choice
an application has.
Headline changes
- An agent's step prompt asks for one format, as DSPy's does. With an LM that
calls tools natively, the step no longer also asks for a
tool_callsfield; an LM that cannot is shown each tool's description and arguments in the prompt and writes its calls intool_calls. - Failures are reported instead of passing as success. A ReActV2 turn whose
model fails returns
Imp.Predict.ReActV2.StepErrorwith the history as far as it got; a GEPA run that continued past failed proposals reports:with_errors; the Chat, JSON and XML adapters report a reply that answers no output as a parse error; and evaluation and optimizers refuse examples that never declared their inputs, whose labels were passed to the program as inputs. - Redaction runs before a term is converted, in reports, results, GRPO checkpoints, session records and saved programs, so a client, retriever or OAuth store in them is no longer written with its secrets. The SIMBA, MIPROv2, InferRules, random-search and GEPA checkpoints redact their failure reasons. Redaction still replaces the whole string, as in 0.5.0, and recognizes more credential shapes.
- Renderers (
:system_renderer,:output_renderer) shape the JSON fallback and every JSON or XML request, so a fallback sends the request the host shaped. Imp.Clients.ReqLLMBatchnever sends again a request that may have run, and waits for the provider'sretry-afterbefore a retry.- A streamed call is recorded in its run like any other, and a reply with text and tool calls keeps all of them, streamed or not.
- GEPA checkpoints resume: from a pending proposal batch, from a program that is an agent, and in a fresh VM.
Upgrading from 0.5
- Change the dependency to
{:imp, "~> 0.6"}, runmix deps.get, and commitmix.lock.nimble_csvandmintare new direct dependencies. Imp.collect/3returns{:ok, prediction}or{:error, reason}; read fields withImp.get(prediction, :answer)instead of matching a string.- Where you checked
Imp.Prediction.complete?/1after a ReActV2 model failure, match{:error, %Imp.Predict.ReActV2.StepError{reason: reason, history: history}}and storehistoryas you store a finished turn's. A step refused by anImp.OperationalSafetyErrorends the turn this way at once; where you call the program yourself, match{:error, %Imp.Predict.ReActV2.StepError{reason: %Imp.OperationalSafetyError{}}}.Imp.Evaluateand the optimizers already raise it. - Call
Imp.with_inputs/2on every example you evaluate or optimize on, and build evaluation rows withImp.example/1 |> Imp.with_inputs(...)rather than plain maps or pair lists. Give each field of an example or prediction once, under one spelling. To keep a signature's instructions, pass it toImp.Signature.new/2without instructions. - A field called
toolsin anImp.reacttask signature is refused, and a saved program with one no longer loads. Rebuild the program with the field renamed and save it; to keep a saved program's optimized instructions and demos, rename the field in the saved file, or optimize again. - Match
%Imp.AdapterParseError{kind: :missing_fields}where you relied on a prediction of defaults, or on ProgramOfThought's:missing_program, for a reply that answered no output. - Compare
Imp.Clients.ReqLLMclients bymodel, not by the whole struct, which now carries:tool_calling;%Imp.Predict.ReActV2{}likewise carries:tool_order. - Treat a
ReqLLMBatchrequest that ends:ambiguousas possibly run, and check it with the provider before sending it again. A 0.5.0 checkpoint's:transient_failurerequests become:ambiguouson resume. - An MCP call answered with 503 or 529 is
:refused, not:unknown. - Quote CSV fields that hold a quote (
"12"" pipe",1) and remove spaces between a comma and a quoted field;Imp.Datasets.csv/3refuses both. - Match
Imp.Observability.Status's new:succeeded_with_errors, which an optimizer report with errors gives where it gave:failed. Read GEPA'sreport.errorsrather than expectingstatus: :ok: a run that went on past failed proposals reports:with_errors. Review:beam_nativestoppers built onconsecutive_outcome/2, which now counts an iteration that raised as:proposal_errorinstead of:none. - Keep 0.5.0 away from files 0.6.0 writes: it cannot read a trajectory with
atom keys (in a GEPA or Playbook checkpoint, or saved with
Imp.dump/1), an optimizer report that holds anImp.History, or aReqLLMBatchcheckpoint. - A ReActV2 turn that reaches
max_iterswith text beside tool calls it did not run now answers with that text, where it answerednil; the calls are still listed as unexecuted. A host that publishes every non-empty answer should decide whether to publish such a turn's text. - Re-evaluate saved agents on held-out data: the step prompt and tool roster order changed, so they send different prompt text.
- A
:system_rendereror:output_renderernow also shapes the JSON fallback and JSON and XML requests. Build onopts[:default_system]andopts[:default_outputs]rather than ignoring the options, or the fallback sends a Chat-shaped prompt.
Known limits
mint1.11.0 leaves an HTTP/1 connection open after a receive timeout, and Finch 0.23.0, the newest release, returns it to its pool with the unanswered request still on it. A later request the pool gives that connection waits behind the unanswered one and times out, and so does a retry that lands there, until the server answers the first request or closes the connection. If the late answer arrives while another request is waiting, Finch raisesCaseClauseError. This affects every Req or Finch user on HTTP/1, the default for Req and ReqLLM, whose server can time out; ReqLLM spreads a host's requests over several connections, so there only the requests that draw the stuck one fail. Withmint1.10.1 a timeout closes the connection and the next request opens a new one, so Imp's lock holds 1.10.1. It has three advisories that 1.11.0 fixes: EEF-CVE-2026-91043 (high) and EEF-CVE-2026-92103 are in Mint's HTTP/2 client only, and EEF-CVE-2026-94194 is in HTTP/1 chunked framing and needs a malicious server behind an intermediary that reads the framing strictly. An application chooses one: add{:mint, "~> 1.10.1"}to its dependencies to lock 1.10.1 and keep those advisories, or take 1.11.0 and accept that a connection that timed out is reused until the server closes it. Finch has an open, unreleased fix (https://github.com/sneako/finch/pull/397); a Finch release that includes it ends the choice.- A flat two-element name-first list that is not itself an element of a
list (at the top level, in a tuple, or under a key that is not a credential
name), such as
["password", "hunter2"], is not redacted, where 0.5.0 redacted it. Such a list is read as a key and value only as an element of a list, so that lists of names such aswith_inputs([:api_key, :question])survive saving. - The GEPA, SIMBA, MIPROv2, InferRules and random-search checkpoints redact their failure reasons but otherwise hold the resume state as it is: GEPA's candidates, evaluation cache, proposed instructions and reflection data, and the others' instructions, demos and scores. Fast-Slow and Playbook checkpoints likewise hold their prompts, rollouts and playbooks. Treat checkpoint files as sensitive.
- A ReActV2 step whose prose quotes its own field names (a JSON object with
next_thoughtortool_callskeys, a[[ ## field ## ]]line, a<next_thought>tag) is not read as prose and goes to the JSON fallback, which usually costs one more call. If the model repeats the same reply, the step ends:incomplete. Beside native tool calls, such a thought becomesnil; the calls still run. - When a streamed ReqLLM request fails, ReqLLM's own warning log prints the error with its response headers. Imp strips them from the error it returns, but cannot change that log line.
- In command output, a
Bearertoken of 12 to 15 characters, or one with no digit, is shown when more text or a newline follows it. 0.5.0's command pipeline hid any such token of 12 or more characters. - A GEPA checkpoint taken between preparing and starting a full validation resumes by rejecting that candidate, as before.
The CHANGELOG records every user-visible change in this
release. Generated module documentation is the complete API reference. Start
with Imp, Imp.Signature, Imp.Module, Imp.Evaluate, Imp.Optimizer,
Imp.ACP, Imp.MCP, and Imp.Telemetry.