intentkit 0.8.12rc0__py3-none-any.whl → 0.8.13__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/abstracts/skill.py +2 -59
- intentkit/clients/__init__.py +3 -2
- intentkit/clients/cdp.py +63 -44
- intentkit/clients/twitter.py +35 -28
- intentkit/config/config.py +1 -0
- intentkit/core/agent.py +2 -279
- intentkit/core/asset.py +63 -16
- intentkit/core/engine.py +9 -5
- intentkit/core/scheduler.py +8 -8
- intentkit/models/agent.py +138 -94
- intentkit/models/agent_schema.json +6 -9
- intentkit/models/chat.py +1 -0
- intentkit/models/llm.csv +15 -12
- intentkit/models/skills.csv +5 -4
- intentkit/skills/acolyt/__init__.py +2 -9
- intentkit/skills/acolyt/base.py +2 -5
- intentkit/skills/aixbt/__init__.py +2 -13
- intentkit/skills/aixbt/base.py +0 -4
- intentkit/skills/aixbt/projects.py +1 -2
- intentkit/skills/allora/__init__.py +2 -9
- intentkit/skills/allora/base.py +2 -5
- intentkit/skills/base.py +101 -37
- intentkit/skills/basename/__init__.py +1 -3
- intentkit/skills/carv/__init__.py +116 -121
- intentkit/skills/carv/base.py +184 -185
- intentkit/skills/casino/__init__.py +4 -15
- intentkit/skills/casino/base.py +0 -4
- intentkit/skills/casino/deck_draw.py +1 -2
- intentkit/skills/casino/deck_shuffle.py +1 -2
- intentkit/skills/casino/dice_roll.py +1 -2
- intentkit/skills/cdp/__init__.py +0 -5
- intentkit/skills/cdp/base.py +0 -4
- intentkit/skills/cdp/schema.json +1 -17
- intentkit/skills/chainlist/__init__.py +2 -7
- intentkit/skills/chainlist/base.py +0 -4
- intentkit/skills/common/__init__.py +2 -9
- intentkit/skills/common/base.py +0 -4
- intentkit/skills/cookiefun/__init__.py +6 -9
- intentkit/skills/cookiefun/base.py +0 -4
- intentkit/skills/cryptocompare/__init__.py +7 -24
- intentkit/skills/cryptocompare/base.py +0 -5
- intentkit/skills/cryptopanic/__init__.py +3 -6
- intentkit/skills/cryptopanic/base.py +53 -55
- intentkit/skills/cryptopanic/fetch_crypto_news.py +0 -2
- intentkit/skills/cryptopanic/fetch_crypto_sentiment.py +1 -3
- intentkit/skills/dapplooker/__init__.py +2 -9
- intentkit/skills/dapplooker/base.py +2 -5
- intentkit/skills/defillama/__init__.py +24 -74
- intentkit/skills/defillama/base.py +0 -4
- intentkit/skills/defillama/coins/fetch_batch_historical_prices.py +2 -2
- intentkit/skills/defillama/coins/fetch_block.py +2 -2
- intentkit/skills/defillama/coins/fetch_current_prices.py +2 -2
- intentkit/skills/defillama/coins/fetch_first_price.py +2 -2
- intentkit/skills/defillama/coins/fetch_historical_prices.py +2 -2
- intentkit/skills/defillama/coins/fetch_price_chart.py +2 -2
- intentkit/skills/defillama/coins/fetch_price_percentage.py +2 -2
- intentkit/skills/defillama/fees/fetch_fees_overview.py +2 -2
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_chains.py +2 -2
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_charts.py +2 -2
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_prices.py +2 -2
- intentkit/skills/defillama/stablecoins/fetch_stablecoins.py +2 -2
- intentkit/skills/defillama/tvl/fetch_chain_historical_tvl.py +2 -2
- intentkit/skills/defillama/tvl/fetch_chains.py +2 -2
- intentkit/skills/defillama/tvl/fetch_historical_tvl.py +2 -2
- intentkit/skills/defillama/tvl/fetch_protocol.py +2 -2
- intentkit/skills/defillama/tvl/fetch_protocol_current_tvl.py +2 -2
- intentkit/skills/defillama/tvl/fetch_protocols.py +2 -2
- intentkit/skills/defillama/volumes/fetch_dex_overview.py +2 -2
- intentkit/skills/defillama/volumes/fetch_dex_summary.py +2 -2
- intentkit/skills/defillama/volumes/fetch_options_overview.py +2 -2
- intentkit/skills/defillama/yields/fetch_pool_chart.py +2 -2
- intentkit/skills/defillama/yields/fetch_pools.py +2 -2
- intentkit/skills/dexscreener/__init__.py +97 -102
- intentkit/skills/dexscreener/base.py +125 -130
- intentkit/skills/dexscreener/get_pair_info.py +2 -3
- intentkit/skills/dexscreener/get_token_pairs.py +2 -3
- intentkit/skills/dexscreener/get_tokens_info.py +2 -3
- intentkit/skills/dexscreener/search_token.py +2 -4
- intentkit/skills/dune_analytics/__init__.py +4 -6
- intentkit/skills/dune_analytics/base.py +50 -52
- intentkit/skills/dune_analytics/fetch_kol_buys.py +0 -2
- intentkit/skills/dune_analytics/fetch_nation_metrics.py +0 -2
- intentkit/skills/elfa/__init__.py +5 -18
- intentkit/skills/elfa/base.py +8 -10
- intentkit/skills/enso/__init__.py +9 -29
- intentkit/skills/enso/base.py +3 -6
- intentkit/skills/enso/route.py +1 -3
- intentkit/skills/erc20/__init__.py +1 -5
- intentkit/skills/erc721/__init__.py +1 -3
- intentkit/skills/firecrawl/__init__.py +5 -18
- intentkit/skills/firecrawl/base.py +2 -5
- intentkit/skills/firecrawl/crawl.py +10 -9
- intentkit/skills/firecrawl/query.py +3 -1
- intentkit/skills/firecrawl/scrape.py +8 -10
- intentkit/skills/firecrawl/utils.py +25 -26
- intentkit/skills/github/__init__.py +2 -7
- intentkit/skills/github/base.py +0 -4
- intentkit/skills/heurist/__init__.py +8 -27
- intentkit/skills/heurist/base.py +2 -5
- intentkit/skills/heurist/image_generation_animagine_xl.py +5 -5
- intentkit/skills/heurist/image_generation_arthemy_comics.py +5 -5
- intentkit/skills/heurist/image_generation_arthemy_real.py +5 -5
- intentkit/skills/heurist/image_generation_braindance.py +5 -5
- intentkit/skills/heurist/image_generation_cyber_realistic_xl.py +5 -5
- intentkit/skills/heurist/image_generation_flux_1_dev.py +5 -5
- intentkit/skills/heurist/image_generation_sdxl.py +5 -5
- intentkit/skills/http/__init__.py +4 -15
- intentkit/skills/http/base.py +0 -4
- intentkit/skills/lifi/__init__.py +1 -6
- intentkit/skills/lifi/base.py +0 -4
- intentkit/skills/lifi/token_execute.py +1 -4
- intentkit/skills/lifi/token_quote.py +1 -3
- intentkit/skills/moralis/__init__.py +3 -7
- intentkit/skills/moralis/base.py +2 -5
- intentkit/skills/morpho/__init__.py +1 -3
- intentkit/skills/nation/__init__.py +2 -7
- intentkit/skills/nation/base.py +4 -7
- intentkit/skills/onchain.py +27 -0
- intentkit/skills/openai/__init__.py +5 -18
- intentkit/skills/openai/base.py +8 -10
- intentkit/skills/openai/dalle_image_generation.py +2 -5
- intentkit/skills/openai/gpt_image_generation.py +2 -5
- intentkit/skills/openai/gpt_image_to_image.py +2 -5
- intentkit/skills/openai/image_to_text.py +2 -5
- intentkit/skills/portfolio/__init__.py +11 -35
- intentkit/skills/portfolio/base.py +2 -5
- intentkit/skills/pyth/__init__.py +1 -5
- intentkit/skills/skills.toml +4 -0
- intentkit/skills/slack/__init__.py +5 -17
- intentkit/skills/slack/base.py +0 -4
- intentkit/skills/supabase/__init__.py +7 -23
- intentkit/skills/supabase/base.py +0 -4
- intentkit/skills/superfluid/__init__.py +1 -3
- intentkit/skills/system/__init__.py +7 -24
- intentkit/skills/system/add_autonomous_task.py +2 -2
- intentkit/skills/system/delete_autonomous_task.py +2 -2
- intentkit/skills/system/edit_autonomous_task.py +2 -4
- intentkit/skills/system/list_autonomous_tasks.py +2 -2
- intentkit/skills/system/read_agent_api_key.py +6 -4
- intentkit/skills/system/regenerate_agent_api_key.py +6 -4
- intentkit/skills/tavily/__init__.py +3 -12
- intentkit/skills/tavily/base.py +2 -5
- intentkit/skills/tavily/tavily_extract.py +1 -2
- intentkit/skills/tavily/tavily_search.py +3 -3
- intentkit/skills/token/__init__.py +5 -10
- intentkit/skills/token/base.py +2 -6
- intentkit/skills/twitter/__init__.py +11 -35
- intentkit/skills/twitter/base.py +14 -16
- intentkit/skills/twitter/follow_user.py +0 -1
- intentkit/skills/twitter/get_mentions.py +0 -1
- intentkit/skills/twitter/get_timeline.py +0 -1
- intentkit/skills/twitter/get_user_by_username.py +0 -1
- intentkit/skills/twitter/get_user_tweets.py +0 -1
- intentkit/skills/twitter/like_tweet.py +0 -1
- intentkit/skills/twitter/post_tweet.py +2 -2
- intentkit/skills/twitter/reply_tweet.py +2 -2
- intentkit/skills/twitter/retweet.py +0 -1
- intentkit/skills/twitter/search_tweets.py +0 -1
- intentkit/skills/unrealspeech/__init__.py +2 -7
- intentkit/skills/unrealspeech/base.py +0 -4
- intentkit/skills/venice_audio/__init__.py +99 -106
- intentkit/skills/venice_audio/base.py +118 -121
- intentkit/skills/venice_audio/venice_audio.py +1 -5
- intentkit/skills/venice_image/__init__.py +147 -154
- intentkit/skills/venice_image/base.py +185 -192
- intentkit/skills/web_scraper/__init__.py +5 -18
- intentkit/skills/web_scraper/base.py +20 -4
- intentkit/skills/web_scraper/document_indexer.py +6 -4
- intentkit/skills/web_scraper/scrape_and_index.py +11 -8
- intentkit/skills/web_scraper/utils.py +31 -27
- intentkit/skills/web_scraper/website_indexer.py +7 -8
- intentkit/skills/weth/__init__.py +1 -5
- intentkit/skills/wow/__init__.py +1 -5
- intentkit/skills/x402/__init__.py +53 -0
- intentkit/skills/x402/ask_agent.py +141 -0
- intentkit/skills/x402/base.py +9 -0
- intentkit/skills/x402/schema.json +40 -0
- intentkit/skills/x402/x402.png +0 -0
- intentkit/skills/xmtp/__init__.py +4 -15
- intentkit/skills/xmtp/base.py +2 -2
- intentkit/skills/xmtp/price.py +3 -3
- intentkit/skills/xmtp/swap.py +4 -4
- intentkit/utils/schema.py +100 -0
- {intentkit-0.8.12rc0.dist-info → intentkit-0.8.13.dist-info}/METADATA +1 -1
- {intentkit-0.8.12rc0.dist-info → intentkit-0.8.13.dist-info}/RECORD +188 -181
- {intentkit-0.8.12rc0.dist-info → intentkit-0.8.13.dist-info}/WHEEL +0 -0
- {intentkit-0.8.12rc0.dist-info → intentkit-0.8.13.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Any, List, Optional, TypedDict
|
|
3
3
|
|
|
4
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
5
4
|
from intentkit.skills.base import SkillConfig, SkillState
|
|
6
5
|
from intentkit.skills.lifi.base import LiFiBaseTool
|
|
7
6
|
from intentkit.skills.lifi.token_execute import TokenExecute
|
|
@@ -31,7 +30,6 @@ class Config(SkillConfig):
|
|
|
31
30
|
async def get_skills(
|
|
32
31
|
config: "Config",
|
|
33
32
|
is_private: bool,
|
|
34
|
-
store: SkillStoreABC,
|
|
35
33
|
**_: Any,
|
|
36
34
|
) -> list[LiFiBaseTool]:
|
|
37
35
|
"""Get all LiFi skills."""
|
|
@@ -60,7 +58,7 @@ async def get_skills(
|
|
|
60
58
|
skills: list[LiFiBaseTool] = []
|
|
61
59
|
for name in available_skills:
|
|
62
60
|
try:
|
|
63
|
-
skill = get_lifi_skill(name,
|
|
61
|
+
skill = get_lifi_skill(name, config)
|
|
64
62
|
skills.append(skill)
|
|
65
63
|
logger.info(f"[LiFi_Skills] Successfully loaded skill: {name}")
|
|
66
64
|
except Exception as e:
|
|
@@ -73,7 +71,6 @@ async def get_skills(
|
|
|
73
71
|
|
|
74
72
|
def get_lifi_skill(
|
|
75
73
|
name: str,
|
|
76
|
-
store: SkillStoreABC,
|
|
77
74
|
config: Config,
|
|
78
75
|
) -> LiFiBaseTool:
|
|
79
76
|
"""Get a LiFi skill by name."""
|
|
@@ -108,7 +105,6 @@ def get_lifi_skill(
|
|
|
108
105
|
logger.info(f"[LiFi_Skills] Allowed chains: {allowed_chains}")
|
|
109
106
|
|
|
110
107
|
_cache[cache_key] = TokenQuote(
|
|
111
|
-
skill_store=store,
|
|
112
108
|
default_slippage=default_slippage,
|
|
113
109
|
allowed_chains=allowed_chains,
|
|
114
110
|
)
|
|
@@ -129,7 +125,6 @@ def get_lifi_skill(
|
|
|
129
125
|
)
|
|
130
126
|
|
|
131
127
|
_cache[cache_key] = TokenExecute(
|
|
132
|
-
skill_store=store,
|
|
133
128
|
default_slippage=default_slippage,
|
|
134
129
|
allowed_chains=allowed_chains,
|
|
135
130
|
max_execution_time=max_execution_time,
|
intentkit/skills/lifi/base.py
CHANGED
|
@@ -2,7 +2,6 @@ from typing import Type
|
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, Field
|
|
4
4
|
|
|
5
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
6
5
|
from intentkit.skills.base import IntentKitSkill
|
|
7
6
|
|
|
8
7
|
|
|
@@ -12,9 +11,6 @@ class LiFiBaseTool(IntentKitSkill):
|
|
|
12
11
|
name: str = Field(description="The name of the tool")
|
|
13
12
|
description: str = Field(description="A description of what the tool does")
|
|
14
13
|
args_schema: Type[BaseModel]
|
|
15
|
-
skill_store: SkillStoreABC = Field(
|
|
16
|
-
description="The skill store for persisting data"
|
|
17
|
-
)
|
|
18
14
|
|
|
19
15
|
@property
|
|
20
16
|
def category(self) -> str:
|
|
@@ -6,7 +6,6 @@ from coinbase_agentkit import CdpEvmWalletProvider
|
|
|
6
6
|
from pydantic import BaseModel, Field
|
|
7
7
|
from web3 import Web3
|
|
8
8
|
|
|
9
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
10
9
|
from intentkit.clients import get_wallet_provider as get_agent_wallet_provider
|
|
11
10
|
from intentkit.models.agent import Agent
|
|
12
11
|
from intentkit.skills.lifi.base import LiFiBaseTool
|
|
@@ -75,20 +74,18 @@ class TokenExecute(LiFiBaseTool):
|
|
|
75
74
|
|
|
76
75
|
def __init__(
|
|
77
76
|
self,
|
|
78
|
-
skill_store: SkillStoreABC,
|
|
79
77
|
default_slippage: float = 0.03,
|
|
80
78
|
allowed_chains: Optional[List[str]] = None,
|
|
81
79
|
max_execution_time: int = 300,
|
|
82
80
|
) -> None:
|
|
83
81
|
"""Initialize the TokenExecute skill with configuration options."""
|
|
84
|
-
super().__init__(
|
|
82
|
+
super().__init__()
|
|
85
83
|
self.default_slippage = default_slippage
|
|
86
84
|
self.allowed_chains = allowed_chains
|
|
87
85
|
self.max_execution_time = max_execution_time
|
|
88
86
|
# Initialize quote tool if not set
|
|
89
87
|
if not self.quote_tool:
|
|
90
88
|
self.quote_tool = TokenQuote(
|
|
91
|
-
skill_store=skill_store,
|
|
92
89
|
default_slippage=default_slippage,
|
|
93
90
|
allowed_chains=allowed_chains,
|
|
94
91
|
)
|
|
@@ -3,7 +3,6 @@ from typing import Any, Dict, List, Optional, Type
|
|
|
3
3
|
import httpx
|
|
4
4
|
from pydantic import BaseModel, Field
|
|
5
5
|
|
|
6
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
7
6
|
from intentkit.skills.lifi.base import LiFiBaseTool
|
|
8
7
|
from intentkit.skills.lifi.utils import (
|
|
9
8
|
LIFI_API_URL,
|
|
@@ -62,12 +61,11 @@ class TokenQuote(LiFiBaseTool):
|
|
|
62
61
|
|
|
63
62
|
def __init__(
|
|
64
63
|
self,
|
|
65
|
-
skill_store: SkillStoreABC,
|
|
66
64
|
default_slippage: float = 0.03,
|
|
67
65
|
allowed_chains: Optional[List[str]] = None,
|
|
68
66
|
) -> None:
|
|
69
67
|
"""Initialize the TokenQuote skill with configuration options."""
|
|
70
|
-
super().__init__(
|
|
68
|
+
super().__init__()
|
|
71
69
|
self.default_slippage = default_slippage
|
|
72
70
|
self.allowed_chains = allowed_chains
|
|
73
71
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import Dict, List, NotRequired, TypedDict
|
|
5
5
|
|
|
6
|
-
from intentkit.
|
|
6
|
+
from intentkit.config.config import config as system_config
|
|
7
7
|
from intentkit.skills.base import SkillConfig, SkillState
|
|
8
8
|
from intentkit.skills.moralis.base import WalletBaseTool
|
|
9
9
|
from intentkit.skills.moralis.fetch_chain_portfolio import FetchChainPortfolio
|
|
@@ -34,7 +34,6 @@ class Config(SkillConfig):
|
|
|
34
34
|
async def get_skills(
|
|
35
35
|
config: "Config",
|
|
36
36
|
is_private: bool,
|
|
37
|
-
store: SkillStoreABC,
|
|
38
37
|
**_,
|
|
39
38
|
) -> List[WalletBaseTool]:
|
|
40
39
|
"""Get all Wallet Portfolio skills.
|
|
@@ -42,7 +41,6 @@ async def get_skills(
|
|
|
42
41
|
Args:
|
|
43
42
|
config: Skill configuration
|
|
44
43
|
is_private: Whether the request is from an authenticated user
|
|
45
|
-
store: Skill store for persistence
|
|
46
44
|
chain_provider: Optional chain provider for blockchain interactions
|
|
47
45
|
**_: Additional arguments
|
|
48
46
|
|
|
@@ -67,12 +65,12 @@ async def get_skills(
|
|
|
67
65
|
if config.get("api_key_provider") == "agent_owner":
|
|
68
66
|
api_key = config.get("api_key")
|
|
69
67
|
else:
|
|
70
|
-
api_key =
|
|
68
|
+
api_key = system_config.moralis_api_key
|
|
71
69
|
|
|
72
70
|
# Get each skill using the getter
|
|
73
71
|
result = []
|
|
74
72
|
for name in available_skills:
|
|
75
|
-
skill = get_wallet_skill(name, api_key
|
|
73
|
+
skill = get_wallet_skill(name, api_key)
|
|
76
74
|
if skill:
|
|
77
75
|
result.append(skill)
|
|
78
76
|
return result
|
|
@@ -81,7 +79,6 @@ async def get_skills(
|
|
|
81
79
|
def get_wallet_skill(
|
|
82
80
|
name: str,
|
|
83
81
|
api_key: str,
|
|
84
|
-
store: SkillStoreABC,
|
|
85
82
|
) -> WalletBaseTool:
|
|
86
83
|
"""Get a specific Wallet Portfolio skill by name.
|
|
87
84
|
|
|
@@ -106,5 +103,4 @@ def get_wallet_skill(
|
|
|
106
103
|
|
|
107
104
|
return skill_classes[name](
|
|
108
105
|
api_key=api_key,
|
|
109
|
-
skill_store=store,
|
|
110
106
|
)
|
intentkit/skills/moralis/base.py
CHANGED
|
@@ -5,7 +5,7 @@ from typing import List, Optional, Type
|
|
|
5
5
|
from langchain_core.tools.base import ToolException
|
|
6
6
|
from pydantic import BaseModel, Field
|
|
7
7
|
|
|
8
|
-
from intentkit.
|
|
8
|
+
from intentkit.config.config import config
|
|
9
9
|
from intentkit.skills.base import IntentKitSkill
|
|
10
10
|
|
|
11
11
|
# Chain ID to chain name mapping for EVM chains
|
|
@@ -30,9 +30,6 @@ class WalletBaseTool(IntentKitSkill):
|
|
|
30
30
|
name: str = Field(description="The name of the tool")
|
|
31
31
|
description: str = Field(description="A description of what the tool does")
|
|
32
32
|
args_schema: Type[BaseModel]
|
|
33
|
-
skill_store: SkillStoreABC = Field(
|
|
34
|
-
description="The skill store for persisting data"
|
|
35
|
-
)
|
|
36
33
|
|
|
37
34
|
# Optional fields for blockchain providers
|
|
38
35
|
solana_networks: Optional[List[str]] = Field(
|
|
@@ -44,7 +41,7 @@ class WalletBaseTool(IntentKitSkill):
|
|
|
44
41
|
skill_config = context.agent.skill_config(self.category)
|
|
45
42
|
api_key_provider = skill_config.get("api_key_provider")
|
|
46
43
|
if api_key_provider == "platform":
|
|
47
|
-
return
|
|
44
|
+
return config.moralis_api_key
|
|
48
45
|
# for backward compatibility, may only have api_key in skill_config
|
|
49
46
|
elif skill_config.get("api_key"):
|
|
50
47
|
return skill_config.get("api_key")
|
|
@@ -4,7 +4,6 @@ from typing import TYPE_CHECKING, Optional, TypedDict
|
|
|
4
4
|
|
|
5
5
|
from coinbase_agentkit import morpho_action_provider
|
|
6
6
|
|
|
7
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
8
7
|
from intentkit.skills.base import (
|
|
9
8
|
SkillConfig,
|
|
10
9
|
SkillState,
|
|
@@ -31,7 +30,6 @@ class Config(SkillConfig):
|
|
|
31
30
|
async def get_skills(
|
|
32
31
|
config: "Config",
|
|
33
32
|
is_private: bool,
|
|
34
|
-
store: SkillStoreABC,
|
|
35
33
|
agent_id: str,
|
|
36
34
|
agent: Optional["Agent"] = None,
|
|
37
35
|
**_,
|
|
@@ -46,7 +44,7 @@ async def get_skills(
|
|
|
46
44
|
available_skills.append(skill_name)
|
|
47
45
|
|
|
48
46
|
actions = await get_agentkit_actions(
|
|
49
|
-
agent_id,
|
|
47
|
+
agent_id, [morpho_action_provider], agent=agent
|
|
50
48
|
)
|
|
51
49
|
tools: list[MorphoBaseTool] = []
|
|
52
50
|
for skill in available_skills:
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Optional, TypedDict
|
|
3
3
|
|
|
4
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
5
4
|
from intentkit.skills.base import SkillConfig, SkillState
|
|
6
5
|
from intentkit.skills.nation.base import NationBaseTool
|
|
7
6
|
from intentkit.skills.nation.nft_check import NftCheck
|
|
@@ -25,7 +24,6 @@ class Config(SkillConfig):
|
|
|
25
24
|
async def get_skills(
|
|
26
25
|
config: "Config",
|
|
27
26
|
is_private: bool,
|
|
28
|
-
store: SkillStoreABC,
|
|
29
27
|
**_,
|
|
30
28
|
) -> list[NationBaseTool]:
|
|
31
29
|
"""Get all nation skills."""
|
|
@@ -42,20 +40,17 @@ async def get_skills(
|
|
|
42
40
|
return [
|
|
43
41
|
skill
|
|
44
42
|
for name in available_skills
|
|
45
|
-
if (skill := get_nation_skill(name
|
|
43
|
+
if (skill := get_nation_skill(name)) is not None
|
|
46
44
|
]
|
|
47
45
|
|
|
48
46
|
|
|
49
47
|
def get_nation_skill(
|
|
50
48
|
name: str,
|
|
51
|
-
store: SkillStoreABC,
|
|
52
49
|
) -> Optional[NationBaseTool]:
|
|
53
50
|
"""Get a nation skill by name."""
|
|
54
51
|
if name == "nft_check":
|
|
55
52
|
if name not in _cache:
|
|
56
|
-
_cache[name] = NftCheck(
|
|
57
|
-
skill_store=store,
|
|
58
|
-
)
|
|
53
|
+
_cache[name] = NftCheck()
|
|
59
54
|
return _cache[name]
|
|
60
55
|
else:
|
|
61
56
|
logger.error(f"Unknown Nation skill: {name}")
|
intentkit/skills/nation/base.py
CHANGED
|
@@ -2,7 +2,7 @@ from typing import Type
|
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, Field
|
|
4
4
|
|
|
5
|
-
from intentkit.
|
|
5
|
+
from intentkit.config.config import config
|
|
6
6
|
from intentkit.skills.base import IntentKitSkill
|
|
7
7
|
|
|
8
8
|
default_nation_api_url = "http://backend-api"
|
|
@@ -14,16 +14,13 @@ class NationBaseTool(IntentKitSkill):
|
|
|
14
14
|
name: str = Field(description="The name of the tool")
|
|
15
15
|
description: str = Field(description="A description of what the tool does")
|
|
16
16
|
args_schema: Type[BaseModel]
|
|
17
|
-
skill_store: SkillStoreABC = Field(
|
|
18
|
-
description="The skill store for persisting data"
|
|
19
|
-
)
|
|
20
17
|
|
|
21
18
|
def get_api_key(self) -> str:
|
|
22
|
-
return
|
|
19
|
+
return config.nation_api_key
|
|
23
20
|
|
|
24
21
|
def get_base_url(self) -> str:
|
|
25
|
-
if
|
|
26
|
-
return
|
|
22
|
+
if config.nation_api_url:
|
|
23
|
+
return config.nation_api_url
|
|
27
24
|
return default_nation_api_url
|
|
28
25
|
|
|
29
26
|
@property
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
from web3 import Web3
|
|
4
|
+
|
|
5
|
+
from intentkit.clients import get_evm_account as fetch_evm_account
|
|
6
|
+
from intentkit.clients.web3 import get_web3_client
|
|
7
|
+
from intentkit.skills.base import IntentKitSkill
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from cdp import EvmServerAccount
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class IntentKitOnChainSkill(IntentKitSkill):
|
|
14
|
+
"""Shared helpers for on-chain enabled skills."""
|
|
15
|
+
|
|
16
|
+
def web3_client(self) -> Web3:
|
|
17
|
+
"""Get a Web3 client for the active agent network."""
|
|
18
|
+
context = self.get_context()
|
|
19
|
+
agent = context.agent
|
|
20
|
+
network_id = agent.network_id
|
|
21
|
+
return get_web3_client(network_id)
|
|
22
|
+
|
|
23
|
+
async def get_evm_account(self) -> "EvmServerAccount":
|
|
24
|
+
"""Fetch the EVM account associated with the active agent."""
|
|
25
|
+
context = self.get_context()
|
|
26
|
+
agent = context.agent
|
|
27
|
+
return await fetch_evm_account(agent)
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import TypedDict
|
|
5
5
|
|
|
6
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
7
6
|
from intentkit.skills.base import SkillConfig, SkillState
|
|
8
7
|
from intentkit.skills.openai.base import OpenAIBaseTool
|
|
9
8
|
from intentkit.skills.openai.dalle_image_generation import DALLEImageGeneration
|
|
@@ -34,7 +33,6 @@ class Config(SkillConfig):
|
|
|
34
33
|
async def get_skills(
|
|
35
34
|
config: "Config",
|
|
36
35
|
is_private: bool,
|
|
37
|
-
store: SkillStoreABC,
|
|
38
36
|
**_,
|
|
39
37
|
) -> list[OpenAIBaseTool]:
|
|
40
38
|
"""Get all OpenAI skills.
|
|
@@ -42,7 +40,6 @@ async def get_skills(
|
|
|
42
40
|
Args:
|
|
43
41
|
config: The configuration for OpenAI skills.
|
|
44
42
|
is_private: Whether to include private skills.
|
|
45
|
-
store: The skill store for persisting data.
|
|
46
43
|
|
|
47
44
|
Returns:
|
|
48
45
|
A list of OpenAI skills.
|
|
@@ -59,7 +56,7 @@ async def get_skills(
|
|
|
59
56
|
# Get each skill using the cached getter
|
|
60
57
|
result = []
|
|
61
58
|
for name in available_skills:
|
|
62
|
-
skill = get_openai_skill(name
|
|
59
|
+
skill = get_openai_skill(name)
|
|
63
60
|
if skill:
|
|
64
61
|
result.append(skill)
|
|
65
62
|
return result
|
|
@@ -67,40 +64,30 @@ async def get_skills(
|
|
|
67
64
|
|
|
68
65
|
def get_openai_skill(
|
|
69
66
|
name: str,
|
|
70
|
-
store: SkillStoreABC,
|
|
71
67
|
) -> OpenAIBaseTool:
|
|
72
68
|
"""Get an OpenAI skill by name.
|
|
73
69
|
|
|
74
70
|
Args:
|
|
75
71
|
name: The name of the skill to get
|
|
76
|
-
store: The skill store for persisting data
|
|
77
72
|
|
|
78
73
|
Returns:
|
|
79
74
|
The requested OpenAI skill
|
|
80
75
|
"""
|
|
81
76
|
if name == "image_to_text":
|
|
82
77
|
if name not in _cache:
|
|
83
|
-
_cache[name] = ImageToText(
|
|
84
|
-
skill_store=store,
|
|
85
|
-
)
|
|
78
|
+
_cache[name] = ImageToText()
|
|
86
79
|
return _cache[name]
|
|
87
80
|
elif name == "dalle_image_generation":
|
|
88
81
|
if name not in _cache:
|
|
89
|
-
_cache[name] = DALLEImageGeneration(
|
|
90
|
-
skill_store=store,
|
|
91
|
-
)
|
|
82
|
+
_cache[name] = DALLEImageGeneration()
|
|
92
83
|
return _cache[name]
|
|
93
84
|
elif name == "gpt_image_generation":
|
|
94
85
|
if name not in _cache:
|
|
95
|
-
_cache[name] = GPTImageGeneration(
|
|
96
|
-
skill_store=store,
|
|
97
|
-
)
|
|
86
|
+
_cache[name] = GPTImageGeneration()
|
|
98
87
|
return _cache[name]
|
|
99
88
|
elif name == "gpt_image_to_image":
|
|
100
89
|
if name not in _cache:
|
|
101
|
-
_cache[name] = GPTImageToImage(
|
|
102
|
-
skill_store=store,
|
|
103
|
-
)
|
|
90
|
+
_cache[name] = GPTImageToImage()
|
|
104
91
|
return _cache[name]
|
|
105
92
|
else:
|
|
106
93
|
logger.warning(f"Unknown OpenAI skill: {name}")
|
intentkit/skills/openai/base.py
CHANGED
|
@@ -5,7 +5,7 @@ from typing import Type
|
|
|
5
5
|
from langchain_core.tools.base import ToolException
|
|
6
6
|
from pydantic import BaseModel, Field
|
|
7
7
|
|
|
8
|
-
from intentkit.
|
|
8
|
+
from intentkit.config.config import config
|
|
9
9
|
from intentkit.skills.base import IntentKitSkill
|
|
10
10
|
|
|
11
11
|
|
|
@@ -18,23 +18,21 @@ class OpenAIBaseTool(IntentKitSkill):
|
|
|
18
18
|
name: str = Field(description="The name of the tool")
|
|
19
19
|
description: str = Field(description="A description of what the tool does")
|
|
20
20
|
args_schema: Type[BaseModel]
|
|
21
|
-
skill_store: SkillStoreABC = Field(
|
|
22
|
-
description="The skill store for persisting data"
|
|
23
|
-
)
|
|
24
21
|
|
|
25
22
|
def get_api_key(self) -> str:
|
|
26
23
|
context = self.get_context()
|
|
27
24
|
skill_config = context.agent.skill_config(self.category)
|
|
28
25
|
api_key_provider = skill_config.get("api_key_provider")
|
|
29
26
|
if api_key_provider == "platform":
|
|
30
|
-
|
|
27
|
+
if not config.openai_api_key:
|
|
28
|
+
raise ToolException("OpenAI API key is not configured")
|
|
29
|
+
return config.openai_api_key
|
|
31
30
|
# for backward compatibility, may only have api_key in skill_config
|
|
32
|
-
|
|
31
|
+
if skill_config.get("api_key"):
|
|
33
32
|
return skill_config.get("api_key")
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
)
|
|
33
|
+
raise ToolException(
|
|
34
|
+
f"Invalid API key provider: {api_key_provider}, or no api_key in config"
|
|
35
|
+
)
|
|
38
36
|
|
|
39
37
|
@property
|
|
40
38
|
def category(self) -> str:
|
|
@@ -79,12 +79,9 @@ class DALLEImageGeneration(OpenAIBaseTool):
|
|
|
79
79
|
Exception: If the image generation fails.
|
|
80
80
|
"""
|
|
81
81
|
context = self.get_context()
|
|
82
|
-
skill_config = context.agent.skill_config(self.category)
|
|
83
82
|
|
|
84
|
-
# Get the OpenAI API key from
|
|
85
|
-
api_key =
|
|
86
|
-
"openai_api_key"
|
|
87
|
-
)
|
|
83
|
+
# Get the OpenAI API key from configuration or agent settings
|
|
84
|
+
api_key = self.get_api_key()
|
|
88
85
|
|
|
89
86
|
# Generate a unique job ID
|
|
90
87
|
job_id = str(XID())
|
|
@@ -80,12 +80,9 @@ class GPTImageGeneration(OpenAIBaseTool):
|
|
|
80
80
|
Exception: If the image generation fails.
|
|
81
81
|
"""
|
|
82
82
|
context = self.get_context()
|
|
83
|
-
skill_config = context.agent.skill_config(self.category)
|
|
84
83
|
|
|
85
|
-
# Get the OpenAI API key from
|
|
86
|
-
api_key =
|
|
87
|
-
"openai_api_key"
|
|
88
|
-
)
|
|
84
|
+
# Get the OpenAI API key from configuration or agent settings
|
|
85
|
+
api_key = self.get_api_key()
|
|
89
86
|
|
|
90
87
|
# Generate a unique job ID
|
|
91
88
|
job_id = str(XID())
|
|
@@ -81,12 +81,9 @@ class GPTImageToImage(OpenAIBaseTool):
|
|
|
81
81
|
Exception: If the image editing fails.
|
|
82
82
|
"""
|
|
83
83
|
context = self.get_context()
|
|
84
|
-
skill_config = context.agent.skill_config(self.category)
|
|
85
84
|
|
|
86
|
-
# Get the OpenAI API key from
|
|
87
|
-
api_key =
|
|
88
|
-
"openai_api_key"
|
|
89
|
-
)
|
|
85
|
+
# Get the OpenAI API key from configuration or agent settings
|
|
86
|
+
api_key = self.get_api_key()
|
|
90
87
|
|
|
91
88
|
# Generate a unique job ID
|
|
92
89
|
job_id = str(XID())
|
|
@@ -58,13 +58,10 @@ class ImageToText(OpenAIBaseTool):
|
|
|
58
58
|
ImageToTextOutput: Object containing the text description and image dimensions.
|
|
59
59
|
"""
|
|
60
60
|
context = self.get_context()
|
|
61
|
-
skill_config = context.agent.skill_config(self.category)
|
|
62
61
|
logger.debug(f"context: {context}")
|
|
63
62
|
|
|
64
|
-
# Get the OpenAI client from
|
|
65
|
-
api_key =
|
|
66
|
-
"openai_api_key"
|
|
67
|
-
)
|
|
63
|
+
# Get the OpenAI client from configuration or agent settings
|
|
64
|
+
api_key = self.get_api_key()
|
|
68
65
|
client = openai.AsyncOpenAI(api_key=api_key)
|
|
69
66
|
|
|
70
67
|
try:
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import TypedDict
|
|
5
5
|
|
|
6
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
7
6
|
from intentkit.skills.base import SkillConfig, SkillState
|
|
8
7
|
from intentkit.skills.portfolio.base import PortfolioBaseTool
|
|
9
8
|
from intentkit.skills.portfolio.token_balances import TokenBalances
|
|
@@ -51,7 +50,6 @@ class Config(SkillConfig):
|
|
|
51
50
|
async def get_skills(
|
|
52
51
|
config: "Config",
|
|
53
52
|
is_private: bool,
|
|
54
|
-
store: SkillStoreABC,
|
|
55
53
|
**_,
|
|
56
54
|
) -> list[PortfolioBaseTool]:
|
|
57
55
|
"""Get all Portfolio blockchain analysis skills.
|
|
@@ -59,7 +57,6 @@ async def get_skills(
|
|
|
59
57
|
Args:
|
|
60
58
|
config: The configuration for Portfolio skills.
|
|
61
59
|
is_private: Whether to include private skills.
|
|
62
|
-
store: The skill store for persisting data.
|
|
63
60
|
|
|
64
61
|
Returns:
|
|
65
62
|
A list of Portfolio blockchain analysis skills.
|
|
@@ -76,7 +73,7 @@ async def get_skills(
|
|
|
76
73
|
# Get each skill using the cached getter
|
|
77
74
|
result = []
|
|
78
75
|
for name in available_skills:
|
|
79
|
-
skill = get_portfolio_skill(name
|
|
76
|
+
skill = get_portfolio_skill(name)
|
|
80
77
|
if skill:
|
|
81
78
|
result.append(skill)
|
|
82
79
|
return result
|
|
@@ -84,68 +81,47 @@ async def get_skills(
|
|
|
84
81
|
|
|
85
82
|
def get_portfolio_skill(
|
|
86
83
|
name: str,
|
|
87
|
-
store: SkillStoreABC,
|
|
88
84
|
) -> PortfolioBaseTool:
|
|
89
85
|
"""Get a portfolio skill by name."""
|
|
90
86
|
if name == "wallet_history":
|
|
91
87
|
if name not in _cache:
|
|
92
|
-
_cache[name] = WalletHistory(
|
|
93
|
-
skill_store=store,
|
|
94
|
-
)
|
|
88
|
+
_cache[name] = WalletHistory()
|
|
95
89
|
return _cache[name]
|
|
96
90
|
elif name == "token_balances":
|
|
97
91
|
if name not in _cache:
|
|
98
|
-
_cache[name] = TokenBalances(
|
|
99
|
-
skill_store=store,
|
|
100
|
-
)
|
|
92
|
+
_cache[name] = TokenBalances()
|
|
101
93
|
return _cache[name]
|
|
102
94
|
elif name == "wallet_approvals":
|
|
103
95
|
if name not in _cache:
|
|
104
|
-
_cache[name] = WalletApprovals(
|
|
105
|
-
skill_store=store,
|
|
106
|
-
)
|
|
96
|
+
_cache[name] = WalletApprovals()
|
|
107
97
|
return _cache[name]
|
|
108
98
|
elif name == "wallet_swaps":
|
|
109
99
|
if name not in _cache:
|
|
110
|
-
_cache[name] = WalletSwaps(
|
|
111
|
-
skill_store=store,
|
|
112
|
-
)
|
|
100
|
+
_cache[name] = WalletSwaps()
|
|
113
101
|
return _cache[name]
|
|
114
102
|
elif name == "wallet_net_worth":
|
|
115
103
|
if name not in _cache:
|
|
116
|
-
_cache[name] = WalletNetWorth(
|
|
117
|
-
skill_store=store,
|
|
118
|
-
)
|
|
104
|
+
_cache[name] = WalletNetWorth()
|
|
119
105
|
return _cache[name]
|
|
120
106
|
elif name == "wallet_profitability_summary":
|
|
121
107
|
if name not in _cache:
|
|
122
|
-
_cache[name] = WalletProfitabilitySummary(
|
|
123
|
-
skill_store=store,
|
|
124
|
-
)
|
|
108
|
+
_cache[name] = WalletProfitabilitySummary()
|
|
125
109
|
return _cache[name]
|
|
126
110
|
elif name == "wallet_profitability":
|
|
127
111
|
if name not in _cache:
|
|
128
|
-
_cache[name] = WalletProfitability(
|
|
129
|
-
skill_store=store,
|
|
130
|
-
)
|
|
112
|
+
_cache[name] = WalletProfitability()
|
|
131
113
|
return _cache[name]
|
|
132
114
|
elif name == "wallet_stats":
|
|
133
115
|
if name not in _cache:
|
|
134
|
-
_cache[name] = WalletStats(
|
|
135
|
-
skill_store=store,
|
|
136
|
-
)
|
|
116
|
+
_cache[name] = WalletStats()
|
|
137
117
|
return _cache[name]
|
|
138
118
|
elif name == "wallet_defi_positions":
|
|
139
119
|
if name not in _cache:
|
|
140
|
-
_cache[name] = WalletDefiPositions(
|
|
141
|
-
skill_store=store,
|
|
142
|
-
)
|
|
120
|
+
_cache[name] = WalletDefiPositions()
|
|
143
121
|
return _cache[name]
|
|
144
122
|
elif name == "wallet_nfts":
|
|
145
123
|
if name not in _cache:
|
|
146
|
-
_cache[name] = WalletNFTs(
|
|
147
|
-
skill_store=store,
|
|
148
|
-
)
|
|
124
|
+
_cache[name] = WalletNFTs()
|
|
149
125
|
return _cache[name]
|
|
150
126
|
else:
|
|
151
127
|
raise ValueError(f"Unknown portfolio skill: {name}")
|
|
@@ -9,7 +9,7 @@ import aiohttp
|
|
|
9
9
|
from langchain_core.tools import ToolException
|
|
10
10
|
from pydantic import BaseModel, Field
|
|
11
11
|
|
|
12
|
-
from intentkit.
|
|
12
|
+
from intentkit.config.config import config
|
|
13
13
|
from intentkit.skills.base import IntentKitSkill
|
|
14
14
|
from intentkit.skills.portfolio.constants import MORALIS_API_BASE_URL
|
|
15
15
|
|
|
@@ -22,9 +22,6 @@ class PortfolioBaseTool(IntentKitSkill, ABC):
|
|
|
22
22
|
name: str = Field(description="The name of the tool")
|
|
23
23
|
description: str = Field(description="A description of what the tool does")
|
|
24
24
|
args_schema: Type[BaseModel]
|
|
25
|
-
skill_store: SkillStoreABC = Field(
|
|
26
|
-
description="The skill store for persisting data"
|
|
27
|
-
)
|
|
28
25
|
|
|
29
26
|
def get_api_key(self) -> str:
|
|
30
27
|
context = self.get_context()
|
|
@@ -32,7 +29,7 @@ class PortfolioBaseTool(IntentKitSkill, ABC):
|
|
|
32
29
|
if skill_config.get("api_key_provider") == "agent_owner":
|
|
33
30
|
api_key = skill_config.get("api_key")
|
|
34
31
|
else:
|
|
35
|
-
api_key =
|
|
32
|
+
api_key = config.moralis_api_key
|
|
36
33
|
|
|
37
34
|
if not api_key:
|
|
38
35
|
raise ToolException("Moralis API key is not configured.")
|
|
@@ -4,7 +4,6 @@ from typing import TYPE_CHECKING, Optional, TypedDict
|
|
|
4
4
|
|
|
5
5
|
from coinbase_agentkit import pyth_action_provider
|
|
6
6
|
|
|
7
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
8
7
|
from intentkit.skills.base import (
|
|
9
8
|
SkillConfig,
|
|
10
9
|
SkillState,
|
|
@@ -31,7 +30,6 @@ class Config(SkillConfig):
|
|
|
31
30
|
async def get_skills(
|
|
32
31
|
config: "Config",
|
|
33
32
|
is_private: bool,
|
|
34
|
-
store: SkillStoreABC,
|
|
35
33
|
agent_id: str,
|
|
36
34
|
agent: Optional["Agent"] = None,
|
|
37
35
|
**_,
|
|
@@ -45,9 +43,7 @@ async def get_skills(
|
|
|
45
43
|
if state == "public" or (state == "private" and is_private):
|
|
46
44
|
available_skills.append(skill_name)
|
|
47
45
|
|
|
48
|
-
actions = await get_agentkit_actions(
|
|
49
|
-
agent_id, store, [pyth_action_provider], agent=agent
|
|
50
|
-
)
|
|
46
|
+
actions = await get_agentkit_actions(agent_id, [pyth_action_provider], agent=agent)
|
|
51
47
|
tools: list[PythBaseTool] = []
|
|
52
48
|
for skill in available_skills:
|
|
53
49
|
for action in actions:
|