solana-agent 28.0.0__py3-none-any.whl → 28.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.
@@ -10,6 +10,7 @@ from openai import AsyncOpenAI
10
10
  from pydantic import BaseModel
11
11
  import instructor
12
12
  from instructor import Mode
13
+ import logfire
13
14
 
14
15
  from solana_agent.interfaces.providers.llm import LLMProvider
15
16
 
@@ -26,8 +27,21 @@ DEFAULT_TTS_MODEL = "tts-1"
26
27
  class OpenAIAdapter(LLMProvider):
27
28
  """OpenAI implementation of LLMProvider with web search capabilities."""
28
29
 
29
- def __init__(self, api_key: str):
30
+ def __init__(self, api_key: str, logfire_api_key: Optional[str] = None):
30
31
  self.client = AsyncOpenAI(api_key=api_key)
32
+
33
+ self.logfire = False
34
+ if logfire_api_key:
35
+ try:
36
+ logfire.configure(token=logfire_api_key)
37
+ self.logfire = True
38
+ print("Logfire configured successfully.") # Optional: confirmation log
39
+ except Exception as e:
40
+ print(
41
+ f"Failed to configure Logfire: {e}"
42
+ ) # Log error if configuration fails
43
+ self.logfire = False # Ensure logfire is False if config fails
44
+
31
45
  self.parse_model = DEFAULT_PARSE_MODEL
32
46
  self.text_model = DEFAULT_CHAT_MODEL
33
47
  self.transcription_model = DEFAULT_TRANSCRIPTION_MODEL
@@ -65,6 +79,7 @@ class OpenAIAdapter(LLMProvider):
65
79
  Audio bytes as they become available
66
80
  """
67
81
  try:
82
+ logfire.instrument_openai(self.client)
68
83
  async with self.client.audio.speech.with_streaming_response.create(
69
84
  model=self.tts_model,
70
85
  voice=voice,
@@ -106,6 +121,7 @@ class OpenAIAdapter(LLMProvider):
106
121
  Transcript text chunks as they become available
107
122
  """
108
123
  try:
124
+ logfire.instrument_openai(self.client)
109
125
  async with self.client.audio.transcriptions.with_streaming_response.create(
110
126
  model=self.transcription_model,
111
127
  file=(f"file.{input_format}", audio_bytes),
@@ -149,6 +165,9 @@ class OpenAIAdapter(LLMProvider):
149
165
  else:
150
166
  client = self.client
151
167
 
168
+ if self.logfire:
169
+ logfire.instrument_openai(client)
170
+
152
171
  try:
153
172
  # Make the non-streaming API call
154
173
  response = await client.chat.completions.create(**request_params)
@@ -186,6 +205,9 @@ class OpenAIAdapter(LLMProvider):
186
205
  else:
187
206
  client = self.client
188
207
 
208
+ if self.logfire:
209
+ logfire.instrument_openai(client)
210
+
189
211
  if model:
190
212
  self.parse_model = model
191
213
 
@@ -229,6 +251,9 @@ class OpenAIAdapter(LLMProvider):
229
251
  else:
230
252
  client = self.client
231
253
 
254
+ if self.logfire:
255
+ logfire.instrument_openai(client)
256
+
232
257
  if model:
233
258
  self.parse_model = model
234
259
 
@@ -288,6 +313,9 @@ class OpenAIAdapter(LLMProvider):
288
313
  # Replace newlines with spaces as recommended by OpenAI
289
314
  text = text.replace("\n", " ")
290
315
 
316
+ if self.logfire:
317
+ logfire.instrument_openai(self.client)
318
+
291
319
  response = await self.client.embeddings.create(
292
320
  input=[text], model=embedding_model, dimensions=embedding_dimensions
293
321
  )
@@ -78,6 +78,10 @@ class SolanaAgentFactory:
78
78
  # Create adapters
79
79
 
80
80
  if "mongo" in config:
81
+ if "connection_string" not in config["mongo"]:
82
+ raise ValueError("MongoDB connection string is required.")
83
+ if "database" not in config["mongo"]:
84
+ raise ValueError("MongoDB database name is required.")
81
85
  db_adapter = MongoDBAdapter(
82
86
  connection_string=config["mongo"]["connection_string"],
83
87
  database_name=config["mongo"]["database"],
@@ -85,9 +89,21 @@ class SolanaAgentFactory:
85
89
  else:
86
90
  db_adapter = None
87
91
 
88
- llm_adapter = OpenAIAdapter(
89
- api_key=config["openai"]["api_key"],
90
- )
92
+ if "logfire" in config:
93
+ if "api_key" not in config["logfire"]:
94
+ raise ValueError("Pydantic Logfire API key is required.")
95
+ if "openai" not in config or "api_key" not in config["openai"]:
96
+ raise ValueError("OpenAI API key is required.")
97
+ llm_adapter = OpenAIAdapter(
98
+ api_key=config["openai"]["api_key"],
99
+ logfire_api_key=config["logfire"].get("api_key"),
100
+ )
101
+ else:
102
+ if "openai" not in config or "api_key" not in config["openai"]:
103
+ raise ValueError("OpenAI API key is required.")
104
+ llm_adapter = OpenAIAdapter(
105
+ api_key=config["openai"].get("api_key"),
106
+ )
91
107
 
92
108
  # Create business mission if specified in config
93
109
  business_mission = None
@@ -782,10 +782,6 @@ class AgentService(AgentServiceInterface):
782
782
 
783
783
  tools_json = json.dumps(simplified_tools, indent=2)
784
784
 
785
- logger.info(
786
- f"Generated tool usage prompt for agent '{agent_name}': {tools_json}"
787
- )
788
-
789
785
  return f"""
790
786
  AVAILABLE TOOLS:
791
787
  {tools_json}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: solana-agent
3
- Version: 28.0.0
3
+ Version: 28.1.0
4
4
  Summary: AI Agents for Solana
5
5
  License: MIT
6
6
  Keywords: solana,solana ai,solana agent,ai,ai agent,ai agents
@@ -17,6 +17,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
17
  Requires-Dist: instructor (>=1.7.9,<2.0.0)
18
18
  Requires-Dist: llama-index-core (>=0.12.30,<0.13.0)
19
19
  Requires-Dist: llama-index-embeddings-openai (>=0.3.1,<0.4.0)
20
+ Requires-Dist: logfire (>=3.14.0,<4.0.0)
20
21
  Requires-Dist: openai (>=1.75.0,<2.0.0)
21
22
  Requires-Dist: pinecone (>=6.0.2,<7.0.0)
22
23
  Requires-Dist: pydantic (>=2)
@@ -63,6 +64,7 @@ Build your AI agents in three lines of code!
63
64
  * Knowledge Base
64
65
  * MCP Support
65
66
  * Guardrails
67
+ * Pydantic Logfire
66
68
  * Tested & Secure
67
69
  * Built in Python
68
70
  * Powers [CometHeart](https://cometheart.com)
@@ -74,6 +76,7 @@ Build your AI agents in three lines of code!
74
76
  * Fast AI responses
75
77
  * Solana Ecosystem Integration via [AgentiPy](https://github.com/niceberginc/agentipy)
76
78
  * MCP tool usage with first-class support for [Zapier](https://zapier.com/mcp)
79
+ * Integrated observability and tracing via [Pydantic Logfire](https://logfire.pydantic.dev/)
77
80
  * Designed for a multi-agent swarm
78
81
  * Seamless text and audio streaming with real-time multi-modal processing
79
82
  * Persistent memory that preserves context across all agent interactions
@@ -92,10 +95,13 @@ Build your AI agents in three lines of code!
92
95
  ### Tech
93
96
 
94
97
  * [Python](https://python.org) - Programming Language
95
- * [OpenAI](https://openai.com) - AI Provider
98
+ * [OpenAI](https://openai.com) - AI Model Provider
96
99
  * [MongoDB](https://mongodb.com) - Conversational History (optional)
97
100
  * [Zep Cloud](https://getzep.com) - Conversational Memory (optional)
98
101
  * [Pinecone](https://pinecone.io) - Knowledge Base (optional)
102
+ * [AgentiPy](https://agentipy.fun) - Solana Ecosystem (optional)
103
+ * [Zapier](https://zapier.com) - App Integrations (optional)
104
+ * [Pydantic Logfire](https://logfire.pydantic.dev) - Observability and Tracing (optional)
99
105
 
100
106
  ### AI Models Used
101
107
 
@@ -319,6 +325,16 @@ config = {
319
325
  }
320
326
  ```
321
327
 
328
+ ### Observability and Tracing
329
+
330
+ ```python
331
+ config = {
332
+ "logfire": {
333
+ "api_key": "your-logfire-write-token",
334
+ },
335
+ }
336
+ ```
337
+
322
338
  ### Knowledge Base
323
339
 
324
340
  The Knowledge Base (KB) is meant to store text values and/or small PDFs.
@@ -1,7 +1,7 @@
1
1
  solana_agent/__init__.py,sha256=g83qhMOCwcWL19V4CYbQwl0Ykpb0xn49OUh05i-pu3g,1001
2
2
  solana_agent/adapters/__init__.py,sha256=tiEEuuy0NF3ngc_tGEcRTt71zVI58v3dYY9RvMrF2Cg,204
3
3
  solana_agent/adapters/mongodb_adapter.py,sha256=0KWIa6kaFbUFvtKUzuV_0p0RFlPPGKrDVIEU2McVY3k,2734
4
- solana_agent/adapters/openai_adapter.py,sha256=QwNMWT2JKChb6RoHzlHWZrhujsi1cn8V4HDPWjUclIs,11105
4
+ solana_agent/adapters/openai_adapter.py,sha256=iDAOKZkN4x2yNarDIrS71w6ufjKnC-wlT3iZFOXCoY4,12099
5
5
  solana_agent/adapters/pinecone_adapter.py,sha256=SDbf_XJMuFDKhNfF25_VXaYG3vrmYyPIo2SyhaniEwg,23048
6
6
  solana_agent/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  solana_agent/client/solana_agent.py,sha256=jUGWxYJL9ZWxGsVX9C6FrRQyX7r6Cep0ijcfm7cbkJI,10098
@@ -9,7 +9,7 @@ solana_agent/domains/__init__.py,sha256=HiC94wVPRy-QDJSSRywCRrhrFfTBeHjfi5z-QfZv
9
9
  solana_agent/domains/agent.py,sha256=3Q1wg4eIul0CPpaYBOjEthKTfcdhf1SAiWc2R-IMGO8,2561
10
10
  solana_agent/domains/routing.py,sha256=1yR4IswGcmREGgbOOI6TKCfuM7gYGOhQjLkBqnZ-rNo,582
11
11
  solana_agent/factories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- solana_agent/factories/agent_factory.py,sha256=WdXvVE4301vi_5QTDesQG3dCoSnMi4rp7LWvBQQD0bk,11377
12
+ solana_agent/factories/agent_factory.py,sha256=_tBCzx-QIAkGg0v47GiGaQIH7xjlF_5zAt7VFEyqu6k,12273
13
13
  solana_agent/guardrails/pii.py,sha256=FCz1IC3mmkr41QFFf5NaC0fwJrVkwFsxgyOCS2POO5I,4428
14
14
  solana_agent/interfaces/__init__.py,sha256=IQs1WIM1FeKP1-kY2FEfyhol_dB-I-VAe2rD6jrVF6k,355
15
15
  solana_agent/interfaces/client/client.py,sha256=hsvaQiQdz3MLMNc77oD6ocvvnyl7Ez2n087ptFDA19M,3687
@@ -31,11 +31,11 @@ solana_agent/plugins/tools/auto_tool.py,sha256=uihijtlc9CCqCIaRcwPuuN7o1SHIpWL2G
31
31
  solana_agent/repositories/__init__.py,sha256=fP83w83CGzXLnSdq-C5wbw9EhWTYtqE2lQTgp46-X_4,163
32
32
  solana_agent/repositories/memory.py,sha256=YYpCyiDVi3a5ZOFYFkzBS6MDjo9g2TnwbEZ5KKfKbII,7204
33
33
  solana_agent/services/__init__.py,sha256=iko0c2MlF8b_SA_nuBGFllr2E3g_JowOrOzGcnU9tkA,162
34
- solana_agent/services/agent.py,sha256=6CwTqIzPykx4yGI53BM1UbYhQN5Va1DJu0RzNvzuh6U,41894
34
+ solana_agent/services/agent.py,sha256=9FB1Tj7v8JwJVVmZwK8IOSrBbgbV4iFZOtFHzw3gcEs,41780
35
35
  solana_agent/services/knowledge_base.py,sha256=J9V8dNoCCcko3EasiGwK2JJ_A_oG_e-Ni9pgNg0T6wA,33486
36
36
  solana_agent/services/query.py,sha256=bAoUfe_2EBVEVeh99-2E9KZ0zaHUzf7Lqel3rlHyNX8,17459
37
37
  solana_agent/services/routing.py,sha256=-0fNIKDtCn0-TLUYDFYAE4jPLMeI_jCXIpgtgWDpdf8,6986
38
- solana_agent-28.0.0.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
39
- solana_agent-28.0.0.dist-info/METADATA,sha256=UdgCn1QADdEba_j5vwdZmqPAQiHm_fO9sMzqJtvFYL0,26646
40
- solana_agent-28.0.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
41
- solana_agent-28.0.0.dist-info/RECORD,,
38
+ solana_agent-28.1.0.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
39
+ solana_agent-28.1.0.dist-info/METADATA,sha256=OP8i0NO-3L_nMBRlXjx8GbWAdrdW7Gub8T1k0_6gMKE,27151
40
+ solana_agent-28.1.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
41
+ solana_agent-28.1.0.dist-info/RECORD,,