Skip to content

feat: add conversation history summarization - #24

Open
lithikaneelakandan56-ctrl wants to merge 5 commits into
Harshbansal8705:mainfrom
lithikaneelakandan56-ctrl:feature/conversation-summarization
Open

lithikaneelakandan56-ctrl wants to merge 5 commits into
Harshbansal8705:mainfrom
lithikaneelakandan56-ctrl:feature/conversation-summarization

Conversation

@lithikaneelakandan56-ctrl

Copy link
Copy Markdown

Description

This PR integrates the existing conversation summarization functionality into the agent workflow.

When the conversation history exceeds the configured MAX_TOKENS_HISTORY limit, the existing summarize_conversation() function is triggered. The resulting summary is stored in the agent state and included in the generated prompt, allowing the agent to continue working with a summarized conversation history.

Fixes #2

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔨 Refactor (non-breaking change that improves code quality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📖 Documentation update

Changes Made

  • Added conversation history token counting using MAX_TOKENS_HISTORY.
  • Integrated the existing summarize_conversation() function when the history exceeds the configured limit.
  • Updated the agent state with the generated summary and recent messages.
  • Included the stored summary in the generated prompt.

How Has This Been Tested?

  • Tested the assistant runs without errors.
  • Tested the conversation summarization integration manually using a controlled agent-state verification.
  • Verified that summarization is triggered when the conversation exceeds the configured token limit.
  • Verified that no unrelated or temporary files are included in the PR.

Checklist

  • My code follows the project's code style
  • I have added/updated docstrings for new/modified functions
  • I have updated the README if needed
  • I have added my new configuration to src/config.py (if applicable)
  • New tools use the @tool decorator from src/core/tools.py

Screenshots / Logs (if applicable)

The assistant was successfully run after the changes. A controlled verification also confirmed that the summarization path is triggered when the conversation history exceeds MAX_TOKENS_HISTORY.

@Harshbansal8705

Copy link
Copy Markdown
Owner

@lithikaneelakandan56-ctrl Please resolve merge conflicts and lint issues

@lithikaneelakandan56-ctrl

Copy link
Copy Markdown
Author

I checked the lint failure against the current origin/main.
The two files changed in this PR (src/core/assistant.py and src/core/generate_prompt.py) pass Ruff locally with no errors.
I also checked the reported 15 violations against origin/main, and they are present there as well. Based on this check, they appear to be pre-existing lint issues rather than issues introduced by this PR.
I have kept those unrelated files unchanged so that this PR remains focused on the conversation summarization feature.

@Harshbansal8705

Copy link
Copy Markdown
Owner

@lithikaneelakandan56-ctrl I think you forgot to push the commit?

@lithikaneelakandan56-ctrl

Copy link
Copy Markdown
Author

Thanks! I had pushed the commit just now. The latest commit is c574d36 (chore: fix existing ruff lint errors) and it has been pushed to the PR branch. Could you please check the latest commit?

@Harshbansal8705

Copy link
Copy Markdown
Owner

Please rebase your branch with main to resolve the merge conflicts

@lithikaneelakandan56-ctrl
lithikaneelakandan56-ctrl force-pushed the feature/conversation-summarization branch from c574d36 to 9eeefb1 Compare October 7, 2026 08:45
@lithikaneelakandan56-ctrl
lithikaneelakandan56-ctrl force-pushed the feature/conversation-summarization branch from 9eeefb1 to b5db187 Compare October 7, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Integrate conversation summarization into the agent workflow

2 participants