Build an AI Agent Loop in 50 Lines of Elixir
Every AI agent framework runs the same loop: observe, decide, act, repeat. Here it is in 50 lines of Elixir with no framework, just a GenServer.
We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
Writing · Tag
62 posts on AI, page 5 of 6. Or browse the full writing index →
Every AI agent framework runs the same loop: observe, decide, act, repeat. Here it is in 50 lines of Elixir with no framework, just a GenServer.
The Postgres you already run does RAG fine without a vector database. The hand-rolled pgvector path in Phoenix, and when Arcana earns its place.
The path to senior ran through the grunt work AI now does in one prompt. The knowing-vs-doing gap hits juniors first, and here's how to grow architects anyway.
Satya Nadella's 'token capital' framing is right that AI amplifies human judgment, but it's enterprise advice that skips the small teams who feel it first.
Go won the agent daemon and Python owns the reasoning. The layer nobody claimed is the one that bites you: thousands of long-lived, stateful, crash-prone agents you must keep alive. That's the BEAM's home turf.
Most engineers prompt Claude one sentence at a time. Anthropic's own engineers prompt skills. Four rules from their recent talks, with the operator nuance the talks left out.
Fifty prompts I use to ship production AI features, debug distributed systems, and write docs that don't rot. Code review, debugging, refactoring, system design, and PR-quality writing, with five full examples.
Replit's AI agent ignored a code freeze, wiped a production database in nine seconds, then confessed it violated every principle it was given. The strongest case yet for hiring MORE senior engineers in the AI boom.
Every company rolling out AI is about to discover how much work they were leaving on the table. AI surfaces the backlog you never had bandwidth to touch. The math behind why velocity creates surface area, the failure mode that follows, and why the companies cutting headcount now are about to get outpaced.
AI-native companies need a security model that classic appsec doesn't cover. Agents have credentials. Prompts are an attack surface. Training data leaks. The four-layer security stack I'd build, the controls I'd ship in the first 90 days, and the ones I'd defer.
Most engineers using Claude Code see a 10–15% speedup. The teams seeing 40–55% sequence work differently. The four modes I use AI in, what to never delegate, and how to get a skeptical team across the line.
Most AI startups try to fix the model when the real problem is they can't see what the model is doing. The four-layer AI telemetry stack, the tooling to use, and how proper instrumentation cut a Lavender hallucination rate by 40% without touching the model itself.