Skip to main content
v0.10 ships agents, streams, and datasets in one binary

A small language for scripts, agents, and AI tools.

Mochi is a statically typed, expression-oriented language. It compiles to compact bytecode, ships agents and streams as keywords, and treats AI generation as a first-order construct.

$curl -fsSL get.mochi-lang.dev | sh
hello.mochi
// no main needed, programs run top to bottom
let greeting = "Hello, " + name + "!"
print(greeting)

// strongly typed, inference does the work
fun greet(user: string): string {
return "welcome, " + user
}

// agents react to events
agent inbox {
on message(text: string) {
emit reply(greet(text))
}
}

Six programs end to end

Each tab is a complete Mochi file. Copy, paste, and run.

Hello, Mochi

No main function, no imports, no class wrapper. Write the program and run it.

hello.mochi
let name = "Mochi"
print("Hello, " + name + "!")

// Strings concatenate with + and interpolate via str()
let answer = 42
print("the answer is " + str(answer))
Output
Hello, Mochi!
the answer is 42

What Mochi gives you

Six properties that the language and toolchain commit to. Every other feature is built on top of these.

Static types, low ceremony

Type inference covers most annotations. Bindings are immutable by default. Programs run top to bottom with no main function and no class wrapper.

  • let / var with full inference
  • union types for nullable values
  • expression-oriented syntax

Agents in the language

agent, stream, and intent are keywords, not a framework. Build event-driven systems without a message bus or actor library.

  • agent blocks with on handlers
  • typed stream events
  • intent endpoints exposed as MCP tools

AI as a primitive

Call language models with a generate block. Configure providers with a model declaration. Tool calling and structured output need no SDK.

  • generate text and embedding
  • tool definitions with description fields
  • structured output via as json

Datasets in the language

Query lists with from / where / select / join. Read and write CSV, JSON, JSONL, and YAML with one keyword.

  • from … where … select / join
  • load and save in 4 formats
  • composes with map / filter / reduce

Bytecode VM

Compiles to compact bytecode with constant folding and liveness-based dead-code elimination. One static binary, no runtime dependency.

  • compact bytecode
  • AOT or interpreted
  • one static binary

Tests next to code

test and expect blocks live alongside the code they cover. No framework, no separate runner. Run mochi test and the tests run.

  • test "name" { … } co-located
  • expect with rich diffs
  • runs from the same toolchain

Install

Pick the path that fits your environment. Mochi ships as a single binary, in a Docker image, and as source.

Binary

Download a single static binary for your platform. The fastest path from zero to running Mochi code.

  • Works on macOS (Intel and Apple Silicon) and Linux.
  • No runtime, no dependencies. Drop it into /usr/local/bin and run.
1Run the install script
curl -fsSL get.mochi-lang.dev | sh
2Verify the install
mochi --version
mochi run -e 'print("ready")'