From 40dd22ce2ce3b40a42c9f03c1155af2f904bc0d9 Mon Sep 17 00:00:00 2001 From: lorenzejay Date: Thu, 24 Apr 2025 14:39:55 -0700 Subject: [PATCH] refactor: remove main execution block from EnterpriseActionKitToolAdapter - Removed the main execution block that included token validation and agent/task setup for testing. - This change streamlines the adapter's code, focusing on its core functionality without execution logic. --- .../adapters/enterprise_adapter.py | 56 ------------------- 1 file changed, 56 deletions(-) diff --git a/src/crewai_tools/adapters/enterprise_adapter.py b/src/crewai_tools/adapters/enterprise_adapter.py index 9a3d1860a..1d93894b7 100644 --- a/src/crewai_tools/adapters/enterprise_adapter.py +++ b/src/crewai_tools/adapters/enterprise_adapter.py @@ -3,7 +3,6 @@ from pydantic import Field, create_model from typing import List, Any, Dict, Optional import json from crewai.tools import BaseTool -from crewai import Agent, Task, Crew ENTERPRISE_ACTION_KIT_PROJECT_ID = "dd525517-df22-49d2-a69e-6a0eed211166" @@ -202,58 +201,3 @@ class EnterpriseActionKitToolAdapter: def __exit__(self, exc_type, exc_val, exc_tb): pass - - -if __name__ == "__main__": - # IMPORTANT: Replace 'YOUR_TOKEN_HERE' with your actual valid token - # You can also load it from an environment variable for better security - import os - - token = os.environ.get( - "ENTERPRISE_TOOL_TOKEN", - ) # Replace YOUR_TOKEN_HERE if not using env var - - if token == "YOUR_TOKEN_HERE" or not token: - print("Error: ENTERPRISE_TOOL_TOKEN is not set.") - print( - "Please replace 'YOUR_TOKEN_HERE' in the code or set the ENTERPRISE_TOOL_TOKEN environment variable." - ) - else: - try: - print("Initializing EnterpriseActionKitTool...") - adapter = EnterpriseActionKitToolAdapter(enterprise_action_token=token) - available_tools = adapter.tools() - - agent = Agent( - model="gpt-4o", - tools=available_tools, - role="You are are expert at google sheets", - goal="Get the sheet with the data x", - backstory="You are a expert at google sheets", - verbose=True, - ) - - task = Task( - description="return data from the sheet with the id: {spreadsheetId}, with the limit: {limit}", - expected_output="The data from the sheet with the id: {spreadsheetId} with the limit: {limit}", - agent=agent, - ) - crew = Crew( - agents=[agent], - tasks=[task], - verbose=True, - ) - result = crew.kickoff( - inputs={ - "spreadsheetId": "1DHDIWGdhUXqXeYOO8yA44poiY222qHPQEUu28olipKs", - "limit": 2, - } - ) - - except ValueError as e: - print(f"\nConfiguration Error: {e}") - except Exception as e: - print(f"\nAn unexpected error occurred during execution: {e}") - import traceback - - traceback.print_exc()