intentkit 0.7.5.dev15__py3-none-any.whl → 0.7.5.dev17__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/models/agent.py +82 -13
- intentkit/models/skills.csv +23 -28
- intentkit/skills/base.py +45 -0
- intentkit/skills/basename/__init__.py +49 -0
- intentkit/skills/basename/base.py +11 -0
- intentkit/skills/basename/basename.svg +11 -0
- intentkit/skills/basename/schema.json +57 -0
- intentkit/skills/cdp/__init__.py +18 -92
- intentkit/skills/cdp/schema.json +13 -301
- intentkit/skills/erc20/__init__.py +50 -0
- intentkit/skills/erc20/base.py +11 -0
- intentkit/skills/erc20/erc20.svg +5 -0
- intentkit/skills/erc20/schema.json +73 -0
- intentkit/skills/erc721/__init__.py +51 -0
- intentkit/skills/erc721/base.py +11 -0
- intentkit/skills/erc721/erc721.svg +5 -0
- intentkit/skills/erc721/schema.json +89 -0
- intentkit/skills/lifi/__init__.py +4 -4
- intentkit/skills/lifi/token_execute.py +24 -12
- intentkit/skills/lifi/token_quote.py +2 -2
- intentkit/skills/lifi/utils.py +96 -43
- intentkit/skills/morpho/__init__.py +50 -0
- intentkit/skills/morpho/base.py +11 -0
- intentkit/skills/morpho/morpho.svg +12 -0
- intentkit/skills/morpho/schema.json +73 -0
- intentkit/skills/pyth/__init__.py +50 -0
- intentkit/skills/pyth/base.py +11 -0
- intentkit/skills/pyth/pyth.svg +6 -0
- intentkit/skills/pyth/schema.json +73 -0
- intentkit/skills/skills.toml +32 -0
- intentkit/skills/superfluid/__init__.py +51 -0
- intentkit/skills/superfluid/base.py +11 -0
- intentkit/skills/superfluid/schema.json +89 -0
- intentkit/skills/superfluid/superfluid.svg +6 -0
- intentkit/skills/weth/__init__.py +49 -0
- intentkit/skills/weth/base.py +11 -0
- intentkit/skills/weth/schema.json +57 -0
- intentkit/skills/weth/weth.svg +6 -0
- intentkit/skills/wow/__init__.py +51 -0
- intentkit/skills/wow/base.py +11 -0
- intentkit/skills/wow/schema.json +89 -0
- intentkit/skills/wow/wow.svg +7 -0
- {intentkit-0.7.5.dev15.dist-info → intentkit-0.7.5.dev17.dist-info}/METADATA +1 -1
- {intentkit-0.7.5.dev15.dist-info → intentkit-0.7.5.dev17.dist-info}/RECORD +47 -17
- intentkit/skills/cdp/get_balance.py +0 -110
- intentkit/skills/cdp/swap.py +0 -121
- {intentkit-0.7.5.dev15.dist-info → intentkit-0.7.5.dev17.dist-info}/WHEEL +0 -0
- {intentkit-0.7.5.dev15.dist-info → intentkit-0.7.5.dev17.dist-info}/licenses/LICENSE +0 -0
intentkit/__init__.py
CHANGED
intentkit/models/agent.py
CHANGED
|
@@ -142,7 +142,7 @@ class AgentExample(BaseModel):
|
|
|
142
142
|
description="Name of the example",
|
|
143
143
|
max_length=50,
|
|
144
144
|
json_schema_extra={
|
|
145
|
-
"x-
|
|
145
|
+
"x-placeholder": "Add a name for the example",
|
|
146
146
|
},
|
|
147
147
|
),
|
|
148
148
|
]
|
|
@@ -152,7 +152,7 @@ class AgentExample(BaseModel):
|
|
|
152
152
|
description="Description of the example",
|
|
153
153
|
max_length=200,
|
|
154
154
|
json_schema_extra={
|
|
155
|
-
"x-
|
|
155
|
+
"x-placeholder": "Add a short description for the example",
|
|
156
156
|
},
|
|
157
157
|
),
|
|
158
158
|
]
|
|
@@ -162,7 +162,7 @@ class AgentExample(BaseModel):
|
|
|
162
162
|
description="Example prompt",
|
|
163
163
|
max_length=2000,
|
|
164
164
|
json_schema_extra={
|
|
165
|
-
"x-
|
|
165
|
+
"x-placeholder": "The prompt will be sent to the agent",
|
|
166
166
|
},
|
|
167
167
|
),
|
|
168
168
|
]
|
|
@@ -394,6 +394,21 @@ class AgentTable(Base, AgentUserInputColumns):
|
|
|
394
394
|
nullable=True,
|
|
395
395
|
comment="List of example interactions for the agent",
|
|
396
396
|
)
|
|
397
|
+
public_extra = Column(
|
|
398
|
+
JSON().with_variant(JSONB(), "postgresql"),
|
|
399
|
+
nullable=True,
|
|
400
|
+
comment="Public extra data of the agent",
|
|
401
|
+
)
|
|
402
|
+
deployed_at = Column(
|
|
403
|
+
DateTime(timezone=True),
|
|
404
|
+
nullable=True,
|
|
405
|
+
comment="Timestamp when the agent was deployed",
|
|
406
|
+
)
|
|
407
|
+
public_info_updated_at = Column(
|
|
408
|
+
DateTime(timezone=True),
|
|
409
|
+
nullable=True,
|
|
410
|
+
comment="Timestamp when the agent public info was last updated",
|
|
411
|
+
)
|
|
397
412
|
|
|
398
413
|
# auto timestamp
|
|
399
414
|
created_at = Column(
|
|
@@ -881,6 +896,8 @@ class AgentUpdate(AgentUserInput):
|
|
|
881
896
|
# update
|
|
882
897
|
for key, value in self.model_dump(exclude_unset=True).items():
|
|
883
898
|
setattr(db_agent, key, value)
|
|
899
|
+
db_agent.version = self.hash()
|
|
900
|
+
db_agent.deployed_at = func.now()
|
|
884
901
|
await db.commit()
|
|
885
902
|
await db.refresh(db_agent)
|
|
886
903
|
return Agent.model_validate(db_agent)
|
|
@@ -903,6 +920,7 @@ class AgentUpdate(AgentUserInput):
|
|
|
903
920
|
setattr(db_agent, key, value)
|
|
904
921
|
# version
|
|
905
922
|
db_agent.version = self.hash()
|
|
923
|
+
db_agent.deployed_at = func.now()
|
|
906
924
|
await db.commit()
|
|
907
925
|
await db.refresh(db_agent)
|
|
908
926
|
return Agent.model_validate(db_agent)
|
|
@@ -964,6 +982,7 @@ class AgentCreate(AgentUpdate):
|
|
|
964
982
|
try:
|
|
965
983
|
db_agent = AgentTable(**self.model_dump())
|
|
966
984
|
db_agent.version = self.hash()
|
|
985
|
+
db_agent.deployed_at = func.now()
|
|
967
986
|
db.add(db_agent)
|
|
968
987
|
await db.commit()
|
|
969
988
|
await db.refresh(db_agent)
|
|
@@ -991,7 +1010,6 @@ class AgentPublicInfo(BaseModel):
|
|
|
991
1010
|
default=None,
|
|
992
1011
|
description="Description of the agent, for public view, not contained in prompt",
|
|
993
1012
|
json_schema_extra={
|
|
994
|
-
"x-group": "basic",
|
|
995
1013
|
"x-placeholder": "Introduce your agent",
|
|
996
1014
|
},
|
|
997
1015
|
),
|
|
@@ -1002,7 +1020,6 @@ class AgentPublicInfo(BaseModel):
|
|
|
1002
1020
|
default=None,
|
|
1003
1021
|
description="Link of external website of the agent, if you have one",
|
|
1004
1022
|
json_schema_extra={
|
|
1005
|
-
"x-group": "basic",
|
|
1006
1023
|
"x-placeholder": "Enter agent external website url",
|
|
1007
1024
|
"format": "uri",
|
|
1008
1025
|
},
|
|
@@ -1016,7 +1033,6 @@ class AgentPublicInfo(BaseModel):
|
|
|
1016
1033
|
max_length=10,
|
|
1017
1034
|
min_length=1,
|
|
1018
1035
|
json_schema_extra={
|
|
1019
|
-
"x-group": "basic",
|
|
1020
1036
|
"x-placeholder": "If one day, your agent has it's own token, what will it be?",
|
|
1021
1037
|
},
|
|
1022
1038
|
),
|
|
@@ -1028,8 +1044,7 @@ class AgentPublicInfo(BaseModel):
|
|
|
1028
1044
|
description="Token address of the agent",
|
|
1029
1045
|
max_length=42,
|
|
1030
1046
|
json_schema_extra={
|
|
1031
|
-
"x-
|
|
1032
|
-
"readOnly": True,
|
|
1047
|
+
"x-placeholder": "The contract address of the agent token",
|
|
1033
1048
|
},
|
|
1034
1049
|
),
|
|
1035
1050
|
]
|
|
@@ -1040,8 +1055,7 @@ class AgentPublicInfo(BaseModel):
|
|
|
1040
1055
|
description="Pool of the agent token",
|
|
1041
1056
|
max_length=42,
|
|
1042
1057
|
json_schema_extra={
|
|
1043
|
-
"x-
|
|
1044
|
-
"readOnly": True,
|
|
1058
|
+
"x-placeholder": "The contract address of the agent token pool",
|
|
1045
1059
|
},
|
|
1046
1060
|
),
|
|
1047
1061
|
]
|
|
@@ -1052,7 +1066,7 @@ class AgentPublicInfo(BaseModel):
|
|
|
1052
1066
|
description="Fee percentage of the agent",
|
|
1053
1067
|
ge=Decimal("0.0"),
|
|
1054
1068
|
json_schema_extra={
|
|
1055
|
-
"x-
|
|
1069
|
+
"x-placeholder": "Agent will charge service fee according to this ratio.",
|
|
1056
1070
|
},
|
|
1057
1071
|
),
|
|
1058
1072
|
]
|
|
@@ -1063,7 +1077,7 @@ class AgentPublicInfo(BaseModel):
|
|
|
1063
1077
|
description="Introduction of the example",
|
|
1064
1078
|
max_length=2000,
|
|
1065
1079
|
json_schema_extra={
|
|
1066
|
-
"x-
|
|
1080
|
+
"x-placeholder": "Add a short introduction in new chat",
|
|
1067
1081
|
},
|
|
1068
1082
|
),
|
|
1069
1083
|
]
|
|
@@ -1074,11 +1088,51 @@ class AgentPublicInfo(BaseModel):
|
|
|
1074
1088
|
description="List of example prompts for the agent",
|
|
1075
1089
|
max_length=6,
|
|
1076
1090
|
json_schema_extra={
|
|
1077
|
-
"x-group": "examples",
|
|
1078
1091
|
"x-inline": True,
|
|
1079
1092
|
},
|
|
1080
1093
|
),
|
|
1081
1094
|
]
|
|
1095
|
+
public_extra: Annotated[
|
|
1096
|
+
Optional[Dict[str, Any]],
|
|
1097
|
+
PydanticField(
|
|
1098
|
+
default=None,
|
|
1099
|
+
description="Public extra data of the agent",
|
|
1100
|
+
),
|
|
1101
|
+
]
|
|
1102
|
+
|
|
1103
|
+
async def override(self, agent_id: str) -> "Agent":
|
|
1104
|
+
"""Override agent public info with all fields from this instance.
|
|
1105
|
+
|
|
1106
|
+
Args:
|
|
1107
|
+
agent_id: The ID of the agent to override
|
|
1108
|
+
|
|
1109
|
+
Returns:
|
|
1110
|
+
The updated Agent instance
|
|
1111
|
+
"""
|
|
1112
|
+
async with get_session() as session:
|
|
1113
|
+
# Get the agent from database
|
|
1114
|
+
result = await session.execute(
|
|
1115
|
+
select(AgentTable).where(AgentTable.id == agent_id)
|
|
1116
|
+
)
|
|
1117
|
+
db_agent = result.scalar_one_or_none()
|
|
1118
|
+
|
|
1119
|
+
if not db_agent:
|
|
1120
|
+
raise IntentKitAPIError(404, "NotFound", f"Agent {agent_id} not found")
|
|
1121
|
+
|
|
1122
|
+
# Update public info fields
|
|
1123
|
+
update_data = self.model_dump()
|
|
1124
|
+
for key, value in update_data.items():
|
|
1125
|
+
if hasattr(db_agent, key):
|
|
1126
|
+
setattr(db_agent, key, value)
|
|
1127
|
+
|
|
1128
|
+
# Update public_info_updated_at timestamp
|
|
1129
|
+
db_agent.public_info_updated_at = func.now()
|
|
1130
|
+
|
|
1131
|
+
# Commit changes
|
|
1132
|
+
await session.commit()
|
|
1133
|
+
await session.refresh(db_agent)
|
|
1134
|
+
|
|
1135
|
+
return Agent.model_validate(db_agent)
|
|
1082
1136
|
|
|
1083
1137
|
|
|
1084
1138
|
class Agent(AgentCreate, AgentPublicInfo):
|
|
@@ -1124,6 +1178,21 @@ class Agent(AgentCreate, AgentPublicInfo):
|
|
|
1124
1178
|
description="Other helper data fields for query, come from agent and agent data"
|
|
1125
1179
|
),
|
|
1126
1180
|
]
|
|
1181
|
+
deployed_at: Annotated[
|
|
1182
|
+
Optional[datetime],
|
|
1183
|
+
PydanticField(
|
|
1184
|
+
default=None,
|
|
1185
|
+
description="Timestamp when the agent was deployed",
|
|
1186
|
+
),
|
|
1187
|
+
]
|
|
1188
|
+
public_info_updated_at: Annotated[
|
|
1189
|
+
Optional[datetime],
|
|
1190
|
+
PydanticField(
|
|
1191
|
+
default=None,
|
|
1192
|
+
description="Timestamp when the agent public info was last updated",
|
|
1193
|
+
),
|
|
1194
|
+
]
|
|
1195
|
+
|
|
1127
1196
|
# auto timestamp
|
|
1128
1197
|
created_at: Annotated[
|
|
1129
1198
|
datetime,
|
intentkit/models/skills.csv
CHANGED
|
@@ -2,34 +2,29 @@ category,config_name,name,enabled,price_level,price,price_self_key,rate_limit_co
|
|
|
2
2
|
acolyt,ask_gpt,acolyt_ask_gpt,FALSE,1,1,1,,,0x2Bd32A312280bF5A01140e68ca630fB76cE8A3De
|
|
3
3
|
aixbt,aixbt_projects,aixbt_projects,TRUE,3,100,5,,,0x3cdd051eeC909f94965F9c1c657f5b70a172B2C0
|
|
4
4
|
allora,get_price_prediction,allora_get_price_prediction,TRUE,4,230,5,,,0x2Bd32A312280bF5A01140e68ca630fB76cE8A3De
|
|
5
|
-
|
|
6
|
-
cdp,
|
|
7
|
-
cdp,
|
|
8
|
-
cdp,
|
|
9
|
-
cdp,
|
|
10
|
-
cdp,
|
|
11
|
-
cdp,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
cdp,WowActionProvider_buy_token,WowActionProvider_buy_token,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
29
|
-
cdp,WowActionProvider_create_token,WowActionProvider_create_token,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
30
|
-
cdp,WowActionProvider_sell_token,WowActionProvider_sell_token,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
31
|
-
cdp,get_balance,cdp_get_balance,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
32
|
-
cdp,swap,cdp_swap,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
5
|
+
basename,BasenameActionProvider_register_basename,BasenameActionProvider_register_basename,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
6
|
+
cdp,CdpApiActionProvider_request_faucet_funds,CdpApiActionProvider_request_faucet_funds,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
7
|
+
cdp,CdpEvmWalletActionProvider_get_swap_price,CdpEvmWalletActionProvider_get_swap_price,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
8
|
+
cdp,CdpEvmWalletActionProvider_swap,CdpEvmWalletActionProvider_swap,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
9
|
+
cdp,WalletActionProvider_get_balance,WalletActionProvider_get_balance,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
10
|
+
cdp,WalletActionProvider_get_wallet_details,WalletActionProvider_get_wallet_details,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
11
|
+
cdp,WalletActionProvider_native_transfer,WalletActionProvider_native_transfer,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
12
|
+
erc20,ERC20ActionProvider_get_balance,ERC20ActionProvider_get_balance,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
13
|
+
erc20,ERC20ActionProvider_transfer,ERC20ActionProvider_transfer,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
14
|
+
erc721,Erc721ActionProvider_get_balance,Erc721ActionProvider_get_balance,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
15
|
+
erc721,Erc721ActionProvider_mint,Erc721ActionProvider_mint,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
16
|
+
erc721,Erc721ActionProvider_transfer,Erc721ActionProvider_transfer,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
17
|
+
morpho,MorphoActionProvider_deposit,MorphoActionProvider_deposit,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
18
|
+
morpho,MorphoActionProvider_withdraw,MorphoActionProvider_withdraw,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
19
|
+
pyth,PythActionProvider_fetch_price,PythActionProvider_fetch_price,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
20
|
+
pyth,PythActionProvider_fetch_price_feed,PythActionProvider_fetch_price_feed,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
21
|
+
superfluid,SuperfluidActionProvider_create_flow,SuperfluidActionProvider_create_flow,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
22
|
+
superfluid,SuperfluidActionProvider_delete_flow,SuperfluidActionProvider_delete_flow,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
23
|
+
superfluid,SuperfluidActionProvider_update_flow,SuperfluidActionProvider_update_flow,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
24
|
+
weth,WethActionProvider_wrap_eth,WethActionProvider_wrap_eth,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
25
|
+
wow,WowActionProvider_buy_token,WowActionProvider_buy_token,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
26
|
+
wow,WowActionProvider_create_token,WowActionProvider_create_token,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
27
|
+
wow,WowActionProvider_sell_token,WowActionProvider_sell_token,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
33
28
|
chainlist,chain_lookup,chain-lookup,TRUE,1,5,5,,,0x3cdd051eeC909f94965F9c1c657f5b70a172B2C0
|
|
34
29
|
common,current_time,common_current_time,TRUE,1,5,5,,,0x445750026A4a1906b61302442E085f9cbAfe206a
|
|
35
30
|
cookiefun,get_account_details,cookiefun_get_account_details,TRUE,2,70,5,,,0x3cdd051eeC909f94965F9c1c657f5b70a172B2C0
|
intentkit/skills/base.py
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
from collections.abc import Sequence
|
|
2
3
|
from typing import Any, Callable, Dict, Literal, NotRequired, Optional, TypedDict, Union
|
|
3
4
|
|
|
5
|
+
from coinbase_agentkit import (
|
|
6
|
+
Action,
|
|
7
|
+
AgentKit,
|
|
8
|
+
AgentKitConfig,
|
|
9
|
+
CdpEvmWalletProvider,
|
|
10
|
+
)
|
|
11
|
+
from langchain.tools import StructuredTool
|
|
4
12
|
from langchain_core.tools import BaseTool
|
|
5
13
|
from langchain_core.tools.base import ToolException
|
|
6
14
|
from langgraph.runtime import get_runtime
|
|
@@ -13,6 +21,7 @@ from web3 import Web3
|
|
|
13
21
|
|
|
14
22
|
from intentkit.abstracts.graph import AgentContext
|
|
15
23
|
from intentkit.abstracts.skill import SkillStoreABC
|
|
24
|
+
from intentkit.clients import CdpClient, get_cdp_client
|
|
16
25
|
from intentkit.clients.web3 import get_web3_client
|
|
17
26
|
from intentkit.models.redis import get_redis
|
|
18
27
|
from intentkit.utils.error import RateLimitExceeded
|
|
@@ -162,3 +171,39 @@ class IntentKitSkill(BaseTool):
|
|
|
162
171
|
network_id = agent.network_id
|
|
163
172
|
|
|
164
173
|
return get_web3_client(network_id, self.skill_store)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
async def get_agentkit_actions(
|
|
177
|
+
agent_id: str,
|
|
178
|
+
store: SkillStoreABC,
|
|
179
|
+
provider_factories: Sequence[Callable[[], object]],
|
|
180
|
+
) -> list[Action]:
|
|
181
|
+
"""Build an AgentKit instance and return its actions."""
|
|
182
|
+
|
|
183
|
+
cdp_client: CdpClient = await get_cdp_client(agent_id, store)
|
|
184
|
+
wallet_provider: CdpEvmWalletProvider = await cdp_client.get_wallet_provider()
|
|
185
|
+
|
|
186
|
+
agent_kit = AgentKit(
|
|
187
|
+
AgentKitConfig(
|
|
188
|
+
wallet_provider=wallet_provider,
|
|
189
|
+
action_providers=[factory() for factory in provider_factories],
|
|
190
|
+
)
|
|
191
|
+
)
|
|
192
|
+
return agent_kit.get_actions()
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def action_to_structured_tool(action: Action) -> StructuredTool:
|
|
196
|
+
"""Convert an AgentKit action to a LangChain StructuredTool."""
|
|
197
|
+
|
|
198
|
+
def _tool_fn(**kwargs: object) -> str:
|
|
199
|
+
return action.invoke(kwargs)
|
|
200
|
+
|
|
201
|
+
tool = StructuredTool(
|
|
202
|
+
name=action.name,
|
|
203
|
+
description=action.description,
|
|
204
|
+
func=_tool_fn,
|
|
205
|
+
args_schema=action.args_schema,
|
|
206
|
+
)
|
|
207
|
+
tool.handle_tool_error = lambda e: f"tool error: {e}"
|
|
208
|
+
tool.handle_validation_error = lambda e: f"validation error: {e}"
|
|
209
|
+
return tool
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Basename AgentKit skills."""
|
|
2
|
+
|
|
3
|
+
from typing import TypedDict
|
|
4
|
+
|
|
5
|
+
from coinbase_agentkit import basename_action_provider
|
|
6
|
+
|
|
7
|
+
from intentkit.abstracts.skill import SkillStoreABC
|
|
8
|
+
from intentkit.skills.base import (
|
|
9
|
+
SkillConfig,
|
|
10
|
+
SkillState,
|
|
11
|
+
action_to_structured_tool,
|
|
12
|
+
get_agentkit_actions,
|
|
13
|
+
)
|
|
14
|
+
from intentkit.skills.basename.base import BasenameBaseTool
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class SkillStates(TypedDict):
|
|
18
|
+
BasenameActionProvider_register_basename: SkillState
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class Config(SkillConfig):
|
|
22
|
+
"""Configuration for Basename skills."""
|
|
23
|
+
|
|
24
|
+
states: SkillStates
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
async def get_skills(
|
|
28
|
+
config: "Config",
|
|
29
|
+
is_private: bool,
|
|
30
|
+
store: SkillStoreABC,
|
|
31
|
+
agent_id: str,
|
|
32
|
+
**_,
|
|
33
|
+
) -> list[BasenameBaseTool]:
|
|
34
|
+
"""Get all Basename skills."""
|
|
35
|
+
|
|
36
|
+
available_skills: list[str] = []
|
|
37
|
+
for skill_name, state in config["states"].items():
|
|
38
|
+
if state == "disabled":
|
|
39
|
+
continue
|
|
40
|
+
if state == "public" or (state == "private" and is_private):
|
|
41
|
+
available_skills.append(skill_name)
|
|
42
|
+
|
|
43
|
+
actions = await get_agentkit_actions(agent_id, store, [basename_action_provider])
|
|
44
|
+
tools: list[BasenameBaseTool] = []
|
|
45
|
+
for skill in available_skills:
|
|
46
|
+
for action in actions:
|
|
47
|
+
if action.name.endswith(skill):
|
|
48
|
+
tools.append(action_to_structured_tool(action))
|
|
49
|
+
return tools
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
4
|
+
<stop offset="0%" stop-color="#4c7dff" />
|
|
5
|
+
<stop offset="100%" stop-color="#0b2f80" />
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect width="128" height="128" fill="url(#bg)" rx="16" />
|
|
9
|
+
<text x="50%" y="52%" font-family="Arial,Helvetica,sans-serif" font-size="60" fill="#ffffff" font-weight="700" text-anchor="middle">B</text>
|
|
10
|
+
<text x="50%" y="86%" font-family="Arial,Helvetica,sans-serif" font-size="20" fill="#dbe4ff" text-anchor="middle">Base</text>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"title": "Basename",
|
|
5
|
+
"description": "Basename ENS-style name registration via Coinbase AgentKit",
|
|
6
|
+
"x-icon": "https://ai.service.crestal.dev/skills/basename/basename.svg",
|
|
7
|
+
"x-tags": [
|
|
8
|
+
"Blockchain"
|
|
9
|
+
],
|
|
10
|
+
"properties": {
|
|
11
|
+
"enabled": {
|
|
12
|
+
"type": "boolean",
|
|
13
|
+
"title": "Enabled",
|
|
14
|
+
"description": "Whether this skill is enabled",
|
|
15
|
+
"default": true
|
|
16
|
+
},
|
|
17
|
+
"states": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": {
|
|
20
|
+
"BasenameActionProvider_register_basename": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"title": "Register Basename",
|
|
23
|
+
"enum": [
|
|
24
|
+
"disabled",
|
|
25
|
+
"public",
|
|
26
|
+
"private"
|
|
27
|
+
],
|
|
28
|
+
"x-enum-title": [
|
|
29
|
+
"Disabled",
|
|
30
|
+
"Agent Owner + All Users",
|
|
31
|
+
"Agent Owner Only"
|
|
32
|
+
],
|
|
33
|
+
"description": "State for BasenameActionProvider_register_basename",
|
|
34
|
+
"default": "disabled"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"description": "States for each Basename skill (disabled, public, or private)"
|
|
38
|
+
},
|
|
39
|
+
"api_key_provider": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"title": "API Key Provider",
|
|
42
|
+
"description": "Who provides the API key",
|
|
43
|
+
"enum": [
|
|
44
|
+
"platform"
|
|
45
|
+
],
|
|
46
|
+
"x-enum-title": [
|
|
47
|
+
"Nation Hosted"
|
|
48
|
+
],
|
|
49
|
+
"default": "platform"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"required": [
|
|
53
|
+
"states",
|
|
54
|
+
"enabled"
|
|
55
|
+
],
|
|
56
|
+
"additionalProperties": true
|
|
57
|
+
}
|
intentkit/skills/cdp/__init__.py
CHANGED
|
@@ -3,70 +3,28 @@
|
|
|
3
3
|
from typing import TypedDict
|
|
4
4
|
|
|
5
5
|
from coinbase_agentkit import (
|
|
6
|
-
Action,
|
|
7
|
-
AgentKit,
|
|
8
|
-
AgentKitConfig,
|
|
9
|
-
CdpEvmWalletProvider,
|
|
10
|
-
basename_action_provider,
|
|
11
6
|
cdp_api_action_provider,
|
|
12
|
-
|
|
13
|
-
morpho_action_provider,
|
|
14
|
-
pyth_action_provider,
|
|
15
|
-
superfluid_action_provider,
|
|
7
|
+
cdp_evm_wallet_action_provider,
|
|
16
8
|
wallet_action_provider,
|
|
17
|
-
weth_action_provider,
|
|
18
|
-
wow_action_provider,
|
|
19
9
|
)
|
|
20
|
-
from coinbase_agentkit.action_providers.erc721 import erc721_action_provider
|
|
21
|
-
from langchain.tools import StructuredTool
|
|
22
10
|
|
|
23
11
|
from intentkit.abstracts.skill import SkillStoreABC
|
|
24
|
-
from intentkit.
|
|
25
|
-
|
|
12
|
+
from intentkit.skills.base import (
|
|
13
|
+
SkillConfig,
|
|
14
|
+
SkillState,
|
|
15
|
+
action_to_structured_tool,
|
|
16
|
+
get_agentkit_actions,
|
|
17
|
+
)
|
|
26
18
|
from intentkit.skills.cdp.base import CDPBaseTool
|
|
27
|
-
from intentkit.skills.cdp.get_balance import GetBalance
|
|
28
|
-
from intentkit.skills.cdp.swap import Swap
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def _action_to_structured_tool(action: Action) -> StructuredTool:
|
|
32
|
-
"""Convert an AgentKit action to a LangChain StructuredTool."""
|
|
33
|
-
|
|
34
|
-
def _tool_fn(**kwargs: object) -> str:
|
|
35
|
-
return action.invoke(kwargs)
|
|
36
|
-
|
|
37
|
-
return StructuredTool(
|
|
38
|
-
name=action.name,
|
|
39
|
-
description=action.description,
|
|
40
|
-
func=_tool_fn,
|
|
41
|
-
args_schema=action.args_schema,
|
|
42
|
-
)
|
|
43
19
|
|
|
44
20
|
|
|
45
21
|
class SkillStates(TypedDict):
|
|
46
|
-
get_balance: SkillState
|
|
47
|
-
swap: SkillState
|
|
48
22
|
WalletActionProvider_get_balance: SkillState
|
|
49
23
|
WalletActionProvider_get_wallet_details: SkillState
|
|
50
24
|
WalletActionProvider_native_transfer: SkillState
|
|
51
|
-
CdpApiActionProvider_address_reputation: SkillState
|
|
52
25
|
CdpApiActionProvider_request_faucet_funds: SkillState
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
BasenameActionProvider_register_basename: SkillState
|
|
56
|
-
ERC20ActionProvider_get_balance: SkillState
|
|
57
|
-
ERC20ActionProvider_transfer: SkillState
|
|
58
|
-
Erc721ActionProvider_get_balance: SkillState
|
|
59
|
-
Erc721ActionProvider_mint: SkillState
|
|
60
|
-
Erc721ActionProvider_transfer: SkillState
|
|
61
|
-
WethActionProvider_wrap_eth: SkillState
|
|
62
|
-
MorphoActionProvider_deposit: SkillState
|
|
63
|
-
MorphoActionProvider_withdraw: SkillState
|
|
64
|
-
SuperfluidActionProvider_create_flow: SkillState
|
|
65
|
-
SuperfluidActionProvider_delete_flow: SkillState
|
|
66
|
-
SuperfluidActionProvider_update_flow: SkillState
|
|
67
|
-
WowActionProvider_buy_token: SkillState
|
|
68
|
-
WowActionProvider_create_token: SkillState
|
|
69
|
-
WowActionProvider_sell_token: SkillState
|
|
26
|
+
CdpEvmWalletActionProvider_get_swap_price: SkillState
|
|
27
|
+
CdpEvmWalletActionProvider_swap: SkillState
|
|
70
28
|
|
|
71
29
|
|
|
72
30
|
class Config(SkillConfig):
|
|
@@ -105,50 +63,18 @@ async def get_skills(
|
|
|
105
63
|
available_skills.append(skill_name)
|
|
106
64
|
|
|
107
65
|
# Initialize CDP client
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
pyth_action_provider(),
|
|
117
|
-
basename_action_provider(),
|
|
118
|
-
erc20_action_provider(),
|
|
119
|
-
erc721_action_provider(),
|
|
120
|
-
weth_action_provider(),
|
|
121
|
-
morpho_action_provider(),
|
|
122
|
-
superfluid_action_provider(),
|
|
123
|
-
wow_action_provider(),
|
|
124
|
-
],
|
|
125
|
-
)
|
|
66
|
+
actions = await get_agentkit_actions(
|
|
67
|
+
agent_id,
|
|
68
|
+
store,
|
|
69
|
+
[
|
|
70
|
+
wallet_action_provider,
|
|
71
|
+
cdp_api_action_provider,
|
|
72
|
+
cdp_evm_wallet_action_provider,
|
|
73
|
+
],
|
|
126
74
|
)
|
|
127
|
-
actions = agent_kit.get_actions()
|
|
128
75
|
tools = []
|
|
129
76
|
for skill in available_skills:
|
|
130
|
-
if skill == "get_balance":
|
|
131
|
-
# Get the account object for the custom GetBalance skill
|
|
132
|
-
tools.append(
|
|
133
|
-
GetBalance(
|
|
134
|
-
agent_id=agent_id,
|
|
135
|
-
skill_store=store,
|
|
136
|
-
)
|
|
137
|
-
)
|
|
138
|
-
continue
|
|
139
|
-
elif skill == "swap" or skill.endswith("_trade"):
|
|
140
|
-
# Add the custom Swap skill, "trade" is backword compatible
|
|
141
|
-
tools.append(
|
|
142
|
-
Swap(
|
|
143
|
-
agent_id=agent_id,
|
|
144
|
-
skill_store=store,
|
|
145
|
-
)
|
|
146
|
-
)
|
|
147
|
-
continue
|
|
148
77
|
for action in actions:
|
|
149
78
|
if action.name.endswith(skill):
|
|
150
|
-
|
|
151
|
-
tool.handle_tool_error = lambda e: f"tool error: {e}"
|
|
152
|
-
tool.handle_validation_error = lambda e: f"validation error: {e}"
|
|
153
|
-
tools.append(tool)
|
|
79
|
+
tools.append(action_to_structured_tool(action))
|
|
154
80
|
return tools
|