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(middleware): clarify extra_ref persistence contract in TodoListMiddleware
xf gongff0926e863c5
diff --git a/cubepi/middleware/todo.py b/cubepi/middleware/todo.pyindex 845f7c8..cfccef4 100644--- a/cubepi/middleware/todo.py+++ b/cubepi/middleware/todo.py@@ -422,8 +422,6 @@ def _make_write_todos_tool(is_error=True,)- # Persist validated todos onto the per-agent ``extra`` dict so the- # checkpointer's ``save_extra`` call at agent_end picks them up.extra_ref()["todos"] = validated_todos# Build the JSON content identical to _build_todo_tool_message@@ -493,6 +491,10 @@ class TodoListMiddleware(Middleware):system_prompt: str = WRITE_TODOS_SYSTEM_PROMPT,tool_description: str = WRITE_TODOS_TOOL_DESCRIPTION,) -> None:+ # extra_ref must return the agent's persisted extra dict (i.e. the same+ # object as AgentContext.extra) so that todo state survives session+ # checkpointing. AgentTool.execute() does not receive AgentContext, so+ # extra_ref is the only way for the tool to write into that dict.self._extra_ref = extra_refself._system_prompt = system_promptself._tool_description = tool_description