intentkit 0.6.2.dev2__py3-none-any.whl → 0.6.3__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.2-dev2"
6
+ __version__ = "0.6.3"
7
7
  __author__ = "hyacinthus"
8
8
  __email__ = "hyacinthus@gmail.com"
9
9
 
@@ -1,10 +1,9 @@
1
1
  import logging
2
- from typing import Dict, Type
2
+ from typing import Dict, Literal, Type
3
3
 
4
4
  import httpx
5
5
  from langchain_core.runnables import RunnableConfig
6
6
  from pydantic import BaseModel, Field
7
- from typing_extensions import Literal
8
7
 
9
8
  from intentkit.skills.acolyt.base import AcolytBaseTool
10
9
 
@@ -24,10 +24,12 @@ from intentkit.clients import CdpClient, get_cdp_client
24
24
  from intentkit.skills.base import SkillConfig, SkillState
25
25
  from intentkit.skills.cdp.base import CDPBaseTool
26
26
  from intentkit.skills.cdp.get_balance import GetBalance
27
+ from intentkit.skills.cdp.swap import Swap
27
28
 
28
29
 
29
30
  class SkillStates(TypedDict):
30
31
  get_balance: SkillState
32
+ swap: SkillState
31
33
  WalletActionProvider_get_balance: SkillState
32
34
  WalletActionProvider_get_wallet_details: SkillState
33
35
  WalletActionProvider_native_transfer: SkillState
@@ -121,6 +123,15 @@ async def get_skills(
121
123
  )
122
124
  )
123
125
  continue
126
+ elif skill == "swap" or skill.endswith("_trade"):
127
+ # Add the custom Swap skill, "trade" is backword compatible
128
+ tools.append(
129
+ Swap(
130
+ agent_id=agent_id,
131
+ skill_store=store,
132
+ )
133
+ )
134
+ continue
124
135
  for tool in cdp_tools:
125
136
  if tool.name.endswith(skill):
126
137
  tool.handle_tool_error = lambda e: f"tool error: {e}"
@@ -33,6 +33,22 @@
33
33
  "description": "Use coinbase API to get wallet balance, float result.",
34
34
  "default": "private"
35
35
  },
36
+ "swap": {
37
+ "type": "string",
38
+ "title": "CDP Wallet Swap",
39
+ "enum": [
40
+ "disabled",
41
+ "public",
42
+ "private"
43
+ ],
44
+ "x-enum-title": [
45
+ "Disabled",
46
+ "Agent Owner + All Users",
47
+ "Agent Owner Only"
48
+ ],
49
+ "description": "Use coinbase API to swap.",
50
+ "default": "disabled"
51
+ },
36
52
  "WalletActionProvider_get_balance": {
37
53
  "type": "string",
38
54
  "title": "Normal Get Balance",
@@ -0,0 +1,121 @@
1
+ from typing import Optional, Type, Union
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+ from intentkit.abstracts.skill import SkillStoreABC
6
+ from intentkit.clients import get_cdp_client
7
+ from intentkit.skills.cdp.base import CDPBaseTool
8
+
9
+
10
+ class SwapInput(BaseModel):
11
+ """Input for Swap tool."""
12
+
13
+ from_token: str = Field(
14
+ description="The contract address of the token to swap from (e.g., '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' for USDC on Base)"
15
+ )
16
+ to_token: str = Field(
17
+ description="The contract address of the token to swap to (e.g., '0x4200000000000000000000000000000000000006' for WETH on Base)"
18
+ )
19
+ from_amount: Union[str, int] = Field(
20
+ description="The amount to swap from in smallest unit (e.g., 1000000 for 1 USDC with 6 decimals)"
21
+ )
22
+ slippage_bps: Optional[int] = Field(
23
+ default=100,
24
+ description="Maximum slippage in basis points (100 = 1%). Defaults to 100 (1%)",
25
+ )
26
+
27
+
28
+ class Swap(CDPBaseTool):
29
+ """Tool for swapping tokens using CDP wallet.
30
+
31
+ This tool uses the CDP API to execute token swaps on supported networks.
32
+ It wraps the swap functionality from the EVM account.
33
+
34
+ Attributes:
35
+ name: The name of the tool.
36
+ description: A description of what the tool does.
37
+ args_schema: The schema for the tool's input arguments.
38
+ """
39
+
40
+ agent_id: str
41
+ skill_store: SkillStoreABC
42
+
43
+ name: str = "cdp_swap"
44
+ description: str = (
45
+ "This tool will swap tokens using the CDP wallet. "
46
+ "It supports swapping between any ERC-20 tokens on supported networks (Base and Ethereum). "
47
+ "You need to provide the contract addresses of both tokens and the amount to swap. "
48
+ "The amount should be in the smallest unit of the token (e.g., wei for ETH, or atomic units for ERC-20 tokens). "
49
+ "Common token addresses on Base: USDC=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, WETH=0x4200000000000000000000000000000000000006. "
50
+ "The tool will automatically handle gas estimation and transaction submission."
51
+ )
52
+ args_schema: Type[BaseModel] = SwapInput
53
+
54
+ async def _arun(
55
+ self,
56
+ from_token: str,
57
+ to_token: str,
58
+ from_amount: Union[str, int],
59
+ slippage_bps: Optional[int] = 100,
60
+ ) -> str:
61
+ """Async implementation of the tool to swap tokens.
62
+
63
+ Args:
64
+ from_token (str): The contract address of the token to swap from.
65
+ to_token (str): The contract address of the token to swap to.
66
+ from_amount (Union[str, int]): The amount to swap from in smallest unit.
67
+ slippage_bps (Optional[int]): Maximum slippage in basis points. Defaults to 100 (1%).
68
+
69
+ Returns:
70
+ str: A message containing the swap result or error message.
71
+ """
72
+ try:
73
+ # Get CDP client and network information
74
+ cdp_client = await get_cdp_client(self.agent_id, self.skill_store)
75
+ provider = await cdp_client.get_wallet_provider()
76
+ provider_config = await cdp_client.get_provider_config()
77
+ network_id = provider_config.network_id
78
+
79
+ # Map network_id to the format expected by the swap API
80
+ network_mapping = {
81
+ "base-mainnet": "base",
82
+ "ethereum-mainnet": "ethereum",
83
+ }
84
+ api_network = network_mapping.get(network_id, network_id)
85
+
86
+ # Validate network is supported
87
+ supported_networks = ["base", "ethereum"]
88
+ if api_network not in supported_networks:
89
+ return f"Error: Network {api_network} is not supported for swaps. Supported networks: {', '.join(supported_networks)}"
90
+
91
+ # Get the EVM account
92
+ client = provider.get_client()
93
+ async with client:
94
+ account = await client.evm.get_account(provider.get_address())
95
+
96
+ # Import AccountSwapOptions here to avoid circular imports
97
+ from cdp.actions.evm.swap.types import AccountSwapOptions
98
+
99
+ # Create swap options
100
+ swap_options = AccountSwapOptions(
101
+ network=api_network,
102
+ from_token=from_token,
103
+ to_token=to_token,
104
+ from_amount=str(from_amount),
105
+ slippage_bps=slippage_bps,
106
+ )
107
+
108
+ # Execute the swap
109
+ result = await account.swap(swap_options)
110
+
111
+ return (
112
+ f"Swap executed successfully!\n"
113
+ f"Transaction hash: {result.transaction_hash}\n"
114
+ f"Swapped from {from_token} to {to_token}\n"
115
+ f"Amount: {from_amount} (smallest units)\n"
116
+ f"Network: {api_network}\n"
117
+ f"Slippage tolerance: {slippage_bps} basis points ({slippage_bps / 100 if slippage_bps else 0}%)"
118
+ )
119
+
120
+ except Exception as e:
121
+ return f"Error executing swap: {e!s}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: intentkit
3
- Version: 0.6.2.dev2
3
+ Version: 0.6.3
4
4
  Summary: Intent-based AI Agent Platform - Core Package
5
5
  Project-URL: Homepage, https://github.com/crestal-network/intentkit
6
6
  Project-URL: Repository, https://github.com/crestal-network/intentkit
@@ -38,50 +38,27 @@ Classifier: Programming Language :: Python :: 3.12
38
38
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
39
39
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
40
40
  Requires-Python: >=3.12
41
- Requires-Dist: aiogram>=3.17.0
41
+ Requires-Dist: aiohttp>=3.11.16
42
42
  Requires-Dist: aiosqlite>=0.21.0
43
- Requires-Dist: alembic>=1.14.0
44
- Requires-Dist: anyio>=4.8.0
45
- Requires-Dist: apscheduler>=3.11.0
46
43
  Requires-Dist: asyncpg>=0.30.0
47
44
  Requires-Dist: aws-secretsmanager-caching>=1.1.3
48
- Requires-Dist: beautifulsoup4>=4.13.4
45
+ Requires-Dist: bip32>=2.0.0
49
46
  Requires-Dist: boto3<2.0.0,>=1.37.23
50
47
  Requires-Dist: botocore>=1.35.97
51
- Requires-Dist: coinbase-agentkit-langchain==0.3.0
52
- Requires-Dist: coinbase-agentkit==0.4.0
48
+ Requires-Dist: cdp-sdk>=1.22.0
49
+ Requires-Dist: coinbase-agentkit-langchain>=0.5.0
50
+ Requires-Dist: coinbase-agentkit>=0.6.0
53
51
  Requires-Dist: cron-validator<2.0.0,>=1.0.8
54
52
  Requires-Dist: epyxid>=0.3.3
55
- Requires-Dist: faiss-cpu>=1.11.0
53
+ Requires-Dist: eth-keys>=0.4.0
54
+ Requires-Dist: eth-utils>=2.1.0
56
55
  Requires-Dist: fastapi>=0.115.8
57
56
  Requires-Dist: filetype<2.0.0,>=1.2.0
58
- Requires-Dist: goat-sdk-adapter-langchain
59
- Requires-Dist: goat-sdk-plugin-1inch
60
- Requires-Dist: goat-sdk-plugin-allora
61
- Requires-Dist: goat-sdk-plugin-coingecko
62
- Requires-Dist: goat-sdk-plugin-dexscreener
63
- Requires-Dist: goat-sdk-plugin-erc20
64
- Requires-Dist: goat-sdk-plugin-farcaster
65
- Requires-Dist: goat-sdk-plugin-jsonrpc
66
- Requires-Dist: goat-sdk-plugin-jupiter
67
- Requires-Dist: goat-sdk-plugin-nansen
68
- Requires-Dist: goat-sdk-plugin-opensea
69
- Requires-Dist: goat-sdk-plugin-rugcheck
70
- Requires-Dist: goat-sdk-plugin-spl-token
71
- Requires-Dist: goat-sdk-plugin-superfluid
72
- Requires-Dist: goat-sdk-plugin-uniswap
73
- Requires-Dist: goat-sdk-wallet-crossmint
74
- Requires-Dist: goat-sdk-wallet-evm
75
- Requires-Dist: goat-sdk-wallet-solana
76
- Requires-Dist: goat-sdk-wallet-web3
77
- Requires-Dist: goat-sdk>=0.1.4
78
- Requires-Dist: gunicorn>=23.0.0
79
- Requires-Dist: jsonref>=1.1.0
57
+ Requires-Dist: httpx>=0.28.1
80
58
  Requires-Dist: langchain-community>=0.3.19
81
59
  Requires-Dist: langchain-core>=0.3.43
82
60
  Requires-Dist: langchain-mcp-adapters>=0.0.11
83
61
  Requires-Dist: langchain-openai>=0.3.8
84
- Requires-Dist: langchain-postgres>=0.0.13
85
62
  Requires-Dist: langchain-text-splitters>=0.3.8
86
63
  Requires-Dist: langchain-xai>=0.2.1
87
64
  Requires-Dist: langchain<0.4.0,>=0.3.25
@@ -92,25 +69,24 @@ Requires-Dist: langgraph>=0.4.3
92
69
  Requires-Dist: langmem>=0.0.27
93
70
  Requires-Dist: mypy-boto3-s3<2.0.0,>=1.37.24
94
71
  Requires-Dist: openai>=1.59.6
95
- Requires-Dist: pgvector>=0.3.6
96
72
  Requires-Dist: pillow<12.0.0,>=11.1.0
97
73
  Requires-Dist: psycopg-pool>=3.2.4
98
- Requires-Dist: psycopg2-binary<3.0.0,>=2.9.10
99
- Requires-Dist: psycopg>=3.2.3
100
- Requires-Dist: pydantic-settings>=2.8.1
101
- Requires-Dist: pydantic>=2.10.6
74
+ Requires-Dist: psycopg>=3.2.9
75
+ Requires-Dist: pydantic<2.11.0,>=2.10.6
102
76
  Requires-Dist: python-dotenv>=1.0.1
103
- Requires-Dist: python-multipart>=0.0.20
104
77
  Requires-Dist: pytz>=2025.1
105
78
  Requires-Dist: pyyaml>=6.0.2
106
79
  Requires-Dist: redis<7.0.0,>=5.2.1
80
+ Requires-Dist: requests-oauthlib>=2.0.0
107
81
  Requires-Dist: requests>=2.32.3
108
- Requires-Dist: sentry-sdk[fastapi]>=2.20.0
109
82
  Requires-Dist: slack-sdk>=3.34.0
110
83
  Requires-Dist: sqlalchemy[asyncio]>=2.0.37
111
- Requires-Dist: telegramify-markdown<0.6.0,>=0.5.0
84
+ Requires-Dist: starlette>=0.47.1
85
+ Requires-Dist: supabase>=2.16.0
86
+ Requires-Dist: tenacity>=9.1.2
112
87
  Requires-Dist: tweepy[async]>=4.15.0
113
88
  Requires-Dist: uvicorn<1.0.0,>=0.34.0
89
+ Requires-Dist: web3>=7.10.0
114
90
  Description-Content-Type: text/markdown
115
91
 
116
92
  # IntentKit
@@ -1,4 +1,4 @@
1
- intentkit/__init__.py,sha256=E1dn4BImBle0LKPwKBz0OvEYCyAHMnLGo6m4GxSLwM0,383
1
+ intentkit/__init__.py,sha256=Ucz7SIHBqw9FaCS4jvsVujnPXCdyTDdOomkmS34O3FE,378
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
@@ -41,7 +41,7 @@ intentkit/skills/base.py,sha256=nPHX8kZ-r5ffbCGH6Tnh0KwGWlF1D4zMmnjsFf9iScA,6677
41
41
  intentkit/skills/skills.toml,sha256=iFMn_UmdFFCk4HTHolpSv6Ve6O-iRckJtxVcZ5EjxQM,2634
42
42
  intentkit/skills/acolyt/__init__.py,sha256=qHQXFlqyyx4deRxC0rts_ZEEpDVV-vWXPncqI_ZMOi4,2074
43
43
  intentkit/skills/acolyt/acolyt.jpg,sha256=CwrrouzXzYvnHi1rprYruvZqPopG06ppMczEZmZ7D2s,11559
44
- intentkit/skills/acolyt/ask.py,sha256=1IMRxbrHTrqFVjsm-4opF0raDmmBDcEfoXpn824Cog0,6133
44
+ intentkit/skills/acolyt/ask.py,sha256=EHIg73vZBn1s3kMUvS04QnJCAX9HBhjwBJ9-r7OoEwI,6104
45
45
  intentkit/skills/acolyt/base.py,sha256=IJp8RDjYe14hkkPKiiWyPJ-o_AdXbJmhZMkRLVNUieU,916
46
46
  intentkit/skills/acolyt/schema.json,sha256=sKwLHLQOfGdyh7BupUpk5fJxopO8_svg1VRhK1H1S8k,2760
47
47
  intentkit/skills/aixbt/README.md,sha256=OPZEZnYo4fwj37CkDC7onB1bqXR_GwAGAcusd-gZrGI,2499
@@ -63,11 +63,12 @@ intentkit/skills/carv/fetch_news.py,sha256=-xCWPvdVQxI0tEynR8mnjNEFpDkE4k4vNo1A-
63
63
  intentkit/skills/carv/onchain_query.py,sha256=EYV7N2Y-CisyhNVyUm2NbJhdikeFg0Y_a6lToJ5iqDM,6371
64
64
  intentkit/skills/carv/schema.json,sha256=oSReeG50ZJTOxSRniQBJW6KfilscZfp66PiBVOjphS4,5021
65
65
  intentkit/skills/carv/token_info_and_price.py,sha256=R7M5-nkjrauvxaNkORYtLcP9yOYj8PvYu1xRkOBT6lU,4275
66
- intentkit/skills/cdp/__init__.py,sha256=sBuRJdpCrqDQUY576GCph_VS2vnDTGeBnriSfSv7S3A,4399
66
+ intentkit/skills/cdp/__init__.py,sha256=0OAYGSW_8u1kzV7mPxdyLVSlYWv_cQeQ87pVZPgwTsk,4772
67
67
  intentkit/skills/cdp/base.py,sha256=BcleKSXm0oNcHYky4uUPCJ3roXxMeTJs2OUS-8MkfMI,581
68
68
  intentkit/skills/cdp/cdp.png,sha256=dxPF6jPbKVfxJNMvbGTmBhXM-rSDvweF06txoX1cIM4,4425
69
69
  intentkit/skills/cdp/get_balance.py,sha256=-mRFJjlc2gQ4LZRMqD6HZqyR_y_rsMl1HlVONoE0kIw,4473
70
- intentkit/skills/cdp/schema.json,sha256=3ULPR95TW_Fp2GzzHwmwhAqm8vlxs2tN7fG6WoPY87c,11774
70
+ intentkit/skills/cdp/schema.json,sha256=42RIctR_VUwrsIKelEdCreTmVgfUTF9pu3d7gVTe0DQ,12191
71
+ intentkit/skills/cdp/swap.py,sha256=QO476onHskkv5xYoLlV56iU_NDg4q9KVntmknK5EL5Y,4983
71
72
  intentkit/skills/chainlist/README.md,sha256=FEVQObs2W_oL2kyV-vZpHNwZCCgqm5Kt0sv0GD_Xo1M,958
72
73
  intentkit/skills/chainlist/__init__.py,sha256=2aRC-jXW3WYiR_-RM-_Ls1lby_54ZemZ6qtggntGa-U,1502
73
74
  intentkit/skills/chainlist/base.py,sha256=rRhrXcdg06qAYE0uIiL9NctpODuTIu51Eyxp4UVtflU,599
@@ -389,7 +390,7 @@ intentkit/utils/random.py,sha256=DymMxu9g0kuQLgJUqalvgksnIeLdS-v0aRk5nQU0mLI,452
389
390
  intentkit/utils/s3.py,sha256=9trQNkKQ5VgxWsewVsV8Y0q_pXzGRvsCYP8xauyUYkg,8549
390
391
  intentkit/utils/slack_alert.py,sha256=s7UpRgyzLW7Pbmt8cKzTJgMA9bm4EP-1rQ5KXayHu6E,2264
391
392
  intentkit/utils/tx.py,sha256=2yLLGuhvfBEY5n_GJ8wmIWLCzn0FsYKv5kRNzw_sLUI,1454
392
- intentkit-0.6.2.dev2.dist-info/METADATA,sha256=-Gjx0m4aqm8UNe8yd_V-udLAowAwgNrp7Qb8aMgL11c,7285
393
- intentkit-0.6.2.dev2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
394
- intentkit-0.6.2.dev2.dist-info/licenses/LICENSE,sha256=Bln6DhK-LtcO4aXy-PBcdZv2f24MlJFm_qn222biJtE,1071
395
- intentkit-0.6.2.dev2.dist-info/RECORD,,
393
+ intentkit-0.6.3.dist-info/METADATA,sha256=1GqmPK84klTnyPSNO1cZV9TcwL6kfkOMnS1x0WXbvHM,6308
394
+ intentkit-0.6.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
395
+ intentkit-0.6.3.dist-info/licenses/LICENSE,sha256=Bln6DhK-LtcO4aXy-PBcdZv2f24MlJFm_qn222biJtE,1071
396
+ intentkit-0.6.3.dist-info/RECORD,,