Repository navigation
Description
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>](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 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.
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon Sep 7, 2026
🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
Repro:
python/packages/core/agent_framework/_compaction.py::_format_summary_messageat lines 1205-1209 drops non-text content details whenSummarizationStrategyformats tool-call transcripts. A function call/result pair triggers placeholders containing onlyfunction_callandfunction_result. Minimal repro: run the added recording-summarizer test with a named function call, JSON arguments/result, and shared call ID.python/packages/core/tests/core/test_compaction.py::test_summarization_strategy_preserves_tool_trajectory_in_summary_inputtest(core): add strategy-level tool trajectory regression test
JHf0912 commentedon Sep 7, 2026
Thanks for the triage reproduction notes — the placeholder rendering on main is confirmed and addressed by PR #8087, which routes tool trajectory details into the summarizer input.
The repro shape from this note (recording summarizer + named function call + JSON arguments/result + shared call id) is now a permanent regression test in that PR: \ est_summarization_strategy_preserves_tool_trajectory_in_summary_input. It is red against main (transcript contains only \unction_call\ / \unction_result\ placeholders) and green with the fix.
Python: fix(core): include tool trajectory details in summarizer input (