Skip to content
tokenworm ★ GitHub

Home / Use cases / Embed an agent in a native app

C ABI embedding

Embed an agent in a native app

Drive the agent from C, C++, Rust, or any language with FFI by linking libtokenworm — no runtime to bundle, no subprocess to manage.

The problem

Most agent SDKs assume a Node.js or Python runtime is present. Embedding one inside a native desktop app, a game engine, or a systems daemon means shipping that whole runtime alongside your binary — hundreds of megabytes of interpreter and dependencies for a single feature.

How tokenworm handles it

link the shared library
# Build the shared library from source (Zig 0.16)
zig build -Doptimize=ReleaseSmall

# Link against it from a C program
cc app.c -ltokenworm -o app

# The agent core runs in-process — no subprocess, no runtime bundle

Questions

+ Which languages can call the C ABI?

Any language with C FFI. tokenworm ships idiomatic SDKs for Python, TypeScript, and Go over the same boundary, and anything that can call a C function — C, C++, Rust, Swift, and more — can link libtokenworm directly.

+ Do I need a Node or Python runtime to embed it?

No. The shared library is a self-contained Zig-compiled native binary with zero runtime dependencies. You only need the runtime for a specific SDK if you choose to use that SDK.

Put the agent where you need it