intentkit 0.8.14.dev1__py3-none-any.whl → 0.8.15.dev1__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.
Potentially problematic release.
This version of intentkit might be problematic. Click here for more details.
- intentkit/__init__.py +1 -1
- intentkit/skills/x402/ask_agent.py +67 -44
- {intentkit-0.8.14.dev1.dist-info → intentkit-0.8.15.dev1.dist-info}/METADATA +1 -1
- {intentkit-0.8.14.dev1.dist-info → intentkit-0.8.15.dev1.dist-info}/RECORD +6 -6
- {intentkit-0.8.14.dev1.dist-info → intentkit-0.8.15.dev1.dist-info}/WHEEL +0 -0
- {intentkit-0.8.14.dev1.dist-info → intentkit-0.8.15.dev1.dist-info}/licenses/LICENSE +0 -0
intentkit/__init__.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import logging
|
|
1
2
|
import threading
|
|
2
3
|
from typing import Any, Dict, Optional, Type
|
|
3
4
|
|
|
@@ -13,6 +14,8 @@ from intentkit.config.config import config
|
|
|
13
14
|
from intentkit.models.chat import AuthorType
|
|
14
15
|
from intentkit.skills.x402.base import X402BaseSkill
|
|
15
16
|
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
16
19
|
|
|
17
20
|
class AskAgentInput(BaseModel):
|
|
18
21
|
"""Arguments for the x402 ask agent skill."""
|
|
@@ -43,50 +46,70 @@ class X402AskAgent(X402BaseSkill):
|
|
|
43
46
|
search_mode: Optional[bool] = None,
|
|
44
47
|
super_mode: Optional[bool] = None,
|
|
45
48
|
) -> str:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
49
|
+
try:
|
|
50
|
+
base_url = (config.open_api_base_url or "").rstrip("/")
|
|
51
|
+
if not base_url:
|
|
52
|
+
raise ValueError("X402 API base URL is not configured.")
|
|
53
|
+
|
|
54
|
+
# Use wallet provider signer to satisfy eth_account.BaseAccount interface requirements
|
|
55
|
+
context = self.get_context()
|
|
56
|
+
wallet_provider = await get_wallet_provider(context.agent)
|
|
57
|
+
account = ThreadSafeEvmWalletSigner(wallet_provider)
|
|
58
|
+
|
|
59
|
+
payload: Dict[str, Any] = {
|
|
60
|
+
"agent_id": agent_id,
|
|
61
|
+
"message": message,
|
|
62
|
+
"app_id": "skill",
|
|
63
|
+
}
|
|
64
|
+
if search_mode is not None:
|
|
65
|
+
payload["search_mode"] = search_mode
|
|
66
|
+
if super_mode is not None:
|
|
67
|
+
payload["super_mode"] = super_mode
|
|
68
|
+
|
|
69
|
+
async with x402HttpxClient(
|
|
70
|
+
account=account,
|
|
71
|
+
base_url=base_url,
|
|
72
|
+
timeout=20.0,
|
|
73
|
+
) as client:
|
|
74
|
+
response = await client.post("/x402", json=payload)
|
|
75
|
+
try:
|
|
76
|
+
response.raise_for_status()
|
|
77
|
+
except Exception as e:
|
|
78
|
+
error_body = ""
|
|
79
|
+
try:
|
|
80
|
+
error_body = response.text
|
|
81
|
+
except Exception:
|
|
82
|
+
error_body = "Unable to read response body"
|
|
83
|
+
logger.error(
|
|
84
|
+
f"HTTP request failed with status {response.status_code}: {error_body}"
|
|
85
|
+
)
|
|
86
|
+
raise ToolException(
|
|
87
|
+
f"HTTP request failed with status {response.status_code}: {error_body}"
|
|
88
|
+
) from e
|
|
89
|
+
messages = response.json()
|
|
90
|
+
if not isinstance(messages, list) or not messages:
|
|
91
|
+
raise ValueError("Agent returned an empty response.")
|
|
92
|
+
|
|
93
|
+
last_message = messages[-1]
|
|
94
|
+
if not isinstance(last_message, dict):
|
|
95
|
+
raise ValueError("Agent response format is invalid.")
|
|
96
|
+
|
|
97
|
+
author_type = last_message.get("author_type")
|
|
98
|
+
content = last_message.get("message")
|
|
99
|
+
|
|
100
|
+
if author_type == AuthorType.SYSTEM.value:
|
|
101
|
+
raise ToolException(content or "Agent returned a system message.")
|
|
102
|
+
|
|
103
|
+
if not content:
|
|
104
|
+
raise ToolException("Agent response did not include message text.")
|
|
105
|
+
|
|
106
|
+
return str(content)
|
|
107
|
+
except ToolException:
|
|
108
|
+
# Re-raise ToolException as-is
|
|
109
|
+
raise
|
|
110
|
+
except Exception as e:
|
|
111
|
+
logger.error(f"Unexpected error in x402_ask_agent: {str(e)}")
|
|
112
|
+
raise ToolException(f"Unexpected error occurred: {str(e)}") from e
|
|
90
113
|
|
|
91
114
|
|
|
92
115
|
class ThreadSafeEvmWalletSigner(CoinbaseEvmWalletSigner):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: intentkit
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.15.dev1
|
|
4
4
|
Summary: Intent-based AI Agent Platform - Core Package
|
|
5
5
|
Project-URL: Homepage, https://github.com/crestalnetwork/intentkit
|
|
6
6
|
Project-URL: Repository, https://github.com/crestalnetwork/intentkit
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
intentkit/__init__.py,sha256=
|
|
1
|
+
intentkit/__init__.py,sha256=yfCJcP4rBGBMAF4niMTLrFqF73HqcL4fziAR1g2wa0Y,384
|
|
2
2
|
intentkit/abstracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
intentkit/abstracts/agent.py,sha256=108gb5W8Q1Sy4G55F2_ZFv2-_CnY76qrBtpIr0Oxxqk,1489
|
|
4
4
|
intentkit/abstracts/api.py,sha256=ZUc24vaQvQVbbjznx7bV0lbbQxdQPfEV8ZxM2R6wZWo,166
|
|
@@ -437,7 +437,7 @@ intentkit/skills/wow/base.py,sha256=nFt8sJtQQsu2_ZlRasXhyG148fSJYRL-20kEt380PaE,
|
|
|
437
437
|
intentkit/skills/wow/schema.json,sha256=jGpugebVupGTlOUYNu7fN99p-zL-cfaoOYSX7KW8VQc,2292
|
|
438
438
|
intentkit/skills/wow/wow.svg,sha256=PO0-m6TZjJCql9r1oWohlRV5PyqGc5kIDUEnpP2-5SU,427
|
|
439
439
|
intentkit/skills/x402/__init__.py,sha256=tAO80tBlMluExByWiQ_r2GZlaAYTMsaWxCXDREaqqAg,1315
|
|
440
|
-
intentkit/skills/x402/ask_agent.py,sha256=
|
|
440
|
+
intentkit/skills/x402/ask_agent.py,sha256=fvsUftFXygGhK_BiFTN1mSSYTWrIhxGRBgTLCy0_USE,6138
|
|
441
441
|
intentkit/skills/x402/base.py,sha256=KhC9CWFEgdfQjWH1QCRJiNSWCnmgypVIe1ap1hb3X5E,211
|
|
442
442
|
intentkit/skills/x402/schema.json,sha256=drzDQYukjZisupVS-_A73F5GtT7MDHxKcTzDIr-aYTs,1069
|
|
443
443
|
intentkit/skills/x402/x402.webp,sha256=uFUnkwm9lwCwJgmNqa9ZgF6PjzCcAdQ8b_CKAFh8g-Y,4490
|
|
@@ -458,7 +458,7 @@ intentkit/utils/s3.py,sha256=A8Nsx5QJyLsxhj9g7oHNy2-m24tjQUhC9URm8Qb1jFw,10057
|
|
|
458
458
|
intentkit/utils/schema.py,sha256=ATeTskEO2Y-MLFcOJEm5BoFJvxqc_zqQwiRS3rO4XDQ,3428
|
|
459
459
|
intentkit/utils/slack_alert.py,sha256=s7UpRgyzLW7Pbmt8cKzTJgMA9bm4EP-1rQ5KXayHu6E,2264
|
|
460
460
|
intentkit/utils/tx.py,sha256=2yLLGuhvfBEY5n_GJ8wmIWLCzn0FsYKv5kRNzw_sLUI,1454
|
|
461
|
-
intentkit-0.8.
|
|
462
|
-
intentkit-0.8.
|
|
463
|
-
intentkit-0.8.
|
|
464
|
-
intentkit-0.8.
|
|
461
|
+
intentkit-0.8.15.dev1.dist-info/METADATA,sha256=1ePyA7IFVMiUwaRu_EeJcUsUlTbOEDppVHX_LK7QT_c,6316
|
|
462
|
+
intentkit-0.8.15.dev1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
463
|
+
intentkit-0.8.15.dev1.dist-info/licenses/LICENSE,sha256=Bln6DhK-LtcO4aXy-PBcdZv2f24MlJFm_qn222biJtE,1071
|
|
464
|
+
intentkit-0.8.15.dev1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|