Skip to content

Commit 947317e

Browse files
add retry for vybe and update deps
1 parent 73c5e50 commit 947317e

File tree

4 files changed

+59
-39
lines changed

4 files changed

+59
-39
lines changed

poetry.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "sakit"
3-
version = "12.4.1"
3+
version = "12.4.2"
44
description = "Solana Agent Kit"
55
authors = ["Bevan Hunt <bevan@bevanhunt.com>"]
66
license = "MIT"
@@ -17,8 +17,8 @@ packages = [{ include = "sakit" }]
1717
python = ">=3.12,<4.0"
1818
httpx = "^0.28.1"
1919
solana-agent = ">=30.0.0"
20-
boto3 = "^1.38.38"
21-
botocore = "^1.38.38"
20+
boto3 = "^1.38.39"
21+
botocore = "^1.38.39"
2222
nemo-agent = "5.0.3"
2323
fastmcp = "^2.8.1"
2424
solana = "^0.36.7"

sakit/privy_balance.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncio
12
import logging
23
from typing import Dict, Any, List, Optional
34
from solana_agent import AutoTool, ToolRegistry
@@ -107,20 +108,29 @@ async def execute(self, user_id: str) -> Dict[str, Any]:
107108
"accept": "application/json",
108109
"X-API-KEY": self.api_key,
109110
}
110-
try:
111-
async with httpx.AsyncClient(timeout=10.0) as client:
112-
resp = await client.get(url, headers=headers, timeout=15)
113-
resp.raise_for_status()
114-
data = resp.json()
115-
summary = summarize_alphavybe_balances(data)
116-
return {
117-
"status": "success",
118-
"result": summary,
119-
}
120-
except Exception as e:
121-
logging.exception(f"Privy balance check error: {e}")
122-
return {"status": "error", "message": str(e)}
123-
111+
max_retries = 3
112+
for attempt in range(max_retries):
113+
try:
114+
async with httpx.AsyncClient(timeout=10.0) as client:
115+
resp = await client.get(url, headers=headers, timeout=15)
116+
if resp.status_code >= 500:
117+
raise httpx.HTTPStatusError("Server error", request=resp.request, response=resp)
118+
resp.raise_for_status()
119+
data = resp.json()
120+
summary = summarize_alphavybe_balances(data)
121+
return {
122+
"status": "success",
123+
"result": summary,
124+
}
125+
except httpx.HTTPStatusError as e:
126+
if resp.status_code >= 500 and attempt < max_retries - 1:
127+
await asyncio.sleep(1)
128+
continue
129+
logging.exception(f"Privy balance check error: {e}")
130+
return {"status": "error", "message": str(e)}
131+
except Exception as e:
132+
logging.exception(f"Privy balance check error: {e}")
133+
return {"status": "error", "message": str(e)}
124134

125135
class PrivyBalanceCheckerPlugin:
126136
def __init__(self):

sakit/solana_balance.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,30 @@ async def execute(self, wallet_address: str) -> Dict[str, Any]:
8080
"accept": "application/json",
8181
"X-API-KEY": self.api_key,
8282
}
83-
try:
84-
async with httpx.AsyncClient(timeout=10.0) as client:
85-
resp = await client.get(url, headers=headers, timeout=15)
86-
resp.raise_for_status()
87-
data = resp.json()
88-
summary = summarize_alphavybe_balances(data)
89-
return {
90-
"status": "success",
91-
"result": summary,
92-
}
93-
except Exception as e:
94-
logging.exception(f"AlphaVybe balance check error: {e}")
95-
return {"status": "error", "message": str(e)}
96-
83+
max_retries = 3
84+
for attempt in range(max_retries):
85+
try:
86+
async with httpx.AsyncClient(timeout=10.0) as client:
87+
resp = await client.get(url, headers=headers, timeout=15)
88+
if resp.status_code >= 500:
89+
raise httpx.HTTPStatusError("Server error", request=resp.request, response=resp)
90+
resp.raise_for_status()
91+
data = resp.json()
92+
summary = summarize_alphavybe_balances(data)
93+
return {
94+
"status": "success",
95+
"result": summary,
96+
}
97+
except httpx.HTTPStatusError as e:
98+
if resp.status_code >= 500 and attempt < max_retries - 1:
99+
import asyncio
100+
await asyncio.sleep(1)
101+
continue
102+
logging.exception(f"AlphaVybe balance check error: {e}")
103+
return {"status": "error", "message": str(e)}
104+
except Exception as e:
105+
logging.exception(f"AlphaVybe balance check error: {e}")
106+
return {"status": "error", "message": str(e)}
97107

98108
class AlphaVybeBalanceCheckerPlugin:
99109
def __init__(self):

0 commit comments

Comments
 (0)