All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.16.0 - 2026-11-26
Alloy 0.16 brings major-lab wire parity (multimodal PDFs/documents, image URLs,
dynamic :api_key callbacks, provider caching, Gemini native tools, portable
:reasoning), uniform v1 streaming events, cooperative cancellation
(Alloy.Cancel), mid-run :steering and completion :follow_up controls,
Alloy.Tool.Executor.run_tool/3, and optional Alloy.ModelCatalog capability
and pricing metadata — with zero new mandatory runtime dependencies. See
Upgrading to 0.16.
Breaking Changes
- New
:cancelledstatus, error kind, and atomresult.error:Alloy.Agent.State.status(),Alloy.Result.status, andAlloy.Provider.Error.kind()add:cancelled. Cooperatively cancelled runs return{:error, %Alloy.Result{status: :cancelled, error: :cancelled}}(with any%Alloy.Provider.Error{kind: :cancelled}inresult.metadata.run.provider_error), soresult.erroris no longer guaranteed to be aString.t()on{:error, result}. Callers with exhaustivecasematches on run/turn status or provider error kind must handle:cancelled, and persistentAlloy.Provider.Codex(persist_session: true) callers should rotate:session_generationafter:cancelled. - Fail-closed
Alloy.Middleware.run_before_tool_call/2: Direct callers ofMiddleware.run_before_tool_call/2must handle the new:cancelledreturn value whenstate.config.cancel_tokenis cancelled (explicit{:block, reason}verdicts remain preserved). Global provider config validation for
:api_key,:origin_key, and:reasoning:Alloy.Agent.Confignow validates auth and:reasoningoptions on every primary and:fallback_providersconfig (including custom providers). Any provider configured with a 0-arity:api_keyfunction orauth_scheme: :bearerrequires a non-empty string:origin_key, any:reasoningkey in provider config must conform to Alloy's portable format (nil | :off | :low | :medium | :high | :xhigh | %{effort: ..., display: ...}), and built-in HTTP providers validate both static string and callback:api_keyvalues as printable ASCII without CR/LF characters.- Injected
:alloy_cancel_tokenand:reasoningprovider config keys: When:cancel_tokenis set, Alloy injects:alloy_cancel_tokenintoprovider_configalongside:alloy_request_deadline, and when top-level:reasoningis set, Alloy injects normalized:reasoning; custom providers using strict option validators should tolerate unknown:alloy_*keys and:reasoning. - Anthropic
reasoning: :off: Explicitly sends%{"thinking" => %{"type" => "disabled"}}(reasoning: nilcontinues to omit"thinking"). - Stricter
OpenAIStreamandOpenAIstreaming tool-call validation:Alloy.Provider.OpenAIStream(Chat Completions streaming) rejects negative/malformed tool-call indices and conflicting tool identities (id/name) with non-retryable:protocol_error, and invalid/non-object tool argument JSON with retryable:malformed_reply;Alloy.Provider.OpenAI(OpenAI/xAI Responses streaming) rejects conflicting tool-call headers and contradictory completed arguments with:malformed_reply(retryable before output is emitted; retries/fallbacks remain suppressed once output has been emitted to caller callbacks). Alloy.Events.build_correlation_id/1: Empty strings ("") and invalid UTF-8 values incontext[:request_id]/context[:correlation_id]now fall back to a generated correlation ID so downstream tool events and telemetry always carry valid non-empty UTF-8 correlation IDs.
Added
- Multimodal & major-lab wire parity:
- Portable
image(url:ordata:) anddocument(data:,uri:, or origin-scopedfile_id:) content blocks acrossAnthropic,OpenAI,XAI, andGemini(plusimageURLs onOpenAICompat), with origin-scopedfile_idand Gemini File API URI omission inAlloy.Message.normalize_for/3on cross-origin switches. - Dynamic 0-arity
:api_keycallbacks (resolved per HTTP attempt within the request deadline and cancellation token, rejecting non-ASCII/CR/LF keys, never invoked during origin hashing, and redacting auth error diagnostics) plusauth_scheme: :bearersupport. - First-class provider caching and native tools: Anthropic
:cacheTTL ("5m"/"1h") and:web_searchshorthand; OpenAI/xAI:prompt_cache_keyand:prompt_cache_retention; Gemini:cached_content,:google_search,:url_context, and:code_execution(all stripped automatically on compaction summary requests).
- Portable
Portable
:reasoningoption: Unified:reasoningconfig (nil | :off | :low | :medium | :high | :xhigh | %{effort: ..., display: ...}) across all 6 built-in providers (updatable viaAlloy.Agent.State.prepare/2, forwarded to fallback providers, stripped on compaction summaries, and overridable by explicitextra_body/generation_config).- Uniform v1 streaming events (
docs/events.md)::thinking_deltaacross Anthropic, OpenAI/xAI Responses, Gemini, and OpenAICompat/OpenAIStream.:tool_call_delta(%{id:, index:, name:, arguments_delta:}) across streaming providers.:turn_start(%{turn:}) and:turn_end(%{turn:, status:, stop_reason:, usage:}) across bothAlloy.run/2andAlloy.stream/3.:tool_update(%{id:, name:, chunk:, start_event_seq:}) marshalled back to the caller process via per-callProcess.alias/0with bounded in-flight backpressure, wired intoAlloy.Tool.Core.Bashalongside optional:bash_on_output.
- Cooperative cancellation (
Alloy.Cancel):- Lock-free
:atomics-backed cancellation tokens (new/0,cancel/1,cancelled?/1,combine/2,valid?/1, zero processes, zero ETS tables, zero polling overhead whennil) propagated throughTurn,Retry,OwnedWorker,HTTP,SSE,CodexRunner/Codex,Compactor,Middleware, andExecutor— includingtimeout_ms: :infinityruns, OS process-group teardown, verbatim compaction history preservation, retry/fallback suppression, and valid repaired transcripts (Alloy.Transcript.validate/1 == :ok).
- Lock-free
- Mid-run
:steering& completion:follow_upcallbacks::steeringpolled between completed tool batches to redirect active runs, skip remaining unstarted batches with synthetic errortool_resultblocks, and bypass:stop_after_tool.:follow_uppolled before normal non-refusal:end_turncompletion once:until_toolis satisfied, bounded by:max_turns,:timeout_ms, and:cancel_token, firing:after_completiononce on final completion.- Strict
[%Alloy.Message{}]and JSON-compatibility validation plus:redactexception/throw/exit sanitization for both callbacks.
- Reusable single-tool execution (
Alloy.Tool.Executor.run_tool/3) & native:parent_call_id:- Shared single-tool execution entrypoint with full middleware, validation, supervised timeout/deadline clamping (
state.run_deadline), composed cancellation (Alloy.Cancel), truncation, caller-process:tool_updatemarshalling, and native:parent_call_idtagging across:tool_start,:tool_update,:tool_end, tool telemetry, and metadata. - Updated
examples/minimal_host/code_mode.exsanddocs/recipes/code-mode.mdto route single nested calls throughExecutor.run_tool/3, clamp outer deadlines, and finalize child calls gracefully on cancellation/timeout.
- Shared single-tool execution entrypoint with full middleware, validation, supervised timeout/deadline clamping (
- Optional
Alloy.ModelCatalogmetadata &LLMDBrecipe:- Added optional
Alloy.ModelCatalog.max_output_tokens/1,Alloy.ModelCatalog.capabilities/1, andAlloy.ModelCatalog.pricing/1callbacks plusAlloy.ModelCatalog.info/1,2(fully backwards-compatible with minimal v0.14 catalogs exporting onlycontext_window/1). - Implemented all three optional callbacks in
Alloy.ModelMetadata(includinggpt-5.2-pro/gpt-5.4-prostructured_output?: false,grok-4.20-multi-agenttools?: false, non-reasoning Grok distinction, andniloptional metadata for retired models). - Added provider-scoped
LLMDBadapter recipe (docs/recipes/llm-db-catalog.md) anddocs/upgrading-to-0.16.md.
- Added optional
0.14.0 - 2026-11-24
Alloy 0.14 hardens run deadlines, worker supervision, provider wire parsing,
and tool/config validation, splits non-retryable :protocol_error from
retryable :malformed_reply, and adds first-class portable :output_schema
structured outputs. See Upgrading to 0.14.
Breaking Changes
- Run deadline enforcement (
:timeout_ms, or:infinityto disable):Alloy.Agent.Turn,Alloy.Provider.Retry, built-in HTTP/SSE and Codex runners, andAlloy.Tool.Executornow enforce:timeout_ms(default120_000ms) across stalled or trickling HTTP/SSE requests, provider retries, sequential tool batches, in-flight and queued tool tasks, and turn boundaries without renewing expired budgets. Previously, actively streaming requests and long tool batches could run past:timeout_ms.- Retry & timeout headroom: Retries and fallback attempts stop 5 seconds before
:timeout_ms(sotimeout_ms <= 5_000skips both retries and fallback providers). Non-streaming requests reserve that 5-second headroom inreceive_timeoutonce:timeout_ms > 8_000(with a 3-second floor clamped to remaining budget), while streaming requests receive the full remaining run budget up to:timeout_msacross both HTTP/1.1 and HTTP/2. Cancellation teardown adds a brief grace window (~1.5sfor HTTP/SSE worker cleanup, up to5sfor Codex subprocess cleanup), so hosts wrapping runs inTask.await/2should add buffer above:timeout_ms. - Termination precedence: Already-completed
:end_turnanswers and successfulstop_after_tooloutcomes are returned rather than discarded; otherwise an expired deadline fails the run with:timeoutahead of:max_turns. - Unstarted tool batches: Tool calls in a batch that has not started before
:timeout_msexpires (including middleware-blocked calls in that batch) receive matching errortool_resultblocks in the transcript (preserving any:before_tool_callblock reason) without emitting:tool_start/:tool_end, running:after_tool_call, or appearing inresult.tool_calls. Calls already queued inside an in-progress parallel batch whose:tool_startwas already emitted still settle through:tool_end,:after_tool_call, andresult.tool_callswith a run-deadline timeout error so start/end pairs stay balanced. - Migration: Callers with multi-turn or streaming runs exceeding 2 minutes (or single non-streaming generations exceeding
timeout_ms - 5_000) can raise:timeout_msor passtimeout_ms: :infinityto disable the run-level deadline (per-tool:tool_timeout, Codex's own per-invocation:timeout_msdefault of120_000ms, and a 60-second ceiling on unbounded retries — capping jitter at 60 s and aborting ifRetry-Afterexceeds 60 s — still apply; HTTP requests default toreceive_timeout: :infinity, so passreq_options: [receive_timeout: ...]if you still want a per-request idle/socket timeout). When:timeout_msis finite,:tool_timeout(default120_000ms) is bounded by the remaining:timeout_msrun budget, and a tighter caller-providedreq_options[:receive_timeout]is preserved.
- Retry & timeout headroom: Retries and fallback attempts stop 5 seconds before
- Supervised worker execution for deadline-bounded HTTP/SSE requests: When
:timeout_msis finite (the default), built-in HTTP/SSE providers executeReqinside a linked worker underAlloy.TaskSupervisor(so the:alloyapplication must be started).Logger.metadata/0, OpenTelemetry context (:"$__current_otel_ctx"), and$callersare propagated to the worker, while other custom process-dictionary entries are not; customReqtest plugs that callsend(self(), ...)run in the worker process and should capture the test PID in a closure instead. - Internal
:alloy_request_deadlineprovider config key: When:timeout_msis finite, Alloy now passes:alloy_request_deadline(an internal monotonic millisecond deadline) in theprovider_configmap given to providers, alongside existing runtime keys (:system_prompt,:on_event,:provider_state). Custom providers that validateprovider_configstrictly (for example viaKeyword.validate!/2orNimbleOptions) should ignore unknown:alloy_*keys, as documented inAlloy.Provider. Alloy.Tool.Executornow treats explicitinput: nil(for example from a custom provider or:before_tool_call{:edit, ...}middleware) as an invalid non-object tool input instead of coercing it to%{}; omit:inputor pass%{}for no-argument calls.Alloy.Provider.decode_body/1now rejects non-object JSON (such asnull, arrays, or scalars) with{:error, %Alloy.Provider.Error{kind: :protocol_error}}and invalid JSON with{:error, %Alloy.Provider.Error{kind: :malformed_reply}}instead of a bare string.ErrorimplementsString.Chars, so string interpolation continues to work, but callers pattern-matching a binary error or decoding non-object JSON viadecode_body/1must update.Alloy.Agent.Config.from_opts/1validates startup options strictly and raisesArgumentErroronprovider: nil, boolean provider values, non-positive:max_turns/:max_tokens/:tool_timeout, non-positive/non-:infinity:timeout_ms, negative:max_retries/:retry_backoff_ms, non-map:context, non-string:system_prompt, empty or non-string:working_directory, non-2-arity:on_compaction, non-boolean:code_execution, empty or non-string:until_tool, and invalid:middlewareor:fallback_providersentries (including{Mod, nil}). (retry_backoff_ms: 0andtimeout_ms: :infinityare valid.)Alloy.Tool.resolve_path/2expands relative:allowed_pathsentries against:working_directoryrather than the BEAM process working directory, and rejects non-string paths, NUL bytes, and non-list:allowed_paths.Alloy.Provider.Codexlaunches via non-loginsh -cwith explicit port:envinstead of a login shell, rejects option-like:codex_binvalues, and treats non-zero exits underpersist_session: trueas errors even when alast_messagefile exists. Set:codex_binexplicitly ifcodexis only on a login-profilePATH.Alloy.Testing.run_with_responses/3now validates options throughAlloy.Agent.Config.from_opts/1(defaulting tocompaction: false, enforcing the scriptedAlloy.Provider.Test, and clearing:fallback_providers) and raisesArgumentErroron unknown or invalid options that were previously ignored.Alloy.Provider.OpenAI,Alloy.Provider.OpenAICompat, andAlloy.Provider.OpenAIStreamnow require a non-empty string tool-call"id"/"call_id"and"name"(returning non-retryable:protocol_errorif missing or empty instead of emitting tool calls withnilIDs), except underfinish_reason: "length"/ Responsesstatus: "incomplete"(where cut-off calls receive unique placeholder"truncated_<n>_<uniq>"IDs,"truncated"names, andinput: %{}so the loop abandons them with itsmax_tokenserror and matching error tool results inresult.messages) andfinish_reason: "content_filter"/ Responsesincomplete_details.reason: "content_filter"(where partial calls are dropped so the refusal reaches the loop without retrying).Alloy.Provider.Error.kind()adds:protocol_error(non-retryable, for deterministic wire-schema contract violations such as valid non-object JSON replies, malformed choices/candidates/content/blocks, missing required tool-callid/name, or mismatched Anthropic SSE deltas) and:shutdown(non-retryable; skipped by retries and fallback loops) for supervisor shutdown interrupts across HTTP and Codex providers (including resumed Codex turns, which preserve:shutdowninstead of:session_uncertainwhile noting:session_generationrotation inerror.message); callers with exhaustivecasematches onerror.kindor rotating:session_generationbykindshould handle:protocol_errorand:shutdown.tool_validation: :schemanow converts unsupported$schemadialects (ExJsonSchema.Schema.UnsupportedSchemaVersionError, e.g. Draft 2020-12) into anArgumentErrornaming the tool and$schemavalue.- Value-safe tool & custom
:bash_executorexception redaction: Raised exceptions inside tools or custom:bash_executorfunctions now keep their message only forRuntimeError(capped to 500 bytes), standard:badarg("argument error"), and atom key names onKeyError("KeyError (key :foo not found)"). All other raised exceptions (includingMatchError,CaseClauseError, custom-messageArgumentError, and customdefexceptionstructs) report only their exception module intool_resultblocks,result.tool_calls[].error,[:alloy, :tool, :stop], and logs so capturedcontext/credential maps cannot leak. Tools that want the model or telemetry to see an error message should return{:error, message}orraise "...". - Strict middleware return-value validation: Middleware
{:halt, reason},{:halt, reason, state}, and{:block, reason}now require a binary (String.t())reason, and{:edit, modified_call}requires a plain map; non-conforming returns raiseArgumentErrorinstead of propagating into worker crashes orProtocol.UndefinedError.
Added
- Portable structured outputs (
:output_schema/result.output):Alloy.run/2,Alloy.stream/3, andAlloy.Agent.State.prepare/2accept:output_schema(a plain JSON Schema map or%{name: ..., schema: ..., strict: ...}), translating it into each built-in provider's native structured-output wire format (output_config.formaton Anthropic,text.formaton OpenAI/xAI,response_formaton OpenAICompat,generationConfig.responseJsonSchemaon Gemini, prompt schema instructions on Codex), keeping compaction summaries schema-free, decoding/validating the final assistant JSON intoresult.output, and exposing machine-readable failures onresult.metadata.run.output_error. - Opt-in live provider contract test suite (
@tag :live): Excluded by default intest/test_helper.exs; runnable viamix test --only live(or per-provider@tag :live_anthropic,:live_openai,:live_gemini,:live_xai,:live_openai_compat,:live_codex) against real API credentials. - OpenTelemetry tracing recipe & 0.14 upgrade guide: Added
docs/recipes/opentelemetry.mdanddocs/upgrading-to-0.14.md. Alloy.Provider.OpenAIandAlloy.Provider.XAInow accept:extra_headers.Alloy.Provider.Gemininow accepts:extra_body(merged last with stringified keys, merginggenerationConfigone level deep so caller keys coexist with:output_schema).- CI now verifies compilation and tests without the optional
:ex_json_schemadependency.
Changed
- Typed
:malformed_replyvs:protocol_errorerrors: Transient JSON/SSE corruption (undecodable JSON bodies or SSE chunks, invalid/non-object tool-argument JSON from the model, incomplete Anthropic tool blocks, Codex emptytool_use/ stream mismatch) returns retryable%Alloy.Provider.Error{kind: :malformed_reply}(bounded by:max_retriesbefore output is emitted), whereas deterministic provider wire-schema violations (valid non-object top-level/SSE JSON, malformed choices/message/delta/content/candidates/parts/blocks, missing required tool-callid/name, mismatched Anthropic SSE deltas) fail fast with non-retryable%Alloy.Provider.Error{kind: :protocol_error}. Rescued SSE event-handler crashes halt the stream early, log only the exception module plus argument-stripped stacktrace, and return non-retryablekind: :unknown. Valid JSON objects with unexpected top-level keys returnkind: :unknown(non-retryable) with bounded inspect output. - Shared internal sanitization (
Alloy.Internal.Sanitize): Consolidated UTF-8-safe byte capping, bounded term inspection, value-safe outer-shape summaries (used inConfigandMiddlewareArgumentErrormessages so misconfigured provider tuples,:fallback_providers,:context,:system_prompt, or invalid middleware return values never leak secrets), value-safe exception/exit summaries (keeping cappedRuntimeErrormessages,:badarg, atom-keyKeyErrornames, and safe atom-tagged exit tuples while omitting payloads from other raised exceptions and compound exits socontextorprovider_configsecrets never leak into tool results, logs, or telemetry), and stacktrace argument stripping into one internal helper used across providers, tools, compactor, events, retry, middleware, andOwnedWorker. - OpenAI & OpenAICompat refusal blocks:
Alloy.Provider.OpenAI,Alloy.Provider.OpenAICompat, andAlloy.Provider.OpenAIStreamnow surface assistant refusal fields (OpenAIResponses refusal blocks,OpenAICompat/OpenAIStreammessage.refusal,delta.refusal, and array-of-parts%{"type" => "refusal"}) as%{type: "text", text: ..., refusal: true}blocks (making refusal text visible inresult.text/result.messagesand enabling structured-output:refusaldetection), andOpenAICompat/OpenAIStreamreject non-string, non-nullrefusalpayloads with non-retryable:protocol_error. - Core tool & memory bounds:
Alloy.Tool.Core.Editrefuses binary files, files over 10 MiB, and non-booleanreplace_allvalues;BashandWritereject non-string inputs; custom:bash_executorfunctions returning shapes other than{binary, integer}now return{:error, ...}instead of misreporting a timeout or crashing;Alloy.Memory.tool/1caps results at 50,000 characters and rejectscreate/str_replace/inserton/memories. - Event & stream callback resilience:
Alloy.Events.emit/3rescues raising:on_eventcallbacks (logging at most once per run with argument-stripped stacktraces) so a buggy UI callback cannot abort a run after side-effecting tools execute, andAlloy.Provider.Retrysuppresses repeated warnings to at most once per callback per stream (likewise with argument-stripped stacktraces) when:on_chunkor:on_eventraises. - Sequential tool event ordering (
tool_concurrency: 1):Alloy.Tool.Executornow executes each tool call as a singleton batch whentool_concurrency: 1, so:tool_startand:tool_endevents alternate per call instead of emitting all:tool_startevents upfront, and later calls are cleanly skipped if:timeout_msexpires mid-round. - Per-run
Turn.run_loop/2transient state reset:Alloy.Agent.Turn.run_loop/2now resetsstatus(to:running),error,stop_reason,provider_response_metadata, andrun_metadataat the start of every run so hosts drivingTurn.run_loop/2on a reused%Alloy.Agent.State{}never see stalefinal_tool,output,output_error,provider_error, or response metadata from an earlier run.
Fixed
- Structured output prefill scoping:
Alloy.Agent.Turnnow scopes structured-output refusal detection and JSON decoding strictly to the final turn's returned assistant messages, so an empty final turn following an assistant prefill or prior refusal classifies as:missing_textinstead of decoding or re-triggering on pre-turn messages. - SSE framing, backpressure & cancellation:
- Non-200 SSE error bodies (including multi-paragraph HTML/JSON with
\n\n) are captured verbatim, scoped per response so redirect bodies never leak into later errors, and capped at 64 KiB (halting runaway non-200 streams early). SSE.parse_event/1strips at most one leading space and keeps the lastevent:line per the SSE spec.- Deadline-bounded HTTP/SSE workers monitor caller termination and use acknowledged per-chunk delivery to preserve backpressure while executing callbacks in the caller process.
- Non-200 SSE error bodies (including multi-paragraph HTML/JSON with
- Error classification & bounds (
Alloy.Provider.Error):- Added dedicated non-retryable
:shutdownkind for supervisor shutdown interrupts across HTTP and Codex providers (skipped by both retries and fallback loops, and never produced from provider error payloads). Error.from_body/1classifies numeric and string-numeric HTTP status codes (400..599) in in-banderror.codefields (populating:statusso typeless in-band errors format as"HTTP <code>: <message>") and checkserror.typebefore falling back toerror.status.- Overflow phrase checks scan the first 64 KiB of the sanitized message (skipped for 5xx, while explicit
context_length_exceededcodeortypelabels still classify as:context_overflow), and stored error messages slice before UTF-8 sanitization and are capped by byte size (2,000 bytes for string error bodies/messages; 500 bytes forJason.encode/1/inspect/2and transport fallbacks).
- Added dedicated non-retryable
- Provider streaming & parsing:
OpenAIStreamandOpenAICompat:- Map non-truncation/non-refusal finish reasons (including
"stop"and omitted reasons) with present tool calls to:tool_use, and tolerate truncated tool-call arguments underfinish_reason: "length"and"content_filter"so:max_tokenstool abandonment and:refusalreach the loop without retrying. - Support array-of-parts
content(extracting text and thinking parts, skipping unknown well-formed part types forward-compatibly, tagging content-part thinking with JSON-safesource: "content_part"and withholding it from top-levelreasoning_contenton subsequent turns, and rejecting malformed present content/reasoning values). - Preserve
usageon non-emptychoiceschunks, capturefinish_reasonwhendeltais omitted, reject non-map choices and explicit non-mapdelta, validateextra_contentshapes, and guard usage parsing against malformed fields. - Support tool calls without an
index(reusing slots for repeatedids, allocating fresh slots safely alongside sparse explicit indices, and routing id-less continuations to the most recently touched call) and accept missing or""no-arg tool call arguments (while still rejecting explicitnil/false/non-object arguments).
- Map non-truncation/non-refusal finish reasons (including
Anthropic: concatenates splitsignature_deltachunks, rejects non-object SSE JSON, malformed SSE event/delta shapes, and mismatched target-block deltas with non-retryable:protocol_erroron every stop except:refusal, rejects undecodable SSE JSON and invalid or unclosed streaming tool blocks outsidemax_tokens/model_context_window_exceeded/refusalstops with retryable:malformed_reply, and adds a boundedparse_response/1catch-all.Gemini: rejects cut-off streams whose chunks carry"finishReason": null, guards usage parsing (preserving earlier non-nil counts over laternulls), ignores"error": null, and prioritizes real object/string (and list-wrapped) in-band API errors over malformed or present candidates in bothcomplete/3andstream/4.- Trailing
/is trimmed on:api_urlacross HTTP providers, andModelMetadatamatchesmodels/gemini-*prefixes.
- Retry & fallback safety:
- Fallback providers without optional
stream/4fall back tocomplete/3(without emittingon_chunk/:text_deltachunks; the full reply is returned inresult.textandresult.messages); fallbackprovider_stateis isolated from the primary origin;:shutdowninterrupts skip fallback providers (both from primary and mid-fallback loop);retry_backoff_ms: 0no longer crashes:rand.uniform(0); Alloy deadline metadata stays outsidereq_optionsso custom providers forwardingreq_optionsto Req work without unknown-option errors; request timeouts scale monotonically across the 5-second headroom boundary.
- Fallback providers without optional
- Tool loop & middleware controls:
Message.normalize_for/3uses round-local ID renaming so reused same-origin IDs stay paired.tool_validation: :schemapreflights fail-fast (raisingArgumentError/InvalidSchemaError/Jason.EncodeErroron invalid schemas) before the first provider request and whenever middleware changes tools, accepts tool properties literally named"$ref", normalizes and scope-resolves subschemas under literal property names ("default","const","enum","examples") while rejecting nested$id/idinside literal-keyword values and failing closed on$reftargets pointing into non-schema literal data (such as#/default), and enforces$id/id-scoped local-only#-prefixed$refresolution (rejecting external and absolute self-references, verified againstex_json_schema0.11.x) so the remote schema resolver is never invoked.stop_after_toolsucceeds when:after_tool_executionappends a user message; invalid middleware return values raise a descriptiveArgumentError.
- Compactor & overflow recovery:
drop_thinking/1andcompact_messages/2drop emptycontent: []messages;force_compact/2shrinks large tool results on single-round overflows even with adaptive thinking blocks or under-estimated token counts; multimodaltool_resultlists reuse fixed media token budgets instead of counting base64 bytes;before_completionskips:after_compactionwhen messages are unchanged.- Summary requests sanitize primary and fallback provider configs (stripping session, tool/server-tool/web-search controls, OpenAI
"text", and GeminigenerationConfigschema/thinking fields while preserving privacy keys like:store/"store" => false);Turnonly setsprompt_too_long_recovery: truewhen recovery does not fail; eliminated O(N^2)Enum.at/2cut-point scans.
- Process cleanup & OTP hygiene:
- Custom
:bash_executorruns andProvider.HTTPshareAlloy.OwnedWorkerfor supervised caller-monitored execution with Logger metadata and OpenTelemetry context propagation, killing workers on timeout/cancellation even when trapping exits, preserving abnormal worker crash propagation to linked children, re-raising caught Req adapter/plug crashes in the caller under:deadlinewith argument-stripped stacktraces, and returning{:error, %Alloy.Provider.Error{kind: :unknown}}with a sanitized exit reason on external worker/owner kills (such asmax_heap_sizeorProcess.exit/2) instead of crashing the caller. Core.Bashtraps supervisor shutdown signals, checks for immediate caller exit beforePort.open, and kills the process group on runner exits.Codexcreates0700temp directories atomically with cryptographically random names (umask 077+mkdir, failing closed if unavailable), writes input files with[:exclusive]andset -Cdefense in depth, stops the process group on mid-stream crashes without unbounded stack traces, and wraps input-file write errors in%Alloy.Provider.Error{}.OSProcess.signal_group/2falls back cleanly when/bin/shis absent; added:cryptotoextra_applicationsinmix.exs;Usage.merge/2handles explicitnilfields;Transcript.validate/1omits spurious:missing_resultfor invalid call IDs.
- Custom
- Docs & dependencies: Fixed compactor order in
README.mdandCHANGELOG.md(including correcting the[0.13.0]compactor ordering note), added missingAlloyoptions and upgrade notes for:after_tool_call, fixeddocs/recipes/code-mode.mdandlivebooks/quickstart.livemd, and updatedplug/plug_cryptotest dependencies to clear Hex advisories.
0.13.0 - 2026-10-14
Alloy 0.13 is the loop and nothing else: the supervised runtime moves to
the alloy_agent package, memory and compaction become an ordinary tool
and ordinary middleware, and what 0.12.5 deprecated is removed. See
Upgrading to 0.13.
Removed
- The agent runtime moved to
alloy_agent:Alloy.Agent.Server,Alloy.Session,Alloy.send_message/3,Alloy.cancel_request/2, theconfig :alloy, :pubsubapp-start PubSub and the optionalphoenix_pubsubdependency. The deprecatedAlloy.Agent.Eventsshim is gone; useAlloy.Events. - Everything 0.12.5 deprecated:
:max_budget_centsand the:budget_exceededstatus. Use the budget middleware recipe.- Anthropic
:extended_thinking. Setting it now raises instead of silently turning thinking off. - Codex
:auth_path. Setting it now raises instead of silently running as the default account. State.materialize/1,State.cleanup/1andstate.messages_new.ModelMetadata.catalog/0and itsmodel_entrytype.Message.server_tool_result_block/3.
Alloy.Memory.Router's public functions (dispatch_all/2,memory_call?/1,tool_name/0); the router is internal now.state.current_taskandstate.pending_requests, which were server state.
Added
- Composable loop controls:
:after_tool_callmiddleware can replace each result's content and structured data before publication, while preserving success/error status.- Opt-in
tool_validation: :schemavalidates arguments using the optionalex_json_schemadependency (drafts 4/6/7, local references, no coercion). The default remains object/required-key validation. stop_after_tool: "name"completes successfully after a matching successful call and the rest of its round settle.result.textis the selected output;result.metadata.final_toolincludes its ID, name, and structured data.Alloy.Agent.State.prepare/2prepares messages, tools, system prompt, and provider through existing middleware, rebuilding definitions and model limits.Alloy.Transcript.validate/1checks client tool pairing;repair/1explicitly supplies interrupted outcomes only where a result is missing.tool_concurrency:caps parallel tool execution without changing sequential tool barriers. The default remains the scheduler count.
- Opt-in Codex continuation (
persist_session: true) and streaming:- The default remains ephemeral. Continuation fingerprints the serialized
transcript rather than loop-added provenance, and starts fresh when
execution configuration or earlier history changes. Failed resumes return
non-retryable
:session_uncertain. Hosts can change:session_generationafter failure/cancellation to recover without losing Alloy history. Continuation metadata is JSON-safe. - Codex streams the last validated structured answer at
turn.completed, before process exit, keeping command diagnostics and commentary out of answer text. Final-response disagreement is an error; callbacks run in the caller and cancellation stops the subprocess tree.
- The default remains ephemeral. Continuation fingerprints the serialized
transcript rather than loop-added provenance, and starts fresh when
execution configuration or earlier history changes. Failed resumes return
non-retryable
Alloy.Tool.native_types/0(optional) and:native_typeson inline tools: a provider's built-in type for the tool, such as Anthropic'smemory_20250818.- The
:on_context_overflowmiddleware hook. Alloy.Agent.State.deadline: the monotonic deadline for the run's provider requests, for middleware that makes its own.Alloy.Message.normalize_for/3andAlloy.Message.origin/2, for callers who call a provider directly.- Tested host-only recipes for bounded producer-side output capture and nested tool execution. No scripting runtime, file store, or Claude adapter is added to Alloy's core or runtime dependencies.
Changed
- Tool argument edits compose:
:before_tool_calledits now pass through later middleware instead of ending the chain. Block and halt still stop it. - Gemini tool-result envelopes: Gemini preserves tool-result text inside
explicit
output/errorenvelopes rather than decoding JSON-looking text into arbitrary response fields. Public tool results and transcripts retain their original content and error status. - Unknown options raise.
Alloy.run/2,Alloy.stream/3andConfig.from_opts/1ignored options they did not know, so a typo ran silently without its setting. Server options namealloy_agentin the error. Removed provider options (:extended_thinking,:auth_path) raise at startup too, for fallback providers as well as the primary, andcompaction: falsewith the compactor in:middlewareraises. %Alloy.Agent.Config{}dropsmemory,pubsub,subscribe,max_pending,on_shutdownandmax_budget_cents. Middleware reading one gets aKeyErrorwhen that hook runs.- Memory is an ordinary tool.
Alloy.Memory.tool/1builds it, andmemory:is shorthand for it.- Memory calls run through the tool executor, so
:before_tool_callmiddleware, tool events,:tool_timeoutandresult.tool_callscover them; they bypassed all four. - They run one at a time in call order.
- Memory now works with every provider: Anthropic gets its native
memory_20250818tool, and the others get a function tool with the same commands. - Store callbacks now run in a supervised task, like every tool, not in
the process that called
Alloy.run/2. Stores that rely on the calling process need checking: the process dictionary, caller-owned ETS tables, Logger metadata, or aRepo.transactionaround the run. - A store that raises now becomes an error result the model reads (and is logged), instead of crashing the run.
- Memory calls run through the tool executor, so
- Compaction is middleware.
Alloy.Context.CompactorimplementsAlloy.Middleware, andAlloy.run/2puts it last so it budgets inputs prepared by caller middleware.compaction: falseturns it off, and listing it in:middlewarechooses its position.- A hand-built
%Config{}gets no compaction unless it lists the compactor. - On a context-overflow error the loop runs the new
:on_context_overflowhook and retries once, only if the messages changed. 0.12 retried even when nothing could be removed. :after_compactionand[:alloy, :compaction, :done]now also fire after that forced compaction.- The retried request runs
:before_completionagain, including compaction. A history still estimated over budget can be compacted again in that turn. [:alloy, :turn, :prompt_too_long_recovery]fires on a turn's first overflow as before, and now carriesretry: true | false.
- A middleware halt keeps the work done before it in that hook. In
0.12 a halt returned the state from before the hook ran. Now a halt
after compaction keeps the compacted history and the summary request's
usage. Middleware can return
{:halt, reason, state}to keep its own changes as well. - Module tools are validated like inline tools at startup. An invalid
strict?/0,input_examples/0,defer_loading?/0ornative_types/0raisesArgumentError. - Tool names must be unique. Two tools with the same name raise at startup instead of reaching the API, which rejects them.
- Assistant messages record where they came from.
- New fields:
message.provider,message.model, andmessage.origin. The origin is a hash of the provider module,:api_urland:api_key; the key itself is never stored. - Code that compares whole messages with
==sees the new fields. Messages you build yourself leave themnil. - Persist all three with transcripts. A message without an origin is sent as it is.
- New fields:
- Release publication now requires the full
mix cigate, warning-free docs, and a tag matching the package version.
Performance
- Reuse resolved tool schemas across agent turns when their input schemas are unchanged. Schema changes are checked before execution; cache entries remain bounded to the active tool set and never appear in result/session metadata.
Fixed
Gemini tools use
parametersJsonSchemaso valid JSON Schema keywords such asadditionalPropertiesare accepted by the API instead of producing HTTP 400.Compaction summary requests omit thinking and redacted thinking blocks, including string-keyed blocks, while preserving visible text and tool evidence.
Subscription-sharing quota exhaustion is not retried as transient throttling.
Provider retries honor HTTP-date
Retry-Afterheaders as well as numeric delays.Codex
tool_usereplies with no calls return a typed:malformed_replyfailure, retried within the existing attempt/deadline budget on fresh calls. Text accompanying an empty call list is never silently treated as completed work.Switching provider, endpoint or account mid-conversation no longer sends one origin's signed reasoning to another. That failed with HTTP 400s such as
invalid_encrypted_contentor an invalid thinking signature. It covers a fallback provider, an OpenAI fallback on another organisation's key, and a model switch to another provider. Before every request the loop appliesAlloy.Message.normalize_for/3, following pi's rules:- another provider's thinking becomes text;
- its redacted thinking, raw OpenAI/xAI items and server tool records are dropped;
- signatures are removed, and blank text blocks (kept only for a signature, and rejected by Anthropic) are dropped;
- tool-call ids Anthropic would reject (Kimi's
functions.read:0, for one) are rewritten together with their results.
Switching models with the same provider and credentials keeps everything, as Anthropic, OpenAI and Gemini document. Messages without an origin (built by hand, or saved without it) are sent unchanged.
Gemini tool calls written by another provider get Google's documented placeholder thought signature (
skip_thought_signature_validator) on the first call of each step, so Gemini 3 accepts a tool loop that started elsewhere.Anthropic thinking without a signature (written by hand, or by a reasoning model behind OpenAICompat) is sent as text instead of failing the request; empty unsigned thinking is dropped.
0.12.5 - 2026-10-09
Security
:allowed_pathsis enforced on a directory boundary. It was a string prefix match, so allowing/projalso admitted/proj-secrets/key.txt. The path that was checked (symlinks resolved) is now the path that is opened, and a symlink loop returns an error instead of hanging the tool. Custom tools callingAlloy.Tool.resolve_path/2with:allowed_pathsset get that resolved path (for example/private/var/...on macOS).- The bash tool no longer passes secrets to commands. Variables whose
names contain
KEY,TOKEN,SECRET,PASSWORDorCREDENTIALare removed from the command's environment by default, so a prompt-injectedprintenvcan't read your API keys. Pass:bash_envin the tool context (a map of the variables to set, or:inheritfor the previous behaviour) if a command needs one. - Bash timeouts kill the command. A timeout stopped only the Elixir task,
so the command kept running; the whole process group (including background
jobs) is now killed. Output is capped while it streams (the first 8 KB and
last 20 KB are kept), so a command printing hundreds of megabytes no longer
exhausts memory, and the model-requested timeout is capped (10 minutes, or
:bash_max_timeout). - Memory tool paths are validated strictly.
/memories_evil/...,/memories..and percent-encoded..were accepted, and the model could delete or rename the/memoriesroot. - Codex no longer copies
auth.jsoninto temp directories, and the temp directory holding the prompt (the whole conversation) is created0700instead of the default mode, which left it readable on a shared/tmp. - Mint is now constrained to
~> 1.11(and through it HPAX~> 1.1). Mint 1.9 and earlier carry several advisories on the HTTP/1 client path every Alloy provider uses by default, including memory-exhaustion DoS from unbounded response headers and chunked bodies (CVE-2026-58229, CVE-2026-56810, CVE-2026-82728) and response smuggling on pooled connections (CVE-2026-82672, CVE-2026-94194, CVE-2026-59249), plus HTTP/2 issues (CVE-2026-91043, CVE-2026-92103, CVE-2026-59246). HPAX before 1.0.4 has an HPACK decoding DoS (CVE-2026-58226). These matter because Alloy talks to user-configured, possibly untrusted, OpenAI-compatible endpoints. If your application pins Mint below 1.11, runmix deps.update mint hpax. - Req is required at
>= 0.6.1 and < 0.8.0(tested on 0.7.5).
Changed
- Built-in providers return
{:error, %Alloy.Provider.Error{}}instead of a string when called directly.Alloy.run/2andAlloy.Agent.Serverare unaffected:result.erroris still the same string (Exception.message/1of the struct), and the struct is added atresult.metadata.run.provider_error. The struct implementsString.Chars, so interpolating it still works; code that applies=~or binary patterns to a provider's raw error should useException.message/1. Messages keep their"<type>: <message>"shape when the error body has a type; untyped bodies now read"HTTP <status>: <message>"(OpenAICompat produced": message", Gemini"429: message"), and a blocked Gemini prompt is a:refusalinstead of an error.Alloy.Provider.OpenAIStream.stream/5returns the struct too. - Turn telemetry fires in order. Each
[:alloy, :turn, :stop]is emitted when that turn ends; previously the loop recursed first, so stops arrived in reverse and turn 1's stop carried the run's final status. A turn the loop continues past now reportsstatus: :running. Dashboards that read a turn's stop status as the run outcome should use[:alloy, :run, :stop]. Alloy.Agent.Server.chat/3andstream_chat/4return{:error, result}for:budget_exceeded, asAlloy.run/2always did (it returned{:ok, result}), and its default call timeout is the agent'stimeout_msplus 10 seconds instead of 30 seconds, so a caller no longer gives up while the turn is still running.- Compaction strips stale reasoning. Claude Fable 5.1, Opus 5.5,
Sonnet 5.5 and Haiku 5.5 reject signed thinking whose earlier history
changed, for accounts created on or after 2026-08-31. After any
compaction, every thinking block is removed, including the turn in
progress, which was produced before the rewrite. This is the documented
valid change, and those models think adaptively, which doesn't require the
turn to start with thinking. Under manual thinking (
:extended_thinking, or"type" => "enabled"in:extra_body), which does require it and whose models don't check history, the turn in progress keeps its thinking. Truncation never splits a tool round, and oversized retained tool results are shortened with a marker. Alloy.Context.Compactor: incompact_messages/2,:keep_recentis a minimum (whole tool rounds are kept) andredacted_thinkingblocks are dropped with other earlier-turn thinking;force_compact/1always summarizes, which costs a provider call.- A limit-only
model_metadata_overridesentry for a catalog model now also covers its dated snapshots (-2026-03-05,-20251001,-0309-...) but not other suffixes such as-fast; givesuffix_patternsfor those. Alloy.run/2raisesArgumentErrorfor an:on_eventthat is not a 1-arity function, asAlloy.stream/3already did.- The compaction estimate counts the whole request — system prompt, tool definitions and every block type, by bytes rather than characters (CJK text was undercounted about 3x) — so compaction fires earlier and more accurately.
- A tool is not called when the model omits a
requiredkey (or sends non-object input); the model gets an error result naming the missing keys instead of aFunctionClauseErrorit can't act on. If a tool supplies a default for a key, remove that key fromrequired. Types are not checked or coerced. - Every tool call runs in a supervised, unlinked task (previously
sequential tools ran in the agent process).
self()and the process dictionary inside a tool differ for sequential tools; Ecto's SQL sandbox still works through$callers. Event and telemetry handlers for tool start/end now run in the agent process. Alloy.Testing.tool_response/2gives tools input as real providers do: a map goes through a JSON round trip, so keys are strings and atom values become strings (%{unit: :celsius}arrives as%{"unit" => "celsius"}; expect"celsius"inassert_tool_called/3). Tests that relied on atom keys were passing for the wrong reason; update the tool or the test.- Codex runs against your real
CODEX_HOME(or:codex_home) with--ignore-user-config --ignore-rules, and requires Codex CLI 0.122.0 or later. Your$CODEX_HOME/AGENTS.mdand skills now reach Alloy runs; for full isolation, and to keep agents from refreshing the same token as your interactive Codex, log in to a dedicated home (CODEX_HOME=~/.codex-alloy codex login) and pass it as:codex_home. Codex failures return%Alloy.Provider.Error{}; timeouts are retried within the turn deadline.response_metadata.command_outputis now the JSONL event stream. - OpenAI, xAI and OpenAI-compatible providers no longer send a default
output cap (
max_output_tokens/max_tokenswere 4,096). Reasoning tokens count against the cap on current models, so responses came back incomplete or empty. Set:max_tokensto cap output; some OpenAI-compatible servers have small defaults of their own. usage.input_tokensmeans uncached input for every built-in provider. OpenAI-family and Gemini usage now reports cache reads incache_read_input_tokens(and writes incache_creation_input_tokens) instead of insideinput_tokens, matching Anthropic. Total prompt tokens are the sum of the three. Reportedinput_tokens— and with themAlloy.Usage.total/1andAlloy.Usage.estimate_cost/3— drop by the cached amount.Alloy.Provider.SSE.process_chunk/2scans only the new bytes for event boundaries (a large event went from 663 ms to 8 ms), sobuffermust be the remainder returned by the previous call, as in normal use.- Anthropic default
max_tokensis 16,000 (was 4,096). Adaptive thinking is on by default on Claude 5.x and counts towardmax_tokens, so the old default truncated answers. Set:max_tokensto keep a lower cap. - Anthropic code execution uses
code_execution_20260521(required for programmatic tool calling), and Alloy no longer adds beta headers for features that went GA on 2026-02-17 (memory, tool search, input examples, code execution).context-management-2025-06-27is still added when the body uses context editing; user-suppliedanthropic-betavalues are merged into one header. - OpenAI context limits are the documented maximum input, not the
advertised window (which includes output):
gpt-5.4/gpt-5.5and the GPT-6 family budget 922,000 tokens,gpt-5/5.1/5.2272,000. Compaction now fires before the API rejects the request instead of after. - Long-tail OpenAI-compatible models (Kimi, Qwen, GLM, Mistral, Gemma)
are no longer in the built-in catalog, because their limits could not be
verified; they use the 200,000-token default. Set
model_metadata_overridesor a:model_catalogfor them. Compaction may fire earlier than before, which is the safe direction. - Restrict test-only Plug to patched 1.19/1.20 versions.
- Pin the contributor toolchain to Elixir 1.20.4 / OTP 28.5.0.7, add OTP 29 coverage, dependency audits, weekly CI, and explicit read-only CI permissions.
- Stricter quality gates.
mix ciruns every gate CI enforces: format, unused-lock check,hex.audit(advisories), warnings-as-errors compile, compile-time cycle check, strict Credo with opt-in correctness checks, tests with a coverage floor, and Dialyzer with:unmatched_returns,:missing_return,:extra_returnand:error_handling. Docs must build without warnings.
Added
More provider stop reasons.
Alloy.Provider.stop_reason/0adds:max_tokens,:refusaland:pause_turn, andAlloy.Resultgains a:stop_reasonfield. The loop now:- completes a truncated answer (
:max_tokens) withresult.stop_reason == :max_tokens, so callers can detect truncation instead of receiving it silently; - fails the run when
:max_tokenscuts off a tool call (its arguments are incomplete). The orphaned call gets an error result, so the transcript stays valid for a follow-up request; - fails on
:refusaland discards the refused partial output; - resends the conversation unchanged on
:pause_turn.
Custom providers that only return
:tool_use/:end_turnare unaffected. A provider returning an unknown stop reason now fails the run with a clear error instead of crashing the loop.- completes a truncated answer (
Codex reports token usage from
codex exec --jsonturn.completedevents (it reported zero), and a:config_overridesoption passes-csettings to the CLI.Alloy.Result.wrap/1(the status →{:ok, _}/{:error, _}mapping shared byAlloy.run/2andAlloy.Agent.Server),Alloy.Agent.Server.default_call_timeout/1andAlloy.Context.Compactor.force_compact/2.Telemetry:
[:alloy, :turn, :exception]and[:alloy, :run, :exception](withkind,reason,stacktrace); turn start gainsmonotonic_time, turn stop gainsdurationandmonotonic_time, and turn metadata gainstelemetry_span_context. The compaction summary request emits[:alloy, :provider, :request].Read pages large files: output ends with
[Showing lines X-Y of N. Use offset=Z to continue.]when cut, and binary files are refused.Alloy.Provider.Error.from_body/1for errors a provider reports inside a 200 response (mid-streamerrorevents, failed responses).OpenAI Responses replay keeps every output item. Assistant
phase(which gpt-5.3-codex and later expect back) and items such as built-in tool calls and compaction items are preserved as%{type: "output_item", raw: item}blocks instead of being dropped.Anthropic
:server_tools— raw server tool definitions (web search, web fetch,mcp_toolset, tool search) appended after the generated tools, so local and server tools can be combined. Previously the only route wasextra_body["tools"], which replaces every generated tool.Anthropic programmatic tool calling works.
allowed_callersatoms are translated to the API's values (:code_execution→"code_execution_20260120",:human/:direct→"direct"), thecallerfield is kept ontool_useblocks, and the code-execution container is reused across turns viaprovider_state(skipped once itsexpires_athas passed, so a resumed session gets a fresh container).Model catalog: current models. Claude Opus 4.7, Opus 5/5.5, Sonnet 5/5.5, Haiku 5.5, Fable 5.1 and Mythos (1M); GPT-6 Astra/Sol/Luna, GPT-6.1 Sol and GPT-5.6 Sol/Terra/Luna; Gemini 3.1 Flash-Lite, 3.5–3.8 Flash and 3.5 Flash-Lite; Grok 4.5–4.7 and Build 0.1. Every limit was checked against the vendor's model pages on 2026-10-09 and the source is cited in the code.
Alloy.Provider.Error— structured provider failures with a:kind(:rate_limited,:overloaded,:server_error,:timeout,:network,:context_overflow,:quota,:auth,:invalid_request,:unknown), plus:status,:type,:codeand:retry_after_ms. Custom providers may return it; string errors keep working.
Deprecated
:max_budget_cents(removed in 0.13). It stops a run only when the provider reportsusage.estimated_cost_cents, which no built-in provider does, so with them it never fired. A warning is logged once per node when it is set. TheAlloymodule docs have a "Budget limits" recipe: a:before_completionmiddleware that pricesstate.usagewithAlloy.Usage.estimate_cost/3.Alloy.Agent.State.materialize/1,Alloy.Agent.State.cleanup/1and themessages_newfield (removed in 0.13): the history now lives instate.messages.- Codex
:auth_path(removed in 0.13; a warning is logged once per node). Use:codex_home. Anauth.jsonpath uses its directory asCODEX_HOME; a file with another name is still copied into a private per-call home, as in 0.12.4. - Anthropic
:extended_thinking(removed in 0.13). It sends manual thinking (type: "enabled"withbudget_tokens), which Claude 4.7 and later reject. It keeps working for older models; for current ones passextra_body: %{"thinking" => %{"type" => "adaptive"}}(see the provider docs for effort anddisplay). Alloy.ModelMetadata.catalog/0. The built-in catalog is now a short list of family patterns; the function keeps its entry shape (one entry per family, empty:name, full-id pattern as the suffix pattern) and will be removed in 0.13. Usecontext_window/1.Alloy.Message.server_tool_result_block/3. No provider accepts the block it builds; it will be removed in 0.13.
Fixed
- A streamed tool call keeps its id when later chunks repeat it as
null. Some OpenAI-compatible hosts (DeepInfra, serving DeepSeek and GLM) send"id": nullon every chunk after the first, which overwrote the real id; the next request then echoed a nulltool_call_idand was rejected. Chunks carrying"tool_calls": nullare also accepted. Thanks @johns10 (#50). until_toolrequires a successful call. A failed, blocked or unknown call to the target tool used to satisfy it.- A middleware halt no longer leaves an unanswered tool call. Halting in
:before_tool_callor:after_tool_requestleft the assistant'stool_usewithout a result, so the next request in that session failed with HTTP 400; each call now gets an error result first. - A tool named
memoryworks when:memoryis not configured (the turn crashed with aKeyError); configuring both:memoryand a tool namedmemoryraises at startup instead of silently shadowing the tool. - The compaction summary call goes through retries and the turn deadline, and its token usage is counted. Results that compaction already cleared are not cleared again (which lost their original size and invalidated the prompt cache).
- A stream callback that raises no longer corrupts history. Text from a
delta whose
on_chunk/on_eventraised was missing from the stored message, so the UI and the transcript disagreed. A raised exception is now logged and the stream continues; athroworexitfrom a callback still stops the stream, as before. Alloy.run/2passes:on_eventthrough (it was silently ignored), and the documented top-levelcode_execution: truenow reaches the provider.Alloy.Usage.estimate_cost/3no longer rounds per-million rates to whole cents ($0.075/M priced as 8¢).- A tool that calls
exit/1orthrow/1no longer kills the agent, and:tool_timeoutnow applies toconcurrent?: falsetools too (they had no time limit; they are now stopped after:tool_timeout, 120 s by default). Cancelling a turn (Alloy.Agent.Server.cancel_request/2) still stops its in-flight tools: a supervised watcher kills them when the turn is killed. - Tools run in the order the model called them. Sequential tools used to
run before every concurrent one, so
[read f, edit f]read the file after editing it. Consecutive concurrency-safe calls still run in parallel (at mostSystem.schedulers_online/0at once, as before). - Invalid UTF-8 in a tool result no longer breaks the session. Reading a binary file put bytes in the transcript that failed JSON encoding on every later request; results are now sanitised.
- Tool start/end events and telemetry pair up when a tool times out or crashes (the end event had no start sequence and a zero duration).
- Edit rejects an empty
old_string(withreplace_allit inserted the replacement between every character) and no-op edits, matches LF text in CRLF files and keeps their line endings and BOM. - Read validates
offset/limit(anoffsetof 0 dropped the last line; a negativelimitreturned the file's tail) and reports the line count when the offset is past the end. - Memory tool:
view_rangeis honoured andnew_stris optional, as the tool contract specifies. Alloy.Testing.assert_tool_called/3works withrequireas well asuse.- Codex keeps your login. Each call copied
auth.jsoninto a tempCODEX_HOMEand deleted it afterwards, discarding refreshed tokens; since Codex CLI 0.136.0 a reused refresh token forces a re-login. Keyring credentials and:profile(broken since CLI 0.134.0) now work too. - Codex: an explicit
timeout_ms: nilno longer raisesEnum.EmptyError, a missing:workdiris reported by name instead of as "exit status 2", and every Codex failure is an%Alloy.Provider.Error{}(malformed responses were plain strings). - Cancelled or timed-out Codex turns no longer leak the
codexprocess, its children or temp files: a supervised owner process monitors the caller and stops the whole process group. - OpenAI Responses (and xAI) no longer chain responses on their own.
Every response's id was fed back as
previous_response_idwhile the full history was still sent, so from the second request of a run the server replayed the conversation twice — duplicated context and billing — and withstore: falsethe request pointed at a response that was never stored. The stateless encrypted-reasoning echo was also switched off after the first request. Chaining is now explicit: pass:previous_response_idand send only the new messages. If you continued a stored response by passingprovider_state: %{response_id: id}, passprevious_response_id: idinstead — that state is no longer sent. - OpenAI family:
response.failed,response.incomplete,errorevents and cut-off streams are errors or:max_tokens/:refusalinstead of partial successes; Chat Completionslengthmaps to:max_tokensandcontent_filterto:refusal;- OpenAICompat sends
reasoning_contentback on assistant messages, which DeepSeek's thinking mode requires during tool calls (it returned HTTP 400 on the second request of every tool loop); - atom keys in OpenAICompat
extra_bodynow override generated fields (they produced duplicate JSON keys and were ignored).
- Opaque OpenAI items no longer break other providers. When a transcript
moves from OpenAI Responses to Anthropic or Gemini (for example through
fallback_providers),reasoningandoutput_itemblocks are dropped instead of being sent as invalid blocks (Anthropic) or placeholder text (Gemini). - Anthropic:
- every stop reason is mapped (
max_tokens,model_context_window_exceeded,refusalwith itsstop_details,pause_turn) instead of collapsing to:end_turn; - streamed usage is no longer double-counted (
message_deltausage is cumulative; the docs' example reported 13,361 input tokens instead of 10,682); - mid-stream
errorevents, streams that end without a stop reason and error bodies on a 200 response are errors, not partial successes; an overload before any output is retried; - with
cache: true,cache_controlis never put on adefer_loadingtool (HTTP 400).
- every stop reason is mapped (
- Gemini:
- streamed text no longer gains a newline between chunks
(
"Hello\n world"); consecutive text and thought pieces are merged and thought signatures stay on the block they arrived with; output_tokensnow includes thinking tokens (billed as output), andinput_tokensexcludes cache reads (reported ascache_read_input_tokens, matching Anthropic) and includes tool-use prompt tokens;maxOutputTokensis sent only when:max_tokensis set; the old 4096 default also had to fit thinking, so 3.x responses were cut short;finishReasonmaps to:max_tokens/:refusal(details inresponse_metadata.stop_details), blocked prompts are a:refusal, and malformed or unexpected function calls are retryable errors;- mid-stream error chunks and streams cut off before a
finishReasonare errors instead of partial successes.
- streamed text no longer gains a newline between chunks
(
- Overstated context windows. Grok 4.20 was listed at 2M (documented 1M)
and retired Grok slugs at up to 2M, so compaction never fired before the
API rejected the request. Claude Opus/Sonnet 4.6 were listed at 200k (now
1M), and
claude-fable-5-1fell through to the default. - Retries are classified on HTTP status and error code, not message
text. Previously not retried: Anthropic
api_error(500) andtimeout_error(504), OpenAI 503server_is_overloadedand 429s whose type was notrate_limit_error. Quota and spend-limit 429s (insufficient_quota,*_spend_limit_exceeded) are no longer retried.Retry-After/retry-after-msis honoured, within the turn deadline. - Context-overflow recovery now works for Gemini and OpenAI Responses. Their overflow errors ("exceeds the maximum number of tokens", "exceeds the context window") were not recognised, so the one-shot compaction retry never ran.
- A
:tool_useresponse with no client tool calls (only server-executed tools) now completes instead of sending an empty tool-results message. - Anthropic server tools are no longer answered by the client. When a
response mixed a server tool (
code_execution,web_search, tool search) with a local tool call, Alloy also "executed" theserver_tool_useblock and sent back aserver_tool_result, a block type the API rejects, so the next request failed with HTTP 400.Alloy.Message.tool_calls/1now returns only clienttool_useblocks. Transcripts persisted by earlier versions still work: the Anthropic provider drops staleserver_tool_resultblocks when it builds a request. - OpenAI-compatible Gemini streams preserve opaque thought signatures on tool calls, including late signatures and parallel calls, for the next request.
- OpenAICompat's
stream_options: falsenow omits the field from streaming requests. Explicitextra_bodystream option maps are preserved. - Codex process timeouts use an absolute monotonic deadline, so progress output
cannot extend
:timeout_msor the turn's:receive_timeoutcap. - The Codex provider now honours the turn deadline in real runs. The
0.12.4 note claimed this, but the retry loop passes the deadline as
req_options: [receive_timeout: ms]and Codex only read a top-level:receive_timeout, so production runs always waited the full:timeout_ms. All three caps are now respected; the smallest wins.
0.12.4 - 2026-07-03
Fixed
Alloy.Testingdefault tools now ship in Hex. The default echo tool is an inlineAlloy.Tool.Inlineinstead of atest/supportmodule.- Signed thinking blocks are never truncated. Deterministic fallback compaction now drops signed thinking blocks instead of mutating provider signatures.
- Tool crash results are model-legible. Tool result errors are one actionable line, while full stacktraces remain in logs and telemetry.
- Codex provider honors turn deadlines.
:receive_timeoutnow caps the Codex port timeout and still kills the subprocess on expiry.
Added
- Batched tool-result clearing before summary compaction. Old
tool_resultandserver_tool_resultcontent is cleared in one batch before any summarizer call, with:clear_tool_results,:keep_recent_tool_results, and[:alloy, :compaction, :cleared]bytes_clearedtelemetry. :thinkingonAlloy.Result(#36): a run result now surfaces the final assistant reasoning text alongside:text, so callers no longer have to dig it out of the last message's content blocks. Adds anAlloy.Message.thinking/1helper for per-message extraction.- User-owned compaction prompts.
:summary_system_promptand:summary_promptare now configurable undercompaction:. - OpenAI Responses reasoning persistence. Stateless Responses calls request
reasoning.encrypted_content, preserve raw reasoning items, and round-trip them before related function calls. - Strict tool schemas. Tools can opt into
strict?/0orstrict: true; OpenAI, OpenAICompat, and Anthropic emit strict tool definitions, and Alloy validatesadditionalProperties: false. - Anthropic advanced tool-use metadata. Tools can provide
input_examplesanddefer_loading; Anthropic emits the fields and merges theadvanced-tool-use-2025-11-20beta header when needed. - Anthropic
extra_bodypassthrough. Provider-specific body fields such as server-side MCP connector config can be merged into the request.
Changed
- Anthropic prompt caching adds a conversation-tail breakpoint. With
cache: true, the last content block of the last message getscache_control, alongside existing system/tool breakpoints. - Docs grouping updated.
Alloy.Eventsis grouped under Core,Alloy.Agent.Eventsis left ungrouped as the deprecated shim, andAlloy.Memory/Alloy.Memory.Routerhave a Memory group.
Docs
- README documents non-goals, the compaction knobs and cache trade-off, strict tools, Anthropic input examples/deferred loading, and OpenAI reasoning-item persistence.
- MCP recipe documents remote Anthropic MCP mounting via
mcp_servers, beta headers, and provider passthrough while keeping the client-side recipe for local/stdio MCP.
0.12.3 - 2026-06-11
Fixed
- Gemini 3.x thought signatures in
OpenAICompat(lands PR #24):thought_signaturefromextra_content.googleis preserved on tool_use blocks and echoed back on subsequent turns — without it Gemini 3.x returns HTTP 400 on multi-turn tool calls. Also handles Gemini's list-shaped error bodies (previously aFunctionClauseError) and adds aparse_errorcatch-all. Config.on_shutdowntype broadened to(struct() -> any())(#40) soalloy_agent's session struct satisfies dialyzer without a suppression.
Added
extra_bodyon the native OpenAI (Responses) provider (#18), merged last so callers can override any request field; atom keys are stringified. Brings the Responses provider to parity withOpenAICompat.grok-4.3in the model catalog (lands PR #41): xAI's current frontier model, 1M context window; xAI provider docs updated to reference it.Mistral usage example in the
OpenAICompatmoduledoc (#19).Model catalog refresh. Added
claude-fable-5andclaude-opus-4-8(1M-token context windows),gpt-5.5, andgemini-3.5-flashto the built-in catalog.Docs: v1 event envelope specification (
docs/events.md) documenting the:on_eventcontract; a runnable Livebook quickstart (livebooks/quickstart.livemd); README repositioned around the harness-not-framework premise with honest bash-sandboxing language.alloy_agentstatus clarified. README and the migration doc now state plainly thatalloy_agentis not yet on Hex and that the 0.13 removals will not happen before it ships.Inline tool definitions (
Alloy.Tool.inline/1). Tools can now be defined as data — anAlloy.Tool.Inlinestruct withname,description,input_schema, and a 2-arityexecutefunction — and passed intools:alongside tool modules. This unlocks tools discovered at runtime (e.g., building one tool per MCP-server tool from its discovery response — see the MCP recipe) and one-off tools that don't warrant a module. Optional fields mirror the behaviour's optional callbacks (concurrent?,max_result_chars,allowed_callers,result_type). The executor treats both kinds identically: same crash isolation, truncation, events, and parallel execution.Alloy.Testing.run_with_responses/3accepts:context, so tools that read from the agent context can be tested without dropping down toAlloy.run/2.Recipes (hexdocs guides). Two new documented, tested patterns instead of new core features: Sub-agents as tools (delegation via a ~30-line tool whose
execute/2callsAlloy.run/2, verified verbatim intest/alloy/recipes/sub_agent_recipe_test.exs) and MCP servers as tools (a single gateway tool overanubis_mcp, keeping context cost to one tool definition). Core stays loop-only by design.Pluggable model catalog (
Alloy.ModelCatalog). The built-inAlloy.ModelMetadatais now just the default implementation of a new behaviour. Pass any module implementingcontext_window/1(and optionallydefault_context_window/0) via the new:model_catalogoption to source context windows from your own catalog — a static map, your own service, or an adapter overllm_db. Resolution order: explicit:max_tokens→:model_metadata_overrides→:model_catalog→ default window.Alloy.ModelMetadata.override_window/2is new public API supporting this split. Fully backward compatible: the default catalog and override semantics are unchanged.
Changed
- Elixir 1.20 / OTP 28 support. Verified on Elixir 1.20.1 (gradual type
checker) with zero warnings; CI matrix now tests 1.20/OTP 28 and 1.19/OTP 27.
The
~> 1.17requirement is unchanged. - req
~> 0.6(security). req 0.6.0 fixes GHSA-px9f-whj3-246m (multipart header injection) and GHSA-655f-mp8p-96gv (decompression bomb). The floor is bumped because Alloy can target user-configured OpenAI-compatible endpoints, which is the malicious-server vector the bomb fix addresses. - Dev/test deps updated: credo 1.7.19 (1.7.16 crashes under Elixir 1.20), jason 1.4.5, telemetry 1.4.2, plug 1.19.2, ex_doc 0.40.3.
Fixed
- Removed a dead
parse_assistant_content/1fallback clause inAlloy.Provider.OpenAI(flagged as unreachable by the Elixir 1.20 type checker). - Internal tests no longer call the deprecated
Alloy.Agent.Eventsshim; the suite now exercisesAlloy.Eventsdirectly (test/alloy/events_test.exs).
0.12.2 - 2026-04-26
Changed
Alloy.Eventsis the new canonical module for v1 event envelope construction. The implementation moved fromAlloy.Agent.Eventsto the top-level namespace becauseAlloy.Agent.Turn(the protocol loop) calls it directly — anything Turn calls is, by definition, part of Alloy's protocol surface, not a runtime concern.Alloy.Agent.Eventsis now a@deprecatedthin shim that delegates toAlloy.Events. External callers receive compile-time deprecation warnings and should switch theiraliaslines fromAlloy.Agent.EventstoAlloy.Events. The shim will be removed in Alloy 0.13.0.
Corrected
- Retracts the 0.12.1 guidance to migrate
Alloy.Agent.Events→AlloyAgent.Events. That guidance was wrong:Alloy.Agent.Turndepends on event envelope construction, so the v1 envelope format is protocol-layer (stays in Alloy), not runtime-layer (move toalloy_agent). The migration table indocs/MIGRATION-alloy_agent.mdhas been updated to point atAlloy.Eventsinstead. Users who already migrated toAlloyAgent.Eventsbased on 0.12.1 should switch back toAlloy.Events; the two implementations are byte-equivalent today, but onlyAlloy.Eventswill receive future protocol updates. Alloy.Agent.ServerandAlloy.Sessiondeprecation guidance is unchanged — those modules still move toalloy_agentasAlloyAgent.ServerandAlloyAgent.Session(they are runtime concerns Turn doesn't depend on).
0.12.1 - 2026-04-24
Deprecated
Alloy.Agent.Server,Alloy.Session, andAlloy.Agent.Eventsare now documented as deprecated in HexDocs (warning admonitions on each@moduledoc). These modules moved to the newalloy_agentpackage asAlloyAgent.Server,AlloyAgent.Session, andAlloyAgent.Events. The copies in Alloy continue to work unchanged in 0.12.x and will be removed in 0.13.0.
No
@deprecatedattribute / compile-time warnings yet. The protocol loop (Alloy.Agent.Turn) still callsAlloy.Agent.Eventsinternally, so adding@deprecatedwould breakmix compile --warnings-as-errorsfor Alloy itself. The protocol/runtime split for events will be tightened in a follow-up patch ahead of 0.13.0; in the meantime, the HexDocs admonitions and the migration table below are the migration signal.
Why
Alloy is refocusing as a protocol library: the loop, providers, tools, memory behaviour, message types. Runtime concerns (supervised processes, sessions, async dispatch, PubSub, backpressure, default memory stores) belong in the application layer, where OTP already gives you the primitives. alloy_agent is the opt-in runtime wrapper for users who want a supervised agent without wiring a GenServer themselves.
Elixir's value proposition here is stronger than in Python or TypeScript: the BEAM already is the runtime. A protocol library that composes with OTP beats a runtime library that competes with it.
Migration
Add {:alloy_agent, "~> 0.1"} to your deps, then:
| Before (Alloy 0.12.0) | After (alloy_agent 0.1.0) |
|---|---|
alias Alloy.Agent.Server | alias AlloyAgent.Server (or just alias AlloyAgent) |
%Alloy.Session{} | %AlloyAgent.Session{} |
Alloy.Session.new/1 | AlloyAgent.Session.new/1 |
Alloy.send_message/3 | AlloyAgent.send_message/3 |
Alloy.cancel_request/2 | AlloyAgent.cancel_request/2 |
Code that uses only Alloy.run/2, Alloy.stream/3, tools, providers, messages, or the memory behaviour needs no changes.
Not changed
- No runtime behaviour change in this release. The deprecated modules work exactly as they did in 0.12.0. This is a soft-migration patch — you have until Alloy 0.13.0 to move your imports.
0.12.0 - 2026-04-24
Added
Alloy.Memorybehaviour — first-class protocol for Anthropic'smemory_20250818tool. Six callbacks (view,create,str_replace,insert,delete,rename) that any store can implement, matching the split used by Anthropic's own Python SDK (BetaAbstractMemoryTool). Memory is a protocol-level primitive with application-level storage — Alloy ships the behaviour, wire format, and path validation; user code (or futurealloy_agent) ships the backing store.- Anthropic provider memory wiring — passing
memory: {StoreModule, store_opts}toAlloy.run/2when usingAlloy.Provider.Anthropicnow injects thememory_20250818tool into the request and adds thecontext-management-2025-06-27beta header. Memory tool calls are routed throughAlloy.Memory.Routerrather than the generic tool executor, keeping the pipelines clean. Alloy.run/2:memoryoption — validates at entry that memory requiresAlloy.Provider.Anthropic(raisesArgumentErrorotherwise, with a clear migration path). Other providers will be wired as they ship their own memory primitives.- Model catalog — added context-window entries for:
- Kimi K2.5, K2.6 (Moonshot AI, 256K) — via
OpenAICompatatapi.moonshot.ai - Gemma 4 (Google open-weight, 256K) — via
Geminiprovider - GLM-4.6 (Zhipu AI, 200K) — via
OpenAICompatatopen.bigmodel.cn - Qwen 3 family —
qwen3-max/qwen3-coder-plus(up to 1M context),qwen3-vl-plus,qwen3-omni-flash,qwen3.5-397b-a17b— viaOpenAICompatat DashScope - Mistral Large 3 (
mistral-large-2512, 256K) — viaOpenAICompatatapi.mistral.ai
- Kimi K2.5, K2.6 (Moonshot AI, 256K) — via
Notes
- Memory is non-breaking: existing callers who do not pass
:memorysee zero behavioural change. - The
context-management-2025-06-27beta header is injected only when memory is configured. Accounts without beta access continue to see requests exactly as before. - The 1M-context Qwen 3 entries (
qwen3-coder-plus,qwen3.5-397b-a17b) are notable — they offer a larger window than the current OpenAI/Anthropic ceilings and slot into Alloy through the genericOpenAICompatprovider with no new code.
0.11.0 - 2026-04-21
Added
- grok-4.20 family in the model catalog —
grok-4.20-0309-reasoning,grok-4.20-0309-non-reasoning, andgrok-4.20-multi-agent-0309now register their real 2M-token context window inAlloy.ModelMetadata. Users who explicitly pass one of these model IDs toAlloy.Provider.XAIno longer hit the generic 200K fallback in the Compactor. Suffix patterns use regex so future-MMDDsnapshots on the same family don't need a catalog update. - Provider typespec parity — every provider that implements the
Alloy.Providerbehaviour now exposes a@type configand@speconcomplete/3andstream/4. Users who run dialyzer get type-checking at call sites for all six providers (previously onlyCodex). No runtime change — this is purely a tooling-visibility improvement.
Changed
Alloy.Provider.XAIdocstring example — now usesgrok-4.20-0309-reasoningas the default-suggestion model (wasgrok-4) to reflect the current xAI API frontier.
0.10.2 - 2026-04-18
Fixed
- Codex subprocess leak on timeout —
Alloy.Provider.Codexnow spawns codex viaPort.openand explicitly kills the OS process (SIGTERM → 100ms grace → SIGKILL) when:timeout_mstrips. PreviouslyTask.shutdown(:brutal_kill)closed the BEAM task but left the/bin/sh+codexsubprocess tree running, leaking one OS process per timeout. - Codex temp-dir leak —
prepare_paths/1now cleans upbase_dirwhenprepare_codex_home/2fails mid-setup. Previously the directory was orphaned on disk because thetry/aftercleanup incomplete/3never ran. - Codex
arguments_jsondecode — falls back to a backslash-escape repair pass for invalid JSON escapes (\d,\s,\p,\A) that Codex occasionally emits from regex-containing code payloads. Decodes that previously failed withJason.DecodeErrornow retry cleanly. - UTF-8-safe truncation —
response_metadata.command_output(and other truncated fields) no longer splits multi-byte codepoints mid-sequence.truncate/2now usesString.slice/3(character budget) rather thanbinary_part/3(byte budget).
Changed
- Codex provider typespecs — added
@type configand@spectocomplete/3andstream/4; corrected invalidPath.t()references toString.t()(Elixir'sPathmodule defines not/0type). - Codex provider internals — module attribute constants replace scattered magic numbers;
Enum.reduce_while/3replaces two-pass tool-block parsing;with-guards and pattern-matching replace awkward conditional chains; catchallemit_chunks/2clause preventsstream/4crashes on unknown result shapes. Observable behaviour unchanged.
0.10.1 - 2026-04-13
Fixed
- Tool result truncation —
max_result_charsguard now uses character count (String.length) instead of byte count (byte_size). Multi-byte UTF-8 content (CJK, emoji) was triggering truncation earlier than intended. - Codex provider timeout —
run_codexnow wrapsSystem.cmdin aTaskwith a configurable timeout (default 120s). Previously a hungcodex execprocess could block the turn loop indefinitely. - Symlink path traversal —
allowed_pathsvalidation now resolves symlinks recursively viaresolve_real_path, preventing symlink-based escapes from allowed directories. - OpenAICompat nil guard — added pattern match on
tc["function"]before accessing arguments. Malformed tool call responses now return a graceful error instead of crashing the turn loop. - Testing helper —
assert_tool_calledno longer raisesArgumentErrorwhen matching string keys against atom-keyed input maps. Usessafe_atom_getwith rescue fallback. - Gemini streaming performance —
parse_stream_partsuses prepend+reverse instead of++accumulation, eliminating O(n²) behavior on large streaming responses. - Terminate ordering —
State.cleanupnow runs afteron_shutdowncallback and:session_endmiddleware, ensuring consumers can access state before resources are freed. - Middleware docs — documented that
{:edit, ...},{:block, ...}, and{:halt, ...}all stop the middleware chain immediately (first responder wins).
0.10.0 - 2026-04-12
Added
- Gemini provider —
Alloy.Provider.Geminiadds native Google Gemini support via the GenerateContent API, including streaming and tool calling. - xAI provider —
Alloy.Provider.XAIwraps the OpenAI Responses API with xAI defaults. Use{Alloy.Provider.XAI, api_key: key, model: "grok-4"}instead of manually settingapi_url. Supportsweb_search: trueandx_search: truefor Grok's native search tools. - Codex provider —
Alloy.Provider.Codexadds OpenAI Codex support with ChatGPT authentication and session management. - Tool concurrency control — tools can implement
concurrent?/0to declare whether they are safe to run in parallel. The executor runs non-concurrent tools sequentially first, then concurrent tools in parallel. Default:true. - Tool result truncation — tools can implement
max_result_chars/0to cap output length. The executor truncates results that exceed the limit, keeping head and tail. Default::unlimited. - Prompt-too-long recovery — when a provider returns a "prompt is too long" error, Alloy forces context compaction and retries the turn once before failing.
until_tooloption —Alloy.run("question", until_tool: "submit")forces the loop to continue until the model calls the named tool. If the model signals:end_turnwithout calling it, the loop injects a continuation prompt and keeps going. Useful for structured output enforcement via tool schemas.- HITL
:editvariant — middleware can return{:edit, modified_call}from:before_tool_callto rewrite tool arguments before execution. The modified call must preserve the original:idand:name. This enables human-in-the-loop argument correction, policy-based input rewriting, and tool-call sanitization.
Fixed
- Duplicate
prompt_too_long?/1clause — removed dead code (identical function clause).
0.9.0 - 2026-03-22
Breaking
Compactor.maybe_compact/1return type — now returns{:compacted | :unchanged, State.t()}instead of a bareState.t().Alloy.Context.TokenCounterremoved — token estimation logic inlined intoCompactor. Users who calledTokenCounterdirectly should useCompactorfunctions instead.
Added
:after_compactionmiddleware hook — fires after context compaction occurs, allowing middleware to inspect or modify state post-compaction.- Reasoning/thinking block parsing in OpenAICompat — DeepSeek and xAI reasoning models that return
reasoning_contentnow produce%{type: "thinking", thinking: text}blocks instead of silently dropping the reasoning data. Works in bothcomplete/3and streaming. extra_bodyconfig for OpenAICompat — passextra_body: %{"response_format" => ..., "temperature" => 0.7}to inject arbitrary provider-specific parameters into the request. Merges last so it can override defaults.- Anthropic prompt caching — pass
cache: truein Anthropic provider config to automatically addcache_controlbreakpoints to the system prompt and last tool definition. Enables 60-90% input token cost savings. Default:false(no behavior change). - 6 new telemetry events —
[:alloy, :run, :start],[:alloy, :run, :stop],[:alloy, :turn, :start],[:alloy, :turn, :stop],[:alloy, :provider, :request],[:alloy, :compaction, :done]provide full lifecycle observability for OTEL, logging, or custom metrics. - xAI grok-4.1-fast model family — dot-notation models (
grok-4.1-fast,grok-4.1-fast-reasoning,grok-4.1-fast-non-reasoning) added to the model catalog.
Fixed
- grok-4 context window — corrected from 256K to 2M tokens per xAI documentation.
0.8.0 - 2026-03-21
Added
- Cost guard —
Alloy.run/2now acceptsmax_budget_cents: Nto cap agent spend. The loop halts with:budget_exceededstatus when cumulativeestimated_cost_centsexceeds the threshold. Default isnil(no limit). - One-shot streaming helper —
Alloy.stream/3provides a simpler API for streaming agent responses without managing a GenServer.
Changed
- Summary-first context compaction —
Alloy.Context.Compactornow preserves the first message, keeps a recent token-budgeted verbatim window, and replaces older context with a single structured handoff summary generated through the configured provider. Falls back to deterministic truncation if summary generation fails. - Grouped compaction settings —
compaction: [reserve_tokens: N, keep_recent_tokens: N, fallback: :truncate]makes context compaction behavior configurable. - Reserve-based compaction trigger — compaction now starts when the conversation exceeds
max_tokens - reserve_tokensinstead of the previous fixed 90% threshold.
Fixed
- Bash tool timeout — fixed timeout override not being respected when passed via tool input.
0.7.6 - 2026-03-19
Added
- Grouped compaction settings —
Alloy.run/2now acceptscompaction: [...]withreserve_tokens,keep_recent_tokens, andfallback, making context compaction behavior configurable without replacingmax_tokens.
Changed
- Summary-first context compaction —
Alloy.Context.Compactornow preserves the first message, keeps a recent token-budgeted verbatim window, and replaces older context with a single structured handoff summary generated through the configured provider. - Reserve-based compaction trigger — compaction now starts when the conversation exceeds
max_tokens - reserve_tokensinstead of relying on the previous fixed 90% threshold. - Repeated compactions reuse the handoff summary — Alloy updates the existing synthetic summary message on later compactions instead of stacking multiple summaries, while still falling back to deterministic truncation if summary generation fails.
0.7.5 - 2026-03-13
Fixed
- EchoTool test crashes (7 warnings) —
EchoTool.execute/2now accepts both string and atom key maps, fixing pattern-match failures when the test provider sends atom-keyed tool inputs. - Anthropic double-timeout — removed the
Task.Supervisorwrapper fromAnthropic.complete/3. Req'sreceive_timeout(injected byRetry.inject_receive_timeout) already enforces the deadline — the Task added a redundantyield + 5sbuffer.complete/3now callsReq.requestdirectly, matching the OpenAI and OpenAICompat providers. - 6 Dialyzer warnings resolved — changed
pending_requeststypespec from:queue.queue()(opaque in OTP 28) toterm()inState, replacedwhen value == %{}guard withmap_size/1inResult, and removed unreachablenilclause inmaybe_put_metadata/3. stringify_keys/1safety — added explicitis_binary(k)clause andraise ArgumentErrorfor unexpected (non-atom, non-string) map keys instead of silent pass-through.
0.7.4 - 2026-03-06
Added
- Config-level model metadata overrides —
Alloy.run/2now accepts:model_metadata_overrides, allowing applications to override or extend model context windows used to derive compaction budgets without waiting for a library release.
Changed
max_tokensdefaults now follow provider models —Alloy.Agent.Configderives the compaction budget from the configured provider:modelwhen the catalog knows that model, re-derives it when models change viaServer.set_model/2, and falls back to200_000only when no model metadata is available or when no model is configured.
0.7.3 - 2026-03-06
Fixed
- Hex publish workflow validation — the release workflow no longer references
secrets.*directly in stepif:guards, so tag-triggered publish jobs can run again and dispatch the landing-site sync correctly.
Changed
- Release version bump — republishes the provider/model refresh from
0.7.2as a valid Hex release candidate after fixing the GitHub Actions publish workflow.
0.7.2 - 2026-03-06
Added
- xAI Responses path documented and tested —
Alloy.Provider.OpenAInow explicitly documentsapi_url: "https://api.x.ai"usage, and tests verify custom Responses API routing. - Current xAI model budgeting —
TokenCounternow recognizes current public xAI API model names includinggrok-4,grok-4-fast-reasoning,grok-4-fast-non-reasoning,grok-4-1-fast-reasoning,grok-4-1-fast-non-reasoning, andgrok-code-fast-1.
Changed
- Provider/model docs refreshed — README and provider moduledocs now point to current Anthropic 4.6, OpenAI GPT-5.4, Gemini 2.5/3 preview, and xAI model setups.
- Anthropic code execution integration updated — provider now uses
code_execution_20250825and automatically merges requiredanthropic-betaheaders with caller-supplied beta flags. - Publish workflow aligned with CI strictness — release pipeline now runs
mix credo --strictbefore publishing to Hex.pm.
Fixed
- OpenAI token budgets corrected —
gpt-5,gpt-5.1, andgpt-5.2context limits were updated to current published limits, preventing stale compaction thresholds. - xAI token budgets corrected —
grok-4now uses the documented 256k window, while Grok 4 fast and Grok 4.1 fast variants use the documented 2M window. - Anthropic model drift removed — stale Anthropic alias examples were replaced with current
claude-opus-4-6,claude-sonnet-4-6, andclaude-haiku-4-5references.
0.7.1 - 2026-03-04
Added
Alloy.Resultstruct — typed,Access-compatible return value fromAlloy.run/2andServer.chat/3. Single source of truth for the 8-field result contract. ImplementsAccessbehaviour for bracket-syntax backwards compatibility (result[:text]).Alloy.Resultin hex docs — added to the Core group in the sidebar.
0.7.0 - 2026-03-04
Added
- Anthropic code execution support — configure
code_execution: trueto enable Anthropic's server-side Python sandbox. Alloy handlesserver_tool_use/server_tool_resultround-trips across Message, Executor, and Anthropic provider layers. Thecode_execution_20250522tool type is appended to the request body when enabled. - Optional tool callbacks —
Alloy.Toolbehaviour gainsallowed_callers/0andresult_type/0as@optional_callbacks. Tools that don't implement them compile and work as before. Registry usesfunction_exported?/3to conditionally include metadata in tool definitions. - Structured tool results — tools can return
{:ok, text, data}3-tuples. Text goes into the result block (what the model sees), structured data goes intometa.structured_datafor programmatic consumption (e.g., by a code execution sandbox). allowed_callersforwarding — Anthropic provider includesallowed_callersin the tool definition sent to the API when present, enabling tools to declare whether they can be invoked from a code execution sandbox.server_tool_use/server_tool_resulttoken counting —TokenCounternow estimates tokens for server tool blocks, preventing compaction from underestimating context size when code execution is in use.- Thinking block truncation in compactor — thinking blocks exceeding the truncation length are sliced during compaction, reducing context size for extended thinking conversations.
Testing.last_text/1accepts%State{}— delegates toState.last_assistant_text/1when given a%State{}struct, avoiding redundant reverse-search logic.
Changed
pending_requestsmigrated to:queue—State.pending_requestschanged from a plain list to an Erlang:queuefor O(1) enqueue/dequeue. All Server functions (enqueue_pending_request,maybe_start_next_pending,remove_pending_request,health) updated accordingly.agent_eventhandler now async —handle_info({:agent_event, message})now dispatches viastart_async_turn/3(supervised Task) instead of running the Turn synchronously in the GenServer process. Prevents blocking the GenServer mailbox during long-running turns.handle_infocatchall logs unexpected messages — the catch-allhandle_info/2now logs viaLogger.debug/1instead of silently discarding unknown messages.on_shutdowncrash logging —terminate/2now logsLogger.warningwith the exception and stacktrace whenon_shutdowncallbacks crash, instead of silently swallowing.:after_tool_requestmiddleware hook — renamed from:after_completionin the tool-use code path.:after_completionnow fires only on:end_turn(final response).:after_tool_requestgates tool execution.within_budget?/3accepts configurable ratio — third parameter (default0.9) replaces the hardcoded 90% budget threshold.- SSE parser crash logging —
SSE.parse_streamnow logsLogger.warningwith exception message and stacktrace when an event handler crashes, instead of silently recovering. - Executor crash logging —
Executor.run_taggednow captures__STACKTRACE__and logsLogger.warningwith tool name and stacktrace when a tool crashes. - Compactor refactor — extracted
split_messages/2to DRY message splitting betweencompact/2andfire_on_compaction. Theon_compactioncallback now receives the middle slice directly instead of the full message list + keep_recent count. - Executor result dispatch —
result_block_fn/1dispatches toMessage.tool_result_block/3orMessage.server_tool_result_block/3based on call type, so timeout and crash results also respect the call type. Message.tool_calls/1— now matches both"tool_use"and"server_tool_use"block types.Alloy.Tool.execute/2return type — widened to{:ok, String.t()} | {:ok, String.t(), map()} | {:error, String.t()}.
Breaking
- Middleware hook
:after_completionno longer fires on tool-use responses — use:after_tool_requestfor middleware that should gate tool execution.:after_completionnow only fires on:end_turn(the model's final response).
0.6.0 - 2026-03-02
Breaking
- OpenAI provider migrated from Chat Completions to Responses API — requests now use
/v1/responseswithinputitems andoutputparsing instead of/v1/chat/completionswithmessages/choices. Streaming uses native SSE handler instead of the removedOpenAIStreammodule. Tool definitions use flat{type, name, description, parameters}instead of nested{type, function: {name, description, parameters}}.
Added
- Fallback providers — configure
fallback_providers: [{Provider, config}, ...]to automatically try alternative providers when the primary fails. Respects deadline budgets and never switches mid-stream (once chunks are emitted, the turn sticks with that provider). on_compactioncallback — configureon_compaction: fn messages, state -> ... endto extract facts from messages about to be compacted. Crash-safe: callback failures are logged but never prevent compaction.
Fixed
- Deduplicated
normalize_provider_config/1— removed redundant copy fromTurnmodule;Confignow handles all provider config normalization at construction time. - Quadratic list concatenation in OpenAI response parsing —
parse_output_to_blocks/1now uses O(n) prepend+reverse instead of O(n²)acc ++ blocks. - Double list traversal in compaction callback — cached
length(rest)to avoid traversing the message list twice. - Silent callback failures now logged —
fire_on_compactionlogsLogger.warningon callback crashes instead of silently swallowing.
[0.5.1] - 2026-03-01
Added
- Docs coverage gate — added
mix docs.checkand wired it into CI and publish workflows to enforce@moduledocand@doccoverage on public Alloy APIs.
Fixed
- Missing test helper docs — added
@docforAlloy.Testing.assert_tool_called/3so public test helper macro docs are complete.
0.5.0 - 2026-03-01
Breaking
on_eventcontract is now a versioned envelope map — runtime stream/tool events are emitted as%{v: 1, seq:, correlation_id:, turn:, ts_ms:, event:, payload:}instead of tagged tuples.Migration example:- before:
{:text_delta, chunk} - after:
%{v: 1, event: :text_delta, payload: chunk}
- before:
Added
- Unified runtime event protocol —
:text_delta,:thinking_delta,:tool_start, and:tool_endnow share the same event envelope with deterministic sequencing and correlation IDs. - Per-tool lifecycle telemetry — added
[:alloy, :tool, :start]and[:alloy, :tool, :stop]events with correlation, turn, tool identity, and timing metadata. - Per-run runtime telemetry envelope — added
[:alloy, :event]with normalized event metadata (seq,event,correlation_id,turn). - Async request cancellation API —
Alloy.cancel_request/2andAlloy.Agent.Server.cancel_request/2cancel both queued and in-flight async requests byrequest_id. - Bounded async backpressure —
send_message/3now supports bounded queuing viamax_pendingand explicit rejections (:busy,:queue_full).
Changed
send_message/3result contract — now returns{:ok, request_id}(instead of bare:ok) for robust caller correlation.- Async run correlation propagation — async turns now set event correlation to the async
request_idby default. - Result maps now include
tool_callsmetadata — one-shot and server flows expose structured tool execution details (duration_ms,error, correlation and event sequence data). - Agent health payload — now includes queue metrics (
pending_count,max_pending).
0.4.3 - 2026-03-01
Fixed
- Jason.decode! crash on malformed tool args — all 6 OpenAI-compatible providers now use
Jason.decode/1instead ofJason.decode!/1when parsing model-produced tool call arguments. Invalid JSON returns{:error, reason}instead of crashing the agent GenServer. - Multimodal user messages silently dropped — DeepSeek, Mistral, Ollama, OpenRouter, and XAI providers now correctly format text and image blocks in list-content user messages (previously the
_other -> nilcatch-all discarded them). - Tool executor preserves tool_use_id on timeout/crash — timed-out or crashed tool calls now return the original tool_use_id (was
"unknown", which broke provider protocol state). - File.stream! on directories —
Tool.Core.Readnow usesFile.regular?/1instead ofFile.exists?/1, returning a clean error for directories instead of raisingFile.Error. - File.mkdir_p! in Write tool — replaced with
File.mkdir_p/1+ structured error return on permission failure. - One-shot Alloy.run/2 status — now sets
status: :runningbefore entering the turn loop, consistent withServer.chat/3. Middleware no longer sees:idleduring execution. - Timeout floor overshoot —
inject_receive_timeout/2floor reduced from 5,000ms to 1,000ms to prevent HTTP requests from outliving the agent's overall deadline. - Scheduler stale callbacks —
remove_job/2no longer fires callbacks for in-flight tasks that complete after the job is removed. - Context.Discovery cross-platform —
find_git_root/1now terminates correctly on all OS filesystem roots (was hardcoded to"/"). - Message.text/1 consistency — always returns
String.t()(nevernil). Empty text returns""instead ofnil. - OpenAI missing usage key —
parse_responsenow handles responses without a"usage"field (zero-count fallback) instead of raisingFunctionClauseError. - Google unknown part types —
parse_parts_to_blocksnow skips unrecognised part shapes instead of raising.
Changed
- Credo strict + Dialyzer in CI —
mix credo --strictandmix dialyzernow run on every push/PR. All 34 pre-existing Credo violations resolved. PLT caching added. - Scratchpad Agent cleanup —
State.cleanup/1stops the scratchpad process interminate/2andtry/afterblocks. Prevents process leak on crash. - O(1) message append —
Stateuses a prepend accumulator (messages_new) instead of++for O(1) append per turn, materialised at turn boundaries. - Float cost precision —
Usage.estimate_cost/3uses float division instead ofdiv/2to avoid truncating sub-cent costs to zero. - Agent :idle status —
Statedefault status changed from:runningto:idle. Agents are only:runningduring active turn execution.
0.4.2 - 2026-02-28
Added
- Extended thinking (Anthropic) — pass
extended_thinking: [budget_tokens: N]in provider config to enable Claude's reasoning mode. Thinking blocks are parsed and stored as first-class content (%{type: "thinking", thinking: text, signature: sig}) for correct round-trip. Non-Anthropic providers silently ignore this opt. on_eventstreaming callback — passon_event: fn {:text_delta, t} | {:thinking_delta, t} -> :ok endalongsideon_chunkto receive tagged stream events.on_chunkremains unchanged for backward compatibility. Anthropic emits both:text_deltaand:thinking_delta; all other providers emit only:text_delta.- Thinking token counting —
TokenCounter.estimate_block_tokens/1now counts thinking blocks toward context budget. Prevents compaction from underestimating context size when extended thinking is in use.
Fixed
on_eventnow validated as a 1-arity function atstream_chat/4call site — invalid values raiseArgumentErrorbefore reaching the provider instead of crashing deep in the pipeline.extended_thinking: [budget_tokens: nil]now raisesArgumentErrorimmediately rather than sendingnullto the Anthropic API and receiving a cryptic HTTP 400.stream_optscan no longer override internal:streamingand:on_chunkflags viaKeyword.merge/2(previously used++which could theoretically be shadowed by user opts).on_eventemissions (thinking deltas) now correctly markchunks_emitted?in the retry guard — previously, a retryable error after a thinking delta but before any text chunk would re-emit the thinking delta on retry.
0.4.1 - 2026-02-28
Added
- Unified streaming across all 8 providers —
Alloy.Provider.SSEnow handles all transport-level SSE framing (CRLF normalisation, event boundary splitting, cross-chunk boundary handling). Anthropic, OpenAI, Google, Ollama, OpenRouter, xAI, DeepSeek, and Mistral all stream through the same pipeline. Each provider pattern-matches on parsed events. Adding a new streaming provider is ~50 lines. send_message/2— async non-blocking dispatch forAlloy.Agent.Server. Returns:okimmediately; the agent runs its Turn loop in a supervisedTaskand broadcasts the result via Phoenix.PubSub when done. Returns{:error, :busy}if the agent is mid-turn. Designed for Phoenix LiveView and background jobs that cannot block.Alloy.Application— proper OTP application entry point. StartsAlloy.TaskSupervisor(aTask.Supervisor) underAlloy.Supervisor. Required forsend_message/2. Addalloyto yourextra_applicationslist if using an umbrella.- Persistence behaviour —
Alloy.Persistencedefines the formal contract for session persistence backends (save_session/1,load_session/1,delete_session/1,list_sessions/0). Alloy itself remains in-memory only — this behaviour is the seam for your own Ecto/SQLite/Redis adapter.
0.4.0 - 2026-02-26
Added
- Configurable timeouts —
Server.chat/3,Server.stream_chat/4,Team.delegate/4,Team.broadcast/3,Team.handoff/4all acceptopts \\ []with:timeout(default 120s). Removes all:infinitytimeouts for daemon safety. - Provider retry with backoff —
Confignow hasmax_retries: 3andretry_backoff_ms: 1_000. Retries on HTTP 429/500/502/503/504 and:timeoutwith linear backoff. Non-retryable errors (e.g. 401) fail immediately. - Middleware loop halting — middleware can return
{:halt, reason}to stop the agent loop. State status becomes:halted. Works at all hook points:before_completion,after_completion,after_tool_execution,on_error. - Cost estimation —
Usage.estimate_cost/3computesestimated_cost_centsfrom token counts and per-million prices.Usage.merge/2accumulates cost across turns. - Streaming as opts —
Turn.run_loop/2now acceptsstreaming: true, on_chunk: fnopts directly, eliminating the config mutation hack inServer.stream_chat.:streamingfield removed fromConfig. - Export session —
Server.export_session/1returns a%Alloy.Session{}with messages, usage, and metadata. Session ID sourced fromcontext[:session_id]if set. - Graceful shutdown —
Configacceptson_shutdown: fn session -> ... end. Called inServer.terminate/2. Combined withProcess.flag(:trap_exit, true)to ensure callback fires on supervisor shutdown. - Pluggable bash executor —
Alloy.Tool.Core.Bashcheckscontext[:bash_executor]for a custom(command, working_dir) -> {output, exit_code}function. Enables Docker sandboxing without modifying Alloy. - Health check API —
Server.health/1returns%{status, turns, message_count, usage, uptime_ms}cheaply without touching the message loop. - PubSub integration —
Alloy.PubSubwrapper module. Agents can subscribe to topics (subscribe: ["tasks:new"]) and react to{:agent_event, message}messages. Results broadcast to"agent:<agent_id>:responses"using a stable ID (fromcontext[:session_id]or auto-generated).phoenix_pubsub ~> 2.1is an optional dependency.
Changed
Turn.run_loop/1→Turn.run_loop/2withopts \\ [](backward compatible)Configstruct: removed:streaming, added:max_retries,:retry_backoff_ms,:on_shutdown,:pubsub,:subscribeState.statustype: added:haltedMiddleware.call_resulttype: added{:halt, String.t()}Middleware.run/2return type:State.t() | {:halted, String.t()}phoenix_pubsubdependency is now optional (users add it to their ownmix.exs)Team.init/1returns{:stop, reason}instead of raising on agent start failure- PubSub response topic uses stable
agent_id(fromcontext[:session_id]or auto-generated UUID) instead of volatile PID string - All
TeamGenServer callbacks now have@impl GenServerannotation Executor.execute_all/3short-circuits middleware checks on halt viaEnum.reduce_while
Fixed
retryable?/1now matches OpenAI's native 429 shape ("rate_limit_exceeded: ...") — previously OpenAI rate-limit errors were never retried- PubSub response topic now uses
effective_session_id/1(same asexport_session/1) — topic and session ID no longer diverge when:session_startmiddleware injectscontext[:session_id] retryable?/1pattern clauses matched tuple shapes that no provider ever returned — rewritten to match actual string error shapes from providersMiddleware.run_before_tool_call/2missing{:halt, reason}clause causedCaseClauseErrorExecutor.execute_all/3did not propagate{:halted, reason}fromrun_before_tool_callTeam.broadcast/3crashed on{:exit, reason}fromTask.async_streamTeam.handoff/4timed out immediately when called with empty agent list (timeout * 0 = 0)Server.terminate/2usedcatch :exit, _which missed throws — changed tocatch _, _Server.init/1did not handle{:halted, reason}from:session_startmiddlewareServer.handle_call(:chat/:stream_chat)treated:haltedstatus as success — now returns{:error, result}Bashtool missing{:exit, reason}clause inTask.yieldresult handlingUsage.estimate_cost/3used float arithmetic causing accumulation errors — converted to integer mathTurn.run_loop/2streaming fallback —function_exported?/3returnedfalsefor unloaded provider modules, silently falling back to non-streamingcomplete/3. Fixed withCode.ensure_loaded/1before the capability check.
0.3.0 - 2026-02-26
Added
Alloy.Testingmodule — ExUnit helpers for testing agents (run_with_responses,assert_tool_called,refute_tool_called,last_text,tool_calls)- Usage examples in all 8 provider
@moduledocsections - Expanded
@moduledocfor all 4 built-in tool modules - Grouped module sidebar in hex docs (Core, Providers, Tools, Context, Middleware, Advanced, Testing)
- Dialyzer passing with 0 errors
Fixed
- Dialyzer errors caused by missing
:mixin PLT (plt_add_apps: [:mix]) - Compile warnings from module attributes in
@moduledocstrings
0.2.0 - 2026-02-26
Added
- Test coverage for
Session,Tool.resolve_path/2, andTool.Executor(26 new tests) - Automated hex.pm publish pipeline via GitHub Actions (tag-triggered)
Changed
- Updated all provider model references to current models (Feb 2026)
- Total test suite: 298 tests
0.1.0 - 2026-02-26
Added
- Core agent loop (
Alloy.run/2) with configurable max turns - 8 LLM providers: Anthropic, OpenAI, Google Gemini, Ollama, OpenRouter, xAI (Grok), DeepSeek, Mistral
- 5 built-in tools: read, write, edit, bash, scratchpad
- GenServer agent wrapper (
Alloy.Agent.Server) with supervision support - Multi-agent teams (
Alloy.Team) with delegate, broadcast, and handoff - Streaming responses with provider-level SSE support
- Mid-session model switching
- Context compaction (automatic conversation summarization when approaching token limits)
- Context file auto-discovery (
.alloy/context/*.md, 3-tier: global/git-root/cwd) - Skills system (frontmatter parsing, discovery, placeholder expansion)
- Cron/heartbeat scheduler with overlap protection
- Middleware pipeline with telemetry integration
- Extension events (
:before_tool_callwith blocking,:session_start,:session_end) - Interactive REPL via
mix alloy - Deterministic test provider for full TDD workflows