Skip to content

feat: add automatic compaction settings to agent config#437

Merged
mudler merged 3 commits intomudler:mainfrom
localai-bot:feature/auto-compaction
Feb 26, 2026
Merged

feat: add automatic compaction settings to agent config#437
mudler merged 3 commits intomudler:mainfrom
localai-bot:feature/auto-compaction

Conversation

@localai-bot
Copy link
Contributor

This PR adds support for automatic conversation compaction in the LocalAGI agent configuration.

Changes

  • Add (bool) and (int) fields to struct
  • Add corresponding UI fields in for the checkbox and number input (default 4096 tokens)
  • Add and option functions in
  • Forward options to the agent when creating it in

Usage

Users can enable automatic compaction in the agent configuration UI:

  • Enable Auto Compaction: checkbox to enable/disable
  • Auto Compaction Threshold (tokens): number input (default 4096)

When enabled, the cogito library will automatically compact conversations when the token count exceeds the threshold.

This follows the same pattern as configuration.

Closes: (refer to mudler/cogito@37b69f1)

@localai-bot localai-bot force-pushed the feature/auto-compaction branch from 2f929ea to ad3bd63 Compare February 26, 2026 19:06
@localai-bot
Copy link
Contributor Author

I have fixed the build errors in the PR. The issue was unresolved merge conflict markers in core/state/config.go that caused syntax errors. The code now compiles successfully. Awaiting CI results.

Wire enableAutoCompaction and autoCompactionThreshold options to
cogito.WithCompactionThreshold() when starting the agent.
@localai-bot localai-bot marked this pull request as ready for review February 26, 2026 20:12
@mudler mudler merged commit fb20d12 into mudler:main Feb 26, 2026
1 of 2 checks passed
@mudler mudler added the enhancement New feature or request label Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants