← Back to Home

Zerolang — The Graph-Native Programming Language for AI Agents

Zerolang — The Graph-Native Programming Language for AI Agents

AI agents write code today the same way humans do: by generating text files and running them through a compiler. But text lines are a terrible interface for machines. A single misplaced character sends the agent back to the drawing board. What if instead of text, the program was a graph — a semantic database that agents can query, inspect, and patch directly?

Zerolang (by Vercel Labs) is an experimental answer to that question. It's a graph-native programming language where the semantic graph is the program database. Humans ask for outcomes. Agents query the graph, submit checked edits, and prove the result — without guessing at line numbers or text structure.

Why It's Trending

Zerolang hit 5,000+ GitHub stars within two weeks of its public release. The AI agent ecosystem is hungry for better tools, and Zerolang's graph-first approach addresses three fundamental pain points:

  • Stale context — Agents re-read entire files when a single node changes
  • Random errors — Text patching produces syntax errors from trivial mistakes
  • No semantic structure — Line ranges carry no meaning about what changed

By making the graph the source of truth, Zerolang gives agents explicit handles: symbols, node IDs, graph hashes, types, effects, ownership facts, and call edges. Every edit is checked against the graph before it's stored.

Architecture Overview

Zerolang Architecture

The architecture follows a clean four-layer pipeline:

User Layer — A developer + AI agent initiates a request (e.g., "build a calculator"). The agent doesn't write text files — it issues graph queries and patch commands.

CLI Layer — The zero CLI is the agent's interface. Commands like zero query inspect the graph, zero patch submits checked edits, and zero run executes programs with full capability sandboxing.

Core Layer — Three interconnected components form the engine:

  • zero.graph — The semantic graph database. This is the single source of truth. Every node, edge, type, and hash is stored here.
  • Compiler — Parses, type-checks, and validates patches against the graph. Stale hashes, invalid shapes, and type errors fail before any data is written.
  • Runtime — Token-efficient execution with explicit capability checks, fast startup, and low memory usage.

Output Layer — Human-readable .0 projection files (text) let humans review and occasionally edit. Compiled binaries are standalone executables tested via zero test.

Prerequisites

  • Linux, macOS, or Windows
  • curl (for installation)
  • An AI agent (Claude, Codex, etc.) to interact with Zerolang — though you can use the CLI directly too

Installation

Zerolang provides a single-command installer:

curl -fsSL https://zerolang.ai/install.sh | bash
export PATH="$HOME/.zero/bin:$PATH"
zero --version

On our test system (Linux x86_64), this installed zero 0.3.2 cleanly.

Agent Skill Setup

If you're using an AI agent, install the bootstrap skill:

npx skills add vercel-labs/zerolang

Then load the compiler's bundled skills:

zero skills
zero skills get agent
zero skills get graph
zero skills get language
zero skills get stdlib

Getting Started: Hello World

Zerolang's workflow is completely different from traditional programming. You don't write a file — you initialize a graph project and submit patches.

mkdir hello-zero && cd hello-zero
zero init

This creates zero.toml (package config) and zero.graph (the graph database).

Step 1: Add a Main Function

zero patch --op 'addMain'

This adds a main function node to the graph. Query the graph to confirm:

zero query

You'll see the function listed under functions: main.

Step 2: Add Output

zero patch --op 'addCheckWrite fn="main" text="hello from zero\n"'

Step 3: Run

zero run

You won't see visible output because the runtime writes to world.out (which defaults to /dev/null in headless mode). Let's make it interactive:

Step 4: Replace with a Greeting

zero patch --op 'replaceFunctionBody main
  let name Maybe<String> = std.args.get 1
  if name.has
    check world.out.write "hello "
    check world.out.write name.value
    check world.out.write "\n"
  else
    check world.out.write "hello anonymous\n"
end'

Now run with and without an argument:

zero run -- "World"
# Output: hello World
zero run
# Output: hello anonymous

Building a Math Function with Tests

Zerolang supports modular functions and built-in testing:

mkdir zero-math && cd zero-math
zero init

Add an add function:

zero patch --op 'addFunction name="add" ret="i32"' \
--op 'addParam fn="add" name="left" type="i32"' \
--op 'addParam fn="add" name="right" type="i32"' \
--op 'addReturnBinary fn="add" name="+" left="left" right="right" type="i32"'

Add a test:

zero patch --op 'addTest name="addition works" call="add" arg0="40" arg1="2" expect="42" type="i32"'

Run tests:

zero test
# Output: 1 test(s) ok

The Daily Loop

Zerolang's development cycle is designed for agents, not text editors:

# Inspect the current graph state
zero query

# See available patch operations
zero patch --op help

# Check for errors
zero check

# Run tests
zero test

# Execute
zero run -- <args>

# Export human-readable projection
zero export

When a human wants to review the program:

zero export
# Reads as: pub fn main(world: World) -> Void raises { ... }

When a human edits a projection file manually:

zero import
zero check

Key Concepts

Graph-First Model

Traditional programming: Text → Parse → AST → Compile → Run

Zerolang programming: Graph Query → Patch → Validate → Store → Execute

The graph is never "compiled from text" — it is the program. Text projections are read-only views that can be verified against the graph.

Capability Safety

Every runtime operation is gated by explicit capabilities. The world.out.write call, for example, requires write access. Capabilities are declared in the graph, not inferred from imports. This makes Zerolang naturally sandboxed — an agent can't accidentally write to your filesystem.

Token Efficiency

Because agents query the graph by ID and hash rather than by reading text files, Zerolang drastically reduces token consumption. A graph query on a medium-sized project is a few hundred tokens. Reading the equivalent text files would be thousands.

Verification Checklist

Before deploying a Zerolang program:

  • zero check passes without errors
  • zero test passes all tests
  • Graph hash is stable (compare zero query output before and after)
  • Capability requests match what the runtime actually needs
  • Projection exports render correctly (zero export then review .0 files)

Use Cases

  • Agent-native development — Build tools where agents create and modify programs without touching text files
  • Sandboxed execution — Run user-submitted code with explicit capability boundaries
  • Self-modifying systems — Programs that can safely inspect and patch their own graph

Resources

← Retour à l'Accueil

Zerolang — Le Langage de Programmation Natif-Graphe pour Agents IA

Zerolang — Le Langage de Programmation Natif-Graphe pour Agents IA

Les agents IA écrivent aujourd'hui du code comme les humains : en générant des fichiers texte et en les passant à un compilateur. Mais les lignes de texte sont une interface terrible pour les machines. Un seul caractère mal placé renvoie l'agent à la case départ. Et si, au lieu du texte, le programme était un graphe — une base de données sémantique que les agents peuvent interroger, inspecter et modifier directement ?

Zerolang (par Vercel Labs) est une réponse expérimentale à cette question. C'est un langage de programmation natif-graphe où le graphe sémantique est la base de données du programme. Les humains demandent des résultats. Les agents interrogent le graphe, soumettent des modifications vérifiées et prouvent le résultat — sans deviner les numéros de ligne ou la structure du texte.

Pourquoi C'est Tendance

Zerolang a atteint plus de 5 000 étoiles GitHub en deux semaines après sa sortie publique. L'écosystème des agents IA a soif de meilleurs outils, et l'approche graphe-first de Zerolang résout trois problèmes fondamentaux :

  • Contexte obsolète — Les agents relisent des fichiers entiers lorsqu'un seul nœud change
  • Erreurs aléatoires — Le patching de texte produit des erreurs de syntaxe à partir de fautes triviales
  • Absence de structure sémantique — Les plages de lignes ne portent aucune signification sur ce qui a changé

En faisant du graphe la source de vérité, Zerolang donne aux agents des poignées explicites : symboles, IDs de nœuds, hachages de graphe, types, effets, faits de propriété et arêtes d'appel. Chaque modification est vérifiée par rapport au graphe avant d'être stockée.

Architecture

Architecture Zerolang

L'architecture suit un pipeline propre en quatre couches :

Couche Utilisateur — Un développeur + un agent IA initie une requête (ex : « construis une calculatrice »). L'agent n'écrit pas de fichiers texte — il émet des requêtes graphe et des commandes de patch.

Couche CLI — La CLI zero est l'interface de l'agent. Des commandes comme zero query inspectent le graphe, zero patch soumet des modifications vérifiées, et zero run exécute les programmes avec un sandboxing complet des capacités.

Couche Moteur — Trois composants interconnectés forment le cœur :

  • zero.graph — La base de données sémantique. C'est la source unique de vérité. Chaque nœud, arête, type et hachage y est stocké.
  • Compilateur — Analyse, vérifie les types et valide les patches par rapport au graphe. Les hachages obsolètes, les formes invalides et les erreurs de type échouent avant toute écriture.
  • Runtime — Exécution économique en tokens avec vérification explicite des capacités, démarrage rapide et faible utilisation mémoire.

Couche Sortie — Des fichiers de projection .0 lisibles par l'humain (texte) permettent la révision. Les binaires compilés sont des exécutables autonomes testés via zero test.

Prérequis

  • Linux, macOS ou Windows
  • curl (pour l'installation)
  • Un agent IA (Claude, Codex, etc.) pour interagir avec Zerolang — mais vous pouvez aussi utiliser la CLI directement

Installation

Zerolang fournit un installateur en une commande :

curl -fsSL https://zerolang.ai/install.sh | bash
export PATH="$HOME/.zero/bin:$PATH"
zero --version

Sur notre système de test (Linux x86_64), cela a installé zero 0.3.2 proprement.

Configuration des Compétences Agent

Si vous utilisez un agent IA, installez la compétence d'amorçage :

npx skills add vercel-labs/zerolang

Puis chargez les compétences groupées du compilateur :

zero skills
zero skills get agent
zero skills get graph
zero skills get language
zero skills get stdlib

Premiers Pas : Hello World

Le flux de travail de Zerolang est complètement différent de la programmation traditionnelle. Vous n'écrivez pas un fichier — vous initialisez un projet graphe et soumettez des patches.

mkdir hello-zero && cd hello-zero
zero init

Ceci crée zero.toml (configuration du paquet) et zero.graph (la base de données graphe).

Étape 1 : Ajouter une Fonction Main

zero patch --op 'addMain'

Ceci ajoute un nœud de fonction main au graphe. Interrogez le graphe pour confirmer :

zero query

Vous verrez la fonction listée sous functions: main.

Étape 2 : Ajouter une Sortie

zero patch --op 'addCheckWrite fn="main" text="hello from zero\n"'

Étape 3 : Exécuter

zero run

Vous ne verrez pas de sortie visible car le runtime écrit dans world.out (qui pointe par défaut vers /dev/null en mode sans tête). Rendons-le interactif :

Étape 4 : Remplacer par un Message de Bienvenue

zero patch --op 'replaceFunctionBody main
  let name Maybe<String> = std.args.get 1
  if name.has
    check world.out.write "hello "
    check world.out.write name.value
    check world.out.write "\n"
  else
    check world.out.write "hello anonymous\n"
end'

Exécutez maintenant avec et sans argument :

zero run -- "Monde"
# Sortie : hello Monde
zero run
# Sortie : hello anonymous

Construire une Fonction Mathématique avec des Tests

Zerolang supporte les fonctions modulaires et les tests intégrés :

mkdir zero-math && cd zero-math
zero init

Ajoutez une fonction add :

zero patch --op 'addFunction name="add" ret="i32"' \
--op 'addParam fn="add" name="left" type="i32"' \
--op 'addParam fn="add" name="right" type="i32"' \
--op 'addReturnBinary fn="add" name="+" left="left" right="right" type="i32"'

Ajoutez un test :

zero patch --op 'addTest name="addition works" call="add" arg0="40" arg1="2" expect="42" type="i32"'

Exécutez les tests :

zero test
# Sortie : 1 test(s) ok

Le Cycle Quotidien

Le cycle de développement de Zerolang est conçu pour les agents, pas les éditeurs de texte :

# Inspecter l'état actuel du graphe
zero query

# Voir les opérations de patch disponibles
zero patch --op help

# Vérifier les erreurs
zero check

# Exécuter les tests
zero test

# Exécuter
zero run -- <args>

# Exporter la projection lisible par l'humain
zero export

Quand un humain veut réviser le programme :

zero export
# S'affiche comme : pub fn main(world: World) -> Void raises { ... }

Quand un humain édite manuellement un fichier de projection :

zero import
zero check

Concepts Clés

Modèle Graphe-First

Programmation traditionnelle : Texte → Analyse → AST → Compilation → Exécution

Programmation Zerolang : Requête Graphe → Patch → Validation → Stockage → Exécution

Le graphe n'est jamais « compilé à partir du texte » — il est le programme. Les projections textuelles sont des vues en lecture seule qui peuvent être vérifiées par rapport au graphe.

Sécurité par Capacités

Chaque opération d'exécution est contrôlée par des capacités explicites. L'appel world.out.write, par exemple, nécessite un accès en écriture. Les capacités sont déclarées dans le graphe, pas déduites des imports. Cela rend Zerolang naturellement sandboxé — un agent ne peut pas accidentellement écrire sur votre système de fichiers.

Efficacité des Tokens

Parce que les agents interrogent le graphe par ID et hachage plutôt qu'en lisant des fichiers texte, Zerolang réduit considérablement la consommation de tokens. Une requête graphe sur un projet de taille moyenne représente quelques centaines de tokens. Lire les fichiers texte équivalents en représenterait des milliers.

Liste de Vérification

Avant de déployer un programme Zerolang :

  • zero check passe sans erreur
  • zero test passe tous les tests
  • Le hachage du graphe est stable (comparez la sortie de zero query avant et après)
  • Les demandes de capacités correspondent à ce dont le runtime a réellement besoin
  • Les projections exportées s'affichent correctement (zero export puis révisez les fichiers .0)

Cas d'Utilisation

  • Développement natif-agent — Construisez des outils où les agents créent et modifient des programmes sans toucher aux fichiers texte
  • Exécution sandboxée — Exécutez du code soumis par l'utilisateur avec des limites de capacités explicites
  • Systèmes auto-modifiants — Programmes qui peuvent inspecter et modifier leur propre graphe en toute sécurité

Ressources