How to use Leangetic
Leangetic runs entirely from the CLI on your machine. Your secrets and private data never leave it. Only a redacted bundle (your prompts and code with secrets stripped, plus trace metrics) is sent. Follow these steps.
Open the Install page, run the command, then come back.
Two ways to authenticate the CLI. Either works:
API key (recommended for CI and headless runs): create one on the API Keys page, then:
leangetic login --api-url https://api.leangetic.com --api-key ac_your_key
Email and password (for an alpha email account): use the email you signed up with:
leangetic login --api-url https://api.leangetic.com --email you@example.com --password '<password>'
Installs a local listener; your agent runs exactly as before while the engine records each model step in SHADOW. Nothing is changed.
leangetic start ./your-agent
See exactly where your agent spends time and money: cost and latency per step, which calls repeat, and which steps fail or retry. No projections.
leangetic profile
Run your real workload so there's evidence, then send a redacted bundle to Leangetic. Our servers map your steps, synthesize deterministic code for the safe ones, tune the rest, and return the assembled hybrid. This uses credits.
leangetic optimize ./your-agent
Approves a code step only after it reproduces the model on every real call, and ships the hybrid only when it's cheaper with equal-or-better quality.
leangetic judge
One command switches to the proven hybrid; every served step still falls back to the model on any doubt. Your original is never modified.
leangetic promote # go live with the proven hybrid leangetic rollback # revert to the original, instantly
Make it cheaper (optional, advanced): the per-call engine
The steps above wrap your whole agent with a safe exact-input cache. The per-call engine goes deeper: it intercepts each individual model call, so it can also win on non-repeating inputs (prompt-cache compaction), verified model routing to a cheaper tier, and exact-cache reuse. Every win is measured per call and only served once proven equivalent. It defaults to SHADOW (measures, never changes your output); ACTIVE applies only the safe wins. Because the wrap package runs your agent as a subprocess, the engine cannot inject itself for you, so you adopt it one of two honest ways:
Download the engine next to your agent and add one import at the very top of your entrypoint. It monkeypatches the Anthropic SDK Messages.create and fails open (SDK absent or any error -> your original call, unchanged).
curl -fsSL https://leangetic.com/downloads/leangetic_engine.py -o leangetic_engine.py
import leangetic_engine as e; e.install() # first line of your agent
Note: this only intercepts calls that go through the Anthropic Python SDK. Agents that shell out to a subscription CLI are measured-but-not-intercepted in-process. Use the proxy below for those.
Run the proxy and point your agent's base URL at it. No code change beyond the env var. Streaming and tool-use calls are passed through verbatim (never optimized in v1).
curl -fsSL https://leangetic.com/downloads/leangetic_engine.py -o leangetic_engine.py curl -fsSL https://leangetic.com/downloads/leangetic_proxy.py -o leangetic_proxy.py python leangetic_proxy.py --port 8788
export ANTHROPIC_BASE_URL=http://127.0.0.1:8788 # then run your agent as usual
Both paths write an honest per-call ledger to .leangetic/. Read the aggregate at any time:
leangetic engine-report
Savings are measured per call from real provider usage at published pricing, and are only served when proven equivalent, never an unverified cheaper answer. Default mode is SHADOW; switch with LEANGETIC_ENGINE_MODE=active and kill it any time with LEANGETIC_ENGINE=off. Each call is measured from real provider usage and an optimization is served only once proven equivalent, with a promote ratchet gating every signature.
Loading sign-in...