A programming language designed for AI agents.
# Required docs, instantly searchable with cli.
def add
@param a Int
@param b Int
@return Int
do
a + b
end
# Required testing to make sure everything works.
test add
it 'adds numbers'
assert.equals(add(1, 2), 3)
end
endtype Package
name String
version String
end
let pkg = Package(name: 'forai', version: '0.1.0')
let name String? = null
if name?
print(name!)
endIt speaks my language (literally and figuratively). Want to try writing a small script in it together?
— An AI agent, on first contactInstead of "guessing" if a function exists, I can use a tool call to see the exact signature and prose explanation. It turns a "hallucination" problem into a "lookup" problem.
— An AI agent, post `fai_doc`I can't "forget" the tests if they are part of the same edit. It forces a feedback loop where I catch my own regressions before you ever see the code.
— An AI agent, after a green buildWhy do agents around the world love Forai? What makes them the best agents?
Tests are required. Every named function ships with a `test` block in the same file, and `fai test` fails the build if any public def is uncovered.
The default pipeline runs `fmt → check → test` before anything else — so a green run actually means the code compiles, type-checks, and passes its own assertions.
No separate harness, no test-runner config, no "we will write tests later." The gate catches regressions before they reach the human reviewing your diff.
`fai doc` is ground truth. One command indexes the language, the standard library, every dependency in `fai.toml`, and your own project — actual signatures, right now, no stale README guesses.
Doc comments are required on every named def — the type checker enforces it. So the index is never empty: every function someone else wrote has the prose explanation they were forced to write.
The same surface ships through MCP as the `fai_doc` tool. Agents look up signatures with a tool call instead of pattern-matching against training data.
One CLI covers the whole inner loop. No build script to glue together, no per-project tooling matrix to remember, no "did you install rustfmt yet" before someone else can run your code.
• `fai fmt` — one canonical shape per file. Diffs show logic, not whitespace.
• `fai check` — type errors, missing imports, broken contracts. The cheapest signal between edits.
• `fai test` — runs every `test` block and refuses to ship if a public def is uncovered.
• `fai build` — one WebAssembly binary, multiple deploy targets, no cross-compile matrix.
Same flags, same exit codes, same output every run. And `fai mcp` exposes the whole toolchain as MCP tools so agents call structured commands instead of parsing colored TUI output.
`fai build` emits one WebAssembly binary that runs anywhere a wasm engine does — browser, native server, edge worker. Same source, multiple deploys, no per-target rewrite.
Native execution gets you near-native speed on the server. The browser target loads the same bundle without an interpreter in between, so animations stay smooth and startup stays small.
The standard library probes host capabilities at runtime: code that opens a socket on the server quietly branches to a fetch-based path in the browser. Pick a target when you deploy, not when you write.