Inspiration
Every AI agent loop we looked at was quietly wasteful — the same handbook, the same file, the same account lookup, repeated step after step. Model routers already solve "pick a cheaper model," but nobody was solving "stop doing the same work twice." We wanted a compiler for agent loops: something that removes the waste and proves it didn't break anything, instead of asking you to trust a diff.
What it does
OptiLoop ingests an agent trace — prompts, tool calls, latency, cost — and compiles it into a leaner version: deduplicated prompts, merged read-only tool calls, cheaper equivalent tools where they exist. Side effects (payments, ticket updates, deployments) are never touched. Every candidate runs through the same behavioral evals as the original, and OptiLoop ships it only if it passes; otherwise it automatically reverts to baseline. The dashboard shows the whole loop live — prompt tokens before/after, calls removed or merged, eval results, and the ship/rollback decision — with a Replay tab to step through any past run.
How we built it
A local FastAPI leader dispatches every optimization candidate to sandboxed workers — never executing candidates itself — running four variants per batch (conservative, prompt-first, tool-first, balanced) concurrently. Workers run on Akash; AkashML provides real inference and token counts; Nexla carries sanitized live telemetry; Pomerium-style policy constrains what can be optimized. The frontend is a plain black-and-white Vite/React dashboard with hand-rolled SVG charts — no chart library, no router, no query lib — because the story is the data, not the framework.
Challenges we ran into
Keeping the leader honest was the hardest constraint: it's easy to let the local process quietly execute a candidate "just this once." Distinguishing safe-to-merge reads from unsafe-to-touch side effects across three very different use cases (support, coding, invoicing) took real care, and wiring a fully autonomous observe → compile → eval → ship loop — instead of a manual "click optimize" button — meant building trustworthy self-correction, not just a demo path.
Accomplishments that we're proud of
A genuinely autonomous loop that runs itself and only ships a change once it's earned it. A real Akash deployment executing candidate batches end-to-end. Live sanitized telemetry flowing into Nexla instead of a cosmetic label. And a rollback path that actually fires — inject a bad eval, watch the system catch it and self-correct with no one touching the keyboard.
What we learned
Safety constraints are the product, not a footnote — the interesting engineering was never "how do we cut tokens," it was "how do we cut tokens without ever risking a duplicate payment or a leaked customer record." We also learned that eval-gated shipping earns trust in a way that a clean-looking diff never will.
What's next for OptiLoop
Replace the fixed-multiplier prompt shrinker with real content-based rewriting, and land auditable tool-plan optimization with full side-effect protection. Expand past the three seed use cases, layer in real Pomerium enforcement, and open cross-run caching once correctness and invalidation are proven — not before.
Built With
- akash
- nexla
- pomerium
- zero.xyz
Log in or sign up for Devpost to join the conversation.