|
|
""" |
|
|
State Manager for CodeAct Agent. |
|
|
Manages agent state creation and manipulation. |
|
|
""" |
|
|
|
|
|
import time |
|
|
from typing import List, Dict, Optional |
|
|
|
|
|
|
|
|
class StateManager: |
|
|
"""Manages agent state creation and manipulation.""" |
|
|
|
|
|
@staticmethod |
|
|
def create_state_dict(messages: List = None, step_count: int = 0, |
|
|
error_count: int = 0, start_time: float = None, |
|
|
current_plan: str = None) -> Dict: |
|
|
"""Create a standardized state dictionary.""" |
|
|
return { |
|
|
"messages": messages or [], |
|
|
"step_count": step_count, |
|
|
"error_count": error_count, |
|
|
"start_time": start_time or time.time(), |
|
|
"current_plan": current_plan |
|
|
} |