AlexClaw is an autonomous AI agent platform built with Elixir and OTP, designed to run continuously, monitor external sources, execute workflows, and communicate over Telegram and Discord. Its architecture balances concurrency, fault tolerance, and cost efficiency by combining Elixir’s BEAM strengths with a tier-based large language model routing system and persistent memory storage.
What AlexClaw does and how it is architected
At its core, AlexClaw is a single-user autonomous agent that operates on the BEAM virtual machine using Elixir and OTP principles. It continuously monitors external inputs and executes complex workflows that can branch conditionally based on runtime data. Communication channels include popular messaging platforms like Telegram and Discord, enabling practical interaction with users.
The system implements a tiered LLM router that classifies requests into different cost and performance categories — light, medium, heavy, and local. This design routes simpler queries to lightweight or local models, reserving more expensive, large-scale LLM calls for tasks that genuinely require them. This approach helps control token usage and operational costs without sacrificing the agent’s responsiveness or capabilities.
AlexClaw’s persistent memory relies on PostgreSQL combined with the pgvector extension. This allows storing semantic embeddings and performing vector similarity searches to maintain context and recall relevant information across sessions. The repository mentions the use of a vector index with multiple knowledge categories, enabling the agent to efficiently retrieve pertinent data as part of its reasoning process.
The autonomous reasoning loop follows a plan-execute-evaluate cycle, iterating over workflows and refining decisions. To maintain resource efficiency, it compresses working memory periodically, balancing context retention and computational overhead.
Under the hood, AlexClaw uses pure OTP patterns such as GenServer and ETS for core concurrency primitives and circuit breakers. These circuit breakers include cooldown periods to prevent repeated failures or runaway loops, improving system stability. Additionally, AlexClaw supports multi-node BEAM clustering to scale horizontally, which is a significant feature given the demands of autonomous AI agents.
For external integrations, the system exposes an MCP server that allows external AI clients to interface with AlexClaw, potentially extending or controlling the agent programmatically.
All configuration is editable at runtime via an admin UI, requiring no restarts. This improves developer experience and operational flexibility, letting users tune workflows, LLM routing, and other parameters dynamically.
The tiered LLM routing and OTP fault-tolerant design
AlexClaw’s tiered LLM router is a practical solution to the common problem of balancing AI agent capability with operational cost. Instead of sending every request to a large, expensive model, it routes based on the complexity or nature of the task:
- Light tier: Handles simple or obvious queries using low-cost or local models.
- Medium tier: Deals with moderately complex requests.
- Heavy tier: Reserved for computationally expensive or critical operations requiring the largest models.
- Local tier: Uses local models where available to reduce external API calls.
This tiering reduces unnecessary token consumption and latency, which is important for real-world deployments where API costs and response times matter.
The use of OTP’s GenServer and ETS for circuit breakers is another highlight. Circuit breakers prevent repeated invocation of failing services or LLM calls by temporarily disabling certain operations and introducing cooldowns. Implementing these in pure OTP takes advantage of BEAM’s concurrency and fault-tolerance features, making them efficient and resilient.
Multi-node clustering support means AlexClaw can run across several BEAM nodes, sharing workload and providing redundancy. This is not trivial; it requires careful design around state sharing and message passing but allows the agent to scale beyond a single Erlang VM instance.
The workflow engine supports conditional branching, enabling the agent to follow complex logic paths rather than simple linear task execution. This capability is essential for autonomous agents operating in dynamic environments.
Persistent semantic memory stored with PostgreSQL and pgvector offers vector search capabilities for embedding-based retrieval. While the analysis does not specify embedding dimension or index type, pgvector integration is a solid choice for combining relational data management with semantic search.
Quick start
git clone https://github.com/thatsme/AlexClaw.git
cd AlexClaw
cp .env.example .env
This minimal quick start shows how to clone the repo and prepare the environment file. The repository likely requires further configuration via the admin UI at runtime, which means no build or restart steps are strictly necessary for configuration changes.
verdict
AlexClaw stands out for its thoughtful use of Elixir/OTP concurrency and fault-tolerance primitives in building an autonomous AI agent framework. Its tiered LLM routing system is a practical approach to balancing cost and capability, which many AI projects overlook. The persistent semantic memory via PostgreSQL with pgvector integration adds robustness to context retention and retrieval.
The tradeoffs include the complexity of OTP patterns and BEAM clustering, which can have a steep learning curve if you’re not familiar with Erlang/Elixir ecosystems. Also, being single-user focused limits its out-of-the-box applicability for multi-user scenarios without further customization.
If you’re exploring how to build fault-tolerant, cost-efficient autonomous agents with persistent semantic memory, and you’re comfortable with Elixir and OTP, AlexClaw is worth a close look. Its runtime configuration and multi-node support make it a solid base for production-grade autonomous AI workflows.
→ GitHub Repo: thatsme/AlexClaw ⭐ 111 · Elixir