Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

Commit 965f272

Browse files
committed
fix: restore ZapierActionTool import and enhance logging in Zapier adapter
- Reintroduced the import of ZapierActionTool in __init__.py for proper accessibility. - Added logging for error handling in ZapierActionsAdapter to improve debugging. - Updated ZapierActionTools factory function to include logging for missing API key.
1 parent 60644e5 commit 965f272

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

crewai_tools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
S3ReaderTool,
77
S3WriterTool,
88
)
9-
from .adapters.zapier_adapter import ZapierActionTool
109
from .tools import (
1110
AIMindTool,
1211
ApifyActorsTool,
@@ -72,3 +71,4 @@
7271
YoutubeVideoSearchTool,
7372
ZapierActionTools,
7473
)
74+
from .adapters.zapier_adapter import ZapierActionTool

crewai_tools/adapters/zapier_adapter.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import logging
23
from typing import List
34

45
import requests
@@ -7,6 +8,8 @@
78

89
ACTIONS_URL = "https://actions.zapier.com/api/v2/ai-actions"
910

11+
logger = logging.getLogger(__name__)
12+
1013

1114
class ZapierActionTool(BaseTool):
1215
"""
@@ -37,8 +40,6 @@ def _run(self, **kwargs) -> str:
3740
}
3841
action_params = {"instructions": instructions, "params": formatted_params}
3942

40-
print(f"Executing action {self.action_id} with payload: {action_params}")
41-
4243
execute_url = f"{ACTIONS_URL}/{self.action_id}/execute/"
4344
response = requests.request(
4445
"POST", execute_url, headers=headers, json=action_params
@@ -59,6 +60,7 @@ class ZapierActionsAdapter:
5960
def __init__(self, api_key: str = None):
6061
self.api_key = api_key or os.getenv("ZAPIER_API_KEY")
6162
if not self.api_key:
63+
logger.error("Zapier Actions API key is required")
6264
raise ValueError("Zapier Actions API key is required")
6365

6466
def get_zapier_actions(self):
@@ -74,7 +76,6 @@ def get_zapier_actions(self):
7476
def tools(self) -> List[BaseTool]:
7577
"""Convert Zapier actions to BaseTool instances"""
7678
actions_response = self.get_zapier_actions()
77-
print("actions_response", actions_response)
7879
tools = []
7980

8081
for action in actions_response.get("results", []):

crewai_tools/tools/zapier_action_tool/zapier_action_tool.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
import os
2+
import logging
23
from typing import List, Optional
34
from crewai.tools import BaseTool
45
from crewai_tools.adapters.zapier_adapter import ZapierActionsAdapter
56

7+
logger = logging.getLogger(__name__)
8+
69

710
def ZapierActionTools(
811
zapier_api_key: Optional[str] = None, action_list: Optional[List[str]] = None
912
) -> List[BaseTool]:
13+
"""Factory function that returns Zapier action tools.
14+
15+
Args:
16+
zapier_api_key: The API key for Zapier.
17+
action_list: Optional list of specific tool names to include.
18+
19+
Returns:
20+
A list of Zapier action tools.
21+
"""
1022
if zapier_api_key is None:
1123
zapier_api_key = os.getenv("ZAPIER_API_KEY")
1224
if zapier_api_key is None:
25+
logger.error("ZAPIER_API_KEY is not set")
1326
raise ValueError("ZAPIER_API_KEY is not set")
1427
adapter = ZapierActionsAdapter(zapier_api_key)
1528
all_tools = adapter.tools()

0 commit comments

Comments
 (0)