Search
Search docs, blog posts, and ecosystem packages with citations.
Enter a query to see grounded citations.
We can't find the internet
Attempting to reconnect
Search docs, blog posts, and ecosystem packages with citations.
Map Jido's architecture to OTP patterns you already know, then build your first agent.
Jido builds on OTP, not around it. The core concepts have direct parallels:
| OTP pattern | Jido equivalent | Key difference |
|---|---|---|
| GenServer state | Agent struct with Zoi schema |
State is validated at every transition, not just init/1 |
handle_call/3 logic | Action modules with run/2 | Pure functions that return state changes, never perform side effects inline |
| Side effects in callbacks | Directive structs | Effects are data returned from actions, executed separately by the runtime |
| Supervision tree | AgentServer + standard supervisors | AgentServer is a GenServer that wraps an Agent struct |
send/2 / message passing | Signal routing | Typed, schema-validated event dispatch with pattern-matched routing |
The fundamental shift: Jido separates what an agent decides from how the runtime executes it. Your agent logic is pure data transformations. The process layer handles lifecycle, supervision, and effect execution.
In a typical GenServer, state mutation and side effects live in the same callback:
def handle_call({:process, order}, _from, state) do
{:ok, _} = Repo.insert(order) # side effect
Mailer.send_confirmation(order) # side effect
{:reply, :ok, %{state | last: order}} # state mutation
end
If Mailer.send_confirmation/1 raises, the process restarts but the database write already happened. The state update and the side effects are entangled.
Jido makes the boundary explicit:
defmodule MyApp.ProcessOrder do
use Jido.Action,
name: "process_order",
schema: Zoi.object(%{order_id: Zoi.string()})
@impl true
def run(params, _context) do
{:ok, %{last_order: params.order_id, status: :processed},
%Jido.Agent.Directive.Emit{
signal: Jido.Signal.new!("order.processed",
%{order_id: params.order_id}, source: "/orders")
}}
end
end
State changes and effect descriptions come back as data. The runtime handles directive execution with its own failure semantics. Your action stays pure and testable without mocking.
Work through these four tutorials in order. Each builds on the last.
jido and jido_ai to mix.exs, configure runtime secrets, verify compilation CounterAgent with a Zoi schema, implement an Action, execute it with cmd/2jido_ai, configure a provider, run an AI-enhanced command through AgentServerEach tutorial takes under fifteen minutes and ends with a working result you can run in IEx.
Jido’s architecture is built on a small set of composable primitives. The Concepts section covers each one in depth - read these alongside or after the tutorials to solidify your mental model.
cmd/2 contract