zhenfeng-zhu

zhenfeng-zhu

NexAgent - a self-evolving AI agent built on Elixir/OTP

Hi everyone,

I’ve been building NexAgent, an AI agent system designed for long-running, real-world use, and I thought it might be interesting to share here because the project is deeply shaped by Elixir/OTP.

Most agent projects I see are optimized for one-shot tasks: run a prompt, call a few tools, return a result, exit.

NexAgent is aimed at a different problem:

  • keep an agent online
  • put it inside chat apps people already use
  • give it persistent sessions and memory
  • let it run background jobs
  • make it capable of improving over time

In practice, the project currently focuses on two core ideas:

  • Self-evolution
  • Elixir/OTP as the runtime foundation

Why Elixir/OTP

For a short-lived agent script, the runtime is often secondary.

For an agent that is supposed to stay online, manage multiple chat surfaces, isolate failures, run scheduled tasks, and eventually support hot updates, OTP starts to matter a lot more.

That’s the main reason I chose Elixir.

NexAgent uses OTP concepts as product-level building blocks rather than just implementation details:

  • supervision trees for long-lived services
  • process isolation between components
  • GenServer-based managers for sessions, tools, cron, and channel connections
  • fault recovery for message handling and background work
  • a path toward hot code evolution and rollback

What NexAgent does today

Right now, the project includes:

  • chat app integration via a gateway layer
  • long-running sessions scoped by channel:chat_id
  • persistent memory and history
  • built-in tools for file access, shell, web, messaging, memory search, scheduling, and more
  • a skill system for reusable capabilities
  • cron jobs and subagents for background work
  • reflective/evolutionary tooling for source-level self-improvement

Supported chat channels in code today include:

  • Telegram
  • Feishu

The part I find most interesting

The project’s real goal is not “wrap one more model API”.

It is to explore what an agent system looks like when you take these questions seriously:

  • How should memory work beyond a single context window?
  • How should sessions be isolated across chat channels?
  • How should background work be scheduled and supervised?
  • How should an agent evolve beyond prompt edits?
  • What does source-level self-modification look like in a runtime that already supports hot code loading and supervision?

That combination is what made Elixir feel unusually well-suited for this kind of system.

Current status

This is still an early-stage project, but the architecture is already oriented around:

  • Gateway
  • InboundWorker
  • Runner
  • SessionManager
  • Memory / Memory.Index
  • Tool.Registry
  • Cron
  • Subagent
  • Evolution
  • Surgeon

The broader direction is to build an agent that is not just configurable, but persistent, operational, and evolvable.

If this overlaps with your interests in OTP systems, long-running AI services, or agent architecture, I’d be very interested in feedback.

Especially on questions like:

  • whether Elixir feels like the right long-term runtime for this category
  • how far hot upgrades should be pushed in an agent system
  • where OTP gives the biggest advantage over more conventional agent stacks

Thanks for reading.

Repository:

https://github.com/gofenix/nex-agent

Most Liked

zhenfeng-zhu

zhenfeng-zhu

Been working a lot on nex-agent recently.

Over the past few weeks I’ve basically gotten the Feishu and Telegram integrations working smoothly, and the core parts like messaging, memory organization, and persona are all usable now.

What I’ve been thinking about lately is this: how should self-evolution in an agent actually be done without turning into pure self-indulgence?

So I wanted to ask people here. From an actual usage perspective, what capabilities would you want nex-agent to add next?

Where Next?

Popular in Announcing Top

Crowdhailer
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure). 1.0-rc.1 is now available. To use it re...
New
josevalim
Yes, yet another parser combinator library! Most of the parser combinators in the ecosystem are either compile-time, often using AST tra...
159 19834 141
New
devonestes
Introducing assertions, the library that helps you write really great test assertions! GitHub: GitHub - devonestes/assertions: Helpful a...
New
kevinlang
Hey all, We have made an Ecto3 Adapter for SQLite3, ecto_sqlite3! We have successfully on-boarded the full suite of integration tests (...
New
mplatts
With HEEX released we decided to start a components library using Tailwind CSS - check it out here: Petal Components. We also have a boi...
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 10719 134
New
bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
384 14553 119
New

Other popular topics Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New

We're in Beta

About us Mission Statement