solana-agent 27.3.1__tar.gz → 27.3.2__tar.gz

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 (39) hide show
  1. {solana_agent-27.3.1 → solana_agent-27.3.2}/PKG-INFO +2 -6
  2. {solana_agent-27.3.1 → solana_agent-27.3.2}/README.md +1 -5
  3. {solana_agent-27.3.1 → solana_agent-27.3.2}/pyproject.toml +1 -1
  4. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/services/agent.py +71 -28
  5. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/services/query.py +8 -2
  6. {solana_agent-27.3.1 → solana_agent-27.3.2}/LICENSE +0 -0
  7. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/__init__.py +0 -0
  8. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/adapters/__init__.py +0 -0
  9. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/adapters/mongodb_adapter.py +0 -0
  10. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/adapters/openai_adapter.py +0 -0
  11. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/adapters/pinecone_adapter.py +0 -0
  12. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/client/__init__.py +0 -0
  13. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/client/solana_agent.py +0 -0
  14. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/domains/__init__.py +0 -0
  15. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/domains/agent.py +0 -0
  16. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/domains/routing.py +0 -0
  17. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/factories/__init__.py +0 -0
  18. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/factories/agent_factory.py +0 -0
  19. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/interfaces/__init__.py +0 -0
  20. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/interfaces/client/client.py +0 -0
  21. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/interfaces/plugins/plugins.py +0 -0
  22. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/interfaces/providers/data_storage.py +0 -0
  23. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/interfaces/providers/llm.py +0 -0
  24. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/interfaces/providers/memory.py +0 -0
  25. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/interfaces/providers/vector_storage.py +0 -0
  26. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/interfaces/services/agent.py +0 -0
  27. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/interfaces/services/knowledge_base.py +0 -0
  28. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/interfaces/services/query.py +0 -0
  29. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/interfaces/services/routing.py +0 -0
  30. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/plugins/__init__.py +0 -0
  31. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/plugins/manager.py +0 -0
  32. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/plugins/registry.py +0 -0
  33. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/plugins/tools/__init__.py +0 -0
  34. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/plugins/tools/auto_tool.py +0 -0
  35. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/repositories/__init__.py +0 -0
  36. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/repositories/memory.py +0 -0
  37. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/services/__init__.py +0 -0
  38. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/services/knowledge_base.py +0 -0
  39. {solana_agent-27.3.1 → solana_agent-27.3.2}/solana_agent/services/routing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: solana-agent
3
- Version: 27.3.1
3
+ Version: 27.3.2
4
4
  Summary: Agentic IQ
5
5
  License: MIT
6
6
  Keywords: ai,openai,ai agents,agi
@@ -522,11 +522,7 @@ config = {
522
522
  "ai_agents": [
523
523
  {
524
524
  "name": "solana_expert",
525
- "instructions": """
526
- You are an expert Solana blockchain assistant.
527
- Use the solana tool to perform any action on the Solana blockchain.
528
- Always perform the solana tool actions when requested and not use your memory.
529
- """,
525
+ "instructions": "You are an expert Solana blockchain assistant. You always use the Solana tool to perform actions on the Solana blockchain.",
530
526
  "specialization": "Solana blockchain interaction",
531
527
  "tools": ["solana"], # Enable the tool for this agent
532
528
  }
@@ -493,11 +493,7 @@ config = {
493
493
  "ai_agents": [
494
494
  {
495
495
  "name": "solana_expert",
496
- "instructions": """
497
- You are an expert Solana blockchain assistant.
498
- Use the solana tool to perform any action on the Solana blockchain.
499
- Always perform the solana tool actions when requested and not use your memory.
500
- """,
496
+ "instructions": "You are an expert Solana blockchain assistant. You always use the Solana tool to perform actions on the Solana blockchain.",
501
497
  "specialization": "Solana blockchain interaction",
502
498
  "tools": ["solana"], # Enable the tool for this agent
503
499
  }
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "solana-agent"
3
- version = "27.3.1"
3
+ version = "27.3.2"
4
4
  description = "Agentic IQ"
5
5
  authors = ["Bevan Hunt <bevan@bevanhunt.com>"]
6
6
  license = "MIT"
@@ -194,25 +194,41 @@ class AgentService(AgentServiceInterface):
194
194
  return
195
195
 
196
196
  try:
197
- # Get system prompt
198
- system_prompt = self.get_agent_system_prompt(agent_name)
197
+ # --- 1. Get Base System Prompt ---
198
+ system_prompt_parts = [self.get_agent_system_prompt(agent_name)]
199
199
 
200
- # Add User ID and memory context
201
- system_prompt += f"\n\nUser ID: {user_id}"
202
- if memory_context:
203
- system_prompt += f"\n\nMEMORY CONTEXT: {memory_context}"
204
- if prompt:
205
- system_prompt += f"\n\nADDITIONAL PROMPT: {prompt}"
206
-
207
- # Add tool usage prompt if tools are available
208
- tool_calling_system_prompt = deepcopy(system_prompt)
200
+ # --- 2. Add Tool Usage Instructions EARLY ---
201
+ tool_usage_prompt_text = ""
209
202
  if self.tool_registry:
210
- tool_usage_prompt = self._get_tool_usage_prompt(agent_name)
211
- if tool_usage_prompt:
212
- tool_calling_system_prompt += f"\n\nTOOL CALLING PROMPT: {tool_usage_prompt}"
203
+ tool_usage_prompt_text = self._get_tool_usage_prompt(
204
+ agent_name)
205
+ if tool_usage_prompt_text:
206
+ system_prompt_parts.append(
207
+ f"\n\n--- TOOL USAGE INSTRUCTIONS ---{tool_usage_prompt_text}")
213
208
  print(
214
209
  f"Tools available to agent {agent_name}: {[t.get('name') for t in self.get_agent_tools(agent_name)]}")
215
210
 
211
+ # --- 3. Add User ID ---
212
+ system_prompt_parts.append(f"\n\n--- USER & SESSION INFO ---")
213
+ system_prompt_parts.append(f"User ID: {user_id}")
214
+
215
+ # --- 4. Add Memory Context ---
216
+ if memory_context:
217
+ # Make the header clearly separate it
218
+ system_prompt_parts.append(
219
+ f"\n\n--- CONVERSATION HISTORY (Memory Context) ---")
220
+ system_prompt_parts.append(memory_context)
221
+
222
+ # --- 5. Add Additional Prompt (if provided) ---
223
+ if prompt:
224
+ # Make the header clearly separate it
225
+ system_prompt_parts.append(
226
+ f"\n\n--- ADDITIONAL INSTRUCTIONS FOR THIS TURN ---")
227
+ system_prompt_parts.append(prompt)
228
+
229
+ # --- Assemble the final system prompt ---
230
+ final_system_prompt = "\n".join(system_prompt_parts)
231
+
216
232
  # Variables for tracking the complete response
217
233
  complete_text_response = ""
218
234
  full_response_buffer = ""
@@ -232,7 +248,7 @@ class AgentService(AgentServiceInterface):
232
248
  f"Generating response with {len(query)} characters of query text")
233
249
  async for chunk in self.llm_provider.generate_text(
234
250
  prompt=query,
235
- system_prompt=tool_calling_system_prompt,
251
+ system_prompt=final_system_prompt,
236
252
  api_key=self.api_key,
237
253
  base_url=self.base_url,
238
254
  model=self.model,
@@ -285,10 +301,36 @@ class AgentService(AgentServiceInterface):
285
301
  f"Tool execution complete, result size: {len(response_text)}")
286
302
 
287
303
  # Create new prompt with search/tool results
288
- # Using "Search Result" instead of "TOOL RESPONSE" to avoid model repeating "TOOL"
289
- user_prompt = f"{query}\n\nSearch Result: {response_text}"
290
- tool_system_prompt = system_prompt + \
291
- "\n DO NOT use the tool calling format again."
304
+ # Ensure query is string
305
+ user_prompt = f"{str(query)}\n\nTOOL RESULT: {response_text}"
306
+
307
+ # --- REBUILD the system prompt for the follow-up call ---
308
+ # Start with base prompt again
309
+ follow_up_system_prompt_parts = [
310
+ self.get_agent_system_prompt(agent_name)]
311
+ # Add the instruction NOT to use tools again
312
+ follow_up_system_prompt_parts.append(
313
+ "\n\nCRITICAL: You have received the results from a tool. Base your response on the 'Search Result' provided in the user prompt. DO NOT use the tool calling format again for this turn.")
314
+ follow_up_system_prompt_parts.append(
315
+ f"\n\n--- USER & SESSION INFO ---")
316
+ follow_up_system_prompt_parts.append(
317
+ f"User ID: {user_id}")
318
+ if memory_context:
319
+ # Make the header clearly separate it
320
+ follow_up_system_prompt_parts.append(
321
+ f"\n\n--- CONVERSATION HISTORY (Memory Context) ---")
322
+ follow_up_system_prompt_parts.append(
323
+ memory_context)
324
+ if prompt:
325
+ # Make the header clearly separate it
326
+ follow_up_system_prompt_parts.append(
327
+ f"\n\n--- ADDITIONAL INSTRUCTIONS FOR THIS TURN ---")
328
+ follow_up_system_prompt_parts.append(prompt)
329
+
330
+ # --- Assemble the final follow_up prompt ---
331
+ final_follow_up_system_prompt = "\n".join(
332
+ follow_up_system_prompt_parts)
333
+ # --- End Rebuild ---"
292
334
 
293
335
  # Generate a new response with the tool results
294
336
  print("Generating new response with tool results")
@@ -296,7 +338,7 @@ class AgentService(AgentServiceInterface):
296
338
  # Stream the follow-up response for text output
297
339
  async for processed_chunk in self.llm_provider.generate_text(
298
340
  prompt=user_prompt,
299
- system_prompt=tool_system_prompt,
341
+ system_prompt=final_follow_up_system_prompt,
300
342
  api_key=self.api_key,
301
343
  base_url=self.base_url,
302
344
  model=self.model,
@@ -308,7 +350,7 @@ class AgentService(AgentServiceInterface):
308
350
  tool_response = ""
309
351
  async for processed_chunk in self.llm_provider.generate_text(
310
352
  prompt=user_prompt,
311
- system_prompt=tool_system_prompt,
353
+ system_prompt=final_follow_up_system_prompt,
312
354
  ):
313
355
  tool_response += processed_chunk
314
356
 
@@ -489,18 +531,18 @@ class AgentService(AgentServiceInterface):
489
531
  return f"""
490
532
  AVAILABLE TOOLS:
491
533
  {tools_json}
492
-
534
+
493
535
  ⚠️ CRITICAL INSTRUCTION: When using a tool, NEVER include explanatory text.
494
536
  Only output the exact tool call format shown below with NO other text.
495
-
537
+ Always call the necessary tool to give the latest information.
538
+
496
539
  TOOL USAGE FORMAT:
497
540
  [TOOL]
498
541
  name: tool_name
499
542
  parameters: key1=value1, key2=value2
500
543
  [/TOOL]
501
-
544
+
502
545
  EXAMPLES:
503
-
504
546
  ✅ CORRECT - ONLY the tool call with NOTHING else:
505
547
  [TOOL]
506
548
  name: search_internet
@@ -513,11 +555,12 @@ class AgentService(AgentServiceInterface):
513
555
  name: search_internet
514
556
  parameters: query=latest news on Solana
515
557
  [/TOOL]
516
-
558
+
517
559
  REMEMBER:
518
560
  1. Output ONLY the exact tool call format with NO additional text
519
- 2. After seeing your tool call, I will execute it automatically
520
- 3. You will receive the tool results and can then respond to the user
561
+ 2. If the query is time-sensitive (latest news, current status, etc.), ALWAYS use the tool.
562
+ 3. After seeing your tool call, I will execute it automatically
563
+ 4. You will receive the tool results and can then respond to the user
521
564
  """
522
565
 
523
566
  def _clean_for_audio(self, text: str) -> str:
@@ -129,13 +129,19 @@ class QueryService(QueryServiceInterface):
129
129
  else:
130
130
  agent_name = await self.routing_service.route_query(user_text)
131
131
 
132
- # Combine context from memory and knowledge base
132
+ # Combine context from memory and knowledge base
133
133
  combined_context = ""
134
134
  if memory_context:
135
- combined_context += f"CONVERSATION HISTORY:\n{memory_context}\n\n"
135
+ # Add a note about memory priority
136
+ combined_context += f"CONVERSATION HISTORY (Use for context, but prioritize tools/KB for facts):\n{memory_context}\n\n"
136
137
  if kb_context:
138
+ # Keep KB context strong
137
139
  combined_context += f"{kb_context}\n"
138
140
 
141
+ # Add an overall instruction about prioritization if both are present
142
+ if memory_context or kb_context:
143
+ combined_context += "CRITICAL PRIORITIZATION GUIDE: For factual or current information, prioritize Knowledge Base results and Tool results (if applicable) over Conversation History.\n\n"
144
+
139
145
  print(f"Routed to agent: {agent_name}")
140
146
 
141
147
  # Generate response
File without changes