Skip to main content

Development environment

This page sets up the toolchain for writing your own inferlets. Skip it if you only plan to run published inferlets through pie run. Read this after Initial setup.

The build chain depends on the language. All three end at a .wasm component you can run with pie run --path or upload to a server.

Pick a language

LanguageBuild toolCompiler / runtime
Rustbakery + cargorustc + wasm32-wasip2 target
TypeScript / JavaScriptbakeryJS inferlet runtime (bundled with bakery)
Pythonhand-authored project (no scaffold)Python 3.14 inferlet runtime (downloaded by pie config init)

Rust is the canonical SDK. A few advanced primitives (custom speculators, the Constrain trait, the raw ctx.inner() page operations) are Rust-only today.

bakery create ships scaffolds for Rust (default) and TypeScript (--ts). For Python inferlets, copy the python-example tree as a starting point — its Pie.toml and pyproject.toml show what an inferlet needs.

bakery

bakery is the inferlet toolchain. It scaffolds projects, compiles to WebAssembly, and publishes to the registry. It is invoked directly as bakery and is also wrapped by pie new / pie build:

bakery --version

Common commands:

CommandWhat it does
bakery create <name>Scaffold a new Rust inferlet.
bakery create <name> --tsScaffold a TypeScript inferlet.
bakery build <dir> -o <output.wasm>Compile to a .wasm component (Rust crate, TS/JS project, or single .ts / .js file).
bakery loginGitHub OAuth flow for the Pie registry.
bakery inferlet publish <dir>Publish to the registry.
bakery inferlet search <query>Search the registry.
bakery inferlet info <name>Show registry metadata for a published inferlet.

See bakery reference for the full flag list.

Rust toolchain

For Rust inferlets you need rustc and the wasm32-wasip2 target.

# Install rustup if you do not already have it.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Add the WebAssembly target.
rustup target add wasm32-wasip2

A minimum Rust version of 1.85 is required.

To verify, scaffold and build the helloworld inferlet:

bakery create hello
cd hello
bakery build . -o hello.wasm
pie run --path ./hello.wasm --manifest ./Pie.toml

If bakery build succeeds and pie run prints a hello message, the Rust toolchain is configured.

Python and JavaScript runtimes

pie config init downloads the Python 3.14 inferlet runtime into ~/.pie/. The JavaScript runtime is bundled with bakery itself, so no separate download step is needed for TypeScript / JavaScript projects.

pie config init # writes ~/.pie/config.toml + downloads the Python runtime

For Python inferlets, declare your dependencies in pyproject.toml. bakery build resolves them, packages everything with the inferlet runtime, and emits a single .wasm. The Python runtime supports the standard library plus pure-Python packages; native extensions are not supported today.

For TypeScript / JavaScript inferlets, write TS or JS and declare deps in package.json. bakery build runs the bundler and links against the JS runtime.

Local-build run

pie run with no path argument resolves the inferlet name through the registry. To run a local build, point at the .wasm and its manifest:

pie run \
--path ./target/wasm32-wasip2/release/my_inferlet.wasm \
--manifest ./Pie.toml \
-- \
--prompt "hello"

--path accepts the bakery output (./hello.wasm) or the raw cargo output (target/wasm32-wasip2/release/...). Both are the same component.

Iterate

The dev loop is edit, build, run.

# After editing your source:
bakery build . -o hello.wasm
pie run --path ./hello.wasm --manifest ./Pie.toml -- --prompt "Say hello in one sentence."

A Rust rebuild after a one-line change is typically a few seconds. Python and JavaScript rebuilds are faster because they skip native compilation.

To stream stderr from your inferlet during development, write to stderr the language-native way: eprintln! in Rust, print(file=sys.stderr) in Python, console.error in JavaScript. pie run mirrors stderr to your terminal.

Next