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
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:
|
|
@@ -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.slack.base import SlackBaseTool
|
|
9
8
|
from intentkit.skills.slack.get_channel import SlackGetChannel
|
|
@@ -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[SlackBaseTool]:
|
|
40
38
|
"""Get all Slack skills."""
|
|
@@ -50,7 +48,7 @@ async def get_skills(
|
|
|
50
48
|
# Get each skill using the cached getter
|
|
51
49
|
result = []
|
|
52
50
|
for name in available_skills:
|
|
53
|
-
skill = get_slack_skill(name
|
|
51
|
+
skill = get_slack_skill(name)
|
|
54
52
|
if skill:
|
|
55
53
|
result.append(skill)
|
|
56
54
|
return result
|
|
@@ -58,40 +56,30 @@ async def get_skills(
|
|
|
58
56
|
|
|
59
57
|
def get_slack_skill(
|
|
60
58
|
name: str,
|
|
61
|
-
store: SkillStoreABC,
|
|
62
59
|
) -> SlackBaseTool:
|
|
63
60
|
"""Get a Slack skill by name.
|
|
64
61
|
|
|
65
62
|
Args:
|
|
66
63
|
name: The name of the skill to get
|
|
67
|
-
store: The skill store for persisting data
|
|
68
64
|
|
|
69
65
|
Returns:
|
|
70
66
|
The requested Slack skill
|
|
71
67
|
"""
|
|
72
68
|
if name == "get_channel":
|
|
73
69
|
if name not in _cache:
|
|
74
|
-
_cache[name] = SlackGetChannel(
|
|
75
|
-
skill_store=store,
|
|
76
|
-
)
|
|
70
|
+
_cache[name] = SlackGetChannel()
|
|
77
71
|
return _cache[name]
|
|
78
72
|
elif name == "get_message":
|
|
79
73
|
if name not in _cache:
|
|
80
|
-
_cache[name] = SlackGetMessage(
|
|
81
|
-
skill_store=store,
|
|
82
|
-
)
|
|
74
|
+
_cache[name] = SlackGetMessage()
|
|
83
75
|
return _cache[name]
|
|
84
76
|
elif name == "schedule_message":
|
|
85
77
|
if name not in _cache:
|
|
86
|
-
_cache[name] = SlackScheduleMessage(
|
|
87
|
-
skill_store=store,
|
|
88
|
-
)
|
|
78
|
+
_cache[name] = SlackScheduleMessage()
|
|
89
79
|
return _cache[name]
|
|
90
80
|
elif name == "send_message":
|
|
91
81
|
if name not in _cache:
|
|
92
|
-
_cache[name] = SlackSendMessage(
|
|
93
|
-
skill_store=store,
|
|
94
|
-
)
|
|
82
|
+
_cache[name] = SlackSendMessage()
|
|
95
83
|
return _cache[name]
|
|
96
84
|
else:
|
|
97
85
|
logger.warning(f"Unknown Slack skill: {name}")
|
intentkit/skills/slack/base.py
CHANGED
|
@@ -4,7 +4,6 @@ from langchain_core.tools.base import ToolException
|
|
|
4
4
|
from pydantic import BaseModel, Field
|
|
5
5
|
from slack_sdk import WebClient
|
|
6
6
|
|
|
7
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
8
7
|
from intentkit.skills.base import IntentKitSkill
|
|
9
8
|
|
|
10
9
|
|
|
@@ -14,9 +13,6 @@ class SlackBaseTool(IntentKitSkill):
|
|
|
14
13
|
name: str = Field(description="The name of the tool")
|
|
15
14
|
description: str = Field(description="A description of what the tool does")
|
|
16
15
|
args_schema: Type[BaseModel]
|
|
17
|
-
skill_store: SkillStoreABC = Field(
|
|
18
|
-
description="The skill store for persisting data"
|
|
19
|
-
)
|
|
20
16
|
|
|
21
17
|
def get_api_key(self) -> str:
|
|
22
18
|
context = self.get_context()
|
|
@@ -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.supabase.base import SupabaseBaseTool
|
|
9
8
|
from intentkit.skills.supabase.delete_data import SupabaseDeleteData
|
|
@@ -41,7 +40,6 @@ class Config(SkillConfig):
|
|
|
41
40
|
async def get_skills(
|
|
42
41
|
config: "Config",
|
|
43
42
|
is_private: bool,
|
|
44
|
-
store: SkillStoreABC,
|
|
45
43
|
**_,
|
|
46
44
|
) -> list[SupabaseBaseTool]:
|
|
47
45
|
"""Get all Supabase skills."""
|
|
@@ -57,7 +55,7 @@ async def get_skills(
|
|
|
57
55
|
# Get each skill using the cached getter
|
|
58
56
|
result = []
|
|
59
57
|
for name in available_skills:
|
|
60
|
-
skill = get_supabase_skill(name
|
|
58
|
+
skill = get_supabase_skill(name)
|
|
61
59
|
if skill:
|
|
62
60
|
result.append(skill)
|
|
63
61
|
return result
|
|
@@ -65,52 +63,38 @@ async def get_skills(
|
|
|
65
63
|
|
|
66
64
|
def get_supabase_skill(
|
|
67
65
|
name: str,
|
|
68
|
-
store: SkillStoreABC,
|
|
69
66
|
) -> SupabaseBaseTool:
|
|
70
67
|
"""Get a Supabase skill by name.
|
|
71
68
|
|
|
72
69
|
Args:
|
|
73
70
|
name: The name of the skill to get
|
|
74
|
-
store: The skill store for persisting data
|
|
75
71
|
|
|
76
72
|
Returns:
|
|
77
73
|
The requested Supabase skill
|
|
78
74
|
"""
|
|
79
75
|
if name == "fetch_data":
|
|
80
76
|
if name not in _cache:
|
|
81
|
-
_cache[name] = SupabaseFetchData(
|
|
82
|
-
skill_store=store,
|
|
83
|
-
)
|
|
77
|
+
_cache[name] = SupabaseFetchData()
|
|
84
78
|
return _cache[name]
|
|
85
79
|
elif name == "insert_data":
|
|
86
80
|
if name not in _cache:
|
|
87
|
-
_cache[name] = SupabaseInsertData(
|
|
88
|
-
skill_store=store,
|
|
89
|
-
)
|
|
81
|
+
_cache[name] = SupabaseInsertData()
|
|
90
82
|
return _cache[name]
|
|
91
83
|
elif name == "update_data":
|
|
92
84
|
if name not in _cache:
|
|
93
|
-
_cache[name] = SupabaseUpdateData(
|
|
94
|
-
skill_store=store,
|
|
95
|
-
)
|
|
85
|
+
_cache[name] = SupabaseUpdateData()
|
|
96
86
|
return _cache[name]
|
|
97
87
|
elif name == "upsert_data":
|
|
98
88
|
if name not in _cache:
|
|
99
|
-
_cache[name] = SupabaseUpsertData(
|
|
100
|
-
skill_store=store,
|
|
101
|
-
)
|
|
89
|
+
_cache[name] = SupabaseUpsertData()
|
|
102
90
|
return _cache[name]
|
|
103
91
|
elif name == "delete_data":
|
|
104
92
|
if name not in _cache:
|
|
105
|
-
_cache[name] = SupabaseDeleteData(
|
|
106
|
-
skill_store=store,
|
|
107
|
-
)
|
|
93
|
+
_cache[name] = SupabaseDeleteData()
|
|
108
94
|
return _cache[name]
|
|
109
95
|
elif name == "invoke_function":
|
|
110
96
|
if name not in _cache:
|
|
111
|
-
_cache[name] = SupabaseInvokeFunction(
|
|
112
|
-
skill_store=store,
|
|
113
|
-
)
|
|
97
|
+
_cache[name] = SupabaseInvokeFunction()
|
|
114
98
|
return _cache[name]
|
|
115
99
|
else:
|
|
116
100
|
logger.warning(f"Unknown Supabase skill: {name}")
|
|
@@ -4,7 +4,6 @@ from langchain_core.tools import ToolException
|
|
|
4
4
|
from pydantic import BaseModel, Field
|
|
5
5
|
|
|
6
6
|
from intentkit.abstracts.graph import AgentContext
|
|
7
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
8
7
|
from intentkit.skills.base import IntentKitSkill
|
|
9
8
|
|
|
10
9
|
|
|
@@ -14,9 +13,6 @@ class SupabaseBaseTool(IntentKitSkill):
|
|
|
14
13
|
name: str = Field(description="The name of the tool")
|
|
15
14
|
description: str = Field(description="A description of what the tool does")
|
|
16
15
|
args_schema: Type[BaseModel]
|
|
17
|
-
skill_store: SkillStoreABC = Field(
|
|
18
|
-
description="The skill store for persisting data"
|
|
19
|
-
)
|
|
20
16
|
|
|
21
17
|
@property
|
|
22
18
|
def category(self) -> str:
|
|
@@ -4,7 +4,6 @@ from typing import TYPE_CHECKING, Optional, TypedDict
|
|
|
4
4
|
|
|
5
5
|
from coinbase_agentkit import superfluid_action_provider
|
|
6
6
|
|
|
7
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
8
7
|
from intentkit.skills.base import (
|
|
9
8
|
SkillConfig,
|
|
10
9
|
SkillState,
|
|
@@ -32,7 +31,6 @@ class Config(SkillConfig):
|
|
|
32
31
|
async def get_skills(
|
|
33
32
|
config: "Config",
|
|
34
33
|
is_private: bool,
|
|
35
|
-
store: SkillStoreABC,
|
|
36
34
|
agent_id: str,
|
|
37
35
|
agent: Optional["Agent"] = None,
|
|
38
36
|
**_,
|
|
@@ -47,7 +45,7 @@ async def get_skills(
|
|
|
47
45
|
available_skills.append(skill_name)
|
|
48
46
|
|
|
49
47
|
actions = await get_agentkit_actions(
|
|
50
|
-
agent_id,
|
|
48
|
+
agent_id, [superfluid_action_provider], agent=agent
|
|
51
49
|
)
|
|
52
50
|
tools: list[SuperfluidBaseTool] = []
|
|
53
51
|
for skill in available_skills:
|
|
@@ -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, SkillOwnerState
|
|
8
7
|
from intentkit.skills.system.add_autonomous_task import AddAutonomousTask
|
|
9
8
|
from intentkit.skills.system.base import SystemBaseTool
|
|
@@ -37,7 +36,6 @@ class Config(SkillConfig):
|
|
|
37
36
|
async def get_skills(
|
|
38
37
|
config: "Config",
|
|
39
38
|
is_private: bool,
|
|
40
|
-
store: SkillStoreABC,
|
|
41
39
|
**_,
|
|
42
40
|
) -> list[SystemBaseTool]:
|
|
43
41
|
"""Get all system skills.
|
|
@@ -45,7 +43,6 @@ async def get_skills(
|
|
|
45
43
|
Args:
|
|
46
44
|
config: The configuration for system skills.
|
|
47
45
|
is_private: Whether to include private skills.
|
|
48
|
-
store: The skill store for persisting data.
|
|
49
46
|
|
|
50
47
|
Returns:
|
|
51
48
|
A list of system skills.
|
|
@@ -62,7 +59,7 @@ async def get_skills(
|
|
|
62
59
|
# Get each skill using the cached getter
|
|
63
60
|
result = []
|
|
64
61
|
for name in available_skills:
|
|
65
|
-
skill = get_system_skill(name
|
|
62
|
+
skill = get_system_skill(name)
|
|
66
63
|
if skill:
|
|
67
64
|
result.append(skill)
|
|
68
65
|
return result
|
|
@@ -70,52 +67,38 @@ async def get_skills(
|
|
|
70
67
|
|
|
71
68
|
def get_system_skill(
|
|
72
69
|
name: str,
|
|
73
|
-
store: SkillStoreABC,
|
|
74
70
|
) -> SystemBaseTool:
|
|
75
71
|
"""Get a system skill by name.
|
|
76
72
|
|
|
77
73
|
Args:
|
|
78
74
|
name: The name of the skill to get
|
|
79
|
-
store: The skill store for persisting data
|
|
80
75
|
|
|
81
76
|
Returns:
|
|
82
77
|
The requested system skill
|
|
83
78
|
"""
|
|
84
79
|
if name == "read_agent_api_key":
|
|
85
80
|
if name not in _cache:
|
|
86
|
-
_cache[name] = ReadAgentApiKey(
|
|
87
|
-
skill_store=store,
|
|
88
|
-
)
|
|
81
|
+
_cache[name] = ReadAgentApiKey()
|
|
89
82
|
return _cache[name]
|
|
90
83
|
elif name == "regenerate_agent_api_key":
|
|
91
84
|
if name not in _cache:
|
|
92
|
-
_cache[name] = RegenerateAgentApiKey(
|
|
93
|
-
skill_store=store,
|
|
94
|
-
)
|
|
85
|
+
_cache[name] = RegenerateAgentApiKey()
|
|
95
86
|
return _cache[name]
|
|
96
87
|
elif name == "list_autonomous_tasks":
|
|
97
88
|
if name not in _cache:
|
|
98
|
-
_cache[name] = ListAutonomousTasks(
|
|
99
|
-
skill_store=store,
|
|
100
|
-
)
|
|
89
|
+
_cache[name] = ListAutonomousTasks()
|
|
101
90
|
return _cache[name]
|
|
102
91
|
elif name == "add_autonomous_task":
|
|
103
92
|
if name not in _cache:
|
|
104
|
-
_cache[name] = AddAutonomousTask(
|
|
105
|
-
skill_store=store,
|
|
106
|
-
)
|
|
93
|
+
_cache[name] = AddAutonomousTask()
|
|
107
94
|
return _cache[name]
|
|
108
95
|
elif name == "delete_autonomous_task":
|
|
109
96
|
if name not in _cache:
|
|
110
|
-
_cache[name] = DeleteAutonomousTask(
|
|
111
|
-
skill_store=store,
|
|
112
|
-
)
|
|
97
|
+
_cache[name] = DeleteAutonomousTask()
|
|
113
98
|
return _cache[name]
|
|
114
99
|
elif name == "edit_autonomous_task":
|
|
115
100
|
if name not in _cache:
|
|
116
|
-
_cache[name] = EditAutonomousTask(
|
|
117
|
-
skill_store=store,
|
|
118
|
-
)
|
|
101
|
+
_cache[name] = EditAutonomousTask()
|
|
119
102
|
return _cache[name]
|
|
120
103
|
else:
|
|
121
104
|
logger.warning(f"Unknown system skill: {name}")
|
|
@@ -75,7 +75,7 @@ class AddAutonomousTask(SystemBaseTool):
|
|
|
75
75
|
AddAutonomousTaskOutput: The created task
|
|
76
76
|
"""
|
|
77
77
|
context = self.get_context()
|
|
78
|
-
|
|
78
|
+
agent = context.agent
|
|
79
79
|
|
|
80
80
|
task = AgentAutonomous(
|
|
81
81
|
name=name,
|
|
@@ -86,6 +86,6 @@ class AddAutonomousTask(SystemBaseTool):
|
|
|
86
86
|
enabled=True,
|
|
87
87
|
)
|
|
88
88
|
|
|
89
|
-
created_task = await
|
|
89
|
+
created_task = await agent.add_autonomous_task(task)
|
|
90
90
|
|
|
91
91
|
return AddAutonomousTaskOutput(task=created_task)
|
|
@@ -45,9 +45,9 @@ class DeleteAutonomousTask(SystemBaseTool):
|
|
|
45
45
|
DeleteAutonomousTaskOutput: Confirmation of deletion
|
|
46
46
|
"""
|
|
47
47
|
context = self.get_context()
|
|
48
|
-
|
|
48
|
+
agent = context.agent
|
|
49
49
|
|
|
50
|
-
await
|
|
50
|
+
await agent.delete_autonomous_task(task_id)
|
|
51
51
|
|
|
52
52
|
return DeleteAutonomousTaskOutput(
|
|
53
53
|
success=True, message=f"Successfully deleted autonomous task {task_id}"
|
|
@@ -85,7 +85,7 @@ class EditAutonomousTask(SystemBaseTool):
|
|
|
85
85
|
EditAutonomousTaskOutput: The updated task
|
|
86
86
|
"""
|
|
87
87
|
context = self.get_context()
|
|
88
|
-
|
|
88
|
+
agent = context.agent
|
|
89
89
|
|
|
90
90
|
if minutes is not None and cron is not None:
|
|
91
91
|
raise ValueError("minutes and cron are mutually exclusive")
|
|
@@ -107,8 +107,6 @@ class EditAutonomousTask(SystemBaseTool):
|
|
|
107
107
|
if enabled is not None:
|
|
108
108
|
task_updates["enabled"] = enabled
|
|
109
109
|
|
|
110
|
-
updated_task = await
|
|
111
|
-
agent_id, task_id, task_updates
|
|
112
|
-
)
|
|
110
|
+
updated_task = await agent.update_autonomous_task(task_id, task_updates)
|
|
113
111
|
|
|
114
112
|
return EditAutonomousTaskOutput(task=updated_task)
|
|
@@ -43,8 +43,8 @@ class ListAutonomousTasks(SystemBaseTool):
|
|
|
43
43
|
ListAutonomousTasksOutput: List of autonomous tasks
|
|
44
44
|
"""
|
|
45
45
|
context = self.get_context()
|
|
46
|
-
|
|
46
|
+
agent = context.agent
|
|
47
47
|
|
|
48
|
-
tasks = await
|
|
48
|
+
tasks = await agent.list_autonomous_tasks()
|
|
49
49
|
|
|
50
50
|
return ListAutonomousTasksOutput(tasks=tasks)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from pydantic import BaseModel, Field
|
|
2
2
|
|
|
3
|
+
from intentkit.config.config import config
|
|
4
|
+
from intentkit.models.agent_data import AgentData
|
|
3
5
|
from intentkit.skills.system.base import SystemBaseTool
|
|
4
6
|
|
|
5
7
|
|
|
@@ -41,11 +43,11 @@ class ReadAgentApiKey(SystemBaseTool):
|
|
|
41
43
|
context = self.get_context()
|
|
42
44
|
agent_id = context.agent_id
|
|
43
45
|
|
|
44
|
-
# Get agent data from
|
|
45
|
-
agent_data = await
|
|
46
|
+
# Get agent data from the database
|
|
47
|
+
agent_data = await AgentData.get(agent_id)
|
|
46
48
|
|
|
47
49
|
# Get API base URL from system config
|
|
48
|
-
open_api_base_url =
|
|
50
|
+
open_api_base_url = config.open_api_base_url
|
|
49
51
|
api_endpoint = f"{open_api_base_url}/v1/chat/completions"
|
|
50
52
|
|
|
51
53
|
# Check if API keys exist
|
|
@@ -72,7 +74,7 @@ class ReadAgentApiKey(SystemBaseTool):
|
|
|
72
74
|
update_data["api_key_public"] = new_public_api_key
|
|
73
75
|
|
|
74
76
|
if update_data:
|
|
75
|
-
await
|
|
77
|
+
await AgentData.patch(agent_id, update_data)
|
|
76
78
|
|
|
77
79
|
return ReadAgentApiKeyOutput(
|
|
78
80
|
api_key=new_api_key,
|