JEG2
Author of Designing Elixir Systems with OTP
I am collecting examples of uses for Agent. I would love to hear uses you can share. Thanks in advance!
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using.
We’re particularly inte...
New
I’m posting this in response to Jose’s recent tweet (Cr. link) :
People are sleeping on Elixir for a coding harness:
Hot-code swappi...
New
Hello,
I wrote Stop My Hand, a Scattergories-like web application using Phoenix/LiveView as my learning project for Elixir (after readin...
New
AcmeScript — Writing JS hooks as if I were still using Elixir
I’ve been having fun building a little something over the last few days: Ac...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #elixirconf-us
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
hubertlepicki
Oh I’d love to hear some good use cases too. I sort of feel guilty not using Agent at all. I usually grab GenServer instead without much thinking.
OvermindDL1
Yeah, same here, I always have ‘some’ functionality associated with shared state like that, so a GenServer has always seemed better, otherwise for shared state without functionality then I always use ETS/Mnesia instead… ^.^;
JEG2
I have noticed one place that I tend to use it. I’ll share that later, so as not to bias the answers of others just yet…
JEG2
I find it interesting that not many folks are chiming in with answers yet. I wonder if that signifies that they don’t get a ton of usage.
For myself, I have found them useful in testing other processes. I’ve rigged processes to pull pre-arranged values from them and stored values representing work happening inside of a process that I could later write assertions against.
The one time I tried to use them in an application, I grew to regret it and later replaced them with
GenServerprocesses, for the functionality reasons noted by @OvermindDL1.JEG2
Oops, I did forget another decent usage I found for them!
I recorded the events of a simulation as they happened, then fetched and cleared all changes in the drawing code (using
get_and_update()). That worked fine.jeramyRR
I’ve been wondering the same thing myself. When do people actually use agent?
brightball
I’d thought about using them as a low TTL query cache
michalmuskala
I don’t think I ever used Agent in one of my programs. That said, the use cases in the wild, I saw, are:
sasajuric
I also don’t use Agents for the production runtime code. I did use them on few occasions in tests.
StefanHoutzager
I’m using an agent like KV.bucket: http://elixir-lang.org/getting-started/mix-otp/agent.html. In the following function I’m using an agent as “accumulator”. If there’s a handier solution (I’m not as experienced as most posters) I would like to hear.