Skip to main content
cubepi ¡ v0.3.0 ¡ alpha

A Pythonic, async-native agent framework.

Plain async functions instead of graph nodes. 3 deps. Append-only checkpointing.

Quick Start →G Q

Why CubePi

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/exit5 typed hooks with declarative composition rules
ObservabilityLangSmith / Langfuse integrationEvents + middleware hooks — bring your own tracing

Hello, agent.

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

Full quick-start →
import asyncio
from pydantic import BaseModel
from cubepi import Agent, AgentTool, Model
from cubepi.agent.types import AgentToolResult
from cubepi.providers.anthropic import AnthropicProvider
from cubepi.providers.base import TextContent

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

class GetWeatherParams(BaseModel):
city: str

async def get_weather(tool_call_id, params: GetWeatherParams, *, signal=None, on_update=None):
return AgentToolResult(
content=[TextContent(text=f"72°F and sunny in {params.city}")]
)

agent = Agent(
provider=provider,
model=Model(id="claude-sonnet-4-5-20250929", provider="anthropic"),
tools=[AgentTool(
name="get_weather",
description="Get current weather for a city",
parameters=GetWeatherParams,
execute=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]
v0.3.0·py 3.11+·MIT·build 0055b30·● ci passing·pypi · weekly downloads via shields badge