intentkit 0.8.11.dev1__py3-none-any.whl → 0.8.12__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/graph.py +4 -0
- intentkit/abstracts/skill.py +2 -140
- intentkit/clients/twitter.py +35 -28
- intentkit/core/agent.py +2 -374
- intentkit/core/asset.py +63 -16
- intentkit/core/engine.py +16 -7
- intentkit/core/scheduler.py +8 -8
- intentkit/models/agent.py +109 -94
- intentkit/models/agent_schema.json +6 -9
- intentkit/models/llm.csv +15 -12
- intentkit/models/skill.py +38 -40
- 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 +168 -27
- 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 +4 -6
- intentkit/skills/casino/deck_shuffle.py +5 -4
- 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 +4 -18
- intentkit/skills/cryptocompare/fetch_news.py +1 -1
- intentkit/skills/cryptocompare/fetch_price.py +1 -1
- intentkit/skills/cryptocompare/fetch_top_exchanges.py +1 -1
- intentkit/skills/cryptocompare/fetch_top_market_cap.py +1 -1
- intentkit/skills/cryptocompare/fetch_top_volume.py +1 -1
- intentkit/skills/cryptocompare/fetch_trading_signals.py +1 -1
- 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 +3 -13
- 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/networks.py +1 -6
- intentkit/skills/enso/route.py +4 -8
- intentkit/skills/enso/tokens.py +2 -12
- 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/clear.py +3 -6
- intentkit/skills/firecrawl/crawl.py +10 -9
- intentkit/skills/firecrawl/query.py +3 -1
- intentkit/skills/firecrawl/scrape.py +10 -14
- intentkit/skills/firecrawl/utils.py +39 -31
- 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/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/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 +18 -29
- intentkit/skills/twitter/follow_user.py +1 -4
- intentkit/skills/twitter/get_mentions.py +2 -8
- intentkit/skills/twitter/get_timeline.py +3 -10
- intentkit/skills/twitter/get_user_by_username.py +1 -4
- intentkit/skills/twitter/get_user_tweets.py +3 -10
- intentkit/skills/twitter/like_tweet.py +1 -4
- intentkit/skills/twitter/post_tweet.py +3 -5
- intentkit/skills/twitter/reply_tweet.py +3 -5
- intentkit/skills/twitter/retweet.py +1 -4
- intentkit/skills/twitter/search_tweets.py +3 -10
- 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 -10
- intentkit/skills/web_scraper/utils.py +38 -38
- 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/xmtp/__init__.py +4 -15
- {intentkit-0.8.11.dev1.dist-info → intentkit-0.8.12.dist-info}/METADATA +1 -1
- {intentkit-0.8.11.dev1.dist-info → intentkit-0.8.12.dist-info}/RECORD +183 -183
- {intentkit-0.8.11.dev1.dist-info → intentkit-0.8.12.dist-info}/WHEEL +0 -0
- {intentkit-0.8.11.dev1.dist-info → intentkit-0.8.12.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,7 +6,6 @@ Loads and initializes skills for fetching crypto news and providing market insig
|
|
|
6
6
|
import logging
|
|
7
7
|
from typing import Dict, List, Optional, TypedDict
|
|
8
8
|
|
|
9
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
10
9
|
from intentkit.skills.base import SkillConfig, SkillState
|
|
11
10
|
|
|
12
11
|
from .base import CryptopanicBaseTool
|
|
@@ -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
|
**kwargs,
|
|
39
37
|
) -> List[CryptopanicBaseTool]:
|
|
40
38
|
"""Load CryptoPanic skills based on configuration.
|
|
@@ -60,7 +58,7 @@ async def get_skills(
|
|
|
60
58
|
|
|
61
59
|
loaded_skills = []
|
|
62
60
|
for name in available_skills:
|
|
63
|
-
skill = get_cryptopanic_skill(name
|
|
61
|
+
skill = get_cryptopanic_skill(name)
|
|
64
62
|
if skill:
|
|
65
63
|
logger.info("Successfully loaded skill: %s", name)
|
|
66
64
|
loaded_skills.append(skill)
|
|
@@ -72,7 +70,6 @@ async def get_skills(
|
|
|
72
70
|
|
|
73
71
|
def get_cryptopanic_skill(
|
|
74
72
|
name: str,
|
|
75
|
-
store: SkillStoreABC,
|
|
76
73
|
) -> Optional[CryptopanicBaseTool]:
|
|
77
74
|
"""Retrieve a CryptoPanic skill instance by name.
|
|
78
75
|
|
|
@@ -91,11 +88,11 @@ def get_cryptopanic_skill(
|
|
|
91
88
|
if name == "fetch_crypto_news":
|
|
92
89
|
from .fetch_crypto_news import FetchCryptoNews
|
|
93
90
|
|
|
94
|
-
_skill_cache[name] = FetchCryptoNews(
|
|
91
|
+
_skill_cache[name] = FetchCryptoNews()
|
|
95
92
|
elif name == "fetch_crypto_sentiment":
|
|
96
93
|
from .fetch_crypto_sentiment import FetchCryptoSentiment
|
|
97
94
|
|
|
98
|
-
_skill_cache[name] = FetchCryptoSentiment(
|
|
95
|
+
_skill_cache[name] = FetchCryptoSentiment()
|
|
99
96
|
else:
|
|
100
97
|
logger.warning("Unknown CryptoPanic skill: %s", name)
|
|
101
98
|
return None
|
|
@@ -1,55 +1,53 @@
|
|
|
1
|
-
"""Base module for CryptoPanic skills.
|
|
2
|
-
|
|
3
|
-
Defines the base class and shared utilities for CryptoPanic skills.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from typing import Type
|
|
7
|
-
|
|
8
|
-
from langchain_core.tools.base import ToolException
|
|
9
|
-
from pydantic import BaseModel, Field
|
|
10
|
-
|
|
11
|
-
from intentkit.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"""Category of the skill."""
|
|
55
|
-
return "cryptopanic"
|
|
1
|
+
"""Base module for CryptoPanic skills.
|
|
2
|
+
|
|
3
|
+
Defines the base class and shared utilities for CryptoPanic skills.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Type
|
|
7
|
+
|
|
8
|
+
from langchain_core.tools.base import ToolException
|
|
9
|
+
from pydantic import BaseModel, Field
|
|
10
|
+
|
|
11
|
+
from intentkit.skills.base import IntentKitSkill
|
|
12
|
+
|
|
13
|
+
base_url = "https://cryptopanic.com/api/v1/posts/"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class CryptopanicBaseTool(IntentKitSkill):
|
|
17
|
+
"""Base class for CryptoPanic skills.
|
|
18
|
+
|
|
19
|
+
Provides common functionality for interacting with the CryptoPanic API,
|
|
20
|
+
including API key retrieval and shared helpers.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
name: str = Field(description="Tool name")
|
|
24
|
+
description: str = Field(description="Tool description")
|
|
25
|
+
args_schema: Type[BaseModel]
|
|
26
|
+
|
|
27
|
+
def get_api_key(self) -> str:
|
|
28
|
+
"""Retrieve the CryptoPanic API key from context.
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
API key string.
|
|
32
|
+
|
|
33
|
+
Raises:
|
|
34
|
+
ToolException: If the API key is not found.
|
|
35
|
+
"""
|
|
36
|
+
context = self.get_context()
|
|
37
|
+
skill_config = context.agent.skill_config(self.category)
|
|
38
|
+
api_key_provider = skill_config.get("api_key_provider")
|
|
39
|
+
if api_key_provider == "agent_owner":
|
|
40
|
+
api_key = skill_config.get("api_key")
|
|
41
|
+
if api_key:
|
|
42
|
+
return api_key
|
|
43
|
+
else:
|
|
44
|
+
raise ToolException("No api_key found in agent_owner configuration")
|
|
45
|
+
else:
|
|
46
|
+
raise ToolException(
|
|
47
|
+
f"Invalid API key provider: {api_key_provider}. Only 'agent_owner' is supported for CryptoPanic."
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def category(self) -> str:
|
|
52
|
+
"""Category of the skill."""
|
|
53
|
+
return "cryptopanic"
|
|
@@ -8,7 +8,6 @@ from typing import List, Type
|
|
|
8
8
|
import httpx
|
|
9
9
|
from pydantic import BaseModel, Field
|
|
10
10
|
|
|
11
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
12
11
|
from intentkit.skills.cryptopanic.base import CryptopanicBaseTool
|
|
13
12
|
|
|
14
13
|
SUPPORTED_CURRENCIES = ["BTC", "ETH"]
|
|
@@ -49,7 +48,6 @@ class FetchCryptoNews(CryptopanicBaseTool):
|
|
|
49
48
|
"sorted by publication date (newest first). Defaults to BTC."
|
|
50
49
|
)
|
|
51
50
|
args_schema: Type[BaseModel] = CryptopanicNewsInput
|
|
52
|
-
skill_store: SkillStoreABC = Field(description="Skill store for data persistence")
|
|
53
51
|
|
|
54
52
|
async def fetch_news(
|
|
55
53
|
self,
|
|
@@ -4,7 +4,6 @@ from typing import ClassVar, List, Type
|
|
|
4
4
|
|
|
5
5
|
from pydantic import BaseModel, Field
|
|
6
6
|
|
|
7
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
8
7
|
from intentkit.skills.cryptopanic.base import CryptopanicBaseTool
|
|
9
8
|
|
|
10
9
|
SUPPORTED_CURRENCIES = ["BTC", "ETH"]
|
|
@@ -45,7 +44,6 @@ class FetchCryptoSentiment(CryptopanicBaseTool):
|
|
|
45
44
|
"Defaults to BTC."
|
|
46
45
|
)
|
|
47
46
|
args_schema: Type[BaseModel] = CryptopanicSentimentInput
|
|
48
|
-
skill_store: SkillStoreABC = Field(description="Skill store for data persistence")
|
|
49
47
|
|
|
50
48
|
INSIGHTS_PROMPT: ClassVar[str] = """
|
|
51
49
|
CryptoPanic Headlines for {currency}:
|
|
@@ -90,7 +88,7 @@ Conclude with a short-term outlook for {currency}. Provide a concise, profession
|
|
|
90
88
|
currency = "BTC"
|
|
91
89
|
|
|
92
90
|
# Instantiate FetchCryptoNews
|
|
93
|
-
news_skill = FetchCryptoNews(
|
|
91
|
+
news_skill = FetchCryptoNews()
|
|
94
92
|
|
|
95
93
|
try:
|
|
96
94
|
news_output: CryptopanicNewsOutput = await news_skill._arun(
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import NotRequired, TypedDict
|
|
5
5
|
|
|
6
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
7
6
|
from intentkit.skills.base import SkillConfig, SkillState
|
|
8
7
|
from intentkit.skills.dapplooker.base import DappLookerBaseTool
|
|
9
8
|
from intentkit.skills.dapplooker.dapplooker_token_data import DappLookerTokenData
|
|
@@ -28,7 +27,6 @@ class Config(SkillConfig):
|
|
|
28
27
|
async def get_skills(
|
|
29
28
|
config: "Config",
|
|
30
29
|
is_private: bool,
|
|
31
|
-
store: SkillStoreABC,
|
|
32
30
|
**_,
|
|
33
31
|
) -> list[DappLookerBaseTool]:
|
|
34
32
|
"""Get all DappLooker skills.
|
|
@@ -36,7 +34,6 @@ async def get_skills(
|
|
|
36
34
|
Args:
|
|
37
35
|
config: The configuration for DappLooker skills.
|
|
38
36
|
is_private: Whether to include private skills.
|
|
39
|
-
store: The skill store for persisting data.
|
|
40
37
|
|
|
41
38
|
Returns:
|
|
42
39
|
A list of DappLooker skills.
|
|
@@ -53,7 +50,7 @@ async def get_skills(
|
|
|
53
50
|
# Get each skill using the cached getter
|
|
54
51
|
result = []
|
|
55
52
|
for name in available_skills:
|
|
56
|
-
skill = get_dapplooker_skill(name
|
|
53
|
+
skill = get_dapplooker_skill(name)
|
|
57
54
|
if skill:
|
|
58
55
|
result.append(skill)
|
|
59
56
|
return result
|
|
@@ -61,22 +58,18 @@ async def get_skills(
|
|
|
61
58
|
|
|
62
59
|
def get_dapplooker_skill(
|
|
63
60
|
name: str,
|
|
64
|
-
store: SkillStoreABC,
|
|
65
61
|
) -> DappLookerBaseTool:
|
|
66
62
|
"""Get a DappLooker skill by name.
|
|
67
63
|
|
|
68
64
|
Args:
|
|
69
65
|
name: The name of the skill to get
|
|
70
|
-
store: The skill store for persisting data
|
|
71
66
|
|
|
72
67
|
Returns:
|
|
73
68
|
The requested DappLooker skill
|
|
74
69
|
"""
|
|
75
70
|
if name == "dapplooker_token_data":
|
|
76
71
|
if name not in _cache:
|
|
77
|
-
_cache[name] = DappLookerTokenData(
|
|
78
|
-
skill_store=store,
|
|
79
|
-
)
|
|
72
|
+
_cache[name] = DappLookerTokenData()
|
|
80
73
|
return _cache[name]
|
|
81
74
|
else:
|
|
82
75
|
logger.warning(f"Unknown DappLooker skill: {name}")
|
|
@@ -3,7 +3,7 @@ from typing import Type
|
|
|
3
3
|
from langchain_core.tools.base import ToolException
|
|
4
4
|
from pydantic import BaseModel, Field
|
|
5
5
|
|
|
6
|
-
from intentkit.
|
|
6
|
+
from intentkit.config.config import config
|
|
7
7
|
from intentkit.skills.base import IntentKitSkill
|
|
8
8
|
|
|
9
9
|
|
|
@@ -13,16 +13,13 @@ class DappLookerBaseTool(IntentKitSkill):
|
|
|
13
13
|
name: str = Field(description="The name of the tool")
|
|
14
14
|
description: str = Field(description="A description of what the tool does")
|
|
15
15
|
args_schema: Type[BaseModel]
|
|
16
|
-
skill_store: SkillStoreABC = Field(
|
|
17
|
-
description="The skill store for persisting data"
|
|
18
|
-
)
|
|
19
16
|
|
|
20
17
|
def get_api_key(self) -> str:
|
|
21
18
|
context = self.get_context()
|
|
22
19
|
skill_config = context.agent.skill_config(self.category)
|
|
23
20
|
api_key_provider = skill_config.get("api_key_provider")
|
|
24
21
|
if api_key_provider == "platform":
|
|
25
|
-
return
|
|
22
|
+
return config.dapplooker_api_key
|
|
26
23
|
# for backward compatibility, may only have api_key in skill_config
|
|
27
24
|
elif skill_config.get("api_key"):
|
|
28
25
|
return skill_config.get("api_key")
|
|
@@ -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.defillama.base import DefiLlamaBaseTool
|
|
9
8
|
from intentkit.skills.defillama.coins.fetch_batch_historical_prices import (
|
|
@@ -124,7 +123,6 @@ class Config(SkillConfig):
|
|
|
124
123
|
async def get_skills(
|
|
125
124
|
config: "Config",
|
|
126
125
|
is_private: bool,
|
|
127
|
-
store: SkillStoreABC,
|
|
128
126
|
**_,
|
|
129
127
|
) -> list[DefiLlamaBaseTool]:
|
|
130
128
|
"""Get all DeFi Llama skills."""
|
|
@@ -140,7 +138,7 @@ async def get_skills(
|
|
|
140
138
|
# Get each skill using the cached getter
|
|
141
139
|
result = []
|
|
142
140
|
for name in available_skills:
|
|
143
|
-
skill = get_defillama_skill(name
|
|
141
|
+
skill = get_defillama_skill(name)
|
|
144
142
|
if skill:
|
|
145
143
|
result.append(skill)
|
|
146
144
|
return result
|
|
@@ -148,13 +146,11 @@ async def get_skills(
|
|
|
148
146
|
|
|
149
147
|
def get_defillama_skill(
|
|
150
148
|
name: str,
|
|
151
|
-
store: SkillStoreABC,
|
|
152
149
|
) -> DefiLlamaBaseTool:
|
|
153
150
|
"""Get a DeFi Llama skill by name.
|
|
154
151
|
|
|
155
152
|
Args:
|
|
156
153
|
name: The name of the skill to get
|
|
157
|
-
store: The skill store for persisting data
|
|
158
154
|
|
|
159
155
|
Returns:
|
|
160
156
|
The requested DeFi Llama skill
|
|
@@ -167,145 +163,101 @@ def get_defillama_skill(
|
|
|
167
163
|
# TVL Skills
|
|
168
164
|
if name == "fetch_protocols":
|
|
169
165
|
if name not in _cache:
|
|
170
|
-
_cache[name] = DefiLlamaFetchProtocols(
|
|
171
|
-
skill_store=store,
|
|
172
|
-
)
|
|
166
|
+
_cache[name] = DefiLlamaFetchProtocols()
|
|
173
167
|
return _cache[name]
|
|
174
168
|
elif name == "fetch_protocol":
|
|
175
169
|
if name not in _cache:
|
|
176
|
-
_cache[name] = DefiLlamaFetchProtocol(
|
|
177
|
-
skill_store=store,
|
|
178
|
-
)
|
|
170
|
+
_cache[name] = DefiLlamaFetchProtocol()
|
|
179
171
|
return _cache[name]
|
|
180
172
|
elif name == "fetch_historical_tvl":
|
|
181
173
|
if name not in _cache:
|
|
182
|
-
_cache[name] = DefiLlamaFetchHistoricalTvl(
|
|
183
|
-
skill_store=store,
|
|
184
|
-
)
|
|
174
|
+
_cache[name] = DefiLlamaFetchHistoricalTvl()
|
|
185
175
|
return _cache[name]
|
|
186
176
|
elif name == "fetch_chain_historical_tvl":
|
|
187
177
|
if name not in _cache:
|
|
188
|
-
_cache[name] = DefiLlamaFetchChainHistoricalTvl(
|
|
189
|
-
skill_store=store,
|
|
190
|
-
)
|
|
178
|
+
_cache[name] = DefiLlamaFetchChainHistoricalTvl()
|
|
191
179
|
return _cache[name]
|
|
192
180
|
elif name == "fetch_protocol_current_tvl":
|
|
193
181
|
if name not in _cache:
|
|
194
|
-
_cache[name] = DefiLlamaFetchProtocolCurrentTvl(
|
|
195
|
-
skill_store=store,
|
|
196
|
-
)
|
|
182
|
+
_cache[name] = DefiLlamaFetchProtocolCurrentTvl()
|
|
197
183
|
return _cache[name]
|
|
198
184
|
elif name == "fetch_chains":
|
|
199
185
|
if name not in _cache:
|
|
200
|
-
_cache[name] = DefiLlamaFetchChains(
|
|
201
|
-
skill_store=store,
|
|
202
|
-
)
|
|
186
|
+
_cache[name] = DefiLlamaFetchChains()
|
|
203
187
|
return _cache[name]
|
|
204
188
|
|
|
205
189
|
# Coins Skills
|
|
206
190
|
elif name == "fetch_current_prices":
|
|
207
191
|
if name not in _cache:
|
|
208
|
-
_cache[name] = DefiLlamaFetchCurrentPrices(
|
|
209
|
-
skill_store=store,
|
|
210
|
-
)
|
|
192
|
+
_cache[name] = DefiLlamaFetchCurrentPrices()
|
|
211
193
|
return _cache[name]
|
|
212
194
|
elif name == "fetch_historical_prices":
|
|
213
195
|
if name not in _cache:
|
|
214
|
-
_cache[name] = DefiLlamaFetchHistoricalPrices(
|
|
215
|
-
skill_store=store,
|
|
216
|
-
)
|
|
196
|
+
_cache[name] = DefiLlamaFetchHistoricalPrices()
|
|
217
197
|
return _cache[name]
|
|
218
198
|
elif name == "fetch_batch_historical_prices":
|
|
219
199
|
if name not in _cache:
|
|
220
|
-
_cache[name] = DefiLlamaFetchBatchHistoricalPrices(
|
|
221
|
-
skill_store=store,
|
|
222
|
-
)
|
|
200
|
+
_cache[name] = DefiLlamaFetchBatchHistoricalPrices()
|
|
223
201
|
return _cache[name]
|
|
224
202
|
elif name == "fetch_price_chart":
|
|
225
203
|
if name not in _cache:
|
|
226
|
-
_cache[name] = DefiLlamaFetchPriceChart(
|
|
227
|
-
skill_store=store,
|
|
228
|
-
)
|
|
204
|
+
_cache[name] = DefiLlamaFetchPriceChart()
|
|
229
205
|
return _cache[name]
|
|
230
206
|
elif name == "fetch_price_percentage":
|
|
231
207
|
if name not in _cache:
|
|
232
|
-
_cache[name] = DefiLlamaFetchPricePercentage(
|
|
233
|
-
skill_store=store,
|
|
234
|
-
)
|
|
208
|
+
_cache[name] = DefiLlamaFetchPricePercentage()
|
|
235
209
|
return _cache[name]
|
|
236
210
|
elif name == "fetch_first_price":
|
|
237
211
|
if name not in _cache:
|
|
238
|
-
_cache[name] = DefiLlamaFetchFirstPrice(
|
|
239
|
-
skill_store=store,
|
|
240
|
-
)
|
|
212
|
+
_cache[name] = DefiLlamaFetchFirstPrice()
|
|
241
213
|
return _cache[name]
|
|
242
214
|
elif name == "fetch_block":
|
|
243
215
|
if name not in _cache:
|
|
244
|
-
_cache[name] = DefiLlamaFetchBlock(
|
|
245
|
-
skill_store=store,
|
|
246
|
-
)
|
|
216
|
+
_cache[name] = DefiLlamaFetchBlock()
|
|
247
217
|
return _cache[name]
|
|
248
218
|
|
|
249
219
|
# Stablecoins Skills
|
|
250
220
|
elif name == "fetch_stablecoins":
|
|
251
221
|
if name not in _cache:
|
|
252
|
-
_cache[name] = DefiLlamaFetchStablecoins(
|
|
253
|
-
skill_store=store,
|
|
254
|
-
)
|
|
222
|
+
_cache[name] = DefiLlamaFetchStablecoins()
|
|
255
223
|
return _cache[name]
|
|
256
224
|
elif name == "fetch_stablecoin_charts":
|
|
257
225
|
if name not in _cache:
|
|
258
|
-
_cache[name] = DefiLlamaFetchStablecoinCharts(
|
|
259
|
-
skill_store=store,
|
|
260
|
-
)
|
|
226
|
+
_cache[name] = DefiLlamaFetchStablecoinCharts()
|
|
261
227
|
return _cache[name]
|
|
262
228
|
elif name == "fetch_stablecoin_chains":
|
|
263
229
|
if name not in _cache:
|
|
264
|
-
_cache[name] = DefiLlamaFetchStablecoinChains(
|
|
265
|
-
skill_store=store,
|
|
266
|
-
)
|
|
230
|
+
_cache[name] = DefiLlamaFetchStablecoinChains()
|
|
267
231
|
return _cache[name]
|
|
268
232
|
elif name == "fetch_stablecoin_prices":
|
|
269
233
|
if name not in _cache:
|
|
270
|
-
_cache[name] = DefiLlamaFetchStablecoinPrices(
|
|
271
|
-
skill_store=store,
|
|
272
|
-
)
|
|
234
|
+
_cache[name] = DefiLlamaFetchStablecoinPrices()
|
|
273
235
|
return _cache[name]
|
|
274
236
|
|
|
275
237
|
# Yields Skills
|
|
276
238
|
elif name == "fetch_pools":
|
|
277
239
|
if name not in _cache:
|
|
278
|
-
_cache[name] = DefiLlamaFetchPools(
|
|
279
|
-
skill_store=store,
|
|
280
|
-
)
|
|
240
|
+
_cache[name] = DefiLlamaFetchPools()
|
|
281
241
|
return _cache[name]
|
|
282
242
|
elif name == "fetch_pool_chart":
|
|
283
243
|
if name not in _cache:
|
|
284
|
-
_cache[name] = DefiLlamaFetchPoolChart(
|
|
285
|
-
skill_store=store,
|
|
286
|
-
)
|
|
244
|
+
_cache[name] = DefiLlamaFetchPoolChart()
|
|
287
245
|
return _cache[name]
|
|
288
246
|
|
|
289
247
|
# Volumes Skills
|
|
290
248
|
elif name == "fetch_dex_overview": # Handles both base and chain-specific overviews
|
|
291
249
|
if name not in _cache:
|
|
292
|
-
_cache[name] = DefiLlamaFetchDexOverview(
|
|
293
|
-
skill_store=store,
|
|
294
|
-
)
|
|
250
|
+
_cache[name] = DefiLlamaFetchDexOverview()
|
|
295
251
|
return _cache[name]
|
|
296
252
|
elif name == "fetch_dex_summary":
|
|
297
253
|
if name not in _cache:
|
|
298
|
-
_cache[name] = DefiLlamaFetchDexSummary(
|
|
299
|
-
skill_store=store,
|
|
300
|
-
)
|
|
254
|
+
_cache[name] = DefiLlamaFetchDexSummary()
|
|
301
255
|
return _cache[name]
|
|
302
256
|
elif (
|
|
303
257
|
name == "fetch_options_overview"
|
|
304
258
|
): # Handles both base and chain-specific overviews
|
|
305
259
|
if name not in _cache:
|
|
306
|
-
_cache[name] = DefiLlamaFetchOptionsOverview(
|
|
307
|
-
skill_store=store,
|
|
308
|
-
)
|
|
260
|
+
_cache[name] = DefiLlamaFetchOptionsOverview()
|
|
309
261
|
return _cache[name]
|
|
310
262
|
|
|
311
263
|
# Fees Skills
|
|
@@ -313,9 +265,7 @@ def get_defillama_skill(
|
|
|
313
265
|
name == "fetch_fees_overview"
|
|
314
266
|
): # Handles both base and chain-specific overviews
|
|
315
267
|
if name not in _cache:
|
|
316
|
-
_cache[name] = DefiLlamaFetchFeesOverview(
|
|
317
|
-
skill_store=store,
|
|
318
|
-
)
|
|
268
|
+
_cache[name] = DefiLlamaFetchFeesOverview()
|
|
319
269
|
return _cache[name]
|
|
320
270
|
|
|
321
271
|
else:
|
|
@@ -6,7 +6,6 @@ from typing import Type
|
|
|
6
6
|
from pydantic import BaseModel, Field
|
|
7
7
|
|
|
8
8
|
from intentkit.abstracts.graph import AgentContext
|
|
9
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
10
9
|
from intentkit.skills.base import IntentKitSkill
|
|
11
10
|
from intentkit.skills.defillama.config.chains import (
|
|
12
11
|
get_chain_from_alias,
|
|
@@ -28,9 +27,6 @@ class DefiLlamaBaseTool(IntentKitSkill):
|
|
|
28
27
|
name: str = Field(description="The name of the tool")
|
|
29
28
|
description: str = Field(description="A description of what the tool does")
|
|
30
29
|
args_schema: Type[BaseModel]
|
|
31
|
-
skill_store: SkillStoreABC = Field(
|
|
32
|
-
description="The skill store for persisting data"
|
|
33
|
-
)
|
|
34
30
|
base_url: str = Field(
|
|
35
31
|
default=DEFILLAMA_BASE_URL, description="Base URL for DeFi Llama API"
|
|
36
32
|
)
|
|
@@ -52,9 +48,7 @@ class DefiLlamaBaseTool(IntentKitSkill):
|
|
|
52
48
|
Returns:
|
|
53
49
|
Rate limit status and error message if limited
|
|
54
50
|
"""
|
|
55
|
-
rate_limit = await self.
|
|
56
|
-
context.agent_id, self.name, "rate_limit"
|
|
57
|
-
)
|
|
51
|
+
rate_limit = await self.get_agent_skill_data("rate_limit")
|
|
58
52
|
current_time = datetime.now(tz=timezone.utc)
|
|
59
53
|
|
|
60
54
|
if (
|
|
@@ -67,18 +61,14 @@ class DefiLlamaBaseTool(IntentKitSkill):
|
|
|
67
61
|
return True, "Rate limit exceeded"
|
|
68
62
|
|
|
69
63
|
rate_limit["count"] += 1
|
|
70
|
-
await self.
|
|
71
|
-
context.agent_id, self.name, "rate_limit", rate_limit
|
|
72
|
-
)
|
|
64
|
+
await self.save_agent_skill_data("rate_limit", rate_limit)
|
|
73
65
|
return False, None
|
|
74
66
|
|
|
75
67
|
new_rate_limit = {
|
|
76
68
|
"count": 1,
|
|
77
69
|
"reset_time": (current_time + timedelta(minutes=interval)).isoformat(),
|
|
78
70
|
}
|
|
79
|
-
await self.
|
|
80
|
-
context.agent_id, self.name, "rate_limit", new_rate_limit
|
|
81
|
-
)
|
|
71
|
+
await self.save_agent_skill_data("rate_limit", new_rate_limit)
|
|
82
72
|
return False, None
|
|
83
73
|
|
|
84
74
|
async def validate_chain(self, chain: str | None) -> tuple[bool, str | None]:
|
|
@@ -64,9 +64,9 @@ class DefiLlamaFetchBatchHistoricalPrices(DefiLlamaBaseTool):
|
|
|
64
64
|
|
|
65
65
|
Example:
|
|
66
66
|
prices_tool = DefiLlamaFetchBatchHistoricalPrices(
|
|
67
|
-
|
|
67
|
+
,
|
|
68
68
|
agent_id="agent_123",
|
|
69
|
-
|
|
69
|
+
agent=agent
|
|
70
70
|
)
|
|
71
71
|
result = await prices_tool._arun(
|
|
72
72
|
coins_timestamps={
|
|
@@ -46,9 +46,9 @@ class DefiLlamaFetchBlock(DefiLlamaBaseTool):
|
|
|
46
46
|
|
|
47
47
|
Example:
|
|
48
48
|
block_tool = DefiLlamaFetchBlock(
|
|
49
|
-
|
|
49
|
+
,
|
|
50
50
|
agent_id="agent_123",
|
|
51
|
-
|
|
51
|
+
agent=agent
|
|
52
52
|
)
|
|
53
53
|
result = await block_tool._arun(chain="ethereum")
|
|
54
54
|
"""
|
|
@@ -58,9 +58,9 @@ class DefiLlamaFetchCurrentPrices(DefiLlamaBaseTool):
|
|
|
58
58
|
|
|
59
59
|
Example:
|
|
60
60
|
prices_tool = DefiLlamaFetchCurrentPrices(
|
|
61
|
-
|
|
61
|
+
,
|
|
62
62
|
agent_id="agent_123",
|
|
63
|
-
|
|
63
|
+
agent=agent
|
|
64
64
|
)
|
|
65
65
|
result = await prices_tool._arun(
|
|
66
66
|
coins=["ethereum:0x...", "coingecko:bitcoin"]
|
|
@@ -53,9 +53,9 @@ class DefiLlamaFetchFirstPrice(DefiLlamaBaseTool):
|
|
|
53
53
|
|
|
54
54
|
Example:
|
|
55
55
|
first_price_tool = DefiLlamaFetchFirstPrice(
|
|
56
|
-
|
|
56
|
+
,
|
|
57
57
|
agent_id="agent_123",
|
|
58
|
-
|
|
58
|
+
agent=agent
|
|
59
59
|
)
|
|
60
60
|
result = await first_price_tool._arun(
|
|
61
61
|
coins=["ethereum:0x...", "coingecko:ethereum"]
|
|
@@ -61,9 +61,9 @@ class DefiLlamaFetchHistoricalPrices(DefiLlamaBaseTool):
|
|
|
61
61
|
|
|
62
62
|
Example:
|
|
63
63
|
prices_tool = DefiLlamaFetchHistoricalPrices(
|
|
64
|
-
|
|
64
|
+
,
|
|
65
65
|
agent_id="agent_123",
|
|
66
|
-
|
|
66
|
+
agent=agent
|
|
67
67
|
)
|
|
68
68
|
result = await prices_tool._arun(
|
|
69
69
|
timestamp=1640995200, # Jan 1, 2022
|
|
@@ -62,9 +62,9 @@ class DefiLlamaFetchPriceChart(DefiLlamaBaseTool):
|
|
|
62
62
|
|
|
63
63
|
Example:
|
|
64
64
|
chart_tool = DefiLlamaFetchPriceChart(
|
|
65
|
-
|
|
65
|
+
,
|
|
66
66
|
agent_id="agent_123",
|
|
67
|
-
|
|
67
|
+
agent=agent
|
|
68
68
|
)
|
|
69
69
|
result = await chart_tool._arun(
|
|
70
70
|
coins=["ethereum:0x...", "coingecko:ethereum"]
|
|
@@ -46,9 +46,9 @@ class DefiLlamaFetchPricePercentage(DefiLlamaBaseTool):
|
|
|
46
46
|
|
|
47
47
|
Example:
|
|
48
48
|
percentage_tool = DefiLlamaFetchPricePercentage(
|
|
49
|
-
|
|
49
|
+
,
|
|
50
50
|
agent_id="agent_123",
|
|
51
|
-
|
|
51
|
+
agent=agent
|
|
52
52
|
)
|
|
53
53
|
result = await percentage_tool._arun(
|
|
54
54
|
coins=["ethereum:0x...", "coingecko:ethereum"]
|
|
@@ -85,9 +85,9 @@ class DefiLlamaFetchFeesOverview(DefiLlamaBaseTool):
|
|
|
85
85
|
|
|
86
86
|
Example:
|
|
87
87
|
overview_tool = DefiLlamaFetchFeesOverview(
|
|
88
|
-
|
|
88
|
+
,
|
|
89
89
|
agent_id="agent_123",
|
|
90
|
-
|
|
90
|
+
agent=agent
|
|
91
91
|
)
|
|
92
92
|
result = await overview_tool._arun()
|
|
93
93
|
"""
|
|
@@ -61,9 +61,9 @@ class DefiLlamaFetchStablecoinChains(DefiLlamaBaseTool):
|
|
|
61
61
|
|
|
62
62
|
Example:
|
|
63
63
|
chains_tool = DefiLlamaFetchStablecoinChains(
|
|
64
|
-
|
|
64
|
+
,
|
|
65
65
|
agent_id="agent_123",
|
|
66
|
-
|
|
66
|
+
agent=agent
|
|
67
67
|
)
|
|
68
68
|
result = await chains_tool._arun()
|
|
69
69
|
"""
|