DEV Community

DnaFIN
DnaFIN

Posted on

# Introducing Leangetic: a local-first compiler for cheaper AI agents

We’re building Leangetic, a tool that helps turn expensive AI agents into cheaper hybrid workflows without changing what the agent does.

The problem we’re trying to solve is simple:

A lot of AI agents call a large model for steps that do not always need a large model.

Examples:

  • parsing logs
  • formatting structured output
  • routing tasks
  • validating responses
  • repeating the same context
  • retrying known failure patterns
  • summarizing tool results
  • classifying simple cases

These steps are often useful inside an agent loop, but they can also become expensive, slow, and hard to audit when everything goes through an LLM again and again.

What Leangetic does

Leangetic profiles your existing agent and looks for parts of the workflow that can be safely optimized.

The output is not just a report. The goal is to produce a hybrid runtime:

  • deterministic code where it is proven safe
  • LLM calls where reasoning is still needed
  • exact caching where calls repeat
  • prompt compaction where context is bloated
  • model routing where smaller models are enough
  • validation gates before promotion
  • fallback to the original model on uncertainty
  • one-command rollback

The original agent is never modified.

The compiler-style flow

The mental model is closer to profile-guided optimization than a normal AI monitoring tool.

You run the agent normally. Leangetic listens locally in shadow mode. Then it profiles the real calls, identifies waste, builds a candidate hybrid, and judges it against your real traffic before anything is switched on.

npx @leangetic-ai/cli --help

leangetic start ./your-agent      # listen locally
leangetic profile                 # see cost, latency, repeats, retries
leangetic optimize ./your-agent   # build the hybrid candidate
leangetic judge                   # prove cheaper + equal-or-better
leangetic promote                 # switch over
leangetic rollback                # revert instantly
Enter fullscreen mode Exit fullscreen mode

Why we built it

AI agents are becoming more capable, but the production cost profile is not always clean.

A simple agent can become expensive because it keeps sending:

  • the same system prompt
  • the same tool schemas
  • the same file context
  • the same failure logs
  • the same summaries
  • the same validation instructions

In many workflows, the LLM is doing a mix of real reasoning and routine software work.

Leangetic tries to separate those two.

The parts that need intelligence stay AI.
The parts that behave like software become software.

Local-first by default

A major design goal is trust.

The CLI runs locally. Shadow mode records fingerprints and aggregate metrics. The original agent keeps running as-is. Optimization is only promoted after the judge confirms that the new hybrid is cheaper with equal-or-better quality on your own calls.

Every optimized step can fall back to the original model, and rollback is one command.

The client is source-available for transparency. The optimization service is hosted.

GitHub:
https://github.com/DnaFin/leangetic-cli

Website:
https://leangetic.com/

NPM:
https://www.npmjs.com/package/@leangetic-ai/cli

Who it is for

Leangetic is probably not useful if your agent is tiny, cheap, or experimental.

It is more relevant if you already have an agent that:

  • runs often
  • uses real tools
  • has repeated model calls
  • sends a lot of context
  • touches production workflows
  • needs cost and latency control
  • needs safe rollback

We’re currently in assisted alpha and looking for feedback from developers building real agent systems.

I’d love to hear:

  • What parts of your agent loops are the most wasteful?
  • Do you already separate deterministic code from LLM reasoning?
  • What kind of proof would make you trust an optimized hybrid agent?
  • Which frameworks should we test most deeply next?

Top comments (0)