CubePi
CubePi is a Pythonic, async-native agent framework — a leaner, more
readable take on agent runtimes like
langgraph. It models an
agent as a plain async function instead of a state graph; you can read
the entire core loop in five minutes.
pip install cubepi
Then jump to the Quick Start to ship a working tool-using agent in under five minutes.
What you get
- Plain async functions, not graph nodes. The agent loop is a
whileloop over message turns. You build tools asasync deffunctions; the framework routes calls and executes them in parallel. - One streaming pattern. Every provider yields
StreamEvents through aMessageStream. You iterate it withasync for. No callback registries, no separate handler types for text vs. tools. - Append-only checkpointing. Persistence writes the new messages on each turn, not the full transcript. O(1) DB I/O regardless of conversation length — SQLite for laptops, Postgres for production.
- Native multi-provider. Anthropic and OpenAI ship in the box,
through a
ProviderProtocol. Add a new provider in one class. - Five-hook middleware.
transform_context,convert_to_llm,before_tool_call,after_tool_call,should_stop_after_turn— each with explicit composition rules. No mystery node ordering. - MCP loaders. Point at any
Model Context Protocol server
(HTTP or stdio) and get back a list of
AgentTools.
Where to go next
| If you want to… | Start here |
|---|---|
| Install and run your first agent | Getting Started → Installation |
| Understand the building blocks | Getting Started → Core Concepts |
| Wire a real tool-using agent | Guides → Building Your First Agent |
| Persist a conversation across restarts | Guides → SQLite Checkpointing |
| Look up a specific symbol | API Reference |
| See full working examples | Recipes |
| Port an existing langgraph agent | Migration → From langgraph |
Status
CubePi is at v0.3.0 — alpha. The public API surface is stable for
v0.3 and frozen in the 0.3 docs snapshot. The next
channel (toggle in the top-right) tracks the unreleased main branch.
Source, issues, and discussion live on GitHub.