intentkit 0.6.20__py3-none-any.whl → 0.6.21__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 CHANGED
@@ -3,7 +3,7 @@
3
3
  A powerful platform for building AI agents with blockchain and cryptocurrency capabilities.
4
4
  """
5
5
 
6
- __version__ = "0.6.20"
6
+ __version__ = "0.6.21"
7
7
  __author__ = "hyacinthus"
8
8
  __email__ = "hyacinthus@gmail.com"
9
9
 
@@ -4,6 +4,7 @@ from intentkit.clients.twitter import (
4
4
  TwitterClientConfig,
5
5
  get_twitter_client,
6
6
  )
7
+ from intentkit.clients.web3 import get_web3_client
7
8
 
8
9
  __all__ = [
9
10
  "TwitterClient",
@@ -11,4 +12,5 @@ __all__ = [
11
12
  "get_twitter_client",
12
13
  "CdpClient",
13
14
  "get_cdp_client",
15
+ "get_web3_client",
14
16
  ]
@@ -0,0 +1,32 @@
1
+ from typing import Dict
2
+
3
+ from web3 import Web3
4
+
5
+ from intentkit.abstracts.skill import SkillStoreABC
6
+ from intentkit.utils.chain import ChainProvider
7
+
8
+ # Global cache for Web3 clients by network_id
9
+ _web3_client_cache: Dict[str, Web3] = {}
10
+
11
+
12
+ def get_web3_client(network_id: str, skill_store: SkillStoreABC) -> Web3:
13
+ """Get a Web3 client for the specified network.
14
+
15
+ Args:
16
+ network_id: The network ID to get the Web3 client for
17
+ skill_store: The skill store to get system configuration from
18
+
19
+ Returns:
20
+ Web3: A Web3 client instance for the specified network
21
+ """
22
+ # Check global cache first
23
+ if network_id in _web3_client_cache:
24
+ return _web3_client_cache[network_id]
25
+
26
+ # Create new Web3 client and cache it
27
+ chain_provider: ChainProvider = skill_store.get_system_config("chain_provider")
28
+ chain = chain_provider.get_chain_config(network_id)
29
+ web3_client = Web3(Web3.HTTPProvider(chain.rpc_url))
30
+ _web3_client_cache[network_id] = web3_client
31
+
32
+ return web3_client
intentkit/core/chat.py ADDED
@@ -0,0 +1,51 @@
1
+ """Chat memory management utilities.
2
+
3
+ This module provides functions for managing chat thread memory,
4
+ including clearing thread history using LangGraph's checkpointer.
5
+ """
6
+
7
+ import logging
8
+
9
+ from intentkit.models.db import get_langgraph_checkpointer
10
+ from intentkit.utils.error import IntentKitAPIError
11
+
12
+ logger = logging.getLogger(__name__)
13
+
14
+
15
+ async def clear_thread_memory(agent_id: str, chat_id: str) -> bool:
16
+ """Clear all memory content for a specific thread.
17
+
18
+ This function uses LangGraph's official checkpointer.delete_thread() method
19
+ to permanently remove all stored checkpoints and conversation history
20
+ associated with the specified thread.
21
+
22
+ Args:
23
+ agent_id (str): The agent identifier
24
+ chat_id (str): The chat identifier
25
+
26
+ Returns:
27
+ bool: True if the thread memory was successfully cleared
28
+
29
+ Raises:
30
+ IntentKitAPIError: If there's an error clearing the thread memory
31
+ """
32
+ try:
33
+ # Construct thread_id by combining agent_id and chat_id
34
+ thread_id = f"{agent_id}_{chat_id}"
35
+
36
+ # Get the LangGraph checkpointer instance
37
+ checkpointer = get_langgraph_checkpointer()
38
+
39
+ # Use the official LangGraph method to delete all thread content
40
+ await checkpointer.delete_thread(thread_id)
41
+
42
+ logger.info(f"Successfully cleared thread memory for thread_id: {thread_id}")
43
+ return True
44
+
45
+ except Exception as e:
46
+ logger.error(
47
+ f"Failed to clear thread memory for agent_id: {agent_id}, chat_id: {chat_id}. Error: {str(e)}"
48
+ )
49
+ raise IntentKitAPIError(
50
+ 500, "ThreadMemoryClearError", f"Failed to clear thread memory: {str(e)}"
51
+ )
@@ -67,31 +67,6 @@
67
67
  "x-group": "basic",
68
68
  "x-placeholder": "Enter agent name"
69
69
  },
70
- "ticker": {
71
- "title": "Ticker",
72
- "type": "string",
73
- "description": "Ticker symbol of the agent",
74
- "maxLength": 10,
75
- "minLength": 1,
76
- "x-group": "internal",
77
- "x-placeholder": "Enter agent ticker"
78
- },
79
- "token_address": {
80
- "title": "Token Address",
81
- "type": "string",
82
- "description": "Token address of the agent",
83
- "maxLength": 42,
84
- "readOnly": true,
85
- "x-group": "internal"
86
- },
87
- "token_pool": {
88
- "title": "Token Pool",
89
- "type": "string",
90
- "description": "Pool of the agent token",
91
- "maxLength": 42,
92
- "readOnly": true,
93
- "x-group": "internal"
94
- },
95
70
  "mode": {
96
71
  "title": "Usage Type",
97
72
  "type": "string",
@@ -700,6 +675,29 @@
700
675
  "optimism-sepolia"
701
676
  ],
702
677
  "x-group": "onchain"
678
+ },
679
+ "ticker": {
680
+ "title": "Ticker",
681
+ "type": "string",
682
+ "description": "Ticker symbol of the agent",
683
+ "maxLength": 10,
684
+ "minLength": 1,
685
+ "x-group": "onchain",
686
+ "x-placeholder": "Enter agent ticker"
687
+ },
688
+ "token_address": {
689
+ "title": "Token Address",
690
+ "type": "string",
691
+ "description": "Token address of the agent, if it already has one",
692
+ "maxLength": 42,
693
+ "x-group": "onchain"
694
+ },
695
+ "token_pool": {
696
+ "title": "Token Pool",
697
+ "type": "string",
698
+ "description": "Pool of the agent token, if it has one",
699
+ "maxLength": 42,
700
+ "x-group": "onchain"
703
701
  }
704
702
  },
705
703
  "if": {
intentkit/skills/base.py CHANGED
@@ -13,13 +13,10 @@ from web3 import Web3
13
13
 
14
14
  from intentkit.abstracts.graph import AgentContext
15
15
  from intentkit.abstracts.skill import SkillStoreABC
16
+ from intentkit.clients.web3 import get_web3_client
16
17
  from intentkit.models.redis import get_redis
17
- from intentkit.utils.chain import ChainProvider
18
18
  from intentkit.utils.error import RateLimitExceeded
19
19
 
20
- # Global cache for Web3 clients by network_id
21
- _web3_client_cache: Dict[str, Web3] = {}
22
-
23
20
  SkillState = Literal["disabled", "public", "private"]
24
21
  SkillOwnerState = Literal["disabled", "private"]
25
22
  APIKeyProviderValue = Literal["platform", "agent_owner"]
@@ -164,16 +161,4 @@ class IntentKitSkill(BaseTool):
164
161
  agent = context.agent
165
162
  network_id = agent.network_id
166
163
 
167
- # Check global cache first
168
- if network_id in _web3_client_cache:
169
- return _web3_client_cache[network_id]
170
-
171
- # Create new Web3 client and cache it
172
- chain_provider: ChainProvider = self.skill_store.get_system_config(
173
- "chain_provider"
174
- )
175
- chain = chain_provider.get_chain_config(network_id)
176
- web3_client = Web3(Web3.HTTPProvider(chain.rpc_url))
177
- _web3_client_cache[network_id] = web3_client
178
-
179
- return web3_client
164
+ return get_web3_client(network_id, self.skill_store)
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: intentkit
3
- Version: 0.6.20
3
+ Version: 0.6.21
4
4
  Summary: Intent-based AI Agent Platform - Core Package
5
- Project-URL: Homepage, https://github.com/crestal-network/intentkit
6
- Project-URL: Repository, https://github.com/crestal-network/intentkit
7
- Project-URL: Documentation, https://github.com/crestal-network/intentkit/tree/main/docs
8
- Project-URL: Bug Tracker, https://github.com/crestal-network/intentkit/issues
5
+ Project-URL: Homepage, https://github.com/crestalnetwork/intentkit
6
+ Project-URL: Repository, https://github.com/crestalnetwork/intentkit
7
+ Project-URL: Documentation, https://github.com/crestalnetwork/intentkit/tree/main/docs
8
+ Project-URL: Bug Tracker, https://github.com/crestalnetwork/intentkit/issues
9
9
  Author-email: hyacinthus <hyacinthus@gmail.com>
10
10
  License: MIT License
11
11
 
@@ -1,4 +1,4 @@
1
- intentkit/__init__.py,sha256=iqRmGngOLBts2jmMksEAHaRCYgSpf6wHu5TwszgX7P4,379
1
+ intentkit/__init__.py,sha256=g6UsPU2XPpngs0ghvEPQImR1yAf3SnfNMVp5vLBOkzA,379
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
@@ -6,14 +6,16 @@ intentkit/abstracts/engine.py,sha256=C5C9d8vVMePhkKWURKIAbZSDZnmjxj5epL_04E6RpxQ
6
6
  intentkit/abstracts/graph.py,sha256=sX5hVemXsODvwIYLHufaf-zSXmW97bXRoZuyxYqaEV4,1128
7
7
  intentkit/abstracts/skill.py,sha256=cIJ6BkASD31U1IEkE8rdAawq99w_xsg0lt3oalqa1ZA,5071
8
8
  intentkit/abstracts/twitter.py,sha256=cEtP7ygR_b-pHdc9i8kBuyooz1cPoGUGwsBHDpowJyY,1262
9
- intentkit/clients/__init__.py,sha256=sQ_6_bRC2MPWLPH-skQ3qsEe8ce-dUGL7i8VJOautHg,298
9
+ intentkit/clients/__init__.py,sha256=pT_4I7drnuiNWPvYAU_CUAv50PjyaqEAsm_kp-vMPW4,372
10
10
  intentkit/clients/cdp.py,sha256=_A0QRRi6uPYr_AL26arW-Yofez0JcrEQdfxGCVgC7kM,7038
11
11
  intentkit/clients/twitter.py,sha256=Lfa7srHOFnY96SXcElW0jfg7XKS_WliWnXjPZEe6SQc,18976
12
+ intentkit/clients/web3.py,sha256=A-w4vBPXHpDh8svsEFj_LkmvRgoDTZw4E-84S-UC9ws,1023
12
13
  intentkit/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
14
  intentkit/config/config.py,sha256=jhPr7FzZZHUsLIdyiOcaKeAsZQ8FdEo6yUaiIcvmryo,8879
14
15
  intentkit/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
16
  intentkit/core/agent.py,sha256=GIKDn1dTenIHWMRxe-ud7hd1cQaHzbTDdypy5IAgPfU,16658
16
17
  intentkit/core/api.py,sha256=WfoaHNquujYJIpNPuTR1dSaaxog0S3X2W4lG9Ehmkm4,3284
18
+ intentkit/core/chat.py,sha256=6wdwaWfO5Tika6dXUhgeMVFUMP8Zpn3NeeAN4QF9_PA,1682
17
19
  intentkit/core/client.py,sha256=J5K7f08-ucszBKAbn9K3QNOFKIC__7amTbKYii1jFkI,3056
18
20
  intentkit/core/credit.py,sha256=1aKT3hNLCvcQYjNckMxBsUpdtc4RH_KZQPAfzpOs-DU,69552
19
21
  intentkit/core/engine.py,sha256=H4ew1jhn2coMYJ3zR9isM1Y-XbnXNMg91SeDoeXdQ4U,36562
@@ -22,7 +24,7 @@ intentkit/core/prompt.py,sha256=a6nogIGZuDt2u2EuDd29DAv73OjCBOn-bZnuqYRvY7A,1580
22
24
  intentkit/core/skill.py,sha256=vPK37sDRT9kzkMBymPwqZ5uEdxTTRtb_DfREIeyz-Xw,5788
23
25
  intentkit/models/agent.py,sha256=uC5AErdVucaEajKCXAcF6C3VwYRVIhXTIfOBp-n-Xhg,66310
24
26
  intentkit/models/agent_data.py,sha256=mVsiK8TziYa1W1ujU1KwI9osIVIeSM7XJEogGRL1WVU,28263
25
- intentkit/models/agent_schema.json,sha256=psrYONIzAbiuZB4zzYQFmANP1pw31TV_900TagSYT7o,21109
27
+ intentkit/models/agent_schema.json,sha256=mxk0eQaH6mZDu1cD53_Y6AEIeOn9UoAsCH8IT5BILEU,21096
26
28
  intentkit/models/app_setting.py,sha256=iYbW63QD91bt4oEYV3wOXHuRFav2b4VXLwb_StgUQtQ,8230
27
29
  intentkit/models/base.py,sha256=o-zRjVrak-f5Jokdvj8BjLm8gcC3yYiYMCTLegwT2lA,185
28
30
  intentkit/models/chat.py,sha256=cDccEHU8nd7Y5uhrHDCuZGwqrRwhqCaeztMiZcemiug,20469
@@ -36,7 +38,7 @@ intentkit/models/redis.py,sha256=UoN8jqLREO1VO9_w6m-JhldpP19iEHj4TiGVCMutQW4,370
36
38
  intentkit/models/skill.py,sha256=h_2wtKEbYE29TLsMdaSnjfOv6vXY6GwMU_abw-ONX28,16374
37
39
  intentkit/models/user.py,sha256=P7l6LOsZmXZ5tDPTczTbqDtDB_MKc_9_ddZkAB2npPk,9288
38
40
  intentkit/skills/__init__.py,sha256=WkjmKB4xvy36zyXMroPMf_DTPgQloNS3L73nVnBmuQI,303
39
- intentkit/skills/base.py,sha256=s3gY5y7u7vEQsplDm-iYfs_hrWaHJRs4Bd-XZvqE-G0,6223
41
+ intentkit/skills/base.py,sha256=2Lw3LpqKPYzsxRlAaSXz5ObG-LQtHfDxsyT4bgPYEhE,5705
40
42
  intentkit/skills/skills.toml,sha256=BCqO6nQVaU3wSpY0Js1xjakLzfttsq6hcHcJbw7q958,2734
41
43
  intentkit/skills/acolyt/__init__.py,sha256=qHQXFlqyyx4deRxC0rts_ZEEpDVV-vWXPncqI_ZMOi4,2074
42
44
  intentkit/skills/acolyt/acolyt.jpg,sha256=CwrrouzXzYvnHi1rprYruvZqPopG06ppMczEZmZ7D2s,11559
@@ -411,7 +413,7 @@ intentkit/utils/random.py,sha256=DymMxu9g0kuQLgJUqalvgksnIeLdS-v0aRk5nQU0mLI,452
411
413
  intentkit/utils/s3.py,sha256=9trQNkKQ5VgxWsewVsV8Y0q_pXzGRvsCYP8xauyUYkg,8549
412
414
  intentkit/utils/slack_alert.py,sha256=s7UpRgyzLW7Pbmt8cKzTJgMA9bm4EP-1rQ5KXayHu6E,2264
413
415
  intentkit/utils/tx.py,sha256=2yLLGuhvfBEY5n_GJ8wmIWLCzn0FsYKv5kRNzw_sLUI,1454
414
- intentkit-0.6.20.dist-info/METADATA,sha256=RIuDtPsVipNkNs8iPqD9_86VGWR6PPoYRUkIo2r_NtA,6409
415
- intentkit-0.6.20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
416
- intentkit-0.6.20.dist-info/licenses/LICENSE,sha256=Bln6DhK-LtcO4aXy-PBcdZv2f24MlJFm_qn222biJtE,1071
417
- intentkit-0.6.20.dist-info/RECORD,,
416
+ intentkit-0.6.21.dist-info/METADATA,sha256=N3QTpQCzosLEX-A3fAYUB5qE8cAcssvZonJNHpYFPn8,6405
417
+ intentkit-0.6.21.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
418
+ intentkit-0.6.21.dist-info/licenses/LICENSE,sha256=Bln6DhK-LtcO4aXy-PBcdZv2f24MlJFm_qn222biJtE,1071
419
+ intentkit-0.6.21.dist-info/RECORD,,