striking

striking

Alloy 0.8.0 The model-agnostic agent engine for Elixir

Alloy is a minimal agent loop for building AI agents on the BEAM. Think of it as the completion-tool-call loop and nothing else, no opinions on sessions, persistence, or UI.

What’s new in 0.8.0

Cost guard pass max_budget_cents: 50 to Alloy.run/2 and the loop halts with :budget_exceeded status before your agent overspends. The check runs at the start of each turn alongside max_turns.

{:ok, result} = Alloy.run("Research this codebase",
  provider: {Alloy.Provider.Anthropic, api_key: key, model: "claude-sonnet-4-6"},
  tools: [Alloy.Tool.Core.Read, Alloy.Tool.Core.Bash],
  max_budget_cents: 50
)
# result.status => :budget_exceeded | :completed

Summary-based context compaction when conversations approach the token limit, Alloy generates a structured handoff summary of older context instead of truncating. The summary preserves progress, key decisions, constraints, and next steps. Falls back to deterministic truncation if summary generation fails.

Compaction is now configurable:

Alloy.run(input,
  provider: provider,
  compaction: [
    reserve_tokens: 12_000,       # Room for the next response
    keep_recent_tokens: 8_000,    # Recent messages kept verbatim
    fallback: :truncate           # When summary fails
  ]
)

One-shot streaming Alloy.stream/3 gives you token-by-token output without managing a GenServer:

{:ok, result} = Alloy.stream("Explain OTP", fn chunk ->
  IO.write(chunk)
end, provider: {Alloy.Provider.OpenAI, api_key: key, model: "gpt-5.4"})

Why model-agnostic matters

Alloy works with Anthropic, OpenAI (Responses API), xAI/Grok, Gemini, and any OpenAI-compatible endpoint (Ollama, OpenRouter, DeepSeek, Mistral, Groq). Swap providers by changing one line — your tools, prompts, and agent logic stay the same.

Today’s best model might not be tomorrow’s. Building on Alloy means you can switch without rewriting your agent.

The philosophy

Inspired by Pi Agent’s minimalism: 4 built-in tools (read, write, edit, bash), a good prompt, and a loop. That’s the framework. ~5,000 lines, small enough to read and understand in an afternoon.

OTP gives us the rest for free: supervision trees for fault tolerance, Task.Supervisor for parallel tool execution, PubSub for event streaming, GenServer for stateful agents.

Links

Feedback, issues, and PRs welcome. Happy to answer questions about the architecture.

Where Next? Top

Trending in News & Updates Top

sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
bartblast
I’ll be using this thread to share Hologram patch release announcements. Minor releases will continue to get dedicated threads with blog ...
New
sorenone
This release unifies configuration for queues, repos, and services, swaps opaque timing integers for readable durations, and backports pe...
New
pcharbon
:heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::hea...
New
webofbits
Aludel 0.7.0 is released :tada: Since 0.5.0, Aludel has grown into a much more complete LLM evaluation toolkit for Elixir and Phoenix app...
New
nature
NatureWhistle v0.4.1 is out! :tada: This release is a pretty significant step forward for the project. When I first built NatureWhistle,...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews