Skip to main content

CubePi vs pi-agent-core

pi-agent-core is a TypeScript agent framework. CubePi is an independent Python reimplementation of the same architecture — the linear agent loop (agent.ts + agent-loop.ts maps onto CubePi’s agent.py + loop.py) — rebuilt around Pydantic v2, asyncio-native primitives, and built-in checkpointing.

So this is less a "which is better" question and more a "which ecosystem are you in" one. If your stack is TypeScript/Node, pi-agent-core fits natively. If your stack is Python, CubePi gives you the same mental model without dragging a JS runtime into your services.

Moving from TypeScript to Python

pi-agent-coreCubePi
Language / runtimeTypeScript on Node.jsPython 3.11+
ConcurrencyPromises / async-awaitasyncio — async-first, every entry point is async
Schemas & validationTypeScript types (compile-time)Pydantic v2 models — runtime-validated tool params
Agent modelLinear agent loop (agent.ts + agent-loop.ts)Same linear loop (agent.py + loop.py)
ProvidersProvider abstractionProvider protocol — Anthropic & OpenAI built in

Same architecture, Pythonic surface

CubePi deliberately keeps pi-agent-core’s core idea: an agent is a loop, not a graph. What changes is the surface. Tools are plain async functions whose parameters are Pydantic models, so arguments coming back from the model are validated at runtime, not just type-hinted. Streaming is a single async iterator. The result reads like idiomatic Python rather than a TypeScript API transliterated into Python.

What CubePi adds on the Python side

Built-in checkpointing: an append-only persistence layer with memory, SQLite, and Postgres backends, where each turn is O(1) to write regardless of conversation length.

Native OpenTelemetry: a Tracer and Meter emit OTel spans with GenAI semantic-convention attributes out of the box, exportable to any OTLP backend (Jaeger, Tempo, Honeycomb, Langfuse, Datadog, …) — plus a cubepi trace CLI for local JSONL traces.

MCP loaders for HTTP and stdio transports, a streaming-realistic FauxProvider for deterministic tests, and a lean dependency footprint: pydantic, anthropic, and openai are the only core dependencies; everything else is an optional extra.

Which should you choose

Choose pi-agent-core if your services are TypeScript/Node and you want to stay in that runtime. Choose CubePi if you are building in Python and want the same linear-loop agent model with first-class asyncio, Pydantic-validated tools, append-only persistence, and native OpenTelemetry — without running a JavaScript runtime alongside your Python.