From d3f8132b5d56eadcd3c504832cb359a5ac21ad82 Mon Sep 17 00:00:00 2001 From: worldmozara Date: Fri, 9 Oct 2026 20:15:38 +0800 Subject: [PATCH] core/agent: note the live-probe result for the echoed blocks A search round goes back with and without a local `tool_use` after its blocks: the endpoint takes both, and the model answers from the results it already holds. With the blocks stripped it calls its own earlier answer fabricated instead. The note sits where the ordering decision lives, so the shape needs no re-probe. --- src/plyngent/agent/messages_bridge.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plyngent/agent/messages_bridge.py b/src/plyngent/agent/messages_bridge.py index b5a32f8..d453a64 100644 --- a/src/plyngent/agent/messages_bridge.py +++ b/src/plyngent/agent/messages_bridge.py @@ -140,7 +140,10 @@ def _assistant_to_anthropic(message: AssistantChatMessage) -> AnthropicAssistant ``provider_blocks`` go back first and verbatim (a ``thinking`` block's signature is only the provider's to verify, and a hosted search's ``web_search_tool_result`` entries carry an ``encrypted_content`` the API - rejects when trimmed), which is also the order the API sends them in. + rejects when trimmed), which is also the order the API sends them in. A live + probe takes that shape back — the round after a search, with and without a + local ``tool_use`` after the blocks — and the model then answers from the + results it already holds instead of searching again. """ blocks: list[AnthropicTextContent | AnthropicToolUseContent | dict[str, Any]] = [] if message.provider_blocks is not UNSET and message.provider_blocks: