Skip to content

Commit 7f79e01

Browse files
committed
refactor: Remove unused pandas DataFrame from ResourceManager and update CustomTool conversion
1 parent 78baa62 commit 7f79e01

2 files changed

Lines changed: 3 additions & 22 deletions

File tree

BaseAgent/resource_manager.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import importlib
99
from typing import Optional
10-
import pandas as pd
1110
from BaseAgent.resources import (
1211
Tool,
1312
DataLakeItem,
@@ -33,10 +32,7 @@ class ResourceManager:
3332
def __init__(self):
3433
"""Initialize the resource manager."""
3534
self.collection = ResourceCollection()
36-
37-
# Tool registry features
3835
self.next_tool_id: int = 0
39-
self.tool_document_df: pd.DataFrame = pd.DataFrame(columns=["docid", "document_content"])
4036

4137
# ==========================================================================
4238
# Tool Management
@@ -54,12 +50,7 @@ def add_tool(self, tool: Tool) -> None:
5450
# Always assign a fresh sequential ID (internal counter)
5551
tool.id = self.next_tool_id
5652
self.next_tool_id += 1
57-
5853
self.collection.tools.append(tool)
59-
60-
# Add to dataframe for retrieval
61-
new_row = pd.DataFrame([[tool.id, tool]], columns=["docid", "document_content"])
62-
self.tool_document_df = pd.concat([self.tool_document_df, new_row], ignore_index=True)
6354

6455
def add_custom_tool(self, custom_tool: CustomTool) -> None:
6556
"""Add a custom tool to the collection.
@@ -149,10 +140,6 @@ def remove_tool_by_id(self, tool_id: int) -> bool:
149140
tool = self.find_tool_by_id(tool_id)
150141
if tool:
151142
self.collection.tools = [t for t in self.collection.tools if t.id != tool_id]
152-
# Remove from dataframe
153-
self.tool_document_df = self.tool_document_df[
154-
self.tool_document_df['docid'] != tool_id
155-
].reset_index(drop=True)
156143
return True
157144
return False
158145

@@ -167,12 +154,7 @@ def remove_tool_by_name(self, name: str) -> bool:
167154
"""
168155
tool = self.get_tool_by_name(name)
169156
if tool and tool.id is not None:
170-
tool_id = tool.id
171157
self.collection.tools = [t for t in self.collection.tools if t.name != name]
172-
# Remove from dataframe
173-
self.tool_document_df = self.tool_document_df[
174-
self.tool_document_df['docid'] != tool_id
175-
].reset_index(drop=True)
176158
return True
177159
return False
178160

BaseAgent/resources.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
- CustomTool: User-defined custom tools
1717
- CustomData: User-defined custom datasets
1818
- CustomSoftware: User-defined custom software/libraries
19-
20-
Date: 2025-10-30
2119
"""
2220

2321
from typing import Any, Literal, Optional
@@ -245,13 +243,14 @@ def validate_name(cls, v: str) -> str:
245243
return v
246244

247245
def to_tool(self) -> Tool:
248-
"""Convert to standard Tool model."""
246+
"""Convert to standard Tool model, preserving selection state."""
249247
return Tool(
250248
name=self.name,
251249
description=self.description,
252250
required_parameters=self.required_parameters,
253251
optional_parameters=self.optional_parameters,
254-
module=self.module
252+
module=self.module,
253+
selected=self.selected,
255254
)
256255

257256

0 commit comments

Comments
 (0)