Build agents with Elixir
View SourceExAgent · Elixir / OTP
Start with a model and a tool.
Keep control as your application grows.
One agent loop, with optional layers for conversations, persistence, approvals and coordination. Stock ReqLLM connects your models; your application owns its data and effects.
Run your first agent → Integrate with a coding agent
Using ExAgent 2.2
These pages describe ExAgent 2.2.1; published 1.x packages have older contracts. Check supported features and limits, use the dependency in Getting started, or read Migration when upgrading an existing application.
A small, working beginning
Run this inside an application that depends on ExAgent2.0. No credentials or network are needed:
agent = ExAgent.new(model: "test", instructions: "Be concise.")
{:ok, result} = ExAgent.run(agent, "Hello!")
result.output
# => "a test response"The test model follows the same loop as a provider. Next, add a tool, validate a typed result, or replace the model with a qualified ReqLLM instance.
Choose the layer your application needs
- Run
- A request, tools and a validated result. Start here for scripts, jobs and extraction.
- Server
- A supervised conversation with history, a bounded queue and events.
- Store
- Confirmed snapshots and explicit continuation boundaries. Add durability when you need it.
- Coordination
- Session turns, scoped delegation, durable sequences and bounded router or parallel flows.
Each layer has its own ownership contract. A checkpoint confirms saved data; an application still reconciles an external effect whose outcome is uncertain.
Build something useful
| Your next task | Guide |
|---|---|
| Call application code and return validated data | Tools and structured output |
| Select a provider and bound work | Models, budgets and limits |
| Add conversation history, streaming and UI events | Runtime and events |
| Persist a conversation or wait for human approval | Durability and approvals |
| Coordinate several agents | Coordination |
| Test without calling a model provider | Testing |
| Export traces to Langfuse or Opik | Observability |
| Connect an external tool server | MCP |
For an unexpected result, start with Troubleshooting.
Read the contract behind the example
ExAgent.run/3 is the main entry point. ExAgent.Tool describes a tool;
ExAgent.Server owns a conversation. Browse the Modules tab or use /
to search functions and pages. Guides link to the relevant API as you go.
For coding agents, Integration notes provide an API map,
result shapes, responsibilities and a reading route. ExDoc also generates
llms.txt and Markdown versions of these pages from the same source. Use the
View llms.txt action at the bottom of the generated page.
Supported features and limits explains deployment boundaries. The documentation map connects tutorials, integration recipes and the API reference.