Why Elixir is quietly great for AI workloads

Let's get the disclaimer out of the way: if you're training models, Python is where the ecosystem lives, and you should be there. This post is about something different, the application layer. Calling models, coordinating steps, running agents, streaming responses to users. For that layer, Elixir deserves more attention than it gets.

The workload looks different than you think

Most production AI work isn't math. It's waiting. Waiting for a provider to respond, waiting on a tool call, waiting for a human to approve something, waiting out a rate limit. Systems like this spend most of their time idle, juggling thousands of in-flight requests that each take seconds to complete.

That's exactly the shape of problem the Erlang VM was built for.

What Elixir brings

Cheap concurrency. Processes on the BEAM are lightweight. You can run tens of thousands of concurrent agent sessions or pipeline runs without heroic effort, each isolated from the others.

Supervision and "let it crash." When a step fails (and with LLMs, steps fail), supervisors restart it according to rules you define. Failure handling is a first-class design feature instead of a pile of try/catch blocks.

Fault isolation. One misbehaving run doesn't take down the others. For multi-tenant products, that matters a lot.

Streaming and real-time by default. Phoenix channels and LiveView make streaming tokens to a UI, or showing live progress of a long-running agent, almost natural.

Durable job processing. Libraries like Oban give you persistent, retryable, observable background jobs on top of Postgres, which is exactly what multi-step AI pipelines need.

Where it fits well

  • Multi-step LLM pipelines with retries and state
  • Agent runtimes with many concurrent long-lived sessions
  • Streaming chat and collaborative interfaces
  • Multi-tenant SaaS with AI features built into the product

The honest tradeoffs

I'm not going to pretend it's all upside.

  • Smaller ecosystem. Python gets new SDKs and tooling first. In Elixir you'll sometimes write a thin client yourself or lean on community libraries of varying maturity.
  • Hiring. The talent pool is smaller. In practice, I find the people who are in it tend to be strong, but you'll recruit differently.
  • ML-heavy work. For anything involving training or heavy numerical work you'll still reach for Python, or use Elixir's Nx ecosystem where it makes sense.
  • Team familiarity. If your whole team lives in another stack, the switching cost is real.

A common and perfectly sensible architecture is Elixir for orchestration and the product, with Python services for model-specific work behind a clean interface.

The shape of the benefit is easy to picture. A multi-step pipeline where each run is its own supervised process, with background jobs retrying on failure and live progress streaming to the user's browser, takes a lot less custom plumbing on the BEAM than in many stacks. A big share of the reliability code you'd otherwise write is already part of the platform.

The takeaway

Choose tools for the problem in front of you. If your AI work is "call a model and return a result," any stack works. If it's "coordinate many unreliable, slow, concurrent steps and keep users informed while it happens," the Erlang VM has been quietly solving that problem for decades. It's worth a look.

Previous
Previous

Letting AI agents run a business: what actually broke

Next
Next

AI pipelines that don't fall over: lessons from building Assembly Line