# Tofu

A complete AI agent runtime with model routing, streaming, web search, MCP support and code and document tooling, usable as an embedded Python library, a sidecar service, a remote SDK, or a full self-hosted workspace.

Tofu is an agent runtime covering model routing, streaming, web search and page fetching, MCP integration, code and project tools, document and media tooling, retries, context compaction, cancellation and typed events. It can be used at four levels: an embedded Python runtime installed with pip that only needs a provider and messages; a language-neutral sidecar process that applications talk to over a URL and token, with a small setup control plane for no-code model configuration; a remote Python or TypeScript SDK talking to a hosted Tofu server; or the full AI workspace application with a UI backed by SQLite or PostgreSQL.

The first three options run the same orchestrator as the full application rather than a separate, smaller agent loop, and do not require a database. A fresh installation needs no provider environment variables up front; a model provider, such as OpenAI, OpenRouter, DeepSeek or a local model, is configured through a setup UI or environment variables and applied to new runs immediately.

It is written in Python.

Website: https://github.com/NiuTrans/ToFu
