Tier 1

### Delete Agent?

Are you sure you want to delete Agent?
This action is permanent and will purge it from the TIS registry.

⊕ New Agent
Library Template
Agent Name
Custom agents execute real .tern bytecode in the browser or your local cluster node.
Ternlang Logic (Source)
Deploy Swarm Agent
① IDENTITY
② PRICING
③ DEPLOY
Agent Product Name
Service Description
Market Visibility & Pricing
Private
Only you can see and call this agent. Free.
Per Call
Published to Registry. Earn trits per inference.
⏳ Compiling agent flow…
⏳ Registering endpoint…
⏳ Publishing to runtime…
Group into Macro
Define a name for this encapsulated logic module.
System Health
API ternlang-api.fly.dev
Runtime BET-VM v1.0 · WASM
Deploy Fly.io · GitHub Actions
Auth X-Ternlang-Key · tier-gated
MCP Smithery · stdio + HTTP
Enter API key for quota
∞ Unlimited
Albert MoE-13
240+
Global Epoch
6.9003
Best Loss
12k+
Grad Steps
Architecture 4L × 12E × 256H
Quantisation BitNet 1.58-bit
Corpus King James Bible
Status● Training · 4L evolved
Training Dashboard
@sparseskip
A50296/2026 · Pending Measured
2.80×
vs dense MoE
3,228
tok/s per M params · 4L
Routing Top-3 / 12 · 4L
Skip ratio 75% experts skipped / tok
Train 3L 4:30 / epoch
Train 4L 15:18 / epoch
Infer 4L no regression · 83+ tok/s
GPU proj. 8×H100 12.7× vs dense float16
Stack
Language ternlang · .tern
Arithmetic{−1, 0, +1}
Runtime BET-VM v1.0 · WASM
MCP tools 34 · smithery.ai
Stdlib core · math · agents · ml
Transport JSON-RPC 2.0 · SSE
Throughput 83+ tok/s · 4L
Compute 0.157 GF/tok · 4L
BET-VM Playground ⚡ WASM
Execution Log
No executions this session
Resources
ternlang.com ternary-intelligence-stack MCP · smithery.ai/server/ternlang Documentation
Patent
@sparseskip · A50296/2026 · Pending
SPRIND Challenge
KI-Zuverlässigkeit · Stage 1
Quick Actions
bytes—
status—

    — no output —

Registers

Error

Key
No key — anonymous access
Tier 1
Calls: 0 / 0
∞ Unlimited calls
Plan Features
Endpoint: https://ternlang.com
GET /health VM health check
POST /api/run Execute .tern code
GET /api/usage Key quota

    // Click Try to test an endpoint

Trit Builtins

truth() | → trit(+1) | Affirm signal
hold() | → trit(0) | Neutral / hold
conflict() | → trit(-1) | Reject signal
invert(t) | → trit | Negate trit (-1↔+1)
consensus(a,b) | → trit | Ternary AND merge (max signal)

Math Builtins

abs(x) | → int/float | Absolute value
min(a, b) | → int/float | Minimum of two values
max(a, b) | → int/float | Maximum of two values
pow(base, exp) | → int | Integer exponentiation
len(t) | → int | Length of tensor or string
length(t) | → int | Primary dimension of tensor

I/O Builtins

print(v) |  | Print value (no newline)
println(v) |  | Print value + newline
opent(path) | → int | Open file, returns handle
readt(handle) | → string | Read file contents
writet(handle, s) | → trit | Write string to file

Types

trit | -1 / 0 / 1 | Balanced ternary value
int | i64 | 64-bit integer
float | f64 | 64-bit floating point
string | UTF-8 | Text value
bool | true/false | Boolean (coerced to trit)
trit[] | dynamic | Dynamic trit array / buffer
trittensor<N> | N×1 | Fixed-size trit tensor
trittensor<N,M> | N×M | 2D trit tensor
int[N] | fixed | Fixed-size integer array
float[N] | fixed | Fixed-size float array
agentref | ref | Handle to a spawned agent

Control Flow

if ? cond { A } tend { B } reject { C } | Ternary branch (+1/0/-1)
if cond { A } else { B } | Binary branch
while ? cond { body } | Ternary loop (runs on +1)
for x in tensor { body } | Iterate over tensor elements
match x { 1 => {} 0 => {} _ => {} } | Pattern match (int/trit/float)
return val; | Return from function
break; / continue; | Loop control
val? | Early exit on -1 (returns conflict())

Agent Keywords

agent Foo { fn run(...) -> trit { } } | Declare agent type
spawn Foo | → agentref | Create agent instance
send msg to ref |  | Push message to mailbox
await ref | → trit | Run agent, get result
nodeid | → string | Current node address
spawn remote "addr" Foo | → agentref | Spawn on remote node

Directives

@sparseskip |  | Skip zero-signal weights (inference optimization)

VM Error Codes

BET-001 | StackUnderflow | Pop on empty stack — add missing return
BET-007 | TypeMismatch | Wrong type for op — check trit vs int vs float
BET-008 | TensorIndexOOB | Index beyond tensor size
BET-010 | DivByZero | Division or modulo by zero
BET-013 | CallStackOverflow | Deep recursion or unresolved import
BET-014 | AgentIdInvalid | send/await on invalid agent ref
BET-015 | AgentTypeNotRegistered | spawn without agent definition
PARSE-001 | UnexpectedToken | Syntax error — check grammar
PARSE-002 | ExpectedToken | Missing token (often ; or })
MOD-004 | FileNotFound | Import path not found

Literals

1, 0, -1 | int / trit | Integers; coerce to trit where needed
3.14 | float | Decimal float
0xFF, 0b1010 | int | Hex and binary integer literals
"hello" | string | String literal
true / false | bool→int | Boolean literals (1 / 0)
hold / tend | trit | Zero-state trit keyword

Known Limitations

VM-STRUCT-001 | Returning structs from functions not stable — use intermediate vars
COMP-TENSOR-001 | Tensor size max 65535 elements (16-bit immediate)
MOD-004 | Named imports require all dependencies imported explicitly
float[] / int[] | Array literals/params limited — use individual vars or trit[]

⊕
Double-click or press `/` to add a node
Or drag from the library — wire nodes by dragging ● output → ● input
100%
Execution Inspector
MULTIVERSE TIMELINE
TIME: 0.00s
Node Properties
Select a node to configure
Drag ● output → ● input to wire
Workspace Authorization
Enter a new 'tern_...' key to authenticate.
Save Key Locally
Persists your key securely in localStorage across sessions.
Local Secrets Vault
Manage API credentials for external LLM routing. Stored securely in localStorage.
Add / Update Secret
◆ Albert AI Panel
Configure which LLM provider and model Albert uses when invoked from the canvas. Press F6 to open the panel.
Editor Configuration
Customize the Monaco Code Editor and global application theme.
Font Size
Global application and editor text scale.
Minimap
Show code minimap strip.
Word Wrap
Wrap long lines of code.
Theme
Global application theme.
TernStudio v0.3.0 · Ternary Intelligence Stack
Runtime: BET VM (27 registers · balanced ternary)
License: LGPL-3.0-or-later
ternlang.com · GitHub
TernWiki — technical reference for balanced ternary intelligence
Examples Quickstart Stdlib GitHub
Language Fundamentals

## Syntax Guide

Functions

    fn add(a: int, b: int) -> int {
      return a + b;
    }

Control Flow

    match signal {
      affirm => { println("YES"); }
      tend   => { println("HOLD"); }
      reject => { println("NO"); }
    }

Agents

    agent Sensor {
      handle(s: trit) {
        spawn Consensus(s);
      }
    }

Logical Operations

## Truth Tables

Input A | Input B | Consensus
--- | --- | ---
+1 (Affirm) | +1 (Affirm) | +1
+1 (Affirm) | 0 (Tend) | 0
+1 (Affirm) | -1 (Reject) | -1
0 (Tend) | 0 (Tend) | 0
0 (Tend) | -1 (Reject) | -1
-1 (Reject) | -1 (Reject) | -1

Did you know?
The Consensus operator is the ternary equivalent of a logical AND. It resolves to the minimum value of its inputs: `consensus(A, B) = min(A, B)` where `+1 > 0 > -1`.
Graph Mechanics & Routing

### Node Properties (The Workers)

Nodes are the individual brains of your AI. They evaluate data and make a decision: +1 (True), 0 (Uncertain), or -1 (False). You use this panel to set their rules, ensuring they do not get stuck thinking forever.

### Edge Properties (The Smart Pipes)

Edges connect your nodes, but they also filter the traffic. They decide which decisions are allowed to travel to the next worker.

### Activation Logic (The Bouncer)

This is how you filter. If you want a strict system, use +1 so only perfect matches pass. If you want a flexible system, use != -1. This allows 0 (Uncertainty) to pass through, letting the AI continue working even if it is not 100 percent sure.

### Handling Failures (On Fail)

When a signal fails your logic check, you have choices.

Drop
Silently kills the execution branch to save computer power.
Fallback
Routes the failure to a designated secondary recovery path.
Hold (0)
Converts the failure into a neutral state. This is the magic of ternary computing: a failure does not have to break the machine; it can just mean 'pending'.

### The Feedback Loop (Thinking Twice)

Normally, an AI just spits out an answer and stops. Checking this box allows the AI to loop its thoughts backwards and re-evaluate its own work. It is a safety feature that gives the AI permission to think iteratively until it is sure.

Help
⬆ Upskill your plan
Unlock higher quotas, advanced endpoints, and industrial-grade TaaS.
Pro Standard
€99/mo
● 50,000 calls/mo
● Trit decision endpoints
● MoE-13 orchestrator
● Deliberation engine
● EMA gate + coalition API
Get Pro Standard →
Industrial
€349/mo
● Unlimited calls
● All Pro endpoints
● TaaS /api/v1/taas/infer
● SSE streaming
● Sparse benchmark + quantization
Get Industrial →
Enterprise — contact licensing@ternlang.com
After payment you will receive an API key by email. Enter it in the key field.
● Idle
hello_trit.tern
Ln 1, Col 1
Checking…
WASM…
Free
Runs 0 ✓0 ✕0
ternlang-api.fly.dev
🧠 ALBERT CLI F6
Albert CLI — canvas co-pilot mode
Local agent integration coming soon.
This panel will let you prompt Albert directly from the canvas — create nodes, wire flows, and iterate from a single prompt.