diff --git a/backend/agent/run.py b/backend/agent/run.py index bafe8ae2..33862c9f 100644 --- a/backend/agent/run.py +++ b/backend/agent/run.py @@ -38,8 +38,8 @@ async def run_agent( ): """Run the development agent with specified configuration.""" - if not thread_manager: - thread_manager = ThreadManager() + thread_manager = ThreadManager() + client = await thread_manager.db.client # Get account ID from thread for billing checks diff --git a/backend/agentpress/tool_registry.py b/backend/agentpress/tool_registry.py index d237cd63..238b7b33 100644 --- a/backend/agentpress/tool_registry.py +++ b/backend/agentpress/tool_registry.py @@ -21,16 +21,11 @@ class ToolRegistry: get_xml_examples: Get examples of XML tool usage """ - _instance = None - - def __new__(cls): - """Create or return singleton instance.""" - if cls._instance is None: - cls._instance = super().__new__(cls) - cls._instance.tools = {} - cls._instance.xml_tools = {} - logger.debug("Initialized new ToolRegistry instance") - return cls._instance + def __init__(self): + """Initialize a new ToolRegistry instance.""" + self.tools = {} + self.xml_tools = {} + logger.debug("Initialized new ToolRegistry instance") def register_tool(self, tool_class: Type[Tool], function_names: Optional[List[str]] = None, **kwargs): """Register a tool with optional function filtering. diff --git a/backend/sandbox/sandbox.py b/backend/sandbox/sandbox.py index 495792cf..43cd2e7c 100644 --- a/backend/sandbox/sandbox.py +++ b/backend/sandbox/sandbox.py @@ -8,7 +8,7 @@ from dotenv import load_dotenv from agentpress.tool import Tool from utils.logger import logger from utils.files_utils import clean_path -from utils.thread_manager import ThreadManager +from agentpress.thread_manager import ThreadManager load_dotenv()