Nexa is the first Harness Native Agent Language — a programming language designed specifically for Large Language Models (LLMs) and Agentic Systems, where agent safety is a language property, not a runtime convention.
Modern AI application development is plagued by massive Prompt concatenation, bloated JSON parsing suites, unreliable regex belts, and complex frameworks. Nexa elevates high-level intent routing, multi-agent concurrent assembly, pipeline streaming, and tool execution sandboxing as first-class syntax citizens. Through the underlying Transpiler, it transforms into stable, reliable Python Runtime, allowing you to define the most hardcore LLM computation graphs (DAGs) with the most elegant syntax.
Nexa v2.1 adds agent-level properties parsed by the compiler and enforced at runtime — not framework configurations, but language primitives:
| Property | Type | Default | Description |
|---|---|---|---|
stream |
true / false |
false |
Stream output token-by-token |
output_format |
"json" / "" |
"" |
Force OpenAI response_format JSON |
output_schema |
{...} |
— | JSON Schema; compiler auto-generates Pydantic |
max_tool_calls |
int |
10 |
Max tool call rounds per request |
tool_call_strategy |
"auto" / "required" / "none" |
"auto" |
Control tool call behavior |
agent Coder {
prompt: "You are a coding assistant.",
stream: true,
max_tool_calls: 5,
tool_call_strategy: "auto"
}
Backward compatible: all v1.x and v2.0 code runs unchanged.
Nexa v2.0 introduces the Harness Native Runtime — transforming the Harness six-tuple H=(E,T,C,S,L,V) from compile-time validation into runtime first-class primitives:
| Dimension | Primitive | Runtime Component | Tests |
|---|---|---|---|
| E (Execution) | autoloop |
HarnessKernel + AutoLoopConfig | 52 |
| T (Tool) | @tool |
ToolRegistry + ToolSchema | 53 |
| C (Context) | with_context |
ContextManager + importance_weighted | 52 |
| S (State) | snapshot/restore |
StateStore + fork/merge | 45 |
| L (Lifecycle) | before_step/after_step/reflect |
LifecycleHookManager | 53 |
| V (Verify) | verify ... satisfies |
EvaluationInterface + LLMRouter | 59 |
| Actor | spawn/pass/await |
ActorSystem | 18 |
| WASM | sandbox integration | WASM Sandbox + full harness | 15 |
Total 296 new tests, plus v1.x 1500+ tests = 1935+ tests.
12 complete examples covering all Harness dimensions:
examples/v2.0/
01_autoloop.nx — E-dimension: autonomous ReAct loop
02_with_context.nx — C-dimension: context management
03_try_agent.nx — E+L: fault-tolerant execution + reflection
04_tool_annotation.nx — T-dimension: zero-cost tool binding
05_snapshot_restore.nx — S-dimension: state snapshots
06_fork_merge.nx — S-dimension: branch exploration
07_verify.nx — V-dimension: output verification
08_reflect.nx — L-dimension: reflection injection
09_lifecycle_hooks.nx — L-dimension: lifecycle interception
10_actor_system.nx — Actor: multi-agent orchestration
11_well_harnessed.nx — full-dimension example
12_harness_cli.nx — Claude Code-like CLI framework
Nexa released 16 core features from v1.1.0 to v1.3.7, covering 4 priority tiers (P0-P3), with 1500+ tests total.
| Version | Feature | Tests | Highlights |
|---|---|---|---|
| v1.1.0 | Intent-Driven Development (IDD) | 104 | .nxintent files + IAL term rewriting engine + @implements annotations |
| v1.2.0 | Design by Contract (DbC) | 47 | requires/ensures/invariant + ContractViolation cross-module integration |
| v1.3.0 | Agent-Native Tooling | 41 | nexa inspect/validate/lint CLI commands |
| Version | Feature | Tests | Highlights |
|---|---|---|---|
| v1.3.1 | Gradual Type System | 79 | Int/String/Bool/List[T]/Option[T]/Result[T,E] + 3-level mode |
| v1.3.2 | Error Propagation | 82 | ? operator + otherwise + NexaResult/NexaOption |
| v1.3.3 | Background Job System | 73 | job DSL + priority queues + cron + backoff strategies |
| v1.3.4 | Built-In HTTP Server | 94 | server DSL + CORS/CSP + route guards + hot reload |
| v1.3.5 | Database Integration | 79+5 | db DSL + SQLite/PostgreSQL + Agent memory API |
| Version | Feature | Tests | Highlights |
|---|---|---|---|
| v1.3.6 | Auth & OAuth | 79+5 | 3-layer auth (API Key + JWT + OAuth PKCE) |
| v1.3.6 | Structured Concurrency | 172 | spawn/parallel/race/channel + 18 API functions |
| v1.3.6 | KV Store | 81 | SQLite backend + TTL + Agent semantic queries |
| v1.3.6 | Template System | 209 | template"""...""" + 30+ filters + Agent templates |
| Version | Feature | Tests | Highlights |
|---|---|---|---|
| v1.3.7 | Pipe Operator ` | >` | 84 |
| v1.3.7 | defer Statement | 84 | LIFO cleanup on scope exit |
| v1.3.7 | Null Coalescing ?? |
84 | expr ?? fallback safe fallback |
| v1.3.7 | String Interpolation #{} |
100 | Ruby-style string interpolation |
| v1.3.7 | Pattern Matching | 91 | 7 pattern types + match/let/for destructuring |
| v1.3.7 | ADT (Struct/Enum/Trait) | 100 | Algebraic data types + handle-as-dict pattern |
Nexa v1.0-alpha introduced the revolutionary Agent Virtual Machine (AVM) — a high-performance, securely isolated agent execution engine written in Rust:
- High-performance bytecode interpreter — Natively executes compiled Nexa bytecode
- WASM Security Sandbox — wasmtime integration + 4-level permission model
- Smart Scheduler — DAG topological sort + automatic dependency resolution
- Vector Virtual Memory Paging — LRU/LFU/Hybrid eviction + semantic relevance loading
git clone https://github.com/ouyangyipeng/Nexa.git
cd Nexa
pip install -e .If you're using AI Agent tools (Claude Code, Cursor, Copilot, etc.), simply enter:
Follow the instructions at https://github.com/ouyangyipeng/Nexa/AGENT_LEARN to install and try this language
Your Agent will automatically access AGENT_LEARN/ to complete installation and learn Nexa syntax.
Agent-specific docs:
# Run flow
python -m src.cli run examples/01_hello_world.nx
# Semantic assertion tests
python -m src.cli test examples/12_v0.9_features.nx
# Audit generated Python code stack
python -m src.cli build examples/01_hello_world.nx
# Agent-Native tooling (v1.3+)
python -m src.cli inspect examples/01_hello_world.nx
python -m src.cli validate examples/01_hello_world.nx
python -m src.cli lint examples/01_hello_world.nxagent ChatBot {
role: "Helpful Assistant",
model: "gpt-4o-mini",
prompt: "Answer user questions concisely"
}
flow main {
result = user_input |> ChatBot |> format_output;
}
agent SecureBot {
requires: input != None and input.length < 1000
ensures: "response is helpful and accurate"
}
let count: Int = parse(input) ?
let result = risky_operation() otherwise 0
server 8080 {
cors { origins: ["*"], methods: ["GET", "POST"] }
route GET "/chat" => ChatBot
route POST "/analyze" => Analyzer
}
enum Option { Some(value), None }
struct Point { x: Int, y: Int }
match result {
Option::Some(answer) => answer
Option::None => "no response"
}
- Python Tests: 1935 tests passed (v1.x 16 features + v2.0 Harness Runtime + v2.1 Agent Properties)
- Rust AVM: 0 errors, 0 warnings —
cargo checkclean build - v2.0+2.1 Examples: 16/16 all compile with
nexa build --harness=warn
- Nexa Syntax Reference v1.3.7 — 25 chapters full syntax coverage
- Compiler & Runtime Architecture v1.3 — AST scoring, BOILERPLATE, handle-as-dict
- Roadmap & Vision — v0.1 to v1.3.7 complete milestones
- Architecture Evolution Plan — Rust AVM design blueprint
- Quick Start Guide — 5-minute introduction
- IDD Complete Reference — Intent-Driven Development deep dive
- Feature Changelog v1.1-v1.3.x — 16 feature change records
- Release Notes — Per-version release announcements
