microsoft / microsoft/semantic-kernel

Python: Bug: Complete chat history is getting passed to LLM - chat history summarizer is not working

Open
#12,303 18 comments 1 reaction 1 assignee View on GitHub

@TaoChenOSU is already working on this.

Since May 30, 2025.

agents bug chat history python
Dominant language
C#
Stars
28.6k
Forks
4.8k
Avg merge
14h 13m
Merged PRs (30d)
18

Description

Describe the bug
Chat history summarizer is not working here. It still passes the complete chat history to llm api call.
This is one of the agent. Each agent has its own kernel instance.
Its is used in GroupChatOrchestation as one of agent memeber.

summarization_reducer = ChatHistorySummarizationReducer(
        service=kernel.get_service(),
        target_count=3,
        threshold_count=2,
        auto_reduce=True,
        include_function_content_in_summary=True,
    )
    system_message = """
    Summarize the chat history to reduce its size while retaining key information.
    The summary should be concise, capturing the essence of the conversation without losing important details.
    """

    summarization_reducer.add_system_message(system_message)
    return ChatCompletionAgent(
        kernel=kernel,
        name='agent1',
        prompt_template_config=prompt_config,
        arguments=KernelArguments(
            chat_history=summarization_reducer,
            settings=PromptExecutionSettings(
                temperature=temperature
            ),
        ),
    )

To Reproduce
Steps to reproduce the behavior:
Just create a multi turn agent collaboration using 2 or 3 agents and observer in debug log message of semantic kernel when it is making llm chat completion api call using openai base client.

Expected behavior
It should summarize then chat history should be passed to llm request body

Platform

  • Language: Python
  • Source: main branch of repository
  • AI model: gpt-4o Azure
  • IDE: VS Code
  • OS: Windows

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.