Skip to content

Commit 6d99653

Browse files
authored
docs: add CubePi brand assets and refresh README
* docs: add cubepi brand assets Add SVG + PNG logo and 1280x640 social preview, and link the logo from the top of the README. * docs: center logo, refresh social preview, use absolute logo URL - Recenter the cube in cubepi-logo.svg (shift -56 horizontally). - Drop the white card around the social-preview cube, layer in a gradient bg, dot grid, deeper right wave, and floating accents; set wordmark to CubePi. - Switch the README logo reference to an absolute raw.githubusercontent URL so the image resolves on PyPI. * docs: rebrand README to CubePi and refresh content - Use CubePi casing for the wordmark and section headings (package name stays `cubepi`). - Soften the langgraph framing from "built to replace" to "a leaner, more readable take on". - Drop the prominent pi-agent-core section; keep a brief credits note at the bottom. - Cover the new postgres/mcp extras and PostgresCheckpointer, update the architecture tree, and switch the Quick Start import to the canonical `cubepi.providers.anthropic` path. * docs: fix PostgresCheckpointer instantiation in README Drop the non-existent .from_dsn() classmethod (flagged by Codex review); the constructor already takes the DSN directly.
1 parent f90839a commit 6d99653

5 files changed

Lines changed: 123 additions & 39 deletions

File tree

README.md

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,54 @@
1-
# cubepi
1+
<p align="center">
2+
<img src="https://raw.githubusercontent.com/cubeplexai/cubepi/main/assets/brand/cubepi-logo.svg" alt="CubePi logo" width="160">
3+
</p>
4+
5+
<h1 align="center">CubePi</h1>
26

37
[![CI](https://github.com/cubeplexai/cubepi/actions/workflows/ci.yml/badge.svg)](https://github.com/cubeplexai/cubepi/actions/workflows/ci.yml)
48
[![codecov](https://codecov.io/gh/cubeplexai/cubepi/graph/badge.svg)](https://codecov.io/gh/cubeplexai/cubepi)
59
[![PyPI](https://img.shields.io/pypi/v/cubepi)](https://pypi.org/project/cubepi/)
610
[![Python](https://img.shields.io/pypi/pyversions/cubepi)](https://pypi.org/project/cubepi/)
711
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
812

9-
Pythonic async-native agent framework. Built to replace [langgraph](https://github.com/langchain-ai/langgraph) with something simpler, faster, and easier to reason about.
10-
11-
Inspired by [pi-agent-core](https://github.com/anthropics/pi-agent-core) (TypeScript), redesigned for Python.
12-
13-
## Why cubepi
13+
A Pythonic, async-native agent framework — a leaner, more readable take on agent runtimes like [langgraph](https://github.com/langchain-ai/langgraph).
1414

15-
### vs langgraph
15+
## Why CubePi
1616

17-
| | langgraph | cubepi |
17+
| | langgraph | CubePi |
1818
|---|---|---|
1919
| **Abstraction** | Graph nodes + edges + channels — you model your agent as a state machine | Plain async functions — `run_agent_loop` is a while loop you can read in 5 minutes |
2020
| **Streaming** | Callback-based, multiple handler types | `async for event in stream` — one pattern everywhere |
2121
| **Checkpointing** | Full snapshot per step — serializes entire message list on every channel change | Append-only — writes only new messages, O(1) DB I/O regardless of conversation length |
2222
| **Dependencies** | Pulls in langchain-core, langgraph-sdk, and transitive deps | 3 core deps: `pydantic`, `anthropic`, `openai` |
2323
| **Tool execution** | Tools are graph nodes with manual wiring | Declare tools as functions, framework handles routing and parallel execution |
24-
| **Multi-provider** | Via langchain chat model adapters | Native Provider protocol — Anthropic, OpenAI built in, add your own with one class |
24+
| **Multi-provider** | Via langchain chat model adapters | Native `Provider` protocol — Anthropic, OpenAI built in, add your own with one class |
2525
| **Middleware** | Graph-level middleware on node entry/exit | Agent-level middleware with 5 typed hooks and declarative composition rules |
2626
| **Observability** | LangSmith / Langfuse integration, full trace visualization | Events + middleware hooks — bring your own tracing |
2727

28-
### vs pi-agent-core
29-
30-
cubepi is a Python port of pi's architecture with Pythonic improvements:
31-
32-
| | pi-agent-core | cubepi |
33-
|---|---|---|
34-
| **Language** | TypeScript | Python (async-native) |
35-
| **Type system** | Zod schemas | Pydantic v2 — validation, serialization, JSON Schema generation in one |
36-
| **Cancel signal** | `AbortSignal` (Web API) | `asyncio.Event` — same semantics, native to Python |
37-
| **Middleware** | Hooks only (callbacks on Agent) | Hooks + composable Middleware protocol with `compose_middleware()` |
38-
| **Checkpointing** | Not built in | Built-in `MemoryCheckpointer` + `SQLiteCheckpointer` |
39-
| **Test utility** | Internal test helpers | `FauxProvider` as public API — ship it, use it in your tests |
40-
4128
## Install
4229

4330
```bash
4431
pip install cubepi
4532

46-
# With SQLite checkpointer
47-
pip install cubepi[sqlite]
33+
# Optional extras
34+
pip install cubepi[sqlite] # SQLite checkpointer
35+
pip install cubepi[postgres] # Postgres checkpointer
36+
pip install cubepi[mcp] # MCP tool loaders
4837
```
4938

5039
Or with [uv](https://github.com/astral-sh/uv):
5140

5241
```bash
5342
uv add cubepi
54-
uv add cubepi[sqlite]
43+
uv add cubepi[sqlite,postgres,mcp]
5544
```
5645

5746
## Quick Start
5847

5948
```python
6049
import asyncio
6150
from cubepi import Agent, AgentTool, Model
62-
from cubepi.providers import AnthropicProvider
51+
from cubepi.providers.anthropic import AnthropicProvider
6352

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

@@ -68,7 +57,7 @@ def get_weather(city: str) -> str:
6857
return f"72°F and sunny in {city}"
6958

7059
agent = Agent(
71-
model=Model(provider=provider, model="claude-sonnet-4-20250514"),
60+
model=Model(provider=provider, model="claude-sonnet-4-5-20250929"),
7261
tools=[
7362
AgentTool(
7463
name="get_weather",
@@ -99,21 +88,24 @@ asyncio.run(main())
9988
```
10089
cubepi/
10190
├── providers/ # LLM provider abstraction
102-
│ ├── base.py # Provider protocol, message types, MessageStream
103-
│ ├── anthropic.py # Anthropic provider
104-
│ ├── openai.py # OpenAI provider
105-
│ └── faux.py # Test utility — pre-configured responses with realistic streaming
91+
│ ├── base.py # Provider protocol, message types, MessageStream
92+
│ ├── anthropic.py # Anthropic provider
93+
│ ├── openai.py # OpenAI Chat Completions provider
94+
│ ├── openai_responses.py # OpenAI Responses provider
95+
│ └── faux.py # Test utility — pre-configured responses with realistic streaming
10696
├── agent/ # Agent runtime
10797
│ ├── agent.py # Stateful Agent class
10898
│ ├── loop.py # Stateless core loop (the actual algorithm)
10999
│ ├── tools.py # Tool execution engine (sequential + parallel)
110100
│ └── types.py # Events, AgentTool, AgentContext, hook types
111-
├── middleware/ # Composable middleware protocol
101+
├── middleware/ # Composable middleware protocol
112102
│ └── base.py # 5 hooks with distinct composition rules
113-
└── checkpointer/ # Persistence
114-
├── base.py # Checkpointer protocol
115-
├── memory.py # In-memory (dev/test)
116-
└── sqlite.py # SQLite (lightweight persistence)
103+
├── checkpointer/ # Persistence
104+
│ ├── base.py # Checkpointer protocol
105+
│ ├── memory.py # In-memory (dev/test)
106+
│ ├── sqlite.py # SQLite (lightweight persistence)
107+
│ └── postgres/ # Postgres (production persistence)
108+
└── mcp/ # MCP tool loaders (HTTP + stdio transports)
117109
```
118110

119111
## Core Concepts
@@ -123,7 +115,9 @@ cubepi/
123115
Abstract LLM interaction behind a `Provider` protocol. All providers return `MessageStream` — an async iterator of `StreamEvent`s.
124116

125117
```python
126-
from cubepi.providers import AnthropicProvider, OpenAIProvider, FauxProvider
118+
from cubepi.providers.anthropic import AnthropicProvider
119+
from cubepi.providers.openai import OpenAIProvider
120+
from cubepi.providers import FauxProvider
127121

128122
# Real providers
129123
anthropic = AnthropicProvider(api_key="...")
@@ -190,14 +184,18 @@ hooks = compose_middleware([LoggingMiddleware(), SafetyMiddleware()])
190184
Persist conversation state with append-only semantics:
191185

192186
```python
193-
from cubepi.checkpointer import MemoryCheckpointer, SQLiteCheckpointer
187+
from cubepi.checkpointer import MemoryCheckpointer, SQLiteCheckpointer, PostgresCheckpointer
194188

195189
# In-memory for dev/test
196190
cp = MemoryCheckpointer()
197191

198192
# SQLite for lightweight persistence
199193
async with SQLiteCheckpointer("agent.db") as cp:
200194
agent = Agent(model=model, checkpointer=cp, thread_id="conv-1")
195+
196+
# Postgres for production
197+
async with PostgresCheckpointer("postgresql://...") as cp:
198+
agent = Agent(model=model, checkpointer=cp, thread_id="conv-1")
201199
```
202200

203201
### FauxProvider for Testing
@@ -224,7 +222,11 @@ stream = await agent.prompt("Search for python")
224222

225223
- Python >= 3.11
226224
- Core: `pydantic`, `anthropic`, `openai`
227-
- Optional: `aiosqlite` (for `SQLiteCheckpointer`)
225+
- Optional: `aiosqlite` (`[sqlite]`), `asyncpg` + `sqlalchemy` + `msgpack` (`[postgres]`), `mcp` (`[mcp]`)
226+
227+
## Credits
228+
229+
Architecture inspired by [pi-agent-core](https://github.com/anthropics/pi-agent-core) (TypeScript); CubePi is an independent Python reimplementation with Pydantic v2, asyncio-native primitives, and built-in checkpointing.
228230

229231
## License
230232

assets/brand/cubepi-logo.png

9.61 KB
Loading

assets/brand/cubepi-logo.svg

Lines changed: 19 additions & 0 deletions
Loading
99.2 KB
Loading
Lines changed: 63 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)