mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-05-22 19:47:15 +00:00
10 lines
386 B
Python
10 lines
386 B
Python
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
|