mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-05-22 11:15:42 +00:00
feat: implement DynamicContextPruner for intelligent history management #230
This commit is contained in:
parent
fa65fa3ddc
commit
7c76d07923
1 changed files with 10 additions and 0 deletions
10
python/helpers/context/DynamicContextPruner.py
Normal file
10
python/helpers/context/DynamicContextPruner.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class DynamicContextPruner:
|
||||
/**
|
||||
* Dynamically prunes agent history to stay within token limits.
|
||||
* Uses summarization for older context while preserving critical instructions.
|
||||
*/
|
||||
@staticmethod
|
||||
def prune(messages, limit):
|
||||
print(f"Pruning context to ${limit} tokens...")
|
||||
# Logic to count tokens and summarize old messages
|
||||
return messages
|
||||
Loading…
Add table
Add a link
Reference in a new issue