solana-agent 31.0.0__py3-none-any.whl → 31.1.1__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.
@@ -1,8 +1,9 @@
1
1
  """
2
2
  Routing service implementation.
3
3
 
4
- This service manages query routing to appropriate agents based on
5
- specializations and query analysis.
4
+ This service manages query routing to appropriate agents using an LLM-based
5
+ analysis. It defaults to a small, low-cost model for routing to minimize
6
+ overhead while maintaining quality.
6
7
  """
7
8
 
8
9
  import logging
@@ -28,7 +29,7 @@ class RoutingService(RoutingServiceInterface):
28
29
  api_key: Optional[str] = None,
29
30
  base_url: Optional[str] = None,
30
31
  model: Optional[str] = None,
31
- ):
32
+ ) -> None:
32
33
  """Initialize the routing service.
33
34
 
34
35
  Args:
@@ -39,7 +40,10 @@ class RoutingService(RoutingServiceInterface):
39
40
  self.agent_service = agent_service
40
41
  self.api_key = api_key
41
42
  self.base_url = base_url
42
- self.model = model
43
+ # Use a small, cheap model for routing unless explicitly provided
44
+ self.model = model or "gpt-4.1-mini"
45
+ # Simple sticky session: remember last routed agent in-process
46
+ self._last_agent = None
43
47
 
44
48
  async def _analyze_query(self, query: str) -> Dict[str, Any]:
45
49
  """Analyze a query to determine routing information.
@@ -82,9 +86,6 @@ class RoutingService(RoutingServiceInterface):
82
86
  2. Any secondary agents that might be helpful (must be from the listed agents)
83
87
  3. The complexity level (1-5, where 5 is most complex)
84
88
  4. Any key topics or technologies mentioned
85
-
86
- Think carefully about whether the query is more technical/development-focused or more
87
- financial/market-focused to match with the appropriate agent.
88
89
  """
89
90
 
90
91
  try:
@@ -131,18 +132,23 @@ class RoutingService(RoutingServiceInterface):
131
132
  if len(agents) == 1:
132
133
  agent_name = next(iter(agents.keys()))
133
134
  logger.info(f"Only one agent available: {agent_name}") # Use logger.info
135
+ self._last_agent = agent_name
134
136
  return agent_name
135
137
 
136
- # Analyze query
137
- analysis = await self._analyze_query(query)
138
+ # Short reply bypass and default stickiness
139
+ short = query.strip().lower()
140
+ short_replies = {"", "yes", "no", "ok", "k", "y", "n", "1", "0"}
141
+ if short in short_replies and self._last_agent:
142
+ return self._last_agent
138
143
 
139
- # Find best agent based on analysis
144
+ # Always analyze with a small model to select the best agent
145
+ analysis = await self._analyze_query(query)
140
146
  best_agent = await self._find_best_ai_agent(
141
147
  analysis["primary_specialization"], analysis["secondary_specializations"]
142
148
  )
143
-
144
- # Return best agent
145
- return best_agent
149
+ chosen = best_agent or next(iter(agents.keys()))
150
+ self._last_agent = chosen
151
+ return chosen
146
152
 
147
153
  async def _find_best_ai_agent(
148
154
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: solana-agent
3
- Version: 31.0.0
3
+ Version: 31.1.1
4
4
  Summary: AI Agents for Solana
5
5
  License: MIT
6
6
  Keywords: solana,solana ai,solana agent,ai,ai agent,ai agents
@@ -14,20 +14,20 @@ Classifier: Programming Language :: Python :: 3
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Programming Language :: Python :: 3.13
16
16
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
- Requires-Dist: instructor (==1.10.0)
18
- Requires-Dist: llama-index-core (==0.13.0)
17
+ Requires-Dist: instructor (==1.11.2)
18
+ Requires-Dist: llama-index-core (==0.13.3)
19
19
  Requires-Dist: llama-index-embeddings-openai (==0.5.0)
20
- Requires-Dist: logfire (==4.2.0)
21
- Requires-Dist: openai (==1.99.3)
20
+ Requires-Dist: logfire (==4.3.6)
21
+ Requires-Dist: openai (==1.102.0)
22
22
  Requires-Dist: pillow (==11.3.0)
23
- Requires-Dist: pinecone (==7.3.0)
23
+ Requires-Dist: pinecone[asyncio] (==7.3.0)
24
24
  Requires-Dist: pydantic (>=2)
25
- Requires-Dist: pymongo (==4.14.0)
26
- Requires-Dist: pypdf (==5.9.0)
25
+ Requires-Dist: pymongo (==4.14.1)
26
+ Requires-Dist: pypdf (==6.0.0)
27
27
  Requires-Dist: rich (>=13,<14.0)
28
28
  Requires-Dist: scrubadub (==2.0.1)
29
- Requires-Dist: typer (==0.16.0)
30
- Requires-Dist: zep-cloud (==3.1.0)
29
+ Requires-Dist: typer (==0.17.3)
30
+ Requires-Dist: zep-cloud (==3.4.3)
31
31
  Project-URL: Documentation, https://docs.solana-agent.com
32
32
  Project-URL: Homepage, https://solana-agent.com
33
33
  Project-URL: Repository, https://github.com/truemagic-coder/solana-agent
@@ -63,7 +63,7 @@ Build your AI agents in three lines of code!
63
63
  * Extensible Tooling
64
64
  * Autonomous Operation
65
65
  * Smart Workflows
66
- * Structured Outputs
66
+ * Agentic Forms
67
67
  * Knowledge Base
68
68
  * MCP Support
69
69
  * Guardrails
@@ -112,7 +112,7 @@ Smart workflows are as easy as combining your tools and prompts.
112
112
  * Integrated Knowledge Base with semantic search and automatic PDF chunking
113
113
  * Input and output guardrails for content filtering, safety, and data sanitization
114
114
  * Generate custom images based on text prompts with storage on S3 compatible services
115
- * Deterministically return structured outputs
115
+ * Deterministic agentic form filling in natural conversation
116
116
  * Combine with event-driven systems to create autonomous agents
117
117
 
118
118
  ## Stack
@@ -344,7 +344,9 @@ async for response in solana_agent.process("user123", "What is in this image? De
344
344
  print(response, end="")
345
345
  ```
346
346
 
347
- ### Structured Outputs
347
+ ### Agentic Forms
348
+
349
+ You can attach a JSON Schema to any agent in your config so it can collect structured data conversationally.
348
350
 
349
351
  ```python
350
352
  from solana_agent import SolanaAgent
@@ -355,25 +357,28 @@ config = {
355
357
  },
356
358
  "agents": [
357
359
  {
358
- "name": "researcher",
359
- "instructions": "You are a research expert.",
360
- "specialization": "Researcher",
360
+ "name": "customer_support",
361
+ "instructions": "You provide friendly, helpful customer support responses.",
362
+ "specialization": "Customer inquiries",
363
+ "capture_name": "contact_info",
364
+ "capture_mode": "once",
365
+ "capture_schema": {
366
+ "type": "object",
367
+ "properties": {
368
+ "email": { "type": "string" },
369
+ "phone": { "type": "string" },
370
+ "newsletter_subscribe": { "type": "boolean" }
371
+ },
372
+ "required": ["email"]
373
+ }
361
374
  }
362
- ],
375
+ ]
363
376
  }
364
377
 
365
378
  solana_agent = SolanaAgent(config=config)
366
379
 
367
- class ResearchProposal(BaseModel):
368
- title: str
369
- abstract: str
370
- key_points: list[str]
371
-
372
- full_response = None
373
- async for response in solana_agent.process("user123", "Research the life of Ben Franklin - the founding Father.", output_model=ResearchProposal):
374
- full_response = response
375
-
376
- print(full_response.model_dump())
380
+ async for response in solana_agent.process("user123", "What are the latest AI developments?"):
381
+ print(response, end="")
377
382
  ```
378
383
 
379
384
  ### Command Line Interface (CLI)
@@ -5,12 +5,12 @@ solana_agent/adapters/openai_adapter.py,sha256=Vc2lizpJeyZH2T7GX-iLpUUmn2gsw5b2v
5
5
  solana_agent/adapters/pinecone_adapter.py,sha256=XlfOpoKHwzpaU4KZnovO2TnEYbsw-3B53ZKQDtBeDgU,23847
6
6
  solana_agent/cli.py,sha256=FGvTIQmKLp6XsQdyKtuhIIfbBtMmcCCXfigNrj4bzMc,4704
7
7
  solana_agent/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- solana_agent/client/solana_agent.py,sha256=ZNBRpougMi8xjkFQffSyrkJCnbRe7C2rKOjJfhQN5ug,9191
8
+ solana_agent/client/solana_agent.py,sha256=Ivi18kQaHu8Jp395SNe-dr751AEjmNxkt2dGfVXzVew,9374
9
9
  solana_agent/domains/__init__.py,sha256=HiC94wVPRy-QDJSSRywCRrhrFfTBeHjfi5z-QfZv46U,168
10
- solana_agent/domains/agent.py,sha256=3Q1wg4eIul0CPpaYBOjEthKTfcdhf1SAiWc2R-IMGO8,2561
10
+ solana_agent/domains/agent.py,sha256=8pAi1-kIgzFNANt3dyQjw-1zbThcNdpEllbAGWi79uI,2841
11
11
  solana_agent/domains/routing.py,sha256=1yR4IswGcmREGgbOOI6TKCfuM7gYGOhQjLkBqnZ-rNo,582
12
12
  solana_agent/factories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- solana_agent/factories/agent_factory.py,sha256=kduhtCMAxiPmCW_wx-hGGlhehRRGt4OBKY8r-R-LZnI,13246
13
+ solana_agent/factories/agent_factory.py,sha256=i20C57hxF7juWuYy9lru28OwCC-xD4g5UhzmQtPe474,14671
14
14
  solana_agent/guardrails/pii.py,sha256=FCz1IC3mmkr41QFFf5NaC0fwJrVkwFsxgyOCS2POO5I,4428
15
15
  solana_agent/interfaces/__init__.py,sha256=IQs1WIM1FeKP1-kY2FEfyhol_dB-I-VAe2rD6jrVF6k,355
16
16
  solana_agent/interfaces/client/client.py,sha256=9hg35-hp_CI-WVGOXehBE1ZCKYahLmbeAvtQOYmML4o,3245
@@ -18,11 +18,11 @@ solana_agent/interfaces/guardrails/guardrails.py,sha256=gZCQ1FrirW-mX6s7FoYrbRs6
18
18
  solana_agent/interfaces/plugins/plugins.py,sha256=Rz52cWBLdotwf4kV-2mC79tRYlN29zHSu1z9-y1HVPk,3329
19
19
  solana_agent/interfaces/providers/data_storage.py,sha256=Y92Cq8BtC55VlsYLD7bo3ofqQabNnlg7Q4H1Q6CDsLU,1713
20
20
  solana_agent/interfaces/providers/llm.py,sha256=Naj8gTGi3GpIMFHKwQjw7EuAF_uSWwwz2-41iUYtov4,2908
21
- solana_agent/interfaces/providers/memory.py,sha256=h3HEOwWCiFGIuFBX49XOv1jFaQW3NGjyKPOfmQloevk,1011
21
+ solana_agent/interfaces/providers/memory.py,sha256=28X1LeS-bEac4yoIXdRPyuRU91oW9Kdt2NZtDmwSTxM,1360
22
22
  solana_agent/interfaces/providers/vector_storage.py,sha256=XPYzvoWrlDVFCS9ItBmoqCFWXXWNYY-d9I7_pvP7YYk,1561
23
23
  solana_agent/interfaces/services/agent.py,sha256=A-Hmgelr3g_qaNB0PEPMFHxB5nSCBK0WJ5hauJtIcmI,2257
24
24
  solana_agent/interfaces/services/knowledge_base.py,sha256=Mu8lCGFXPmI_IW5LRGti7octLoWZIg4k5PmGwPfe7LQ,1479
25
- solana_agent/interfaces/services/query.py,sha256=Co-pThoT4Zz8jhwKt5fV3LH9MaE_lSyEwNFxsMnTU9Y,1737
25
+ solana_agent/interfaces/services/query.py,sha256=uu_qV-DcMEAjj-XQkIc29-inXgERohui4FXrbJj7tBo,1838
26
26
  solana_agent/interfaces/services/routing.py,sha256=Qbn3-DQGVSQKaegHDekSFmn_XCklA0H2f0XUx9-o3wA,367
27
27
  solana_agent/plugins/__init__.py,sha256=coZdgJKq1ExOaj6qB810i3rEhbjdVlrkN76ozt_Ojgo,193
28
28
  solana_agent/plugins/manager.py,sha256=mO_dKSVJ8GToD3wZflMcpKDEBXRoaaMRtY267HENCI0,5542
@@ -30,14 +30,14 @@ solana_agent/plugins/registry.py,sha256=VAG0BWdUUIsEE-VpATtHi8qat7ziPuh7pKuzGXau
30
30
  solana_agent/plugins/tools/__init__.py,sha256=VDjJxvUjefIy10VztQ9WDKgIegvDbIXBQWsHLhxdZ3o,125
31
31
  solana_agent/plugins/tools/auto_tool.py,sha256=uihijtlc9CCqCIaRcwPuuN7o1SHIpWL2GV3vr33GG3E,1576
32
32
  solana_agent/repositories/__init__.py,sha256=fP83w83CGzXLnSdq-C5wbw9EhWTYtqE2lQTgp46-X_4,163
33
- solana_agent/repositories/memory.py,sha256=fGKtyqMigeTnffthMZ38UFB3kyY4PUuOI7W-g_rRHQ4,7941
33
+ solana_agent/repositories/memory.py,sha256=F46vZ-Uhj7PX2uFGCRKYsZ8JLmKteMN1d30qGee2vtU,11111
34
34
  solana_agent/services/__init__.py,sha256=iko0c2MlF8b_SA_nuBGFllr2E3g_JowOrOzGcnU9tkA,162
35
- solana_agent/services/agent.py,sha256=EK4tGeG2nk-pIAvZMiKC1dlPVuybouGliONcJiB_2k8,19267
35
+ solana_agent/services/agent.py,sha256=dotuINMtW3TQDLq2eNM5r1cAUwhzxbHBotw8p5CLsYU,20983
36
36
  solana_agent/services/knowledge_base.py,sha256=ZvOPrSmcNDgUzz4bJIQ4LeRl9vMZiK9hOfs71IpB7Bk,32735
37
- solana_agent/services/query.py,sha256=3v5Ym8UqL0rfOC-0MWHALAsS2jVWdpUR3A-YI9n0xyo,18771
38
- solana_agent/services/routing.py,sha256=C5Ku4t9TqvY7S8wlUPMTC04HCrT4Ib3E8Q8yX0lVU_s,7137
39
- solana_agent-31.0.0.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
40
- solana_agent-31.0.0.dist-info/METADATA,sha256=IcmFIp2HBwLYQk-JnMAJnPGqFI4Nzdu_LlOSdP01gJg,29630
41
- solana_agent-31.0.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
42
- solana_agent-31.0.0.dist-info/entry_points.txt,sha256=-AuT_mfqk8dlZ0pHuAjx1ouAWpTRjpqvEUa6YV3lmc0,53
43
- solana_agent-31.0.0.dist-info/RECORD,,
37
+ solana_agent/services/query.py,sha256=FwqZMmuLUI7TmAkzv91D363PfnWajww35s8j5ubatY4,31544
38
+ solana_agent/services/routing.py,sha256=hsHe8HSGO_xFc0A17WIOGTidLTfLSfApQw3l2HHqkLo,7614
39
+ solana_agent-31.1.1.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
40
+ solana_agent-31.1.1.dist-info/METADATA,sha256=Ke1JR65TFAZ3YAE4V_x-WbVXvMfkF-2aj_Hs2xlgcxQ,30013
41
+ solana_agent-31.1.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
42
+ solana_agent-31.1.1.dist-info/entry_points.txt,sha256=-AuT_mfqk8dlZ0pHuAjx1ouAWpTRjpqvEUa6YV3lmc0,53
43
+ solana_agent-31.1.1.dist-info/RECORD,,