intentkit 0.6.9.dev1__py3-none-any.whl → 0.6.10.dev1__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.

Files changed (168) hide show
  1. intentkit/__init__.py +1 -1
  2. intentkit/abstracts/graph.py +17 -2
  3. intentkit/core/engine.py +29 -30
  4. intentkit/core/node.py +10 -20
  5. intentkit/models/agent.py +3 -0
  6. intentkit/models/chat.py +9 -1
  7. intentkit/skills/acolyt/ask.py +2 -5
  8. intentkit/skills/acolyt/base.py +16 -6
  9. intentkit/skills/aixbt/__init__.py +3 -7
  10. intentkit/skills/aixbt/projects.py +12 -36
  11. intentkit/skills/allora/base.py +16 -6
  12. intentkit/skills/allora/price.py +2 -4
  13. intentkit/skills/base.py +8 -1
  14. intentkit/skills/carv/base.py +12 -10
  15. intentkit/skills/carv/fetch_news.py +90 -92
  16. intentkit/skills/carv/onchain_query.py +162 -164
  17. intentkit/skills/carv/token_info_and_price.py +108 -110
  18. intentkit/skills/chainlist/chain_lookup.py +1 -2
  19. intentkit/skills/common/current_time.py +1 -2
  20. intentkit/skills/cookiefun/base.py +20 -12
  21. intentkit/skills/cookiefun/get_account_details.py +1 -3
  22. intentkit/skills/cookiefun/get_account_feed.py +1 -3
  23. intentkit/skills/cookiefun/get_account_smart_followers.py +1 -3
  24. intentkit/skills/cookiefun/get_sectors.py +2 -3
  25. intentkit/skills/cookiefun/search_accounts.py +1 -3
  26. intentkit/skills/cryptocompare/fetch_news.py +3 -4
  27. intentkit/skills/cryptocompare/fetch_price.py +3 -4
  28. intentkit/skills/cryptocompare/fetch_top_exchanges.py +3 -4
  29. intentkit/skills/cryptocompare/fetch_top_market_cap.py +3 -4
  30. intentkit/skills/cryptocompare/fetch_top_volume.py +3 -4
  31. intentkit/skills/cryptocompare/fetch_trading_signals.py +3 -4
  32. intentkit/skills/cryptopanic/base.py +13 -9
  33. intentkit/skills/cryptopanic/fetch_crypto_news.py +150 -153
  34. intentkit/skills/cryptopanic/fetch_crypto_sentiment.py +133 -136
  35. intentkit/skills/dapplooker/base.py +16 -6
  36. intentkit/skills/dapplooker/dapplooker_token_data.py +2 -4
  37. intentkit/skills/defillama/coins/fetch_batch_historical_prices.py +2 -3
  38. intentkit/skills/defillama/coins/fetch_block.py +2 -3
  39. intentkit/skills/defillama/coins/fetch_current_prices.py +2 -5
  40. intentkit/skills/defillama/coins/fetch_first_price.py +2 -5
  41. intentkit/skills/defillama/coins/fetch_historical_prices.py +2 -3
  42. intentkit/skills/defillama/coins/fetch_price_chart.py +2 -5
  43. intentkit/skills/defillama/coins/fetch_price_percentage.py +2 -5
  44. intentkit/skills/defillama/fees/fetch_fees_overview.py +2 -3
  45. intentkit/skills/defillama/stablecoins/fetch_stablecoin_chains.py +2 -3
  46. intentkit/skills/defillama/stablecoins/fetch_stablecoin_charts.py +2 -3
  47. intentkit/skills/defillama/stablecoins/fetch_stablecoin_prices.py +2 -3
  48. intentkit/skills/defillama/stablecoins/fetch_stablecoins.py +2 -3
  49. intentkit/skills/defillama/tvl/fetch_chain_historical_tvl.py +2 -5
  50. intentkit/skills/defillama/tvl/fetch_chains.py +2 -3
  51. intentkit/skills/defillama/tvl/fetch_historical_tvl.py +2 -3
  52. intentkit/skills/defillama/tvl/fetch_protocol.py +2 -5
  53. intentkit/skills/defillama/tvl/fetch_protocol_current_tvl.py +2 -5
  54. intentkit/skills/defillama/tvl/fetch_protocols.py +2 -3
  55. intentkit/skills/defillama/volumes/fetch_dex_overview.py +2 -3
  56. intentkit/skills/defillama/volumes/fetch_dex_summary.py +2 -5
  57. intentkit/skills/defillama/volumes/fetch_options_overview.py +2 -3
  58. intentkit/skills/defillama/yields/fetch_pool_chart.py +2 -5
  59. intentkit/skills/defillama/yields/fetch_pools.py +2 -3
  60. intentkit/skills/dune_analytics/base.py +15 -9
  61. intentkit/skills/dune_analytics/fetch_kol_buys.py +125 -128
  62. intentkit/skills/dune_analytics/fetch_nation_metrics.py +234 -237
  63. intentkit/skills/elfa/base.py +16 -6
  64. intentkit/skills/elfa/mention.py +2 -7
  65. intentkit/skills/elfa/stats.py +2 -6
  66. intentkit/skills/elfa/tokens.py +1 -4
  67. intentkit/skills/enso/base.py +25 -13
  68. intentkit/skills/enso/best_yield.py +1 -4
  69. intentkit/skills/enso/networks.py +2 -5
  70. intentkit/skills/enso/prices.py +1 -5
  71. intentkit/skills/enso/route.py +2 -5
  72. intentkit/skills/enso/tokens.py +1 -4
  73. intentkit/skills/enso/wallet.py +3 -9
  74. intentkit/skills/firecrawl/base.py +16 -6
  75. intentkit/skills/firecrawl/clear.py +1 -3
  76. intentkit/skills/firecrawl/crawl.py +7 -8
  77. intentkit/skills/firecrawl/query.py +7 -9
  78. intentkit/skills/firecrawl/scrape.py +7 -8
  79. intentkit/skills/github/github_search.py +1 -3
  80. intentkit/skills/heurist/base.py +15 -0
  81. intentkit/skills/heurist/image_generation_animagine_xl.py +3 -4
  82. intentkit/skills/heurist/image_generation_arthemy_comics.py +3 -4
  83. intentkit/skills/heurist/image_generation_arthemy_real.py +3 -4
  84. intentkit/skills/heurist/image_generation_braindance.py +3 -4
  85. intentkit/skills/heurist/image_generation_cyber_realistic_xl.py +3 -4
  86. intentkit/skills/heurist/image_generation_flux_1_dev.py +3 -4
  87. intentkit/skills/heurist/image_generation_sdxl.py +3 -4
  88. intentkit/skills/http/get.py +0 -2
  89. intentkit/skills/http/post.py +0 -2
  90. intentkit/skills/http/put.py +0 -2
  91. intentkit/skills/lifi/token_execute.py +1 -3
  92. intentkit/skills/lifi/token_quote.py +0 -2
  93. intentkit/skills/moralis/base.py +15 -1
  94. intentkit/skills/nation/nft_check.py +2 -5
  95. intentkit/skills/openai/base.py +14 -5
  96. intentkit/skills/openai/dalle_image_generation.py +6 -5
  97. intentkit/skills/openai/gpt_image_generation.py +6 -5
  98. intentkit/skills/openai/gpt_image_to_image.py +6 -5
  99. intentkit/skills/openai/image_to_text.py +6 -6
  100. intentkit/skills/portfolio/base.py +4 -3
  101. intentkit/skills/portfolio/token_balances.py +2 -4
  102. intentkit/skills/portfolio/wallet_approvals.py +2 -4
  103. intentkit/skills/portfolio/wallet_defi_positions.py +3 -4
  104. intentkit/skills/portfolio/wallet_history.py +2 -4
  105. intentkit/skills/portfolio/wallet_net_worth.py +2 -4
  106. intentkit/skills/portfolio/wallet_nfts.py +2 -4
  107. intentkit/skills/portfolio/wallet_profitability.py +2 -4
  108. intentkit/skills/portfolio/wallet_profitability_summary.py +2 -4
  109. intentkit/skills/portfolio/wallet_stats.py +2 -4
  110. intentkit/skills/portfolio/wallet_swaps.py +2 -4
  111. intentkit/skills/slack/base.py +18 -0
  112. intentkit/skills/slack/get_channel.py +3 -4
  113. intentkit/skills/slack/get_message.py +3 -4
  114. intentkit/skills/slack/schedule_message.py +3 -4
  115. intentkit/skills/slack/send_message.py +3 -4
  116. intentkit/skills/supabase/delete_data.py +3 -6
  117. intentkit/skills/supabase/fetch_data.py +3 -6
  118. intentkit/skills/supabase/insert_data.py +3 -6
  119. intentkit/skills/supabase/invoke_function.py +3 -6
  120. intentkit/skills/supabase/update_data.py +3 -6
  121. intentkit/skills/supabase/upsert_data.py +3 -6
  122. intentkit/skills/system/add_autonomous_task.py +1 -3
  123. intentkit/skills/system/delete_autonomous_task.py +1 -3
  124. intentkit/skills/system/edit_autonomous_task.py +1 -3
  125. intentkit/skills/system/list_autonomous_tasks.py +1 -3
  126. intentkit/skills/system/read_agent_api_key.py +2 -3
  127. intentkit/skills/system/regenerate_agent_api_key.py +2 -5
  128. intentkit/skills/tavily/base.py +14 -5
  129. intentkit/skills/tavily/tavily_extract.py +7 -8
  130. intentkit/skills/tavily/tavily_search.py +11 -9
  131. intentkit/skills/token/base.py +4 -6
  132. intentkit/skills/token/erc20_transfers.py +2 -4
  133. intentkit/skills/token/token_analytics.py +2 -4
  134. intentkit/skills/token/token_price.py +2 -4
  135. intentkit/skills/token/token_search.py +2 -4
  136. intentkit/skills/twitter/base.py +41 -0
  137. intentkit/skills/twitter/follow_user.py +4 -4
  138. intentkit/skills/twitter/get_mentions.py +4 -4
  139. intentkit/skills/twitter/get_timeline.py +4 -4
  140. intentkit/skills/twitter/get_user_by_username.py +4 -4
  141. intentkit/skills/twitter/get_user_tweets.py +4 -4
  142. intentkit/skills/twitter/like_tweet.py +4 -4
  143. intentkit/skills/twitter/post_tweet.py +3 -4
  144. intentkit/skills/twitter/reply_tweet.py +3 -4
  145. intentkit/skills/twitter/retweet.py +4 -4
  146. intentkit/skills/twitter/search_tweets.py +4 -4
  147. intentkit/skills/unrealspeech/base.py +16 -0
  148. intentkit/skills/unrealspeech/text_to_speech.py +4 -4
  149. intentkit/skills/venice_audio/base.py +11 -9
  150. intentkit/skills/venice_audio/venice_audio.py +238 -240
  151. intentkit/skills/venice_image/base.py +23 -19
  152. intentkit/skills/venice_image/image_enhance/image_enhance.py +78 -80
  153. intentkit/skills/venice_image/image_generation/image_generation_base.py +115 -117
  154. intentkit/skills/venice_image/image_upscale/image_upscale.py +88 -90
  155. intentkit/skills/venice_image/image_vision/image_vision.py +98 -100
  156. intentkit/skills/web_scraper/document_indexer.py +3 -5
  157. intentkit/skills/web_scraper/scrape_and_index.py +14 -17
  158. intentkit/skills/web_scraper/website_indexer.py +8 -10
  159. intentkit/skills/xmtp/README.md +110 -0
  160. intentkit/skills/xmtp/__init__.py +82 -0
  161. intentkit/skills/xmtp/base.py +13 -0
  162. intentkit/skills/xmtp/schema.json +41 -0
  163. intentkit/skills/xmtp/transfer.py +170 -0
  164. intentkit/skills/xmtp/xmtp.svg +26 -0
  165. {intentkit-0.6.9.dev1.dist-info → intentkit-0.6.10.dev1.dist-info}/METADATA +3 -3
  166. {intentkit-0.6.9.dev1.dist-info → intentkit-0.6.10.dev1.dist-info}/RECORD +168 -162
  167. {intentkit-0.6.9.dev1.dist-info → intentkit-0.6.10.dev1.dist-info}/WHEEL +0 -0
  168. {intentkit-0.6.9.dev1.dist-info → intentkit-0.6.10.dev1.dist-info}/licenses/LICENSE +0 -0
@@ -1,7 +1,6 @@
1
1
  import logging
2
2
  from typing import Any, Dict, List, Optional, Type
3
3
 
4
- from langchain_core.runnables import RunnableConfig
5
4
  from pydantic import BaseModel, Field
6
5
 
7
6
  from intentkit.skills.portfolio.base import PortfolioBaseTool
@@ -50,7 +49,6 @@ class WalletProfitability(PortfolioBaseTool):
50
49
  chain: str = DEFAULT_CHAIN,
51
50
  days: Optional[str] = "all",
52
51
  token_addresses: Optional[List[str]] = None,
53
- config: RunnableConfig = None,
54
52
  **kwargs,
55
53
  ) -> Dict[str, Any]:
56
54
  """Fetch detailed wallet profitability from Moralis.
@@ -65,13 +63,13 @@ class WalletProfitability(PortfolioBaseTool):
65
63
  Returns:
66
64
  Dict containing wallet profitability breakdown data
67
65
  """
68
- context = self.context_from_config(config)
66
+ context = self.get_context()
69
67
  logger.debug(
70
68
  f"wallet_profitability.py: Fetching profitability breakdown with context {context}"
71
69
  )
72
70
 
73
71
  # Get the API key from the agent's configuration
74
- api_key = self.get_api_key(context)
72
+ api_key = self.get_api_key()
75
73
  if not api_key:
76
74
  return {"error": "No Moralis API key provided in the configuration."}
77
75
 
@@ -1,7 +1,6 @@
1
1
  import logging
2
2
  from typing import Any, Dict, Optional, Type
3
3
 
4
- from langchain_core.runnables import RunnableConfig
5
4
  from pydantic import BaseModel, Field
6
5
 
7
6
  from intentkit.skills.portfolio.base import PortfolioBaseTool
@@ -45,7 +44,6 @@ class WalletProfitabilitySummary(PortfolioBaseTool):
45
44
  address: str,
46
45
  chain: str = DEFAULT_CHAIN,
47
46
  days: Optional[str] = "all",
48
- config: RunnableConfig = None,
49
47
  **kwargs,
50
48
  ) -> Dict[str, Any]:
51
49
  """Fetch wallet profitability summary from Moralis.
@@ -59,13 +57,13 @@ class WalletProfitabilitySummary(PortfolioBaseTool):
59
57
  Returns:
60
58
  Dict containing wallet profitability summary data
61
59
  """
62
- context = self.context_from_config(config)
60
+ context = self.get_context()
63
61
  logger.debug(
64
62
  f"wallet_profitability_summary.py: Fetching profitability summary with context {context}"
65
63
  )
66
64
 
67
65
  # Get the API key from the agent's configuration
68
- api_key = self.get_api_key(context)
66
+ api_key = self.get_api_key()
69
67
  if not api_key:
70
68
  return {"error": "No Moralis API key provided in the configuration."}
71
69
 
@@ -1,7 +1,6 @@
1
1
  import logging
2
2
  from typing import Any, Dict, Type
3
3
 
4
- from langchain_core.runnables import RunnableConfig
5
4
  from pydantic import BaseModel, Field
6
5
 
7
6
  from intentkit.skills.portfolio.base import PortfolioBaseTool
@@ -38,7 +37,6 @@ class WalletStats(PortfolioBaseTool):
38
37
  self,
39
38
  address: str,
40
39
  chain: str = DEFAULT_CHAIN,
41
- config: RunnableConfig = None,
42
40
  **kwargs,
43
41
  ) -> Dict[str, Any]:
44
42
  """Fetch wallet stats from Moralis.
@@ -51,11 +49,11 @@ class WalletStats(PortfolioBaseTool):
51
49
  Returns:
52
50
  Dict containing wallet stats data
53
51
  """
54
- context = self.context_from_config(config)
52
+ context = self.get_context()
55
53
  logger.debug(f"wallet_stats.py: Fetching wallet stats with context {context}")
56
54
 
57
55
  # Get the API key from the agent's configuration
58
- api_key = self.get_api_key(context)
56
+ api_key = self.get_api_key()
59
57
  if not api_key:
60
58
  return {"error": "No Moralis API key provided in the configuration."}
61
59
 
@@ -1,7 +1,6 @@
1
1
  import logging
2
2
  from typing import Any, Dict, List, Optional, Type
3
3
 
4
- from langchain_core.runnables import RunnableConfig
5
4
  from pydantic import BaseModel, Field
6
5
 
7
6
  from intentkit.skills.portfolio.base import PortfolioBaseTool
@@ -82,7 +81,6 @@ class WalletSwaps(PortfolioBaseTool):
82
81
  to_date: Optional[str] = None,
83
82
  order: Optional[str] = DEFAULT_ORDER,
84
83
  transaction_types: Optional[List[str]] = None,
85
- config: RunnableConfig = None,
86
84
  **kwargs,
87
85
  ) -> Dict[str, Any]:
88
86
  """Fetch wallet swap transactions from Moralis.
@@ -103,11 +101,11 @@ class WalletSwaps(PortfolioBaseTool):
103
101
  Returns:
104
102
  Dict containing wallet swaps data
105
103
  """
106
- context = self.context_from_config(config)
104
+ context = self.get_context()
107
105
  logger.debug(f"wallet_swaps.py: Fetching wallet swaps with context {context}")
108
106
 
109
107
  # Get the API key from the agent's configuration
110
- api_key = self.get_api_key(context)
108
+ api_key = self.get_api_key()
111
109
  if not api_key:
112
110
  return {"error": "No Moralis API key provided in the configuration."}
113
111
 
@@ -1,5 +1,6 @@
1
1
  from typing import Optional, Type
2
2
 
3
+ from langchain.tools.base import ToolException
3
4
  from pydantic import BaseModel, Field
4
5
  from slack_sdk import WebClient
5
6
 
@@ -17,6 +18,23 @@ class SlackBaseTool(IntentKitSkill):
17
18
  description="The skill store for persisting data"
18
19
  )
19
20
 
21
+ def get_api_key(self) -> str:
22
+ context = self.get_context()
23
+ skill_config = context.agent.skill_config(self.category)
24
+ api_key_provider = skill_config.get("api_key_provider")
25
+ if api_key_provider == "agent_owner":
26
+ slack_bot_token = skill_config.get("slack_bot_token")
27
+ if slack_bot_token:
28
+ return slack_bot_token
29
+ else:
30
+ raise ToolException(
31
+ "No slack_bot_token found in agent_owner configuration"
32
+ )
33
+ else:
34
+ raise ToolException(
35
+ f"Invalid API key provider: {api_key_provider}. Only 'agent_owner' is supported for Slack."
36
+ )
37
+
20
38
  @property
21
39
  def category(self) -> str:
22
40
  return "slack"
@@ -1,6 +1,5 @@
1
1
  from typing import Any, Dict, Optional, Type, Union
2
2
 
3
- from langchain_core.runnables import RunnableConfig
4
3
  from pydantic import BaseModel, Field
5
4
 
6
5
  from intentkit.skills.slack.base import SlackBaseTool, SlackChannel
@@ -28,7 +27,6 @@ class SlackGetChannel(SlackBaseTool):
28
27
 
29
28
  async def _arun(
30
29
  self,
31
- config: RunnableConfig,
32
30
  channel_id: Optional[str] = None,
33
31
  channel_name: Optional[str] = None,
34
32
  **kwargs,
@@ -46,8 +44,9 @@ class SlackGetChannel(SlackBaseTool):
46
44
  ValueError: If neither channel_id nor channel_name is provided
47
45
  Exception: If an error occurs getting the channel information
48
46
  """
49
- context = self.context_from_config(config)
50
- client = self.get_client(context.config.get("slack_bot_token"))
47
+ context = self.get_context()
48
+ skill_config = context.agent.skill_config(self.category)
49
+ client = self.get_client(skill_config.get("slack_bot_token"))
51
50
 
52
51
  try:
53
52
  # If no channel specified, return a dict of all channels
@@ -1,6 +1,5 @@
1
1
  from typing import Any, Dict, Optional, Type
2
2
 
3
- from langchain_core.runnables import RunnableConfig
4
3
  from pydantic import BaseModel, Field
5
4
 
6
5
  from intentkit.skills.slack.base import SlackBaseTool, SlackMessage
@@ -35,7 +34,6 @@ class SlackGetMessage(SlackBaseTool):
35
34
 
36
35
  async def _arun(
37
36
  self,
38
- config: RunnableConfig,
39
37
  channel_id: str,
40
38
  ts: Optional[str] = None,
41
39
  thread_ts: Optional[str] = None,
@@ -56,8 +54,9 @@ class SlackGetMessage(SlackBaseTool):
56
54
  Raises:
57
55
  Exception: If an error occurs getting the messages
58
56
  """
59
- context = self.context_from_config(config)
60
- client = self.get_client(context.config.get("slack_bot_token"))
57
+ context = self.get_context()
58
+ skill_config = context.agent.skill_config(self.category)
59
+ client = self.get_client(skill_config.get("slack_bot_token"))
61
60
 
62
61
  try:
63
62
  # Ensure limit is within bounds
@@ -1,7 +1,6 @@
1
1
  from datetime import datetime
2
2
  from typing import Any, Dict, Optional, Type
3
3
 
4
- from langchain_core.runnables import RunnableConfig
5
4
  from pydantic import BaseModel, Field
6
5
 
7
6
  from intentkit.skills.slack.base import SlackBaseTool
@@ -34,7 +33,6 @@ class SlackScheduleMessage(SlackBaseTool):
34
33
 
35
34
  async def _arun(
36
35
  self,
37
- config: RunnableConfig,
38
36
  channel_id: str,
39
37
  text: str,
40
38
  post_at: str,
@@ -55,8 +53,9 @@ class SlackScheduleMessage(SlackBaseTool):
55
53
  Raises:
56
54
  Exception: If an error occurs scheduling the message
57
55
  """
58
- context = self.context_from_config(config)
59
- client = self.get_client(context.config.get("slack_bot_token"))
56
+ context = self.get_context()
57
+ skill_config = context.agent.skill_config(self.category)
58
+ client = self.get_client(skill_config.get("slack_bot_token"))
60
59
 
61
60
  try:
62
61
  # Convert ISO datetime string to Unix timestamp
@@ -1,6 +1,5 @@
1
1
  from typing import Optional, Type
2
2
 
3
- from langchain_core.runnables import RunnableConfig
4
3
  from pydantic import BaseModel, Field
5
4
 
6
5
  from intentkit.skills.slack.base import SlackBaseTool, SlackMessage
@@ -30,7 +29,6 @@ class SlackSendMessage(SlackBaseTool):
30
29
 
31
30
  async def _arun(
32
31
  self,
33
- config: RunnableConfig,
34
32
  channel_id: str,
35
33
  text: str,
36
34
  thread_ts: Optional[str] = None,
@@ -49,8 +47,9 @@ class SlackSendMessage(SlackBaseTool):
49
47
  Raises:
50
48
  Exception: If an error occurs sending the message
51
49
  """
52
- context = self.context_from_config(config)
53
- client = self.get_client(context.config.get("slack_bot_token"))
50
+ context = self.get_context()
51
+ skill_config = context.agent.skill_config(self.category)
52
+ client = self.get_client(skill_config.get("slack_bot_token"))
54
53
 
55
54
  try:
56
55
  # Prepare message parameters
@@ -1,7 +1,6 @@
1
1
  import logging
2
2
  from typing import Any, Dict, Type
3
3
 
4
- from langchain_core.runnables import RunnableConfig
5
4
  from langchain_core.tools import ToolException
6
5
  from pydantic import BaseModel, Field
7
6
  from supabase import Client, create_client
@@ -42,18 +41,16 @@ class SupabaseDeleteData(SupabaseBaseTool):
42
41
  table: str,
43
42
  filters: Dict[str, Any],
44
43
  returning: str = "*",
45
- config: RunnableConfig = None,
46
44
  **kwargs,
47
45
  ):
48
46
  try:
49
- context = self.context_from_config(config)
47
+ context = self.get_context()
48
+ skill_config = context.agent.skill_config(self.category)
50
49
 
51
50
  # Validate table access for public mode
52
51
  self.validate_table_access(table, context)
53
52
 
54
- supabase_url, supabase_key = self.get_supabase_config(
55
- context.config, context
56
- )
53
+ supabase_url, supabase_key = self.get_supabase_config(skill_config, context)
57
54
 
58
55
  # Create Supabase client
59
56
  supabase: Client = create_client(supabase_url, supabase_key)
@@ -1,7 +1,6 @@
1
1
  import logging
2
2
  from typing import Any, Dict, Optional, Type
3
3
 
4
- from langchain_core.runnables import RunnableConfig
5
4
  from langchain_core.tools import ToolException
6
5
  from pydantic import BaseModel, Field
7
6
  from supabase import Client, create_client
@@ -57,14 +56,12 @@ class SupabaseFetchData(SupabaseBaseTool):
57
56
  ascending: bool = True,
58
57
  limit: Optional[int] = None,
59
58
  offset: Optional[int] = None,
60
- config: RunnableConfig = None,
61
59
  **kwargs,
62
60
  ):
63
61
  try:
64
- context = self.context_from_config(config)
65
- supabase_url, supabase_key = self.get_supabase_config(
66
- context.config, context
67
- )
62
+ context = self.get_context()
63
+ skill_config = context.agent.skill_config(self.category)
64
+ supabase_url, supabase_key = self.get_supabase_config(skill_config, context)
68
65
 
69
66
  # Create Supabase client
70
67
  supabase: Client = create_client(supabase_url, supabase_key)
@@ -1,7 +1,6 @@
1
1
  import logging
2
2
  from typing import Any, Dict, List, Type, Union
3
3
 
4
- from langchain_core.runnables import RunnableConfig
5
4
  from langchain_core.tools import ToolException
6
5
  from pydantic import BaseModel, Field
7
6
  from supabase import Client, create_client
@@ -42,18 +41,16 @@ class SupabaseInsertData(SupabaseBaseTool):
42
41
  table: str,
43
42
  data: Union[Dict[str, Any], List[Dict[str, Any]]],
44
43
  returning: str = "*",
45
- config: RunnableConfig = None,
46
44
  **kwargs,
47
45
  ):
48
46
  try:
49
- context = self.context_from_config(config)
47
+ context = self.get_context()
48
+ skill_config = context.agent.skill_config(self.category)
50
49
 
51
50
  # Validate table access for public mode
52
51
  self.validate_table_access(table, context)
53
52
 
54
- supabase_url, supabase_key = self.get_supabase_config(
55
- context.config, context
56
- )
53
+ supabase_url, supabase_key = self.get_supabase_config(skill_config, context)
57
54
 
58
55
  # Create Supabase client
59
56
  supabase: Client = create_client(supabase_url, supabase_key)
@@ -1,7 +1,6 @@
1
1
  import logging
2
2
  from typing import Any, Dict, Optional, Type
3
3
 
4
- from langchain_core.runnables import RunnableConfig
5
4
  from langchain_core.tools import ToolException
6
5
  from pydantic import BaseModel, Field
7
6
  from supabase import Client, create_client
@@ -41,14 +40,12 @@ class SupabaseInvokeFunction(SupabaseBaseTool):
41
40
  function_name: str,
42
41
  parameters: Optional[Dict[str, Any]] = None,
43
42
  headers: Optional[Dict[str, str]] = None,
44
- config: RunnableConfig = None,
45
43
  **kwargs,
46
44
  ):
47
45
  try:
48
- context = self.context_from_config(config)
49
- supabase_url, supabase_key = self.get_supabase_config(
50
- context.config, context
51
- )
46
+ context = self.get_context()
47
+ skill_config = context.agent.skill_config(self.category)
48
+ supabase_url, supabase_key = self.get_supabase_config(skill_config, context)
52
49
 
53
50
  # Create Supabase client
54
51
  supabase: Client = create_client(supabase_url, supabase_key)
@@ -1,7 +1,6 @@
1
1
  import logging
2
2
  from typing import Any, Dict, Type
3
3
 
4
- from langchain_core.runnables import RunnableConfig
5
4
  from langchain_core.tools import ToolException
6
5
  from pydantic import BaseModel, Field
7
6
  from supabase import Client, create_client
@@ -45,18 +44,16 @@ class SupabaseUpdateData(SupabaseBaseTool):
45
44
  data: Dict[str, Any],
46
45
  filters: Dict[str, Any],
47
46
  returning: str = "*",
48
- config: RunnableConfig = None,
49
47
  **kwargs,
50
48
  ):
51
49
  try:
52
- context = self.context_from_config(config)
50
+ context = self.get_context()
51
+ skill_config = context.agent.skill_config(self.category)
53
52
 
54
53
  # Validate table access for public mode
55
54
  self.validate_table_access(table, context)
56
55
 
57
- supabase_url, supabase_key = self.get_supabase_config(
58
- context.config, context
59
- )
56
+ supabase_url, supabase_key = self.get_supabase_config(skill_config, context)
60
57
 
61
58
  # Create Supabase client
62
59
  supabase: Client = create_client(supabase_url, supabase_key)
@@ -1,7 +1,6 @@
1
1
  import logging
2
2
  from typing import Any, Dict, List, Type, Union
3
3
 
4
- from langchain_core.runnables import RunnableConfig
5
4
  from langchain_core.tools import ToolException
6
5
  from pydantic import BaseModel, Field
7
6
  from supabase import Client, create_client
@@ -47,18 +46,16 @@ class SupabaseUpsertData(SupabaseBaseTool):
47
46
  data: Union[Dict[str, Any], List[Dict[str, Any]]],
48
47
  on_conflict: str,
49
48
  returning: str = "*",
50
- config: RunnableConfig = None,
51
49
  **kwargs,
52
50
  ):
53
51
  try:
54
- context = self.context_from_config(config)
52
+ context = self.get_context()
53
+ skill_config = context.agent.skill_config(self.category)
55
54
 
56
55
  # Validate table access for public mode
57
56
  self.validate_table_access(table, context)
58
57
 
59
- supabase_url, supabase_key = self.get_supabase_config(
60
- context.config, context
61
- )
58
+ supabase_url, supabase_key = self.get_supabase_config(skill_config, context)
62
59
 
63
60
  # Create Supabase client
64
61
  supabase: Client = create_client(supabase_url, supabase_key)
@@ -1,6 +1,5 @@
1
1
  from typing import Optional
2
2
 
3
- from langchain_core.runnables import RunnableConfig
4
3
  from pydantic import BaseModel, Field
5
4
 
6
5
  from intentkit.models.agent import AgentAutonomous
@@ -60,7 +59,6 @@ class AddAutonomousTask(SystemBaseTool):
60
59
  minutes: Optional[int] = None,
61
60
  cron: Optional[str] = None,
62
61
  prompt: str = "",
63
- config: RunnableConfig = None,
64
62
  **kwargs,
65
63
  ) -> AddAutonomousTaskOutput:
66
64
  """Add an autonomous task to the agent.
@@ -76,7 +74,7 @@ class AddAutonomousTask(SystemBaseTool):
76
74
  Returns:
77
75
  AddAutonomousTaskOutput: The created task
78
76
  """
79
- context = self.context_from_config(config)
77
+ context = self.get_context()
80
78
  agent_id = context.agent_id
81
79
 
82
80
  task = AgentAutonomous(
@@ -1,4 +1,3 @@
1
- from langchain_core.runnables import RunnableConfig
2
1
  from pydantic import BaseModel, Field
3
2
 
4
3
  from intentkit.skills.system.base import SystemBaseTool
@@ -34,7 +33,6 @@ class DeleteAutonomousTask(SystemBaseTool):
34
33
  async def _arun(
35
34
  self,
36
35
  task_id: str,
37
- config: RunnableConfig,
38
36
  **kwargs,
39
37
  ) -> DeleteAutonomousTaskOutput:
40
38
  """Delete an autonomous task from the agent.
@@ -46,7 +44,7 @@ class DeleteAutonomousTask(SystemBaseTool):
46
44
  Returns:
47
45
  DeleteAutonomousTaskOutput: Confirmation of deletion
48
46
  """
49
- context = self.context_from_config(config)
47
+ context = self.get_context()
50
48
  agent_id = context.agent_id
51
49
 
52
50
  await self.skill_store.delete_autonomous_task(agent_id, task_id)
@@ -1,6 +1,5 @@
1
1
  from typing import Optional
2
2
 
3
- from langchain_core.runnables import RunnableConfig
4
3
  from pydantic import BaseModel, Field
5
4
 
6
5
  from intentkit.models.agent import AgentAutonomous
@@ -68,7 +67,6 @@ class EditAutonomousTask(SystemBaseTool):
68
67
  cron: Optional[str] = None,
69
68
  prompt: Optional[str] = None,
70
69
  enabled: Optional[bool] = None,
71
- config: RunnableConfig = None,
72
70
  **kwargs,
73
71
  ) -> EditAutonomousTaskOutput:
74
72
  """Edit an autonomous task for the agent.
@@ -86,7 +84,7 @@ class EditAutonomousTask(SystemBaseTool):
86
84
  Returns:
87
85
  EditAutonomousTaskOutput: The updated task
88
86
  """
89
- context = self.context_from_config(config)
87
+ context = self.get_context()
90
88
  agent_id = context.agent_id
91
89
 
92
90
  if minutes is not None and cron is not None:
@@ -1,6 +1,5 @@
1
1
  from typing import List
2
2
 
3
- from langchain_core.runnables import RunnableConfig
4
3
  from pydantic import BaseModel, Field
5
4
 
6
5
  from intentkit.models.agent import AgentAutonomous
@@ -33,7 +32,6 @@ class ListAutonomousTasks(SystemBaseTool):
33
32
 
34
33
  async def _arun(
35
34
  self,
36
- config: RunnableConfig,
37
35
  **kwargs,
38
36
  ) -> ListAutonomousTasksOutput:
39
37
  """List autonomous tasks for the agent.
@@ -44,7 +42,7 @@ class ListAutonomousTasks(SystemBaseTool):
44
42
  Returns:
45
43
  ListAutonomousTasksOutput: List of autonomous tasks
46
44
  """
47
- context = self.context_from_config(config)
45
+ context = self.get_context()
48
46
  agent_id = context.agent_id
49
47
 
50
48
  tasks = await self.skill_store.list_autonomous_tasks(agent_id)
@@ -1,4 +1,3 @@
1
- from langchain_core.runnables import RunnableConfig
2
1
  from pydantic import BaseModel, Field
3
2
 
4
3
  from intentkit.skills.system.base import SystemBaseTool
@@ -36,10 +35,10 @@ class ReadAgentApiKey(SystemBaseTool):
36
35
  )
37
36
  args_schema = ReadAgentApiKeyInput
38
37
 
39
- async def _arun(self, config: RunnableConfig, **kwargs) -> ReadAgentApiKeyOutput:
38
+ async def _arun(self, **kwargs) -> ReadAgentApiKeyOutput:
40
39
  """Retrieve or generate an API key for the agent."""
41
40
  # Get context from runnable config to access agent.id
42
- context = self.context_from_config(config)
41
+ context = self.get_context()
43
42
  agent_id = context.agent_id
44
43
 
45
44
  # Get agent data from skill store
@@ -1,4 +1,3 @@
1
- from langchain_core.runnables import RunnableConfig
2
1
  from pydantic import BaseModel, Field
3
2
 
4
3
  from intentkit.skills.system.base import SystemBaseTool
@@ -38,12 +37,10 @@ class RegenerateAgentApiKey(SystemBaseTool):
38
37
  )
39
38
  args_schema = RegenerateAgentApiKeyInput
40
39
 
41
- async def _arun(
42
- self, config: RunnableConfig, **kwargs
43
- ) -> RegenerateAgentApiKeyOutput:
40
+ async def _arun(self, **kwargs) -> RegenerateAgentApiKeyOutput:
44
41
  """Generate and set a new API key for the agent."""
45
42
  # Get context from runnable config to access agent.id
46
- context = self.context_from_config(config)
43
+ context = self.get_context()
47
44
  agent_id = context.agent_id
48
45
 
49
46
  # Get agent data from skill store
@@ -1,9 +1,10 @@
1
1
  from typing import Type
2
2
 
3
+ from langchain.tools.base import ToolException
3
4
  from pydantic import BaseModel, Field
4
5
 
5
6
  from intentkit.abstracts.skill import SkillStoreABC
6
- from intentkit.skills.base import IntentKitSkill, SkillContext
7
+ from intentkit.skills.base import IntentKitSkill
7
8
 
8
9
 
9
10
  class TavilyBaseTool(IntentKitSkill):
@@ -16,11 +17,19 @@ class TavilyBaseTool(IntentKitSkill):
16
17
  description="The skill store for persisting data"
17
18
  )
18
19
 
19
- def get_api_key(self, context: SkillContext) -> str:
20
- skill_config = context.config
21
- if skill_config.get("api_key_provider") == "agent_owner":
20
+ def get_api_key(self) -> str:
21
+ context = self.get_context()
22
+ skill_config = context.agent.skill_config(self.category)
23
+ api_key_provider = skill_config.get("api_key_provider")
24
+ if api_key_provider == "platform":
25
+ return self.skill_store.get_system_config("tavily_api_key")
26
+ # for backward compatibility, may only have api_key in skill_config
27
+ elif skill_config.get("api_key"):
22
28
  return skill_config.get("api_key")
23
- return self.skill_store.get_system_config("tavily_api_key")
29
+ else:
30
+ raise ToolException(
31
+ f"Invalid API key provider: {api_key_provider}, or no api_key in config"
32
+ )
24
33
 
25
34
  @property
26
35
  def category(self) -> str:
@@ -2,7 +2,6 @@ import logging
2
2
  from typing import Type
3
3
 
4
4
  import httpx
5
- from langchain_core.runnables import RunnableConfig
6
5
  from pydantic import BaseModel, Field
7
6
 
8
7
  from intentkit.skills.tavily.base import TavilyBaseTool
@@ -50,7 +49,6 @@ class TavilyExtract(TavilyBaseTool):
50
49
  urls: str,
51
50
  include_images: bool = False,
52
51
  extract_depth: str = "basic",
53
- config: RunnableConfig = None,
54
52
  **kwargs,
55
53
  ) -> str:
56
54
  """Implementation of the Tavily extract tool.
@@ -64,23 +62,24 @@ class TavilyExtract(TavilyBaseTool):
64
62
  Returns:
65
63
  str: Formatted extraction results with content from the URL.
66
64
  """
67
- context = self.context_from_config(config)
65
+ context = self.get_context()
66
+ skill_config = context.agent.skill_config(self.category)
68
67
  logger.debug(
69
68
  f"tavily_extract.py: Running web extraction with context {context}"
70
69
  )
71
70
 
72
- if context.config.get("api_key_provider") == "agent_owner":
73
- if context.config.get("rate_limit_number") and context.config.get(
71
+ if skill_config.get("api_key_provider") == "agent_owner":
72
+ if skill_config.get("rate_limit_number") and skill_config.get(
74
73
  "rate_limit_minutes"
75
74
  ):
76
75
  await self.user_rate_limit_by_category(
77
76
  context.user_id,
78
- context.config["rate_limit_number"],
79
- context.config["rate_limit_minutes"],
77
+ skill_config["rate_limit_number"],
78
+ skill_config["rate_limit_minutes"],
80
79
  )
81
80
 
82
81
  # Get the API key from the agent's configuration
83
- api_key = self.get_api_key(context)
82
+ api_key = self.get_api_key()
84
83
  if not api_key:
85
84
  return "Error: No Tavily API key provided in the configuration."
86
85