symfonic.core.nodes.tool_results¶
tool_results ¶
Legacy-side wiring for the result-policy capability (T3.1.3).
The react node used to carry the whole tool-result rewriter inline: a
hundred and thirty lines that read six config keys, derived a turn
boundary, priced an offload gate, walked the transcript twice and
rebuilt ToolMessages. The policy is now
:mod:symfonic.capabilities.tools.results; this module is the adapter
that supplies the two things a capability may not own — the LangChain
message type and the pricing table.
:class:LangChainTranscript is the structural reading of a message list.
:func:net_saving_gate prices the v8.6.0 offload decision from
MODEL_PRICING. Everything else lives in the capability.
LangChainTranscript ¶
Read (and re-stub) a LangChain message list, structurally.
content_text ¶
Flatten content to a single string.
LangChain content is str OR list[ContentBlock]; the size
compare needs the wire-text length either way.
Source code in src/symfonic/core/nodes/tool_results.py
is_viewable ¶
Does content carry a block the model looks at rather than reads?
content_text flattens such a block with str(block), which is a
description of the evidence and not the evidence. Compaction compares
that flattened length and would swap the block for a stub, so the size
question and the modality question have to be asked separately.
Shape rather than provider: a block whose type is not text is
treated as viewable. A new modality is then preserved by default and
an unknown one is never silently flattened -- the failure mode this
guards is losing evidence, so the conservative answer is True.
Source code in src/symfonic/core/nodes/tool_results.py
restub ¶
Build the replacement result message.
tool_call_id is copied verbatim — any modification is an
immediate provider 400 — and additional_kwargs / status
ride along so downstream telemetry stays intact.
Source code in src/symfonic/core/nodes/tool_results.py
build_result_policy_service ¶
Assemble the service from the engine's _tool_compaction stamp.
Source code in src/symfonic/core/nodes/tool_results.py
net_saving_gate ¶
The v8.6.0 net-saving gate, priced from MODEL_PRICING.
Horizon is the fixed expected_conversation_depth prior (locked
product decision — NOT the live iteration index). Any failure is
contained by the capability, which declines rather than firing.