perf(tokens): document tool schema cache assumption

This commit is contained in:
Xubin Ren
2026-06-21 13:06:34 +08:00
parent 7275a81ec7
commit 98916a31e3
+1
View File
@@ -44,6 +44,7 @@ def _estimate_tools_tokens(
leading_separator: bool,
) -> int:
"""Estimate stable tool definition tokens without re-encoding every loop."""
# ToolRegistry keeps the returned definitions list alive until the registry changes.
tools_id = id(tools)
fingerprint = tuple(id(tool) for tool in tools)
cached = _TOOLS_TOKEN_CACHE.get(tools_id)