Production agents in 2026 are still held together with Python glue: prompt chains parsed by hand, tool calls wrapped in try/except, no replay, no cost control, no regression tests. Libraries patch symptoms. I wanted to fix the layer where the problem actually lives — the language.
So I built Nudge: a typed, replayable, budget-aware programming language for LLM agents. The compiler is written in Rust (zero dependencies), and it compiles to Python & TypeScript.
The pain, concretely
| Pain | With libraries | With Nudge |
|---|---|---|
| Untyped LLM output | validate at runtime | schema is a type — proven at compile time |
| Hidden side effects | invisible |
uses LLM, Tool, IO in every signature |
| No regression testing | record/replay bolted on | every run emits a trace; every trace is a test |
| Cost surprises | dashboards after the fact | budget is a contract, enforced by compiler + runtime |
A taste
type Finding = { claim: string, source: Url, confidence: float @range(0, 1) }
fn analyze(q: string, hits: [SearchResult]) -> [Finding] uses LLM {
llm"""Extract verifiable findings about {q} from: {hits}"""
with { schema: [Finding], model: "anthropic:sonnet-4.6",
budget: 0.03 USD, retry: 2 with repair }
}
test "stays within budget on recorded trace" {
let t = replay("traces/demo.jsonl")
assert t.cost_usd < 0.25 // zero tokens burned in CI
}
The compiler proves the schema matches, infers effects, and computes a static cost bound. The runtime records every call to a content-addressed trace you can diff, commit, and replay.
What you get out of one .ndg file
- Typed LLM calls — output schema is a language type; violations trigger automatic repair
-
Effect system — pure /
LLM/Tool/IOeffects shown in signatures - Deterministic replay — traces are git-friendly JSONL; replay tests burn zero tokens
- Budget contracts — per-call and per-run USD ceilings with static estimation
-
Checkpoint/resume — crash, then
nudge resumefrom the last checkpoint -
Native parallelism —
par map,par race,par allwith compile-time race safety - MCP tools, A2A agent-card export, LSP, OpenTelemetry — built in, not bolted on
Try it
Everything runs against a deterministic fake provider by default — no API key, no token spend:
cargo build
export PYTHONPATH=$PWD/runtime
nudgec check examples/research_agent.ndg
nudgec cost examples/research_agent.ndg
cd examples && nudgec test research_agent.ndg
There's also a VS Code extension (search "Nudge Language" in the Marketplace) with an LSP for diagnostics, hover, and completion.
The project is MIT-licensed and v1.0 just shipped. I'd genuinely love feedback from people building agents in production — what would you want a language like this to prove for you?
GitHub: https://github.com/NekomyaDev/nudge
If you find it useful, a ⭐ on the repo means a lot at this stage. Thanks for reading!
Top comments (0)