Use agents when one in-process state value should receive serialized asynchronous actions, and choose send or send-off based on whether the work is CPU-bound or may block.
Agents are Clojure references for asynchronous state transitions. You send a function to an agent; Clojure applies that function later to the agent’s current state, and the function’s return value becomes the next state.
For Java engineers, an agent is not a general actor framework. It is closer to a small serialized worker attached to one immutable state value.
1(def events (agent []))
2
3(send events conj {:type :login
4 :user/id 42})
Use this section to decide when agents fit, how to read their state, how failures behave, and when a queue, executor, atom, ref, or database is a better boundary.