Skip to content

Python: [Bug]: Summarizer input drops tool call parameters and results #8086

Description

@JHf0912

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_callfunction_call <name>(<arguments>) [call_id=<id>]
  • function_resultfunction_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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pythonUsage: [Issues, PRs], Target: PythontriageUsage: [Issues], Target: All issues that still need to be triaged

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions