Architecture¶
Design principles¶
These are binding constraints, not aspirations.
- Tiny kernel. The core is the execution loop, the state model, and the guard checks โ importable with zero third-party runtime dependencies beyond the standard library + Pydantic + anyio.
- Everything is a plugin. Each feature is exactly one of: middleware (wraps a step), backend (implements a protocol), or adapter (bridges a standard). If a feature requires editing the kernel, it was modeled wrong.
- Pay only for what you import. A beginner imports nothing extra and writes 3 lines. An enterprise stacks a dozen middlewares. Same kernel.
- Protocol-first. Consume MCP and A2A rather than inventing proprietary equivalents. Lock-in is a non-goal.
- Observable & deterministic by default. Every step emits a trace event and an OpenTelemetry span. No hidden state, no hidden prompts.
- Async-first. The core is
async; a thin synchronous facade sits on top. - Typed and validated. Pydantic v2 at every boundary.
The four planes¶
flowchart TB
API["<b>Developer API</b><br/><code>Agent()</code> ยท <code>@tool</code> ยท <code>middleware=[...]</code>"]
subgraph KERNEL ["๐ง KERNEL ยท we own"]
direction LR
K1[Step loop] ~~~ K2[State] ~~~ K3[Guards] ~~~ K4[Tracer]
end
subgraph MW ["๐งฉ MIDDLEWARE ยท opt-in, chainable"]
direction LR
M1[Retry] ~~~ M2[Guardrails] ~~~ M3[Cache] ~~~ M4[Compaction] ~~~ M5[Memory]
end
subgraph BE ["๐ BACKENDS ยท swappable, behind protocols"]
direction LR
B1[Providers] ~~~ B2[Checkpoints] ~~~ B3[Memory stores]
end
subgraph AD ["๐ ADAPTERS ยท bridge open standards"]
direction LR
A1[MCP] ~~~ A2[A2A] ~~~ A3[OTLP]
end
API --> KERNEL --> MW --> BE --> AD
%% stroke-only accents โ no fill/text-color overrides, so text follows the
%% Material theme and stays readable in both light and dark mode.
classDef api stroke:#6366f1,stroke-width:2px;
classDef kernel stroke:#4f46e5,stroke-width:2.5px;
classDef plane stroke:#94a3b8,stroke-width:1.5px;
class API api;
class KERNEL kernel;
class MW,BE,AD plane;
The kernel never constructs behavior; it invokes hooks. Middlewares attach to defined hook points; backends sit behind tiny protocols; adapters translate open standards.
Repository layout¶
spine/
โโโ packages/
โ โโโ spine-core/ # kernel, protocols, guards, tracer
โ โโโ spine-cli/ # Typer CLI + templates + dev server
โ โโโ spine-providers/ # OpenAI, Anthropic adapters
โ โโโ spine-middleware/ # the middleware suite
โ โโโ spine-backends/ # sqlite/redis/postgres + vector/buffer/pgvector
โ โโโ spine-mcp/ # MCP client adapter
โ โโโ spine-a2a/ # A2A adapter
โ โโโ spine-otel/ # OpenTelemetry middleware
โ โโโ spine-eval/ # eval harness + scorers
โ โโโ spine-orchestration/# sequential / supervisor / handoff
โโโ docs/
The source is organized by plane under packages/*/src/ (import names
spine_core, spine_providers, โฆ), but it all ships as one distribution,
spinekit โ a lean core (Pydantic + anyio) with heavy dependencies as opt-in
extras (spinekit[openai], spinekit[redis], spinekit[all], โฆ). The code is
small; only the third-party dependencies are optional.
The bet¶
The integration layer that made monolithic frameworks valuable has been commoditized by open standards. The durable value sits in the reliability runtime โ the execution loop, guards, durable state, and observability that decide whether an agent survives production. Spine owns that core and lets the standards do the integration.