solana-agent 20.1.2__py3-none-any.whl → 31.4.0__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.
Files changed (45) hide show
  1. solana_agent/__init__.py +10 -5
  2. solana_agent/adapters/ffmpeg_transcoder.py +375 -0
  3. solana_agent/adapters/mongodb_adapter.py +15 -2
  4. solana_agent/adapters/openai_adapter.py +679 -0
  5. solana_agent/adapters/openai_realtime_ws.py +1813 -0
  6. solana_agent/adapters/pinecone_adapter.py +543 -0
  7. solana_agent/cli.py +128 -0
  8. solana_agent/client/solana_agent.py +180 -20
  9. solana_agent/domains/agent.py +13 -13
  10. solana_agent/domains/routing.py +18 -8
  11. solana_agent/factories/agent_factory.py +239 -38
  12. solana_agent/guardrails/pii.py +107 -0
  13. solana_agent/interfaces/client/client.py +95 -12
  14. solana_agent/interfaces/guardrails/guardrails.py +26 -0
  15. solana_agent/interfaces/plugins/plugins.py +2 -1
  16. solana_agent/interfaces/providers/__init__.py +0 -0
  17. solana_agent/interfaces/providers/audio.py +40 -0
  18. solana_agent/interfaces/providers/data_storage.py +9 -2
  19. solana_agent/interfaces/providers/llm.py +86 -9
  20. solana_agent/interfaces/providers/memory.py +13 -1
  21. solana_agent/interfaces/providers/realtime.py +212 -0
  22. solana_agent/interfaces/providers/vector_storage.py +53 -0
  23. solana_agent/interfaces/services/agent.py +27 -12
  24. solana_agent/interfaces/services/knowledge_base.py +59 -0
  25. solana_agent/interfaces/services/query.py +41 -8
  26. solana_agent/interfaces/services/routing.py +0 -1
  27. solana_agent/plugins/manager.py +37 -16
  28. solana_agent/plugins/registry.py +34 -19
  29. solana_agent/plugins/tools/__init__.py +0 -5
  30. solana_agent/plugins/tools/auto_tool.py +1 -0
  31. solana_agent/repositories/memory.py +332 -111
  32. solana_agent/services/__init__.py +1 -1
  33. solana_agent/services/agent.py +390 -241
  34. solana_agent/services/knowledge_base.py +768 -0
  35. solana_agent/services/query.py +1858 -153
  36. solana_agent/services/realtime.py +626 -0
  37. solana_agent/services/routing.py +104 -51
  38. solana_agent-31.4.0.dist-info/METADATA +1070 -0
  39. solana_agent-31.4.0.dist-info/RECORD +49 -0
  40. {solana_agent-20.1.2.dist-info → solana_agent-31.4.0.dist-info}/WHEEL +1 -1
  41. solana_agent-31.4.0.dist-info/entry_points.txt +3 -0
  42. solana_agent/adapters/llm_adapter.py +0 -160
  43. solana_agent-20.1.2.dist-info/METADATA +0 -464
  44. solana_agent-20.1.2.dist-info/RECORD +0 -35
  45. {solana_agent-20.1.2.dist-info → solana_agent-31.4.0.dist-info/licenses}/LICENSE +0 -0
@@ -4,14 +4,21 @@ Plugin manager for the Solana Agent system.
4
4
  This module implements the concrete PluginManager that discovers,
5
5
  loads, and manages plugins.
6
6
  """
7
+
7
8
  import importlib
9
+ import logging
8
10
  from typing import Dict, List, Any, Optional
9
11
  import importlib.metadata
10
12
 
11
- from solana_agent.interfaces.plugins.plugins import PluginManager as PluginManagerInterface
13
+ from solana_agent.interfaces.plugins.plugins import (
14
+ PluginManager as PluginManagerInterface,
15
+ )
12
16
  from solana_agent.interfaces.plugins.plugins import Plugin
13
17
  from solana_agent.plugins.registry import ToolRegistry
14
18
 
19
+ # Setup logger for this module
20
+ logger = logging.getLogger(__name__)
21
+
15
22
 
16
23
  class PluginManager(PluginManagerInterface):
17
24
  """Manager for discovering and loading plugins."""
@@ -19,7 +26,11 @@ class PluginManager(PluginManagerInterface):
19
26
  # Class variable to track loaded entry points
20
27
  _loaded_entry_points = set()
21
28
 
22
- def __init__(self, config: Optional[Dict[str, Any]] = None, tool_registry: Optional[ToolRegistry] = None):
29
+ def __init__(
30
+ self,
31
+ config: Optional[Dict[str, Any]] = None,
32
+ tool_registry: Optional[ToolRegistry] = None,
33
+ ):
23
34
  """Initialize with optional configuration and tool registry."""
24
35
  self.config = config or {}
25
36
  self.tool_registry = tool_registry or ToolRegistry()
@@ -43,11 +54,15 @@ class PluginManager(PluginManagerInterface):
43
54
 
44
55
  # Only store plugin if both initialize and configure succeed
45
56
  self._plugins[plugin.name] = plugin
46
- print(f"Successfully registered plugin {plugin.name}")
57
+ logger.info(
58
+ f"Successfully registered plugin {plugin.name}"
59
+ ) # Use logger.info
47
60
  return True
48
61
 
49
62
  except Exception as e:
50
- print(f"Error registering plugin {plugin.name}: {e}")
63
+ logger.error(
64
+ f"Error registering plugin {plugin.name}: {e}"
65
+ ) # Use logger.error
51
66
  # Remove plugin from registry if it was added
52
67
  self._plugins.pop(plugin.name, None)
53
68
  return False
@@ -61,16 +76,21 @@ class PluginManager(PluginManagerInterface):
61
76
  loaded_plugins = []
62
77
 
63
78
  # Discover plugins through entry points
64
- for entry_point in importlib.metadata.entry_points(group='solana_agent.plugins'):
79
+ for entry_point in importlib.metadata.entry_points(
80
+ group="solana_agent.plugins"
81
+ ):
65
82
  # Skip if this entry point has already been loaded
66
83
  entry_point_id = f"{entry_point.name}:{entry_point.value}"
67
84
  if entry_point_id in PluginManager._loaded_entry_points:
68
- print(
69
- f"Skipping already loaded plugin: {entry_point.name}")
85
+ logger.info(
86
+ f"Skipping already loaded plugin: {entry_point.name}"
87
+ ) # Use logger.info
70
88
  continue
71
89
 
72
90
  try:
73
- print(f"Found plugin entry point: {entry_point.name}")
91
+ logger.info(
92
+ f"Found plugin entry point: {entry_point.name}"
93
+ ) # Use logger.info
74
94
  PluginManager._loaded_entry_points.add(entry_point_id)
75
95
  plugin_factory = entry_point.load()
76
96
  plugin = plugin_factory()
@@ -81,7 +101,9 @@ class PluginManager(PluginManagerInterface):
81
101
  loaded_plugins.append(entry_point.name)
82
102
 
83
103
  except Exception as e:
84
- print(f"Error loading plugin {entry_point.name}: {e}")
104
+ logger.error(
105
+ f"Error loading plugin {entry_point.name}: {e}"
106
+ ) # Use logger.error
85
107
 
86
108
  return loaded_plugins
87
109
 
@@ -103,10 +125,7 @@ class PluginManager(PluginManagerInterface):
103
125
  List of plugin details dictionaries
104
126
  """
105
127
  return [
106
- {
107
- "name": plugin.name,
108
- "description": plugin.description
109
- }
128
+ {"name": plugin.name, "description": plugin.description}
110
129
  for plugin in self._plugins.values()
111
130
  ]
112
131
 
@@ -137,10 +156,12 @@ class PluginManager(PluginManagerInterface):
137
156
  """
138
157
  self.config.update(config)
139
158
  self.tool_registry.configure_all_tools(config)
140
- print("Configuring all plugins with updated config")
159
+ logger.info("Configuring all plugins with updated config") # Use logger.info
141
160
  for name, plugin in self._plugins.items():
142
161
  try:
143
- print(f"Configuring plugin: {name}")
162
+ logger.info(f"Configuring plugin: {name}") # Use logger.info
144
163
  plugin.configure(self.config)
145
164
  except Exception as e:
146
- print(f"Error configuring plugin {name}: {e}")
165
+ logger.error(
166
+ f"Error configuring plugin {name}: {e}"
167
+ ) # Use logger.error
@@ -1,14 +1,21 @@
1
1
  """
2
2
  Tool registry for the Solana Agent system.
3
3
 
4
- This module implements the concrete ToolRegistry that manages tools
4
+ This module implements the concrete ToolRegistry that manages tools
5
5
  and their access permissions.
6
6
  """
7
+
8
+ import logging # Import logging
7
9
  from typing import Dict, List, Any, Optional
8
10
 
9
- from solana_agent.interfaces.plugins.plugins import ToolRegistry as ToolRegistryInterface
11
+ from solana_agent.interfaces.plugins.plugins import (
12
+ ToolRegistry as ToolRegistryInterface,
13
+ )
10
14
  from solana_agent.interfaces.plugins.plugins import Tool
11
15
 
16
+ # Setup logger for this module
17
+ logger = logging.getLogger(__name__)
18
+
12
19
 
13
20
  class ToolRegistry(ToolRegistryInterface):
14
21
  """Instance-based registry that manages tools and their access permissions."""
@@ -25,10 +32,12 @@ class ToolRegistry(ToolRegistryInterface):
25
32
  tool.configure(self._config)
26
33
 
27
34
  self._tools[tool.name] = tool
28
- print(f"Successfully registered and configured tool: {tool.name}")
35
+ logger.info(
36
+ f"Successfully registered and configured tool: {tool.name}"
37
+ ) # Use logger.info
29
38
  return True
30
39
  except Exception as e:
31
- print(f"Error registering tool: {str(e)}")
40
+ logger.error(f"Error registering tool: {str(e)}") # Use logger.error
32
41
  return False
33
42
 
34
43
  def get_tool(self, tool_name: str) -> Optional[Tool]:
@@ -38,8 +47,9 @@ class ToolRegistry(ToolRegistryInterface):
38
47
  def assign_tool_to_agent(self, agent_name: str, tool_name: str) -> bool:
39
48
  """Give an agent access to a specific tool."""
40
49
  if tool_name not in self._tools:
41
- print(
42
- f"Error: Tool {tool_name} is not registered. Available tools: {list(self._tools.keys())}")
50
+ logger.error( # Use logger.error
51
+ f"Error: Tool {tool_name} is not registered. Available tools: {list(self._tools.keys())}"
52
+ )
43
53
  return False
44
54
 
45
55
  # Initialize agent's tool list if not exists
@@ -47,12 +57,14 @@ class ToolRegistry(ToolRegistryInterface):
47
57
  self._agent_tools[agent_name] = [tool_name]
48
58
  elif tool_name not in self._agent_tools[agent_name]:
49
59
  # Add new tool to existing list
50
- self._agent_tools[agent_name] = [
51
- *self._agent_tools[agent_name], tool_name]
60
+ self._agent_tools[agent_name] = [*self._agent_tools[agent_name], tool_name]
52
61
 
53
- print(f"Successfully assigned tool {tool_name} to agent {agent_name}")
54
- print(
55
- f"Agent {agent_name} now has access to: {self._agent_tools[agent_name]}")
62
+ logger.info(
63
+ f"Successfully assigned tool {tool_name} to agent {agent_name}"
64
+ ) # Use logger.info
65
+ logger.info(
66
+ f"Agent {agent_name} now has access to: {self._agent_tools[agent_name]}"
67
+ ) # Use logger.info
56
68
 
57
69
  return True
58
70
 
@@ -63,12 +75,15 @@ class ToolRegistry(ToolRegistryInterface):
63
75
  {
64
76
  "name": name,
65
77
  "description": self._tools[name].description,
66
- "parameters": self._tools[name].get_schema()
78
+ "parameters": self._tools[name].get_schema(),
67
79
  }
68
- for name in tool_names if name in self._tools
80
+ for name in tool_names
81
+ if name in self._tools
69
82
  ]
70
- print(
71
- f"Tools available to agent {agent_name}: {[t['name'] for t in tools]}")
83
+ # Changed to debug level as this might be verbose during normal operation
84
+ logger.debug(
85
+ f"Tools available to agent {agent_name}: {[t['name'] for t in tools]}"
86
+ ) # Use logger.debug
72
87
  return tools
73
88
 
74
89
  def list_all_tools(self) -> List[str]:
@@ -86,13 +101,13 @@ class ToolRegistry(ToolRegistryInterface):
86
101
 
87
102
  for name, tool in self._tools.items():
88
103
  try:
89
- print(f"Configuring tool: {name}")
104
+ logger.info(f"Configuring tool: {name}") # Use logger.info
90
105
  tool.configure(self._config)
91
106
  except Exception as e:
92
- print(f"Error configuring tool {name}: {e}")
107
+ logger.error(f"Error configuring tool {name}: {e}") # Use logger.error
93
108
  configure_errors.append((name, str(e)))
94
109
 
95
110
  if configure_errors:
96
- print("The following tools failed to configure:")
111
+ logger.error("The following tools failed to configure:") # Use logger.error
97
112
  for name, error in configure_errors:
98
- print(f"- {name}: {error}")
113
+ logger.error(f"- {name}: {error}") # Use logger.error
@@ -3,8 +3,3 @@ Tools for the Solana Agent system.
3
3
 
4
4
  This package contains the base AutoTool class and built-in tool implementations.
5
5
  """
6
-
7
- from solana_agent.plugins.tools.auto_tool import *
8
-
9
- # Version of the domain model
10
- __version__ = '14.0.0'
@@ -4,6 +4,7 @@ AutoTool implementation for the Solana Agent system.
4
4
  This module provides the base AutoTool class that implements the Tool interface
5
5
  and can be extended to create custom tools.
6
6
  """
7
+
7
8
  from typing import Dict, Any
8
9
 
9
10
  from solana_agent.interfaces.plugins.plugins import Tool