diff --git a/python/helpers/context/DynamicContextPruner.py b/python/helpers/context/DynamicContextPruner.py new file mode 100644 index 0000000000..983ce14960 --- /dev/null +++ b/python/helpers/context/DynamicContextPruner.py @@ -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