solana-agent 19.1.1__py3-none-any.whl → 20.1.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.
@@ -11,6 +11,7 @@ from typing import AsyncGenerator, Dict, Any, Literal, Optional, Union
11
11
  from solana_agent.factories.agent_factory import SolanaAgentFactory
12
12
  from solana_agent.interfaces.client.client import SolanaAgent as SolanaAgentInterface
13
13
  from solana_agent.interfaces.plugins.plugins import Tool
14
+ from solana_agent.interfaces.services.routing import RoutingService as RoutingInterface
14
15
 
15
16
 
16
17
  class SolanaAgent(SolanaAgentInterface):
@@ -54,6 +55,7 @@ class SolanaAgent(SolanaAgentInterface):
54
55
  audio_input_format: Literal[
55
56
  "flac", "mp3", "mp4", "mpeg", "mpga", "m4a", "ogg", "wav", "webm"
56
57
  ] = "mp4",
58
+ router: Optional[RoutingInterface] = None,
57
59
  ) -> AsyncGenerator[Union[str, bytes], None]: # pragma: no cover
58
60
  """Process a user message and return the response stream.
59
61
 
@@ -63,9 +65,10 @@ class SolanaAgent(SolanaAgentInterface):
63
65
  prompt: Optional prompt for the agent
64
66
  output_format: Response format ("text" or "audio")
65
67
  audio_voice: Voice to use for audio output
66
- audio_instructions: Optional instructions for audio synthesis
68
+ audio_instructions: Not used currently
67
69
  audio_output_format: Audio output format
68
70
  audio_input_format: Audio input format
71
+ router: Optional routing service for processing
69
72
 
70
73
  Returns:
71
74
  Async generator yielding response chunks (text strings or audio bytes)
@@ -79,6 +82,7 @@ class SolanaAgent(SolanaAgentInterface):
79
82
  audio_output_format=audio_output_format,
80
83
  audio_input_format=audio_input_format,
81
84
  prompt=prompt,
85
+ router=router,
82
86
  ):
83
87
  yield chunk
84
88
 
@@ -10,7 +10,6 @@ class RoutingService(ABC):
10
10
  """Route a query to the appropriate agent.
11
11
 
12
12
  Args:
13
- user_id: User ID
14
13
  query: User query
15
14
 
16
15
  Returns:
@@ -12,7 +12,6 @@ from typing import AsyncGenerator, Dict, List, Literal, Optional, Any, Union
12
12
 
13
13
  from solana_agent.interfaces.services.agent import AgentService as AgentServiceInterface
14
14
  from solana_agent.interfaces.providers.llm import LLMProvider
15
- from solana_agent.interfaces.plugins.plugins import ToolRegistry as ToolRegistryInterface
16
15
  from solana_agent.plugins.manager import PluginManager
17
16
  from solana_agent.plugins.registry import ToolRegistry
18
17
  from solana_agent.domains.agent import AIAgent, BusinessMission
@@ -8,6 +8,7 @@ clean separation of concerns.
8
8
  from typing import Any, AsyncGenerator, Dict, Literal, Optional, Union
9
9
 
10
10
  from solana_agent.interfaces.services.query import QueryService as QueryServiceInterface
11
+ from solana_agent.interfaces.services.routing import RoutingService as RoutingServiceInterface
11
12
  from solana_agent.services.agent import AgentService
12
13
  from solana_agent.services.routing import RoutingService
13
14
  from solana_agent.interfaces.providers.memory import MemoryProvider
@@ -47,6 +48,7 @@ class QueryService(QueryServiceInterface):
47
48
  "flac", "mp3", "mp4", "mpeg", "mpga", "m4a", "ogg", "wav", "webm"
48
49
  ] = "mp4",
49
50
  prompt: Optional[str] = None,
51
+ router: Optional[RoutingServiceInterface] = None,
50
52
  ) -> AsyncGenerator[Union[str, bytes], None]: # pragma: no cover
51
53
  """Process the user request with appropriate agent.
52
54
 
@@ -59,6 +61,7 @@ class QueryService(QueryServiceInterface):
59
61
  audio_output_format: Audio output format
60
62
  audio_input_format: Audio input format
61
63
  prompt: Optional prompt for the agent
64
+ router: Optional routing service for processing
62
65
 
63
66
  Yields:
64
67
  Response chunks (text strings or audio bytes)
@@ -96,7 +99,11 @@ class QueryService(QueryServiceInterface):
96
99
  memory_context = await self.memory_provider.retrieve(user_id)
97
100
 
98
101
  # Route query to appropriate agent
99
- agent_name = await self.routing_service.route_query(user_text)
102
+ if router:
103
+ agent_name = await router.route_query(user_text)
104
+ else:
105
+ agent_name = await self.routing_service.route_query(user_text)
106
+
100
107
  print(f"Routed to agent: {agent_name}")
101
108
 
102
109
  # Generate response
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: solana-agent
3
- Version: 19.1.1
3
+ Version: 20.1.0
4
4
  Summary: Agentic IQ
5
5
  License: MIT
6
6
  Keywords: ai,openai,ai agents,agi
@@ -75,7 +75,9 @@ You can install Solana Agent using pip:
75
75
 
76
76
  `pip install solana-agent`
77
77
 
78
- ## Basic Usage
78
+ ## Usage
79
+
80
+ ### Text/Text Streaming
79
81
 
80
82
  ```python
81
83
  from solana_agent import SolanaAgent
@@ -123,40 +125,109 @@ async for response in solana_agent.process("user123", "What are the latest AI de
123
125
  print(response, end="")
124
126
  ```
125
127
 
126
- ## Plugin Usage
128
+ ### Audio/Audio Streaming
127
129
 
128
- Plugins like Solana Agent Kit (sakit) integrate automatically with Solana Agent.
130
+ ```python
131
+ from solana_agent import SolanaAgent
129
132
 
130
- `pip install sakit`
133
+ config = {
134
+ "openai": {
135
+ "api_key": "your-openai-api-key",
136
+ },
137
+ "agents": [
138
+ {
139
+ "name": "research_specialist",
140
+ "instructions": "You are an expert researcher who synthesizes complex information clearly.",
141
+ "specialization": "Research and knowledge synthesis",
142
+ },
143
+ {
144
+ "name": "customer_support",
145
+ "instructions": "You provide friendly, helpful customer support responses.",
146
+ "specialization": "Customer inquiries",
147
+ }
148
+ ],
149
+ }
150
+
151
+ solana_agent = SolanaAgent(config=config)
152
+
153
+ audio_content = audio_file.read()
154
+
155
+ async for response in solana_agent.process("user123", audio_content, output_format="audio", audio_voice="nova", audio_input_format="webm", audio_output_format="aac"):
156
+ print(response, end="")
157
+ ```
158
+
159
+ ### Text/Audio Streaming
131
160
 
132
161
  ```python
133
162
  from solana_agent import SolanaAgent
134
163
 
135
164
  config = {
136
- "business": { # optional
137
- "mission": "To provide users with a one-stop shop for their queries.",
138
- "values": {
139
- "Friendliness": "Users must be treated fairly, openly, and with friendliness.",
140
- "Ethical": "Agents must use a strong ethical framework in their interactions with users.",
141
- },
142
- "goals": [
143
- "Empower users with great answers to their queries.",
144
- ],
145
- "voice": "The voice of the brand is that of a research business."
146
- },
147
- "openai": { # optional
165
+ "openai": {
148
166
  "api_key": "your-openai-api-key",
149
167
  },
150
- "ollama": { # optional
151
- "url": "your-ollama-url",
152
- },
153
- "mongo": { # optional
154
- "connection_string": "mongodb://localhost:27017",
155
- "database": "solana_agent"
168
+ "agents": [
169
+ {
170
+ "name": "research_specialist",
171
+ "instructions": "You are an expert researcher who synthesizes complex information clearly.",
172
+ "specialization": "Research and knowledge synthesis",
173
+ },
174
+ {
175
+ "name": "customer_support",
176
+ "instructions": "You provide friendly, helpful customer support responses.",
177
+ "specialization": "Customer inquiries",
178
+ }
179
+ ],
180
+ }
181
+
182
+ solana_agent = SolanaAgent(config=config)
183
+
184
+ async for response in solana_agent.process("user123", "What is the latest news on Elon Musk?", output_format="audio", audio_voice="nova", audio_output_format="aac"):
185
+ print(response, end="")
186
+ ```
187
+
188
+ ### Audio/Text Streaming
189
+
190
+ ```python
191
+ from solana_agent import SolanaAgent
192
+
193
+ config = {
194
+ "openai": {
195
+ "api_key": "your-openai-api-key",
156
196
  },
157
- "zep": { # optional
158
- "api_key": "your-zep-api-key",
159
- "base_url": "your-zep-base-url", # not applicable if using Zep Cloud
197
+ "agents": [
198
+ {
199
+ "name": "research_specialist",
200
+ "instructions": "You are an expert researcher who synthesizes complex information clearly.",
201
+ "specialization": "Research and knowledge synthesis",
202
+ },
203
+ {
204
+ "name": "customer_support",
205
+ "instructions": "You provide friendly, helpful customer support responses.",
206
+ "specialization": "Customer inquiries",
207
+ }
208
+ ],
209
+ }
210
+
211
+ solana_agent = SolanaAgent(config=config)
212
+
213
+ audio_content = audio_file.read()
214
+
215
+ async for response in solana_agent.process("user123", audio_content, audio_input_format="aac"):
216
+ print(response, end="")
217
+ ```
218
+
219
+ ### Plugins
220
+
221
+ Plugins like Solana Agent Kit (sakit) integrate automatically with Solana Agent.
222
+
223
+ `pip install sakit`
224
+
225
+ ```python
226
+ from solana_agent import SolanaAgent
227
+
228
+ config = {
229
+ "openai": {
230
+ "api_key": "your-openai-api-key",
160
231
  },
161
232
  "tools": {
162
233
  "search_internet": {
@@ -188,7 +259,7 @@ async for response in solana_agent.process("user123", "What are the latest AI de
188
259
 
189
260
  To create a plugin like Solana Agent Kit - read the [code](https://github.com/truemagic-coder/solana-agent-kit)
190
261
 
191
- ## Custom Inline Tool Usage
262
+ ### Custom Inline Tools
192
263
 
193
264
  ```python
194
265
  from solana_agent import SolanaAgent
@@ -241,31 +312,9 @@ class TestTool(Tool):
241
312
  }
242
313
 
243
314
  config = {
244
- "business": { # optional
245
- "mission": "To provide users with a one-stop shop for their queries.",
246
- "values": {
247
- "Friendliness": "Users must be treated fairly, openly, and with friendliness.",
248
- "Ethical": "Agents must use a strong ethical framework in their interactions with users.",
249
- },
250
- "goals": [
251
- "Empower users with great answers to their queries.",
252
- ],
253
- "voice": "The voice of the brand is that of a research business."
254
- },
255
- "openai": { # optional
315
+ "openai": {
256
316
  "api_key": "your-openai-api-key",
257
317
  },
258
- "ollama": { # optional
259
- "url": "your-ollama-url",
260
- },
261
- "mongo": { # optional
262
- "connection_string": "mongodb://localhost:27017",
263
- "database": "solana_agent"
264
- },
265
- "zep": { # optional
266
- "api_key": "your-zep-api-key",
267
- "base_url": "your-zep-base-url", # not applicable if using Zep Cloud
268
- },
269
318
  "agents": [
270
319
  {
271
320
  "name": "research_specialist",
@@ -290,6 +339,35 @@ async for response in solana_agent.process("user123", "What are the latest AI de
290
339
  print(response, end="")
291
340
  ```
292
341
 
342
+ ### Custom Prompt Injection at Runtime
343
+
344
+ ```python
345
+ from solana_agent import SolanaAgent
346
+
347
+ config = {
348
+ "openai": {
349
+ "api_key": "your-openai-api-key",
350
+ },
351
+ "agents": [
352
+ {
353
+ "name": "research_specialist",
354
+ "instructions": "You are an expert researcher who synthesizes complex information clearly.",
355
+ "specialization": "Research and knowledge synthesis",
356
+ },
357
+ {
358
+ "name": "customer_support",
359
+ "instructions": "You provide friendly, helpful customer support responses.",
360
+ "specialization": "Customer inquiries",
361
+ }
362
+ ],
363
+ }
364
+
365
+ solana_agent = SolanaAgent(config=config)
366
+
367
+ async for response in solana_agent.process("user123", "What are the latest AI developments?", "Always end your sentences with eh?"):
368
+ print(response, end="")
369
+ ```
370
+
293
371
  ## Notes
294
372
  * Solana Agent agents can only call one tool per response.
295
373
  * Solana Agent agents choose the best tool for the job.
@@ -3,7 +3,7 @@ solana_agent/adapters/__init__.py,sha256=tiEEuuy0NF3ngc_tGEcRTt71zVI58v3dYY9RvMr
3
3
  solana_agent/adapters/llm_adapter.py,sha256=3_7whVsPSJdlzBVUBlV7RBRCCo2dMXNmlACIrCoQxQ4,5426
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=CwUQHA76QiVmp9aNZcH1BVzD7I3LffwkvxtP5yLLmew,5003
6
+ solana_agent/client/solana_agent.py,sha256=4xXPNNcULMEIx-V-_zu2IH0tlPjQU2ZzkIqZFuxAJHY,5206
7
7
  solana_agent/domains/__init__.py,sha256=HiC94wVPRy-QDJSSRywCRrhrFfTBeHjfi5z-QfZv46U,168
8
8
  solana_agent/domains/agent.py,sha256=WTo-pEc66V6D_35cpDE-kTsw1SJM-dtylPZ7em5em7Q,2659
9
9
  solana_agent/domains/routing.py,sha256=UDlgTjUoC9xIBVYu_dnf9-KG_bBgdEXAv_UtDOrYo0w,650
@@ -17,7 +17,7 @@ solana_agent/interfaces/providers/llm.py,sha256=f58kDrvESBfIr2XoZJ-VVa8vL56qyuhk
17
17
  solana_agent/interfaces/providers/memory.py,sha256=oNOH8WZXVW8assDigIWZAWiwkxbpDiKupxA2RB6tQvQ,1010
18
18
  solana_agent/interfaces/services/agent.py,sha256=34luGrUF5FNXLhF6JXwbfOSuo_SbMOmLMywG310sMDw,2082
19
19
  solana_agent/interfaces/services/query.py,sha256=m8Uc0uXT3apSOhX3N1QjLMPk1KdJhj7HDrJjWUpDPBc,1309
20
- solana_agent/interfaces/services/routing.py,sha256=gohkt5f9uYDLpu4iDVDk9yj8js9P56R6QHSIDNylgwA,438
20
+ solana_agent/interfaces/services/routing.py,sha256=76pn3NIOnYVQ8GFpy88dg-mxSLnMv_tAEKoCI8NSvd8,409
21
21
  solana_agent/plugins/__init__.py,sha256=coZdgJKq1ExOaj6qB810i3rEhbjdVlrkN76ozt_Ojgo,193
22
22
  solana_agent/plugins/manager.py,sha256=Il49hXeqvu0b02pURNNp7mY8kp9_sqpi_vJIWBW5Hc0,5044
23
23
  solana_agent/plugins/registry.py,sha256=5S0DlUQKogsg1zLiRUIGMHEmGYHtOovU-S-5W1Mwo1A,3639
@@ -26,10 +26,10 @@ solana_agent/plugins/tools/auto_tool.py,sha256=DgES_cZ6xKSf_HJpFINpvJxrjVlk5oeqa
26
26
  solana_agent/repositories/__init__.py,sha256=fP83w83CGzXLnSdq-C5wbw9EhWTYtqE2lQTgp46-X_4,163
27
27
  solana_agent/repositories/memory.py,sha256=eecl1P0fr_xFSWFKIJg99q90oCS9--ihPrMLH3G2AzM,7136
28
28
  solana_agent/services/__init__.py,sha256=ab_NXJmwYUCmCrCzuTlZ47bJZINW0Y0F5jfQ9OovidU,163
29
- solana_agent/services/agent.py,sha256=Nx3D7HrL9YRP1qI9Yzhm8HR8AXBfavFYnujXsSLdZ4A,16540
30
- solana_agent/services/query.py,sha256=4MEGR_Q2THcCCjln-IcSAw7GGNqJ1q2cyEVRx69OQ7I,10746
29
+ solana_agent/services/agent.py,sha256=MdSPIC81JNuP2hfzXNGWOnRfe7OxwYHgDVZAphVCCo8,16450
30
+ solana_agent/services/query.py,sha256=QduAeiltFTwNDlAbC_emu544U4XGNioj-OauRGt9HSY,11070
31
31
  solana_agent/services/routing.py,sha256=PMCSG5m3uLMaHMj3dxNvNfcFZaeaDi7kMr7AEBCzwDE,6499
32
- solana_agent-19.1.1.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
33
- solana_agent-19.1.1.dist-info/METADATA,sha256=uUatH67fs4BlrNiZPPmm6vFr-by7457xZZCJgXYDins,10961
34
- solana_agent-19.1.1.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
35
- solana_agent-19.1.1.dist-info/RECORD,,
32
+ solana_agent-20.1.0.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
33
+ solana_agent-20.1.0.dist-info/METADATA,sha256=rQm9CUOd7kftGrha1cc7nEFdKqy9eODfb3Pov3GvPJ8,12645
34
+ solana_agent-20.1.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
35
+ solana_agent-20.1.0.dist-info/RECORD,,