
Kujo is the programming language for AI-native software: built in Rust, VM-first, and designed so that both the developer (you) and their (your) AI agents can work with it deterministically.
Here are seven high impact ways it improves your AI-assisted development workflows.
1. Deterministic AI Calls with Record/Replay Cassettes
AI-assisted code is only as testable as its AI calls are repeatable. Kujo's AI runtime records successful responses to JSON cassettes and replays them offline. No sockets, flaky tests or API spend in CI.
- KUJO_AI_RECORD / KUJO_AI_REPLAY environment controls, plus per-call cassette options
- strict mode fails on replay misses instead of silently hitting the network
- Cassettes redact credentials before writing; lookup happens before any network policy checks, so tests stay hermetic even with egress disabled
Why it matters: Your agent-written integration tests run green every time, identically, everywhere.
2. Deterministic Request Hashing for Caching & Idempotency
ai_request_hash() returns a stable SHA-256 of a normalized AI request: pure, versioned (_hash_version: 1), and excluding credentials and volatile headers.
This gives agents and pipelines a reliable key for caching, deduplication, and idempotent retries without ever performing I/O.
Why it matters: Identical prompts map to identical cache keys; billing-grade ambiguity disappears from your automation.
3. Structured Output Validation Built Into the Runtime
json_schema_validate(value, schema) validates model output against a practical JSON Schema subset - types, required fields, bounds, patterns, combinators, local $ref - and rejects unsupported keywords rather than silently passing them.
Errors come back with precise pointer paths such as /items/0/name.
Why it matters: LLMs hallucinate structure; Kujo makes "trust but verify" a one-line contract instead of a bespoke parser.
4. Capability-Gated Egress & Secret Redaction by Default
AI helpers require an explicit network-ai capability (--untrusted --allow-ai), honoring endpoint allowlists via KUJO_AI_ALLOWED_ENDPOINTS.
Secrets wrapped with secret(value) print and serialize as *** through every conversion path, and API keys are redacted from errors, response excerpts, and cassette metadata.
Why it matters: You can let an autonomous agent run Kujo scripts without handing it the keys to your network or your credentials.
5. Token Budgeting and Context Fitting as Primitives
ai_count_tokens() gives deterministic local token estimates, and ai_fit_context(messages, max_tokens) trims conversation history to fit a budget, never dropping system messages or the last user message, and reporting exactly what was dropped.
Why it matters: Agents can manage their own context windows locally and predictably, with no tokenizer downloads or provider round-trips required.
6. An Agent-Readable Toolchain
Kujo is built to be read by machines as much as humans:
- kujo doctor - first-party diagnostics and environment checks
- kujo check / kujo test-run / snapshot kujo test - fast verification loops
- kujo docgen + machine-readable CLI contracts for tooling
- kujo lsp - editor and agent integration
- Deterministic packages: init, package-add, package-install --frozen with reproducible kujo.lock snapshots
Why it matters: Coding agents get structured feedback instead of parsing prose from logs, closing the loop faster.
7. VM-First Execution with Practical Native APIs
Scripts run on a bytecode VM by default, with JIT opt-in and an interpreter fallback. This gives predictable behavior across both your local development and production environments.
A broad native standard library: filesystem, process, network, async, crypto, database, hashing, and vector math (vec_cosine, vec_top_k) means agents write more single-language, sandboxable code.
Why it matters: Fewer moving parts means fewer places for generated code to break, and streaming callbacks (ai_stream_chat) plus multimodal message builders keep modern AI UX patterns first-class.
---
Learn more at kujolang.ai 🦾
