solana-agent 17.1.3__py3-none-any.whl → 17.1.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- solana_agent/client/solana_agent.py +20 -15
- solana_agent/plugins/registry.py +18 -5
- {solana_agent-17.1.3.dist-info → solana_agent-17.1.4.dist-info}/METADATA +1 -1
- {solana_agent-17.1.3.dist-info → solana_agent-17.1.4.dist-info}/RECORD +6 -6
- {solana_agent-17.1.3.dist-info → solana_agent-17.1.4.dist-info}/LICENSE +0 -0
- {solana_agent-17.1.3.dist-info → solana_agent-17.1.4.dist-info}/WHEEL +0 -0
@@ -112,26 +112,31 @@ class SolanaAgent(SolanaAgentInterface):
|
|
112
112
|
)
|
113
113
|
|
114
114
|
def register_tool(self, tool: Tool) -> bool:
|
115
|
-
"""
|
115
|
+
"""
|
116
|
+
Register a tool with the agent system.
|
116
117
|
|
117
118
|
Args:
|
118
|
-
tool: Tool
|
119
|
+
tool: Tool instance to register
|
119
120
|
|
120
121
|
Returns:
|
121
|
-
|
122
|
-
|
123
|
-
Example:
|
124
|
-
```python
|
125
|
-
from solana_agent import SolanaAgent
|
126
|
-
from my_tools import CustomTool
|
127
|
-
|
128
|
-
agent = SolanaAgent(config=config)
|
129
|
-
tool = CustomTool()
|
130
|
-
agent.register_tool(tool)
|
131
|
-
```
|
122
|
+
True if successful, False
|
132
123
|
"""
|
124
|
+
|
133
125
|
try:
|
134
|
-
|
126
|
+
print(f"Attempting to register tool: {tool.name}")
|
127
|
+
success = self.query_service.agent_service.tool_registry.register_tool(
|
128
|
+
tool)
|
129
|
+
if success:
|
130
|
+
print(f"Tool {tool.name} registered successfully")
|
131
|
+
# Get all agents and assign the tool to them
|
132
|
+
agents = self.query_service.agent_service.get_all_ai_agents()
|
133
|
+
for agent_name in agents:
|
134
|
+
print(f"Assigning {tool.name} to agent {agent_name}")
|
135
|
+
self.query_service.agent_service.assign_tool_for_agent(
|
136
|
+
agent_name, tool.name)
|
137
|
+
return success
|
135
138
|
except Exception as e:
|
136
|
-
print(f"Error
|
139
|
+
print(f"Error in register_tool: {str(e)}")
|
140
|
+
import traceback
|
141
|
+
print(traceback.format_exc())
|
137
142
|
return False
|
solana_agent/plugins/registry.py
CHANGED
@@ -20,9 +20,14 @@ class ToolRegistry(ToolRegistryInterface):
|
|
20
20
|
|
21
21
|
def register_tool(self, tool: Tool) -> bool:
|
22
22
|
"""Register a tool with this registry."""
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
try:
|
24
|
+
self._tools[tool.name] = tool
|
25
|
+
print(f"Successfully registered tool: {tool.name}")
|
26
|
+
print(f"Current tools in registry: {list(self._tools.keys())}")
|
27
|
+
return True
|
28
|
+
except Exception as e:
|
29
|
+
print(f"Error registering tool: {str(e)}")
|
30
|
+
return False
|
26
31
|
|
27
32
|
def get_tool(self, tool_name: str) -> Optional[Tool]:
|
28
33
|
"""Get a tool by name."""
|
@@ -31,7 +36,8 @@ class ToolRegistry(ToolRegistryInterface):
|
|
31
36
|
def assign_tool_to_agent(self, agent_name: str, tool_name: str) -> bool:
|
32
37
|
"""Give an agent access to a specific tool."""
|
33
38
|
if tool_name not in self._tools:
|
34
|
-
print(
|
39
|
+
print(
|
40
|
+
f"Error: Tool {tool_name} is not registered. Available tools: {list(self._tools.keys())}")
|
35
41
|
return False
|
36
42
|
|
37
43
|
if agent_name not in self._agent_tools:
|
@@ -39,13 +45,17 @@ class ToolRegistry(ToolRegistryInterface):
|
|
39
45
|
|
40
46
|
if tool_name not in self._agent_tools[agent_name]:
|
41
47
|
self._agent_tools[agent_name].append(tool_name)
|
48
|
+
print(
|
49
|
+
f"Successfully assigned tool {tool_name} to agent {agent_name}")
|
50
|
+
print(
|
51
|
+
f"Agent {agent_name} now has access to: {self._agent_tools[agent_name]}")
|
42
52
|
|
43
53
|
return True
|
44
54
|
|
45
55
|
def get_agent_tools(self, agent_name: str) -> List[Dict[str, Any]]:
|
46
56
|
"""Get all tools available to an agent."""
|
47
57
|
tool_names = self._agent_tools.get(agent_name, [])
|
48
|
-
|
58
|
+
tools = [
|
49
59
|
{
|
50
60
|
"name": name,
|
51
61
|
"description": self._tools[name].description,
|
@@ -53,6 +63,9 @@ class ToolRegistry(ToolRegistryInterface):
|
|
53
63
|
}
|
54
64
|
for name in tool_names if name in self._tools
|
55
65
|
]
|
66
|
+
print(
|
67
|
+
f"Tools available to agent {agent_name}: {[t['name'] for t in tools]}")
|
68
|
+
return tools
|
56
69
|
|
57
70
|
def list_all_tools(self) -> List[str]:
|
58
71
|
"""List all registered tools."""
|
@@ -3,7 +3,7 @@ solana_agent/adapters/__init__.py,sha256=tiEEuuy0NF3ngc_tGEcRTt71zVI58v3dYY9RvMr
|
|
3
3
|
solana_agent/adapters/llm_adapter.py,sha256=hi2JYj6CvhNLJxznIv_7Ef7Y0mk7aztHd_OMYe2scMQ,6034
|
4
4
|
solana_agent/adapters/mongodb_adapter.py,sha256=qqEFbY_v1XGyFXBmwd5HSXSSHnA9wWo-Hm1vGEyIG0k,2718
|
5
5
|
solana_agent/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
solana_agent/client/solana_agent.py,sha256=
|
6
|
+
solana_agent/client/solana_agent.py,sha256=Q9vnsoezsdhe6-T_tMb7Gr-697D1Bo2qIpr1-ytP1ak,5361
|
7
7
|
solana_agent/domains/__init__.py,sha256=HiC94wVPRy-QDJSSRywCRrhrFfTBeHjfi5z-QfZv46U,168
|
8
8
|
solana_agent/domains/agent.py,sha256=Ak_hD5gTCzRqAHLmqtxnny0Xki1qAKR7RzLW9LOQBTg,2930
|
9
9
|
solana_agent/domains/routing.py,sha256=UDlgTjUoC9xIBVYu_dnf9-KG_bBgdEXAv_UtDOrYo0w,650
|
@@ -21,7 +21,7 @@ solana_agent/interfaces/services/query.py,sha256=bspnm-CN6zjRWnlFnkl34qo0EIW5m2T
|
|
21
21
|
solana_agent/interfaces/services/routing.py,sha256=gohkt5f9uYDLpu4iDVDk9yj8js9P56R6QHSIDNylgwA,438
|
22
22
|
solana_agent/plugins/__init__.py,sha256=coZdgJKq1ExOaj6qB810i3rEhbjdVlrkN76ozt_Ojgo,193
|
23
23
|
solana_agent/plugins/manager.py,sha256=GWwhfMBn9THwVn7biOvVa25GLthCA1ilWIoDkt5hXNI,5084
|
24
|
-
solana_agent/plugins/registry.py,sha256=
|
24
|
+
solana_agent/plugins/registry.py,sha256=CyZpfjLxV3cVtDnXvCVcMgXg_XEijDDsKuJ0bqG64cA,2900
|
25
25
|
solana_agent/plugins/tools/__init__.py,sha256=c0z7ij42gs94_VJrcn4Y8gUlTxMhsFNY6ahIsNswdLk,231
|
26
26
|
solana_agent/plugins/tools/auto_tool.py,sha256=Z3CcOzwdXpzciH-5yphhd9qt1b9owTxhwC-dYmPF6B0,1489
|
27
27
|
solana_agent/repositories/__init__.py,sha256=fP83w83CGzXLnSdq-C5wbw9EhWTYtqE2lQTgp46-X_4,163
|
@@ -31,7 +31,7 @@ solana_agent/services/__init__.py,sha256=ab_NXJmwYUCmCrCzuTlZ47bJZINW0Y0F5jfQ9Oo
|
|
31
31
|
solana_agent/services/agent.py,sha256=j0aI_BGaY5Nhkb9ga0r4BqI3qMKu5TOc4QPQsU3NHyQ,17000
|
32
32
|
solana_agent/services/query.py,sha256=rm7XlTCcp5NeorIaLUdr7rdxtWCgg1Q1qe5YuI1bumo,11246
|
33
33
|
solana_agent/services/routing.py,sha256=TPJ2Pas4acE93QzMEV6ZP670OtTNrVEPa76fz6urEV4,4996
|
34
|
-
solana_agent-17.1.
|
35
|
-
solana_agent-17.1.
|
36
|
-
solana_agent-17.1.
|
37
|
-
solana_agent-17.1.
|
34
|
+
solana_agent-17.1.4.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
|
35
|
+
solana_agent-17.1.4.dist-info/METADATA,sha256=o_zPKHGGkqqQpbwtnfjPwlFhgBQWW_Ytupx0rA6Bx7k,4720
|
36
|
+
solana_agent-17.1.4.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
37
|
+
solana_agent-17.1.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|