Description
SummarizationStrategy renders the transcript it sends to the summarizer LLM via _format_summary_message (python/packages/core/agent_framework/_compaction.py:1205), which only uses Message.text. Message.text (python/packages/core/agent_framework/_types.py:1884) concatenates TextContent only, so tool rounds collapse to placeholders:
2. [assistant] function_call
3. [tool] function_result
The summarizer never sees the tool name, arguments, results, exceptions, or call_id, and the resulting summary silently discards the tool trajectory.
Proposal
Add a per-content renderer that serializes tool trajectory contents into the summary input transcript, staying within the private formatting helpers in _compaction.py (no public API change):
function_call → function_call <name>(<arguments>) [call_id=<id>]
function_result → function_result: <result> [call_id=<id>] (with error(<exception>) prefix on failure)
mcp_server_tool_call / mcp_server_tool_result → same shape with the MCP tool name and output
function_approval_request / function_approval_response → nested call name, approval id, and decision
Group-atomic input selection (_select_summary_input_groups) and trigger conditions are untouched; text-only messages keep their legacy rendering.
Scope notes
Out of scope: text_reasoning rendering, structured JSON summary output, and no-call_id adjacency pairing in group_messages (the latter touches pairing semantics covered by docs/specs/004-python-function-calling-loop.md and would be proposed separately).
I'd like to take this on and follow up with a PR once the direction is confirmed.
Description
SummarizationStrategyrenders the transcript it sends to the summarizer LLM via_format_summary_message(python/packages/core/agent_framework/_compaction.py:1205), which only usesMessage.text.Message.text(python/packages/core/agent_framework/_types.py:1884) concatenatesTextContentonly, so tool rounds collapse to placeholders:The summarizer never sees the tool name, arguments, results, exceptions, or
call_id, and the resulting summary silently discards the tool trajectory.Proposal
Add a per-content renderer that serializes tool trajectory contents into the summary input transcript, staying within the private formatting helpers in
_compaction.py(no public API change):function_call→function_call <name>(<arguments>) [call_id=<id>]function_result→function_result: <result> [call_id=<id>](witherror(<exception>)prefix on failure)mcp_server_tool_call/mcp_server_tool_result→ same shape with the MCP tool name and outputfunction_approval_request/function_approval_response→ nested call name, approval id, and decisionGroup-atomic input selection (
_select_summary_input_groups) and trigger conditions are untouched; text-only messages keep their legacy rendering.Scope notes
Out of scope:
text_reasoningrendering, structured JSON summary output, and no-call_idadjacency pairing ingroup_messages(the latter touches pairing semantics covered bydocs/specs/004-python-function-calling-loop.mdand would be proposed separately).I'd like to take this on and follow up with a PR once the direction is confirmed.