Skip to content

CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.

docs: changelog for deferred dispatch strategy; lint/format fixes

xf gong659c53eef5b6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1b479b0..74baebf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Changed (BREAKING)
+
+- **Deferred tool groups default to the new `dispatch` strategy.** Tool
+ schemas are delivered through `load_tools` results and invoked via the
+ `deferred_tool_call` dispatcher; the tools array and system prompt stay
+ byte-stable, so expansions no longer invalidate the prompt cache.
+ Restore the v0.10 behavior with `Agent(deferred_tool_strategy="inject")`
+ / `DeferredToolsMiddleware(strategy="inject")`.
+- **`DeferredToolsMiddleware(resumed_schemas=...)` and
+ `ResumedState.expanded_schemas` are removed**; `prepare_resumed_state`
+ takes a **required** `strategy` keyword (a default could silently resume
+ an inject-mode host with hidden tools).
+- **Inject mode no longer renders expanded schemas into the system
+ prompt.** The definitions were already in the tools array — the
+ duplicate rendering (double token billing per turn) is gone.
+
+### Added
+
+- **`resolve_tool_call` middleware hook** — rewrite a tool call before
+ validation, `before_tool_call`, execution, events, and tracing see it.
+ Composition is first-non-None-wins. Powers the deferred dispatcher;
+ also usable for tool aliasing/redirection.
+- **`AgentTool.expose_to_model`** — when `False`, the tool is resolvable
+ and executable by the engine but its definition is never sent to the
+ provider. Dispatch-mode deferred tools use this.
+- **`Agent(deferred_tool_strategy=...)`** and
+ `DeferredToolsMiddleware(strategy=...)` — choose `"dispatch"` (default)
+ or `"inject"`.
+- Resolved dispatcher calls that fail argument validation get the tool's
+ **full schema appended to the error result**, so the model can
+ self-correct in one round trip.
+
## [0.10.0] - 2026-06-10
### Removed (BREAKING)
diff --git a/cubepi/agent/agent.py b/cubepi/agent/agent.py
index d94eb46..e56c4c6 100644
--- a/cubepi/agent/agent.py
+++ b/cubepi/agent/agent.py
@@ -249,9 +249,7 @@ class Agent(Generic[TMessage]):
"after_model_response"
)
self.before_tool_call = before_tool_call or _mw_hooks.get("before_tool_call")
- self.resolve_tool_call = resolve_tool_call or _mw_hooks.get(
- "resolve_tool_call"
- )
+ self.resolve_tool_call = resolve_tool_call or _mw_hooks.get("resolve_tool_call")
self.after_tool_call = after_tool_call or _mw_hooks.get("after_tool_call")
self.should_stop_after_turn = should_stop_after_turn or _mw_hooks.get(
"should_stop_after_turn"
diff --git a/tests/deferred/test_catalog.py b/tests/deferred/test_catalog.py
index 991a0a9..f2a1d40 100644
--- a/tests/deferred/test_catalog.py
+++ b/tests/deferred/test_catalog.py
@@ -117,7 +117,6 @@ class TestRenderCatalog:
assert "Custom header text" in result
-
class TestStaticCatalog:
def test_lists_all_tools_sorted_by_group_id(self) -> None:
out = render_static_catalog(
diff --git a/tests/deferred/test_dispatch.py b/tests/deferred/test_dispatch.py
index eb220fd..1201555 100644
--- a/tests/deferred/test_dispatch.py
+++ b/tests/deferred/test_dispatch.py
@@ -1,9 +1,12 @@
from __future__ import annotations
+import json
+
from pydantic import BaseModel
-from cubepi.agent.types import AgentTool, AgentToolResult
-from cubepi.providers.base import TextContent
+from cubepi.agent.types import AgentContext, AgentTool, AgentToolResult
+from cubepi.deferred import DeferredToolGroup, DeferredToolsMiddleware
+from cubepi.providers.base import TextContent, ToolCall
class _Empty(BaseModel):
@@ -37,13 +40,6 @@ class TestExposeToModel:
assert [d.name for d in visible] == ["visible"]
-import json
-
-from cubepi.agent.types import AgentContext
-from cubepi.deferred import DeferredToolGroup, DeferredToolsMiddleware
-from cubepi.providers.base import ToolCall
-
-
class _EchoArgs(BaseModel):
value: str
@@ -302,9 +298,7 @@ class TestByteStability:
systems = {c[0] for c in provider.captured}
assert len(systems) == 1 # system prompt byte-identical every turn
- tool_payloads = {
- json.dumps(c[1], sort_keys=True) for c in provider.captured
- }
+ tool_payloads = {json.dumps(c[1], sort_keys=True) for c in provider.captured}
assert len(tool_payloads) == 1 # tools param byte-identical every turn
# And the dispatched tool actually ran, keyed to the dispatcher's id