Showcase

See Borz in action.

Complete runnable examples — from a pure agent talking to a DENSE actor, to a local Gemma4 conversation loop with zero API cost. Each shows the .borz source, what it demonstrates, and how to run it.

Prerequisites — local setup
Borz compiler
# Hosted — no install:
curl -F target=native -F source=@app.borz \
     https://api.borz.ai/v1/compile
# Offline binary: apply for Community access
# at /community-apply (free, one machine)
ollama + Gemma4 (for local LLM examples)
# Install ollama: https://ollama.ai
ollama pull gemma4:12b
ollama pull gemma4:27b   # for arena example
# ollama runs at http://localhost:11434
agent ↔ actor

ReviewCoder agent + ReviewLog actor

What it shows

The canonical corrected model: a pure LLM agent (ReviewCoder, Claude) emits typed ReviewResult messages to a deterministic actor (ReviewLog, DENSE). The agent never touches DENSE. The compiler validates both sides of the handoff.

Run it
cd showcase/06_pure_agent
# Compile the actor to DENSE:
borz compile review.borz --target dense
# Emit the agent manifest:
borz compile review.borz --emit-agents
# → reviewcoder.agent.json (not a binary)

# Or compile actor to native for local testing:
borz compile review.borz --target native
./review.native --serve --port 8086

The agent never becomes a binary. Its compiled artifact is a JSON manifest the Clan Control runtime provisions.

agent constructactor constructtyped message busDENSE binaryagent manifest
agent-actor-interop.borz Open in playground →
// showcase/06_pure_agent/review.borz
// The corrected agent/actor model — a pure LLM agent and a deterministic actor
// talking over one typed message bus.

msg ReviewResult:
    verdict: str
    score:   i64

// Deterministic actor — compiles to DENSE; replayable; Ed25519 receipt per call.
actor ReviewLog:
    @persistent var reviewed: i64 = 0
    @persistent var flagged:  i64 = 0

    on msg ReviewResult:
        reviewed = reviewed + 1
        if msg.score < 50:
            flagged = flagged + 1

// Pure LLM agent — host-bound (Claude); never DENSE.
// Compiled artifact: reviewcoder.agent.json (JSON manifest, not a binary).
agent ReviewCoder:
    kind:    coder
    persona: "Senior code reviewer. Terse; cites file:line; never speculative."
    model:   claude:opus                 # mandated host:model
    memory:  conversation                # uses prior turns
    budget:  <= 200k tokens / hour
    tools:   [ ReviewLog.ReviewResult ]  # agent→actor: record a finished review
    accepts: [ prompt ]                  # generalist: accepts arbitrary prompts
    emits:   [ ReviewResult ]            # typed output consumed by ReviewLog
agent — local LLM

LocalSummariser — agent on gemma4:12b via ollama

What it shows

A pure LLM agent with model: local:ollama:gemma4:12b. No cloud API key. No usage cost. The Clan Control runtime routes dispatches to the local ollama host. Swap the model field to move to a different Gemma4 variant or to Claude.

Run it
# Prerequisite: ollama running with gemma4 pulled
ollama pull gemma4:12b

# Compile + emit agent manifest:
borz compile agent.borz --emit-agents
# → localsummariser.agent.json

# Clan Control provisions the agent from the manifest.
# The agent runs on your local ollama — no API key.

Any agent field can be changed without touching actor code. model: claude:opus provisions the same persona on Claude instead.

agent constructlocal:ollama:gemma4:12bno API keyClan Controlmodel-portable
local-agent-gemma4.borz Open in playground →
// Agent defined for local Gemma4 via ollama.
// model: local:ollama:gemma4:12b — pinned to the local host.
// No ANTHROPIC_API_KEY needed. No cloud cost.

msg SummariseDoc:
    title:   str
    content: str

agent LocalSummariser:
    kind:    summariser
    model:   local:ollama:gemma4:12b
    memory:  rolling(turns: 3)

    system: """
        You summarise technical documents.
        Return a 3-bullet executive summary.
        Be precise; avoid hedging language.
    """

    tools:   [ DocStore.SaveSummary ]
    accepts: [ SummariseDoc, prompt ]
    emits:   [ Summary ]
agentic actor

Classifier — agentic actor with infer

What it shows

An actor that uses infer — a single typed LLM step embedded in a handler. This is an agentic actor, not a pure agent. The actor decides what to infer, handles the typed result deterministically, and routes the outcome. DENSE-eligible.

Run it
# With Claude (ANTHROPIC_API_KEY set):
borz compile classifier.borz --target native
ANTHROPIC_API_KEY=sk-ant-... ./classifier.native --serve --port 8080
curl -X POST http://localhost:8080/classify -d '{"text":"Borz is excellent!"}'

# With local Gemma4 via ollama:
BORZ_LLM_PROVIDER=ollama BORZ_LLM_MODEL=gemma4:12b \
  BORZ_LLM_URL=http://localhost:11434 \
  ./classifier.native --serve --port 8080

infer uses the same BORZ_LLM_* environment variables as the ollama chat example — swap the provider without touching source.

infer:@http@cli@persistentagentic actorollama / Claude
agentic-actor.borz Open in playground →
// examples/20_llm_classifier/classifier.borz
// Agentic actor — uses infer to call a model; still an actor, still DENSE-eligible.

msg Classify:
    text: str

actor Classifier:
    @persistent var last_label: str = ""
    @persistent var call_count: i64 = 0
    @persistent var pos_count:  i64 = 0
    @persistent var neg_count:  i64 = 0

    @http(method="POST", path="/classify")
    @cli(command="classify", desc="Classify text sentiment")
    on msg Classify:
        infer:
            system: "Classify sentiment. Reply: POSITIVE, NEGATIVE, or NEUTRAL."
            user:   msg.text
            target: last_label
        call_count = call_count + 1
        if last_label == "POSITIVE":
            pos_count = pos_count + 1
        if last_label == "NEGATIVE":
            neg_count = neg_count + 1
        response(last_label, pos=pos_count, neg=neg_count, total=call_count)
agentic actor — local LLM

ChatBot — multi-turn conversation on Gemma4

What it shows

A stateful conversational actor using infer with Ollama. Maintains a 3-exchange sliding window via @persistent parallel vars. Serves HTMX fragments. Run it on gemma4:12b for a fully local, uncapped conversation loop.

Run it
borz compile chat.borz --target native
cd examples/35_ollama_chat

# Run on Gemma4 locally (no API key):
BORZ_LLM_PROVIDER=ollama BORZ_LLM_MODEL=gemma4:12b \
  BORZ_LLM_URL=http://localhost:11434 \
  ./chat.native --serve --port 8035

# Or on Claude (requires API key):
ANTHROPIC_API_KEY=sk-ant-... ./chat.native --serve --port 8035

curl -X POST http://localhost:8035/chat -d '{"message":"Hello!"}'

Change BORZ_LLM_MODEL to gemma4:27b, qwen3:8b, or any model in your ollama library without recompiling.

infer:@persistentollamagemma4:12bsliding-window historyHTMX
ollama-chat.borz Open in playground →
// examples/35_ollama_chat/chat.borz
// Multi-turn conversational actor using Ollama + any local model.
// Set BORZ_LLM_MODEL=gemma4:12b to run on Gemma 4 locally.

msg Chat:
    message: str

actor ChatBot:
    @persistent var turn_count: i64 = 0
    @persistent var u0: str = ""
    @persistent var u1: str = ""
    @persistent var u2: str = ""
    @persistent var a0: str = ""
    @persistent var a1: str = ""
    @persistent var a2: str = ""

    @http(method="POST", path="/chat")
    on msg Chat:
        if str_len(msg.message) == 0:
            fail(code=400, msg="message required")
        // Build context from last 3 exchanges
        let ctx = ""
        call go """
            // (sliding-window history built from u0..u2, a0..a2)
        """
        let response = ""
        infer:
            system: "You are a helpful assistant. Respond concisely."
            user:   ctx
            target: response
        // Rotate history
        u0 = u1
        a0 = a1
        u1 = u2
        a1 = a2
        u2 = msg.message
        a2 = response
        turn_count = turn_count + 1
        response(reply=response, turns=turn_count)
agentic actor — multi-model

Arena — side-by-side model comparison

What it shows

Compare two models on the same prompt. Primary model via BORZ_LLM_MODEL (e.g. gemma4:12b); secondary model named in the POST body (e.g. gemma4:27b). Persists last 4 battle records. Good for evaluating Gemma4 variants against each other.

Run it
borz compile arena.borz --target native
cd examples/40_model_arena

BORZ_LLM_PROVIDER=ollama BORZ_LLM_MODEL=gemma4:12b \
  ./arena.native --serve --port 8040

# Compare gemma4:12b vs gemma4:27b:
curl -X POST http://localhost:8040/compare \
  -d '{"prompt":"Explain Borz actors in one sentence.","model_b":"gemma4:27b"}'

The primary model uses infer:; the secondary model is called via a raw Ollama HTTP request in a call go block — both mechanisms in one handler.

infer:call goollamagemma4 variants@persistent parallel arraysHTMX
model-arena.borz Open in playground →
// examples/40_model_arena/arena.borz
// Side-by-side model comparison — primary model (env) vs secondary (POST field).
// Run with gemma4:12b as primary and gemma4:27b as secondary.

msg Compare:
    prompt:  str
    model_b: str   # e.g. "gemma4:27b"

actor Arena:
    @persistent var battle_count: i64 = 0

    @http(method="POST", path="/compare")
    on msg Compare:
        let response_a = ""
        // Primary model via BORZ_LLM_PROVIDER / BORZ_LLM_MODEL env
        infer:
            system: "Be concise and direct."
            user:   msg.prompt
            target: response_a
        // Secondary model via raw Ollama API call (call go block)
        let response_b = ""
        call go """
            // POST to http://localhost:11434/api/chat with msg.ModelB
        """
        battle_count = battle_count + 1
        // Return two-column comparison card as HTML
        serve(content_type="text/html", body=_html)
agent — multi-tool

QAReviewer — three-tool agent on Claude

What it shows

A QA agent with three distinct tools: Issue, Pass, and Escalation — each a separate typed message in the same deterministic actor. Demonstrates that an agent's tools: list can reference multiple message types from one actor, giving the agent a typed call-back API rather than a single generic tool.

Run it
# Compile QALog actor to native:
borz compile qa.borz --target native

# Emit the agent manifest (not a binary):
borz compile qa.borz --emit-agents
# → qareviewer.agent.json

# Run with Claude API key:
ANTHROPIC_API_KEY=sk-ant-... ./qa.native --serve --port 8090

# Clan Control provisions the agent from qareviewer.agent.json.
# The actor runs on --target native; swap to --target dense for DENSE.

tools: [ QALog.Issue, QALog.Pass, QALog.Escalation ] — all three map back to the same actor. The compiler checks every typed contract at build time.

agent constructthree toolsrolling(turns: 10)budget:claude:sonnetdeterministic actor
multi-tool-qa.borz Open in playground →
// showcase/07_qa_reviewer/qa.borz
// Three-tool quality-assurance agent on Claude.
// Issue / Pass / Escalation are separate message types → separate tools.
// The actor records the full audit log deterministically; the agent never touches DENSE.

msg Issue:
    rule:     str
    severity: str    // "error" | "warning"
    excerpt:  str

msg Pass:
    rule: str

msg Escalation:
    reason: str

// QA audit log — deterministic system of record. DENSE-eligible.
actor QALog:
    @persistent var errors:      i64 = 0
    @persistent var warnings:    i64 = 0
    @persistent var passes:      i64 = 0
    @persistent var escalations: i64 = 0

    on msg Issue:
        if msg.severity == "error":
            errors = errors + 1
        else:
            warnings = warnings + 1
        response(rule=msg.rule, severity=msg.severity, errors, warnings)

    on msg Pass:
        passes = passes + 1
        response(rule=msg.rule, passes)

    on msg Escalation:
        escalations = escalations + 1
        response(reason=msg.reason, escalations)

// QA agent — runs on Claude; three distinct tools for issue / pass / escalate.
agent QAReviewer:
    kind:    reviewer
    persona: """
        You are a quality-assurance reviewer. For each piece of content you review:
        — Call Issue for any rule violation (set severity to "error" or "warning").
        — Call Pass for each rule the content satisfies.
        — Call Escalation if the content requires human judgment.
        Cite the rule name precisely. Be terse. No preamble.
    """
    model:   claude:sonnet
    memory:  rolling(turns: 10)
    budget:  <= 100k tokens / hour
    tools:   [ QALog.Issue, QALog.Pass, QALog.Escalation ]
    accepts: [ prompt ]
two-agent pipeline

Classifier + Researcher — two-tier agent pipeline

What it shows

Fast gemma4:e2b classifier routes questions by depth; gemma4:12b researcher handles the complex ones. Both share one deterministic ResearchLog actor. This is the right-sizing pattern: run the cheap model on everything, the expensive model only where it earns its cost. The actor is the auditable record of every finding.

Run it
# Compile ResearchLog actor:
borz compile research.borz --target native

# Emit both agent manifests:
borz compile research.borz --emit-agents
# → classifier.agent.json + researcher.agent.json

# Requires ollama on :11434 with both models:
ollama pull gemma4:e2b
ollama pull gemma4:12b

BORZ_LLM_PROVIDER=ollama BORZ_LLM_URL=http://localhost:11434 \
  ./research.native --serve --port 8091
# Both agents run locally — no API key needed.

Swap Classifier's model to claude:haiku and Researcher's to claude:opus for a cloud-tier right-sizing pattern — no actor code changes.

two agentsgemma4:e2b + gemma4:12bshared actormemory: none vs rollingbudget:model-portable
research-pipeline.borz Open in playground →
// showcase/08_research/research.borz
// Two-tier research pipeline: a fast gemma4:e2b classifier routes questions;
// a larger gemma4:12b researcher synthesises the deep ones.
// Both share one deterministic log actor — the typed contract is enforced at compile time.

msg Finding:
    depth:  str    // "shallow" | "deep"
    answer: str

msg Stats:

// Shared research log — deterministic, replayable.
actor ResearchLog:
    @persistent var shallow: i64 = 0
    @persistent var deep:    i64 = 0
    @persistent var total:   i64 = 0

    on msg Finding:
        total = total + 1
        if msg.depth == "deep":
            deep = deep + 1
        else:
            shallow = shallow + 1
        response(depth=msg.depth, shallow, deep, total)

    on msg Stats:
        response(shallow, deep, total)

// Fast-tier classifier — cheap model; runs on every question.
agent Classifier:
    kind:    classifier
    persona: "Classify this research question as 'shallow' (one-sentence fact) or 'deep' (requires synthesis). Reply with one lowercase word only."
    model:   local:ollama:gemma4:e2b
    memory:  none
    tools:   [ ResearchLog.Finding ]
    accepts: [ prompt ]

// Deep-tier researcher — larger model; for complex questions only.
agent Researcher:
    kind:    researcher
    persona: """
        You synthesise research findings into clear, precise answers.
        Keep answers to 3–5 sentences; cite key assumptions.
        After answering, call the Finding tool with depth="deep" and your answer.
    """
    model:   local:ollama:gemma4:12b
    memory:  rolling(turns: 6)
    budget:  <= 200k tokens / hour
    tools:   [ ResearchLog.Finding ]
    accepts: [ prompt ]
Full applications

Complete Borz applications.

Production-grade examples across all targets — native, DEMIX, DENSE, Ephernity.

native + HTMX

Real-time dashboard

System metrics from N actors, auto-refreshing via HTMX

@http@persistentMap[str,i64]f-strings
native + wasm

Full-stack notes app

Server-side actors + WASM client, one language for both

@http@dom@persistentList[str]
DENSE cluster

Distributed counter

@replicated(factor=3) counter across nodes

@replicated@persistent@http
DENSE cluster

Sharded tenant cache

@partition(key=tenant) Map-of-Maps cache

@partition@shardMap[str,str]
native + infer

LLM conversational agent

Multi-provider routing + persisted conversation history

infer@persistentList[str]
demix

Approval workflow

Multi-actor approve/reject pipeline with audit trail

sendresponse()@httpMap[str,str]
native

Rate-limited public API

Token-bucket + per-key quotas with typed responses

@http@persistentMap[str,i64]
native

Binary attestation registry

HATP (Hardware Attestation Trust Protocol)-style attestation storage and verification

@http@persistentMap[str,str]
wasm

WASM benchmark runner

Runs Borz programs client-side and reports timings

@domcall gostd/dom
native

ETL pipeline

File in → transformer chain → file out

call goList[str]@persistent
native + dense + demix

Ephernity — flagship timed-ledger

Borz's flagship project: an attested append-only ledger spanning seconds (T0) to eternal (T7), with BLAKE3 chains and HATP signing. Open protocol at ephernity.org; the product, Epher CC — Continuity Computer, at epher.cc.

@persistentbytesblake3ed25519falcon-1024@http

Try it in the playground.

Paste any example, compile, and get a share link — no account needed.