AutoGen integration

AutoGen prompt compression

AutoGen enables multi-agent conversations where agents chat with each other. The conversation history grows with every exchange. SuperCompress compresses the history before each agent responds.

By Arjun Shah - Creator of SuperCompress - Updated 2026-07-03

AutoGen conversation bloat

After 10 exchanges between two AutoGen agents, the conversation history can exceed 5,000 tokens. Many of these are pleasantries, confirmations, and irrelevant tangents. Only the factual conclusions and task context matter for the next response.

Custom reply function

from autogen import AssistantAgent
from supercompress import Compressor

comp = Compressor()

class CompressedAssistantAgent(AssistantAgent):
    def generate_reply(self, messages, sender=None, **kwargs):
        # Compress conversation history
        history = "\n".join(m["content"] for m in messages[:-1])
        query = messages[-1]["content"] if messages else ""
        if history and query:
            result = comp.compress(history, query)
            messages[-1]["content"] = result.compressed_text
        return super().generate_reply(messages, sender, **kwargs)

Frequently asked questions

Does compression work with AutoGen's group chat?

Yes. Each agent in the group chat gets compressed context before responding.

Will compression break AutoGen's code execution?

No. Only conversation history is compressed. Code execution results and tool outputs are preserved.

Try it yourself

Paste your long prompt into the playground, ask a question, and see what SuperCompress keeps and removes. Free, no signup needed.

Open the Playground Embed the badge