CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.
Python agent-frameworkagent-harnessagent-runtimeagentic-aiai-agentsai-frameworkanthropicharnessharness-engineeringharness-frameworklanggraphlanggraph-alternativellmmcpopenaipi-agentpi-agent-corepythonpython-agent
docs: move forking guide to agents/, update vs-langgraph fork/timetravel content
xf gong25152f535e2f
diff --git a/website/docs/guides/checkpointing/forking.md b/website/docs/guides/agents/forking.mdsimilarity index 96%rename from website/docs/guides/checkpointing/forking.mdrename to website/docs/guides/agents/forking.mdindex 36f0fe7..7f4798a 100644--- a/website/docs/guides/checkpointing/forking.md+++ b/website/docs/guides/agents/forking.md@@ -241,10 +241,10 @@ deployments (cubebox's default) aren't affected.## See also-- [Postgres Checkpointing](./postgres) — production backend with v4 schema.-- [MySQL Checkpointing](./mysql) — MySQL sibling with v4 schema.-- [SQLite Checkpointing](./sqlite) — single-process backend with auto-migration.-- [Custom Backends](./custom) — Protocol details, including the new+- [Postgres Checkpointing](../checkpointing/postgres) — production backend with v4 schema.+- [MySQL Checkpointing](../checkpointing/mysql) — MySQL sibling with v4 schema.+- [SQLite Checkpointing](../checkpointing/sqlite) — single-process backend with auto-migration.+- [Custom Backends](../checkpointing/custom) — Protocol details, including the new`snapshot`, `fork`, `claim_run`, `mark_run_complete`, `load_pending`methods you need to implement for fork support.- [HITL Overview](../hitl/overview) — channel/binding mechanics.diff --git a/website/docs/guides/checkpointing/mysql.md b/website/docs/guides/checkpointing/mysql.mdindex f7c61c7..bb61159 100644--- a/website/docs/guides/checkpointing/mysql.md+++ b/website/docs/guides/checkpointing/mysql.md@@ -192,7 +192,7 @@ so it supports both `Agent.fork(...)` and `Agent.fork_once(...)`. Therecord fork lineage; `cubepi_runs` (added in v4) tracks per-runclaim/completion state.-See the [Conversation Forking](./forking) guide for the user-facing+See the [Conversation Forking](../agents/forking) guide for the user-facingAPI and semantics.## Schema v3 → v4 migration@@ -221,7 +221,7 @@ def upgrade():`upgrade_v3_to_v4_op()` is idempotent under repeated execution.Pre-feature messages keep `run_id = NULL` and remain readable; see-[Legacy data behaviour](./forking#legacy-data-behaviour) for the+[Legacy data behaviour](../agents/forking#legacy-data-behaviour) for thefork-eligibility rules on mixed threads.## Common pitfallsdiff --git a/website/docs/guides/checkpointing/postgres.md b/website/docs/guides/checkpointing/postgres.mdindex fc7656e..57c924c 100644--- a/website/docs/guides/checkpointing/postgres.md+++ b/website/docs/guides/checkpointing/postgres.md@@ -184,7 +184,7 @@ so it supports both `Agent.fork(...)` and `Agent.fork_once(...)`. Therecord fork lineage; `cubepi_runs` (the v4 partitioned table) tracksper-run claim/completion state.-See the [Conversation Forking](./forking) guide for the user-facing+See the [Conversation Forking](../agents/forking) guide for the user-facingAPI and semantics.## Schema v3 → v4 migration@@ -210,7 +210,7 @@ def upgrade():(`IF NOT EXISTS` guards on every DDL statement).Pre-feature messages keep `run_id = NULL` and remain readable; see-[Legacy data behaviour](./forking#legacy-data-behaviour) for the+[Legacy data behaviour](../agents/forking#legacy-data-behaviour) for thefork-eligibility rules on mixed threads.## Common pitfallsdiff --git a/website/docs/guides/checkpointing/sqlite.md b/website/docs/guides/checkpointing/sqlite.mdindex c44603e..32faaff 100644--- a/website/docs/guides/checkpointing/sqlite.md+++ b/website/docs/guides/checkpointing/sqlite.md@@ -144,7 +144,7 @@ If you need multi-process writers on shared threads, jump to`SQLiteCheckpointer` implements the v4 `snapshot` / `fork` /`claim_run` / `mark_run_complete` / `load_pending` Protocol methods,so it supports both `Agent.fork(...)` and `Agent.fork_once(...)`. See-the [Conversation Forking](./forking) guide for the user-facing API.+the [Conversation Forking](../agents/forking) guide for the user-facing API.## Schema v3 → v4 migration@@ -155,7 +155,7 @@ the first time a v4 CubePi connects to a v3 file. No host action isrequired.Pre-feature messages keep `run_id = NULL` and remain readable; see-[Legacy data behaviour](./forking#legacy-data-behaviour) for the+[Legacy data behaviour](../agents/forking#legacy-data-behaviour) for thefork-eligibility rules on mixed threads.## Where the file livesdiff --git a/website/docs/migration/from-langgraph.md b/website/docs/migration/from-langgraph.mdindex 033cc28..cfca291 100644--- a/website/docs/migration/from-langgraph.md+++ b/website/docs/migration/from-langgraph.md@@ -24,6 +24,7 @@ without having to re-learn from scratch.| **Tools as `@tool` decorated functions** | `AgentTool` with Pydantic params + async execute | Closer to OpenAI/Anthropic native shape || **`HumanMessage`, `AIMessage`** | `UserMessage`, `AssistantMessage` | Same role-tagged messages, just renamed || **Interrupts via `interrupt_before` / `interrupt_after`** | `agent.steer(...)`, `agent.follow_up(...)`, `agent.abort()` | Imperative control instead of declarative interrupt points |+| **Time travel / fork** at any checkpoint | **`Agent.fork()`** / **`Agent.fork_once()`** at run boundaries | CubePi keys off completed `run_id`s; see [Forking](../guides/agents/forking) || **`config_schema`** | Constructor parameters on `Agent` | No separate schema layer |## Side-by-side: a tool-using agent@@ -185,6 +186,35 @@ class SummariseAtEnd(Middleware):There's no built-in branching primitive; flow control happens through`should_stop_after_turn` and `after_model_response`.+### Forking++```python+# langgraph — time travel to a saved checkpoint+config = {"configurable": {"thread_id": "t1", "checkpoint_id": "<id>"}}+app.update_state(config, {"messages": [...]})+result = app.invoke(None, config)++# CubePi — persistent fork at a completed-run boundary+await agent.fork(+ src_thread_id="conv_123",+ new_thread_id="conv_456",+ after_run_id="R1",+)++# CubePi — ephemeral one-shot probe (writes nothing)+result = await agent.fork_once(+ src_thread_id="conv_123",+ message="What if you had said yes?",+ after_run_id="R1",+)+print(result.text)+```++CubePi forks at completed-run boundaries rather than arbitrary mid-run+checkpoints. `fork` creates a persistent branch you can continue;+`fork_once` runs a single probe and discards everything. See+[Conversation Forking](../guides/agents/forking).+## What langgraph does that CubePi doesn't (yet)- **Multi-agent supervisor patterns.** No first-class "agents@@ -193,8 +223,6 @@ There's no built-in branching primitive; flow control happens through- **Visual graph rendering.** No `app.get_graph().draw_mermaid()`equivalent. CubePi's flow is linear so the picture would be a singleline anyway.-- **Time travel / fork** at arbitrary checkpoints. The Postgres schema- has fork columns but no API surface in v0.4.- **First-party UI for traces.** CubePi doesn't render its own tracevisualizer the way LangSmith / Langfuse do; instead it emitsvendor-neutral OpenTelemetry — point any OTLP backenddiff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/forking.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/agents/forking.mdsimilarity index 95%rename from website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/forking.mdrename to website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/agents/forking.mdindex afb22c2..72e2f43 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/forking.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/agents/forking.md@@ -211,9 +211,9 @@ CubePi 能优雅处理此功能上线前的旧消息(`run_id` 列未填充,## 另请参阅-- [Postgres 检查点](./postgres) — 支持 v4 schema 的生产后端。-- [MySQL 检查点](./mysql) — 支持 v4 schema 的 MySQL 后端。-- [SQLite 检查点](./sqlite) — 支持自动迁移的单进程后端。-- [自定义后端](./custom) — Protocol 详情,包括分叉支持所需实现的+- [Postgres 检查点](../checkpointing/postgres) — 支持 v4 schema 的生产后端。+- [MySQL 检查点](../checkpointing/mysql) — 支持 v4 schema 的 MySQL 后端。+- [SQLite 检查点](../checkpointing/sqlite) — 支持自动迁移的单进程后端。+- [自定义后端](../checkpointing/custom) — Protocol 详情,包括分叉支持所需实现的`snapshot`、`fork`、`claim_run`、`mark_run_complete`、`load_pending` 方法。- [HITL 概览](../hitl/overview) — channel/binding 机制。diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/mysql.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/mysql.mdindex 6b7c627..24a7d5e 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/mysql.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/mysql.md@@ -157,7 +157,7 @@ cubepi_schema_version的 claim/completion 状态。用户层 API 与语义详见-[会话 Fork 指南](./forking)。+[会话 Fork 指南](../agents/forking)。## Schema v3 → v4 migration {#schema-v3--v4-migration}@@ -184,7 +184,7 @@ def upgrade():`upgrade_v3_to_v4_op()` 在重复执行下是幂等的。升级前的旧消息保留 `run_id = NULL`,仍然可读;关于混合数据的 fork 资格规则,-请参阅 [旧数据行为](./forking#legacy-data-behaviour)。+请参阅 [旧数据行为](../agents/forking#legacy-data-behaviour)。## 常见陷阱diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/postgres.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/postgres.mdindex 62a16e1..b5b5d23 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/postgres.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/checkpointing/postgres.md@@ -158,7 +158,7 @@ extra = cubepi_threads.extra || EXCLUDED.extra## Fork`parent_thread_id` + `forked_at_seq` 列用于支持-[会话 Fork](./forking):fork 会创建一个新的 thread,并在其+[会话 Fork](../agents/forking):fork 会创建一个新的 thread,并在其`cubepi_threads` 行中写入指向源 thread 的 `parent_thread_id`,以及拷贝时源 thread 末尾的 `forked_at_seq`(最后一条已拷贝消息的`seq`)。@@ -186,7 +186,7 @@ def upgrade():升级前的旧消息保留 `run_id = NULL`,仍然可读;关于混合数据的 fork 资格规则,请参阅-[旧数据行为](./forking#legacy-data-behaviour)。+[旧数据行为](../agents/forking#legacy-data-behaviour)。## 常见坑diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/migration/from-langgraph.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/migration/from-langgraph.mdindex a5907bc..c728271 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/migration/from-langgraph.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/migration/from-langgraph.md@@ -23,6 +23,7 @@ CubePi 和 [langgraph](https://github.com/langchain-ai/langgraph) 都用于构| **以 `@tool` 装饰器修饰的工具函数** | 带有 Pydantic 参数和 async execute 的 `AgentTool` | 更接近 OpenAI/Anthropic 原生形式 || **`HumanMessage`、`AIMessage`** | `UserMessage`、`AssistantMessage` | 相同的角色标记消息,只是重命名 || **通过 `interrupt_before` / `interrupt_after` 中断** | `agent.steer(...)`、`agent.follow_up(...)`、`agent.abort()` | 命令式控制,而非声明式中断点 |+| **任意检查点的时间旅行 / 分叉** | **`Agent.fork()`** / **`Agent.fork_once()`**,在 run 边界处 | CubePi 以已完成的 `run_id` 为基准;参见 [会话分叉](../guides/agents/forking) || **`config_schema`** | `Agent` 的构造函数参数 | 没有独立的 schema 层 |## 并排对比:一个使用工具的 agent@@ -181,14 +182,40 @@ class SummariseAtEnd(Middleware):没有内置的分支原语;流程控制通过 `should_stop_after_turn` 和`after_model_response` 完成。+### 会话分叉++```python+# langgraph — 时间旅行到某个已保存的检查点+config = {"configurable": {"thread_id": "t1", "checkpoint_id": "<id>"}}+app.update_state(config, {"messages": [...]})+result = app.invoke(None, config)++# CubePi — 在已完成的 run 边界处持久化分叉+await agent.fork(+ src_thread_id="conv_123",+ new_thread_id="conv_456",+ after_run_id="R1",+)++# CubePi — 临时一次性探针(不写入任何线程)+result = await agent.fork_once(+ src_thread_id="conv_123",+ message="如果你当时回答了'是'呢?",+ after_run_id="R1",+)+print(result.text)+```++CubePi 在已完成的 run 边界处分叉,而非任意 mid-run 检查点。`fork`+创建可继续对话的持久化分支;`fork_once` 运行单次探针并丢弃所有内容。+参见[会话分叉](../guides/agents/forking)。+## langgraph 有而 CubePi 暂无的功能- **多 agent 监管模式。** 没有"agent 派生 agent"的原生抽象。你可以通过运行多个共享工具的 `Agent` 实例来实现。- **可视化图渲染。** 没有 `app.get_graph().draw_mermaid()` 的等价物。CubePi 的流程是线性的,画出来也只是一条直线。-- **在任意检查点进行时间旅行 / 分叉。** Postgres schema 有分叉列,- 但 v0.4 中没有对应的 API 接口。- **原生 trace 可视化 UI。** CubePi 不像 LangSmith / Langfuse 那样渲染自己的 trace 可视化界面;它改为发射符合厂商中立标准的OpenTelemetry —— 通过diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/checkpointing/forking.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/agents/forking.mdsimilarity index 95%rename from website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/checkpointing/forking.mdrename to website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/agents/forking.mdindex afb22c2..72e2f43 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/checkpointing/forking.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/agents/forking.md@@ -211,9 +211,9 @@ CubePi 能优雅处理此功能上线前的旧消息(`run_id` 列未填充,## 另请参阅-- [Postgres 检查点](./postgres) — 支持 v4 schema 的生产后端。-- [MySQL 检查点](./mysql) — 支持 v4 schema 的 MySQL 后端。-- [SQLite 检查点](./sqlite) — 支持自动迁移的单进程后端。-- [自定义后端](./custom) — Protocol 详情,包括分叉支持所需实现的+- [Postgres 检查点](../checkpointing/postgres) — 支持 v4 schema 的生产后端。+- [MySQL 检查点](../checkpointing/mysql) — 支持 v4 schema 的 MySQL 后端。+- [SQLite 检查点](../checkpointing/sqlite) — 支持自动迁移的单进程后端。+- [自定义后端](../checkpointing/custom) — Protocol 详情,包括分叉支持所需实现的`snapshot`、`fork`、`claim_run`、`mark_run_complete`、`load_pending` 方法。- [HITL 概览](../hitl/overview) — channel/binding 机制。diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/checkpointing/mysql.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/checkpointing/mysql.mdindex 6b7c627..24a7d5e 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/checkpointing/mysql.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/checkpointing/mysql.md@@ -157,7 +157,7 @@ cubepi_schema_version的 claim/completion 状态。用户层 API 与语义详见-[会话 Fork 指南](./forking)。+[会话 Fork 指南](../agents/forking)。## Schema v3 → v4 migration {#schema-v3--v4-migration}@@ -184,7 +184,7 @@ def upgrade():`upgrade_v3_to_v4_op()` 在重复执行下是幂等的。升级前的旧消息保留 `run_id = NULL`,仍然可读;关于混合数据的 fork 资格规则,-请参阅 [旧数据行为](./forking#legacy-data-behaviour)。+请参阅 [旧数据行为](../agents/forking#legacy-data-behaviour)。## 常见陷阱diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/checkpointing/postgres.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/checkpointing/postgres.mdindex 62a16e1..b5b5d23 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/checkpointing/postgres.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/guides/checkpointing/postgres.md@@ -158,7 +158,7 @@ extra = cubepi_threads.extra || EXCLUDED.extra## Fork`parent_thread_id` + `forked_at_seq` 列用于支持-[会话 Fork](./forking):fork 会创建一个新的 thread,并在其+[会话 Fork](../agents/forking):fork 会创建一个新的 thread,并在其`cubepi_threads` 行中写入指向源 thread 的 `parent_thread_id`,以及拷贝时源 thread 末尾的 `forked_at_seq`(最后一条已拷贝消息的`seq`)。@@ -186,7 +186,7 @@ def upgrade():升级前的旧消息保留 `run_id = NULL`,仍然可读;关于混合数据的 fork 资格规则,请参阅-[旧数据行为](./forking#legacy-data-behaviour)。+[旧数据行为](../agents/forking#legacy-data-behaviour)。## 常见坑diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/migration/from-langgraph.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/migration/from-langgraph.mdindex a5907bc..c728271 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/migration/from-langgraph.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.8/migration/from-langgraph.md@@ -23,6 +23,7 @@ CubePi 和 [langgraph](https://github.com/langchain-ai/langgraph) 都用于构| **以 `@tool` 装饰器修饰的工具函数** | 带有 Pydantic 参数和 async execute 的 `AgentTool` | 更接近 OpenAI/Anthropic 原生形式 || **`HumanMessage`、`AIMessage`** | `UserMessage`、`AssistantMessage` | 相同的角色标记消息,只是重命名 || **通过 `interrupt_before` / `interrupt_after` 中断** | `agent.steer(...)`、`agent.follow_up(...)`、`agent.abort()` | 命令式控制,而非声明式中断点 |+| **任意检查点的时间旅行 / 分叉** | **`Agent.fork()`** / **`Agent.fork_once()`**,在 run 边界处 | CubePi 以已完成的 `run_id` 为基准;参见 [会话分叉](../guides/agents/forking) || **`config_schema`** | `Agent` 的构造函数参数 | 没有独立的 schema 层 |## 并排对比:一个使用工具的 agent@@ -181,14 +182,40 @@ class SummariseAtEnd(Middleware):没有内置的分支原语;流程控制通过 `should_stop_after_turn` 和`after_model_response` 完成。+### 会话分叉++```python+# langgraph — 时间旅行到某个已保存的检查点+config = {"configurable": {"thread_id": "t1", "checkpoint_id": "<id>"}}+app.update_state(config, {"messages": [...]})+result = app.invoke(None, config)++# CubePi — 在已完成的 run 边界处持久化分叉+await agent.fork(+ src_thread_id="conv_123",+ new_thread_id="conv_456",+ after_run_id="R1",+)++# CubePi — 临时一次性探针(不写入任何线程)+result = await agent.fork_once(+ src_thread_id="conv_123",+ message="如果你当时回答了'是'呢?",+ after_run_id="R1",+)+print(result.text)+```++CubePi 在已完成的 run 边界处分叉,而非任意 mid-run 检查点。`fork`+创建可继续对话的持久化分支;`fork_once` 运行单次探针并丢弃所有内容。+参见[会话分叉](../guides/agents/forking)。+## langgraph 有而 CubePi 暂无的功能- **多 agent 监管模式。** 没有"agent 派生 agent"的原生抽象。你可以通过运行多个共享工具的 `Agent` 实例来实现。- **可视化图渲染。** 没有 `app.get_graph().draw_mermaid()` 的等价物。CubePi 的流程是线性的,画出来也只是一条直线。-- **在任意检查点进行时间旅行 / 分叉。** Postgres schema 有分叉列,- 但 v0.4 中没有对应的 API 接口。- **原生 trace 可视化 UI。** CubePi 不像 LangSmith / Langfuse 那样渲染自己的 trace 可视化界面;它改为发射符合厂商中立标准的OpenTelemetry —— 通过diff --git a/website/sidebars.ts b/website/sidebars.tsindex 38d6834..b864847 100644--- a/website/sidebars.ts+++ b/website/sidebars.ts@@ -22,6 +22,7 @@ const sidebars: SidebarsConfig = {'guides/agents/tool-use','guides/agents/multi-turn','guides/agents/streaming',+ 'guides/agents/forking',]},{ type: 'category', label: 'Providers', items: ['guides/providers/overview',@@ -34,7 +35,6 @@ const sidebars: SidebarsConfig = {'guides/checkpointing/sqlite','guides/checkpointing/postgres','guides/checkpointing/mysql',- 'guides/checkpointing/forking','guides/checkpointing/custom',]},{ type: 'category', label: 'Middleware', items: [diff --git a/website/src/pages/compare/langgraph.tsx b/website/src/pages/compare/langgraph.tsxindex 8b8c6f3..505dee3 100644--- a/website/src/pages/compare/langgraph.tsx+++ b/website/src/pages/compare/langgraph.tsx@@ -70,8 +70,9 @@ async def get_weather(city: str) -> str:return f"72F and sunny in {city}"+provider = AnthropicProvider(provider_id="anthropic", api_key="...")agent = Agent(- model=AnthropicProvider(provider_id="anthropic", api_key="...").model("claude-sonnet-4-5"),+ model=provider.model("claude-sonnet-4-5"),tools=[get_weather],)await agent.prompt("Weather in Tokyo?")@@ -94,7 +95,7 @@ await agent.prompt("Weather in Tokyo?"){h2: 'When LangGraph is the better fit',body: [- 'LangGraph is the better choice if you genuinely need arbitrary multi-agent supervisor graphs, visual graph rendering, or time-travel/fork at arbitrary checkpoints today — CubePi keeps its flow linear by design and emits vendor-neutral OpenTelemetry rather than shipping its own trace UI. If your agent is fundamentally a loop, CubePi removes the graph machinery you were not really using.',+ 'LangGraph is the better choice if you genuinely need arbitrary multi-agent supervisor graphs or visual graph rendering — CubePi keeps its flow linear by design and emits vendor-neutral OpenTelemetry rather than shipping its own trace UI. CubePi has `Agent.fork()` and `Agent.fork_once()` for branching at completed-run boundaries; LangGraph supports finer-grained mid-run checkpoint forks if you need that granularity. If your agent is fundamentally a loop, CubePi removes the graph machinery you were not really using.',],},],@@ -172,8 +173,9 @@ async def get_weather(city: str) -> str:return f"72F and sunny in {city}"+provider = AnthropicProvider(provider_id="anthropic", api_key="...")agent = Agent(- model=AnthropicProvider(provider_id="anthropic", api_key="...").model("claude-sonnet-4-5"),+ model=provider.model("claude-sonnet-4-5"),tools=[get_weather],)await agent.prompt("Weather in Tokyo?")@@ -196,7 +198,7 @@ await agent.prompt("Weather in Tokyo?"){h2: '什么时候 LangGraph 更合适',body: [- '如果你现在确实需要任意的多 agent supervisor 图、可视化图渲染,或在任意检查点做时间旅行/分叉,那么 LangGraph 更合适 —— CubePi 在设计上保持流程线性,并输出厂商中立的 OpenTelemetry,而不是自带一套 trace UI。但如果你的 agent 本质上就是一个循环,CubePi 帮你去掉了那些你其实没真正用上的图机制。',+ '如果你确实需要任意的多 agent supervisor 图或可视化图渲染,LangGraph 更合适 —— CubePi 在设计上保持流程线性,并输出厂商中立的 OpenTelemetry,而不是自带一套 trace UI。CubePi 已有 `Agent.fork()` 和 `Agent.fork_once()` 在已完成的 run 边界处分叉;如果你需要 mid-run 粒度的任意检查点分叉,LangGraph 粒度更细。但如果你的 agent 本质上就是一个循环,CubePi 帮你去掉了那些你其实没真正用上的图机制。',],},],diff --git a/website/versioned_docs/version-0.8/guides/checkpointing/forking.md b/website/versioned_docs/version-0.8/guides/agents/forking.mdsimilarity index 96%rename from website/versioned_docs/version-0.8/guides/checkpointing/forking.mdrename to website/versioned_docs/version-0.8/guides/agents/forking.mdindex 36f0fe7..7f4798a 100644--- a/website/versioned_docs/version-0.8/guides/checkpointing/forking.md+++ b/website/versioned_docs/version-0.8/guides/agents/forking.md@@ -241,10 +241,10 @@ deployments (cubebox's default) aren't affected.## See also-- [Postgres Checkpointing](./postgres) — production backend with v4 schema.-- [MySQL Checkpointing](./mysql) — MySQL sibling with v4 schema.-- [SQLite Checkpointing](./sqlite) — single-process backend with auto-migration.-- [Custom Backends](./custom) — Protocol details, including the new+- [Postgres Checkpointing](../checkpointing/postgres) — production backend with v4 schema.+- [MySQL Checkpointing](../checkpointing/mysql) — MySQL sibling with v4 schema.+- [SQLite Checkpointing](../checkpointing/sqlite) — single-process backend with auto-migration.+- [Custom Backends](../checkpointing/custom) — Protocol details, including the new`snapshot`, `fork`, `claim_run`, `mark_run_complete`, `load_pending`methods you need to implement for fork support.- [HITL Overview](../hitl/overview) — channel/binding mechanics.diff --git a/website/versioned_docs/version-0.8/guides/checkpointing/mysql.md b/website/versioned_docs/version-0.8/guides/checkpointing/mysql.mdindex f7c61c7..bb61159 100644--- a/website/versioned_docs/version-0.8/guides/checkpointing/mysql.md+++ b/website/versioned_docs/version-0.8/guides/checkpointing/mysql.md@@ -192,7 +192,7 @@ so it supports both `Agent.fork(...)` and `Agent.fork_once(...)`. Therecord fork lineage; `cubepi_runs` (added in v4) tracks per-runclaim/completion state.-See the [Conversation Forking](./forking) guide for the user-facing+See the [Conversation Forking](../agents/forking) guide for the user-facingAPI and semantics.## Schema v3 → v4 migration@@ -221,7 +221,7 @@ def upgrade():`upgrade_v3_to_v4_op()` is idempotent under repeated execution.Pre-feature messages keep `run_id = NULL` and remain readable; see-[Legacy data behaviour](./forking#legacy-data-behaviour) for the+[Legacy data behaviour](../agents/forking#legacy-data-behaviour) for thefork-eligibility rules on mixed threads.## Common pitfallsdiff --git a/website/versioned_docs/version-0.8/guides/checkpointing/postgres.md b/website/versioned_docs/version-0.8/guides/checkpointing/postgres.mdindex fc7656e..57c924c 100644--- a/website/versioned_docs/version-0.8/guides/checkpointing/postgres.md+++ b/website/versioned_docs/version-0.8/guides/checkpointing/postgres.md@@ -184,7 +184,7 @@ so it supports both `Agent.fork(...)` and `Agent.fork_once(...)`. Therecord fork lineage; `cubepi_runs` (the v4 partitioned table) tracksper-run claim/completion state.-See the [Conversation Forking](./forking) guide for the user-facing+See the [Conversation Forking](../agents/forking) guide for the user-facingAPI and semantics.## Schema v3 → v4 migration@@ -210,7 +210,7 @@ def upgrade():(`IF NOT EXISTS` guards on every DDL statement).Pre-feature messages keep `run_id = NULL` and remain readable; see-[Legacy data behaviour](./forking#legacy-data-behaviour) for the+[Legacy data behaviour](../agents/forking#legacy-data-behaviour) for thefork-eligibility rules on mixed threads.## Common pitfallsdiff --git a/website/versioned_docs/version-0.8/guides/checkpointing/sqlite.md b/website/versioned_docs/version-0.8/guides/checkpointing/sqlite.mdindex c44603e..32faaff 100644--- a/website/versioned_docs/version-0.8/guides/checkpointing/sqlite.md+++ b/website/versioned_docs/version-0.8/guides/checkpointing/sqlite.md@@ -144,7 +144,7 @@ If you need multi-process writers on shared threads, jump to`SQLiteCheckpointer` implements the v4 `snapshot` / `fork` /`claim_run` / `mark_run_complete` / `load_pending` Protocol methods,so it supports both `Agent.fork(...)` and `Agent.fork_once(...)`. See-the [Conversation Forking](./forking) guide for the user-facing API.+the [Conversation Forking](../agents/forking) guide for the user-facing API.## Schema v3 → v4 migration@@ -155,7 +155,7 @@ the first time a v4 CubePi connects to a v3 file. No host action isrequired.Pre-feature messages keep `run_id = NULL` and remain readable; see-[Legacy data behaviour](./forking#legacy-data-behaviour) for the+[Legacy data behaviour](../agents/forking#legacy-data-behaviour) for thefork-eligibility rules on mixed threads.## Where the file livesdiff --git a/website/versioned_docs/version-0.8/migration/from-langgraph.md b/website/versioned_docs/version-0.8/migration/from-langgraph.mdindex 033cc28..cfca291 100644--- a/website/versioned_docs/version-0.8/migration/from-langgraph.md+++ b/website/versioned_docs/version-0.8/migration/from-langgraph.md@@ -24,6 +24,7 @@ without having to re-learn from scratch.| **Tools as `@tool` decorated functions** | `AgentTool` with Pydantic params + async execute | Closer to OpenAI/Anthropic native shape || **`HumanMessage`, `AIMessage`** | `UserMessage`, `AssistantMessage` | Same role-tagged messages, just renamed || **Interrupts via `interrupt_before` / `interrupt_after`** | `agent.steer(...)`, `agent.follow_up(...)`, `agent.abort()` | Imperative control instead of declarative interrupt points |+| **Time travel / fork** at any checkpoint | **`Agent.fork()`** / **`Agent.fork_once()`** at run boundaries | CubePi keys off completed `run_id`s; see [Forking](../guides/agents/forking) || **`config_schema`** | Constructor parameters on `Agent` | No separate schema layer |## Side-by-side: a tool-using agent@@ -185,6 +186,35 @@ class SummariseAtEnd(Middleware):There's no built-in branching primitive; flow control happens through`should_stop_after_turn` and `after_model_response`.+### Forking++```python+# langgraph — time travel to a saved checkpoint+config = {"configurable": {"thread_id": "t1", "checkpoint_id": "<id>"}}+app.update_state(config, {"messages": [...]})+result = app.invoke(None, config)++# CubePi — persistent fork at a completed-run boundary+await agent.fork(+ src_thread_id="conv_123",+ new_thread_id="conv_456",+ after_run_id="R1",+)++# CubePi — ephemeral one-shot probe (writes nothing)+result = await agent.fork_once(+ src_thread_id="conv_123",+ message="What if you had said yes?",+ after_run_id="R1",+)+print(result.text)+```++CubePi forks at completed-run boundaries rather than arbitrary mid-run+checkpoints. `fork` creates a persistent branch you can continue;+`fork_once` runs a single probe and discards everything. See+[Conversation Forking](../guides/agents/forking).+## What langgraph does that CubePi doesn't (yet)- **Multi-agent supervisor patterns.** No first-class "agents@@ -193,8 +223,6 @@ There's no built-in branching primitive; flow control happens through- **Visual graph rendering.** No `app.get_graph().draw_mermaid()`equivalent. CubePi's flow is linear so the picture would be a singleline anyway.-- **Time travel / fork** at arbitrary checkpoints. The Postgres schema- has fork columns but no API surface in v0.4.- **First-party UI for traces.** CubePi doesn't render its own tracevisualizer the way LangSmith / Langfuse do; instead it emitsvendor-neutral OpenTelemetry — point any OTLP backenddiff --git a/website/versioned_sidebars/version-0.8-sidebars.json b/website/versioned_sidebars/version-0.8-sidebars.jsonindex f56165c..678d049 100644--- a/website/versioned_sidebars/version-0.8-sidebars.json+++ b/website/versioned_sidebars/version-0.8-sidebars.json@@ -22,7 +22,8 @@"guides/agents/first-agent","guides/agents/tool-use","guides/agents/multi-turn",- "guides/agents/streaming"+ "guides/agents/streaming",+ "guides/agents/forking"]},{@@ -43,8 +44,7 @@"guides/checkpointing/sqlite","guides/checkpointing/postgres","guides/checkpointing/mysql",- "guides/checkpointing/forking",- "guides/checkpointing/custom"+"guides/checkpointing/custom"]},{