Skip to main content
cubepi · v0.13.0

CubePiA Pythonic, async-native agent framework.

CubePi is a Pythonic, async-native agent framework designed for high performance, readability, and production-grade persistence. It provides a leaner alternative to graph-based agent runtimes by modeling agent logic as a linear while loop that developers can easily trace and debug.

Quick Start →G Q

Why CubePi — a langgraph and pi-agent-core alternative

langgraphCubePi
AbstractionGraph nodes + edges + channelsPlain async functions — run_agent_loop is a while loop
StreamingCallback-based, multiple handler typesasync for event in stream — one pattern everywhere
CheckpointingFull snapshot per step; serializes entire message listAppend-only — O(1) DB I/O regardless of conversation length
Dependencieslangchain-core, langgraph-sdk, and transitive deps3 core deps: pydantic, anthropic, openai
Tool executionTools are graph nodes with manual wiringDeclare tools as functions; framework routes and parallelizes
Multi-providerVia langchain chat model adaptersNative Provider protocol — Anthropic, OpenAI built in
MiddlewareGraph-level middleware on node entry/exit8 typed hooks with declarative composition rules
ObservabilityLangSmith / Langfuse integrationNative OpenTelemetry — Tracer, Meter, GenAI semconv, OTLP / JSONL out of the box

Full comparison: CubePi vs LangGraph → · CubePi vs pi-agent-core →

Hello, agent.

A single async function loop. One Provider, one AgentTool, and you're streaming.

Full quick-start →
import asyncio
from cubepi import Agent, tool
from cubepi.providers.anthropic import AnthropicProvider

provider = AnthropicProvider(api_key="sk-...")

@tool
async def get_weather(city: str) -> str:
"Get current weather for a city."
return f"72°F and sunny in {city}"

agent = Agent(
model=provider.model("claude-sonnet-4-6"),
tools=[get_weather],
system_prompt="You are a helpful weather assistant.",
)

def on_event(event, signal=None):
if event.type == "text_delta":
print(event.delta, end="", flush=True)

agent.subscribe(on_event)
asyncio.run(agent.prompt("What's the weather in Tokyo?"))

Install

pippip install cubepi
uvuv add cubepi
poetrypoetry add cubepi
extraspip install cubepi[sqlite,postgres,mcp,tracing,tracing-otlp]
v0.13.0·py 3.11+·MIT·build 94d0ca7·● ci passing·pypi · weekly downloads via shields badge