Introduced new helper methods `reset` and `get_report_sections` in `MessageBuffer` for easier state management

This commit is contained in:
Soumyadip Sarkar 2025-07-01 00:25:18 +05:30 committed by GitHub
parent 718df34932
commit 9bdf0efa3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 1 deletions

View File

@ -11,7 +11,6 @@ from rich.columns import Columns
from rich.markdown import Markdown from rich.markdown import Markdown
from rich.layout import Layout from rich.layout import Layout
from rich.text import Text from rich.text import Text
from rich.live import Live
from rich.table import Table from rich.table import Table
from collections import deque from collections import deque
import time import time
@ -166,6 +165,22 @@ class MessageBuffer:
self.final_report = "\n\n".join(report_parts) if report_parts else None self.final_report = "\n\n".join(report_parts) if report_parts else None
def reset(self):
"""Clear all stored messages and reports and reset agent status."""
self.messages.clear()
self.tool_calls.clear()
self.current_report = None
self.final_report = None
for key in self.report_sections:
self.report_sections[key] = None
for key in self.agent_status:
self.agent_status[key] = "pending"
self.current_agent = None
def get_report_sections(self):
"""Return a copy of the current report sections."""
return dict(self.report_sections)
message_buffer = MessageBuffer() message_buffer = MessageBuffer()