# Issue with From crewai.tools import Tool

**URL:** <https://community.crewai.com/t/issue-with-from-crewai-tools-import-tool/4530>\
**Category:** General\
**Created:** [March 9, 2025, 8:23am UTC](https://community.crewai.com/t/issue-with-from-crewai-tools-import-tool/4530 "2025-03-09T08:23:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vidya\_thirumuru](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/vidya_thirumuru/32/2972_2.png) [@vidya\_thirumuru](https://community.crewai.com/u/vidya_thirumuru)\
**Post date:** [March 9, 2025, 8:23am UTC](https://community.crewai.com/t/issue-with-from-crewai-tools-import-tool/4530/1 "2025-03-09T08:23:54Z")

</div>

from crewai.tools import Tool

# Define tools using BaseTool

resource\_tool = Tool(  
name=“Azure Resource Group Creator”,  
description=“Creates an Azure Resource Group in the specified region.”,  
func=lambda: create\_resource\_group(config[‘subscription\_id’], config[‘resource\_group’], config[‘region’])  
)

app\_service\_tool = Tool(  
name=“Azure App Service Plan Creator”,  
description=“Creates an Azure App Service Plan with the specified name and tier.”,  
func=lambda: create\_app\_service\_plan(config[‘subscription\_id’], config[‘resource\_group’], config[‘app\_service\_plan\_name’], config[‘region’])  
)

```
                                                                                                                    Error PS C:\AgenticAIfeatures\Azureautomation> python azure_agents.py

```

Traceback (most recent call last):  
File “C:\AgenticAIfeatures\Azureautomation\azure\_agents.py”, line 3, in   
from crewai.tools import Tool  
ImportError: cannot import name ‘Tool’ from ‘crewai.tools’ (C:\Python311\Lib\site-packages\crewai\tools\__init_\_.py)

---

<div class="post-metadata">

**Author:** ![zinyando](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/zinyando/32/4435_2.png) [@zinyando](https://community.crewai.com/u/zinyando)\
**Post date:** [March 9, 2025, 8:34am UTC](https://community.crewai.com/t/issue-with-from-crewai-tools-import-tool/4530/2 "2025-03-09T08:34:46Z")

</div>

The way you are creating the tools is not supported. You can either use `BaseTool` class or the `tool` decorator.

`from crewai.tools import BaseTool, tool`

You can find more details on the tools docs [Tools - CrewAI](https://docs.crewai.com/concepts/tools#creating-your-own-tools)

---

<div class="post-metadata">

**Author:** ![vidya\_thirumuru](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/vidya_thirumuru/32/2972_2.png) [@vidya\_thirumuru](https://community.crewai.com/u/vidya_thirumuru)\
**Post date:** [March 9, 2025, 8:56am UTC](https://community.crewai.com/t/issue-with-from-crewai-tools-import-tool/4530/3 "2025-03-09T08:56:18Z")

</div>

from crewai import Agent, Task, Crew

# from crewai\_tools import Tool

from crewai.tools import BaseTool

# Use BaseTool instead of Tool

from azure\_helper import create\_resource\_group, create\_web\_app, create\_app\_service\_plan, create\_container\_registry  
import json

# Load JSON Config

def load\_json\_config():  
try:  
with open(“config.json”, “r”) as file:  
return json.load(file)  
except FileNotFoundError:  
print(“❌ ERROR: ‘config.json’ not found! Make sure it exists in the script directory.”)  
exit(1)  
except json.JSONDecodeError:  
print(“❌ ERROR: ‘config.json’ contains invalid JSON! Fix the formatting.”)  
exit(1)

config = load\_json\_config()

# Define tools using BaseTool

resource\_tool = BaseTool(  
name=“Azure Resource Group Creator”,  
description=“Creates an Azure Resource Group in the specified region.”,  
func=lambda: create\_resource\_group(config[‘subscription\_id’], config[‘resource\_group’], config[‘region’])  
)

app\_service\_tool = BaseTool(  
name=“Azure App Service Plan Creator”,  
description=“Creates an Azure App Service Plan with the specified name and tier.”,  
func=lambda: create\_app\_service\_plan(config[‘subscription\_id’], config[‘resource\_group’], config[‘app\_service\_plan\_name’], config[‘region’])  
)

web\_app\_tool = BaseTool(  
name=“Azure Web App Creator”,  
description=“Creates an Azure Web App and links it to an App Service Plan.”,  
func=lambda: create\_web\_app(config[‘subscription\_id’], config[‘resource\_group’], config[‘web\_app\_name’], config[‘app\_service\_plan\_name’], config[‘region’])  
)

acr\_tool = BaseTool(  
name=“Azure Container Registry Creator”,  
description=“Creates an Azure Container Registry for storing container images.”,  
func=lambda: create\_container\_registry(config[‘subscription\_id’], config[‘resource\_group’], config[‘container\_registry\_name’], config[‘region’])  
)

# Agents with backstories

resource\_agent = Agent(  
role=“Resource Manager”,  
goal=“Create a Resource Group”,  
tools=[resource\_tool],  
backstory=“An experienced Azure cloud architect responsible for provisioning and managing cloud resources efficiently.”  
)

app\_service\_agent = Agent(  
role=“App Service Manager”,  
goal=“Create an App Service Plan”,  
tools=[app\_service\_tool],  
backstory=“A cloud infrastructure specialist ensuring optimal deployment of web applications through scalable App Service Plans.”  
)

web\_app\_agent = Agent(  
role=“Web App Creator”,  
goal=“Deploy a Web App”,  
tools=[web\_app\_tool],  
backstory=“A seasoned DevOps engineer dedicated to deploying and maintaining high-performance web applications on Azure.”  
)

acr\_agent = Agent(  
role=“Container Registry Manager”,  
goal=“Create a Container Registry”,  
tools=[acr\_tool],  
backstory=“A containerization expert managing secure and scalable container image storage within Azure’s ecosystem.”  
)

# Tasks

task1 = Task(description=“Create Resource Group”, agent=resource\_agent)  
task2 = Task(description=“Create App Service Plan”, agent=app\_service\_agent)  
task3 = Task(description=“Create Web App”, agent=web\_app\_agent)  
task4 = Task(description=“Create Container Registry”, agent=acr\_agent)

# Crew (AI Team)

azure\_crew = Crew(  
agents=[resource\_agent, app\_service\_agent, web\_app\_agent, acr\_agent],  
tasks=[task1, task2, task3, task4]  
)

# Execute AI Agents

if **name** == “ **main** ”:  
results = azure\_crew.kickoff()  
print(results)

---

<div class="post-metadata">

**Author:** ![vidya\_thirumuru](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/vidya_thirumuru/32/2972_2.png) [@vidya\_thirumuru](https://community.crewai.com/u/vidya_thirumuru)\
**Post date:** [March 9, 2025, 8:57am UTC](https://community.crewai.com/t/issue-with-from-crewai-tools-import-tool/4530/4 "2025-03-09T08:57:57Z")

</div>

Still same issue

Error :- File “C:\Python311\Lib\site-packages\crewai\__init_\_.py”, line 3, in   
from crewai.agent import Agent  
File “C:\Python311\Lib\site-packages\crewai\agent.py”, line 9, in   
from crewai.agents.agent\_builder.base\_agent import BaseAgent  
File “C:\Python311\Lib\site-packages\crewai\agents\agent\_builder\base\_agent.py”, line 23, in   
from crewai.tools import BaseTool  
ImportError: cannot import name ‘BaseTool’ from ‘crewai.tools’ (C:\Python311\Lib\site-packages\crewai\tools\__init_\_.py)

My code  
from crewai import Agent, Task, Crew

# from crewai\_tools import Tool

from crewai.tools import BaseTool

# Use BaseTool instead of Tool

from azure\_helper import create\_resource\_group, create\_web\_app, create\_app\_service\_plan, create\_container\_registry  
import json

# Load JSON Config

def load\_json\_config():  
try:  
with open(“config.json”, “r”) as file:  
return json.load(file)  
except FileNotFoundError:  
print(“❌ ERROR: ‘config.json’ not found! Make sure it exists in the script directory.”)  
exit(1)  
except json.JSONDecodeError:  
print(“❌ ERROR: ‘config.json’ contains invalid JSON! Fix the formatting.”)  
exit(1)

config = load\_json\_config()

# Define tools using BaseTool

resource\_tool = BaseTool(  
name=“Azure Resource Group Creator”,  
description=“Creates an Azure Resource Group in the specified region.”,  
func=lambda: create\_resource\_group(config[‘subscription\_id’], config[‘resource\_group’], config[‘region’])  
)

app\_service\_tool = BaseTool(  
name=“Azure App Service Plan Creator”,  
description=“Creates an Azure App Service Plan with the specified name and tier.”,  
func=lambda: create\_app\_service\_plan(config[‘subscription\_id’], config[‘resource\_group’], config[‘app\_service\_plan\_name’], config[‘region’])  
)

web\_app\_tool = BaseTool(  
name=“Azure Web App Creator”,  
description=“Creates an Azure Web App and links it to an App Service Plan.”,  
func=lambda: create\_web\_app(config[‘subscription\_id’], config[‘resource\_group’], config[‘web\_app\_name’], config[‘app\_service\_plan\_name’], config[‘region’])  
)

acr\_tool = BaseTool(  
name=“Azure Container Registry Creator”,  
description=“Creates an Azure Container Registry for storing container images.”,  
func=lambda: create\_container\_registry(config[‘subscription\_id’], config[‘resource\_group’], config[‘container\_registry\_name’], config[‘region’])  
)

# Agents with backstories

resource\_agent = Agent(  
role=“Resource Manager”,  
goal=“Create a Resource Group”,  
tools=[resource\_tool],  
backstory=“An experienced Azure cloud architect responsible for provisioning and managing cloud resources efficiently.”  
)

app\_service\_agent = Agent(  
role=“App Service Manager”,  
goal=“Create an App Service Plan”,  
tools=[app\_service\_tool],  
backstory=“A cloud infrastructure specialist ensuring optimal deployment of web applications through scalable App Service Plans.”  
)

web\_app\_agent = Agent(  
role=“Web App Creator”,  
goal=“Deploy a Web App”,  
tools=[web\_app\_tool],  
backstory=“A seasoned DevOps engineer dedicated to deploying and maintaining high-performance web applications on Azure.”  
)

acr\_agent = Agent(  
role=“Container Registry Manager”,  
goal=“Create a Container Registry”,  
tools=[acr\_tool],  
backstory=“A containerization expert managing secure and scalable container image storage within Azure’s ecosystem.”  
)

# Tasks

task1 = Task(description=“Create Resource Group”, agent=resource\_agent)  
task2 = Task(description=“Create App Service Plan”, agent=app\_service\_agent)  
task3 = Task(description=“Create Web App”, agent=web\_app\_agent)  
task4 = Task(description=“Create Container Registry”, agent=acr\_agent)

# Crew (AI Team)

azure\_crew = Crew(  
agents=[resource\_agent, app\_service\_agent, web\_app\_agent, acr\_agent],  
tasks=[task1, task2, task3, task4]  
)

# Execute AI Agents

if **name** == “ **main** ”:  
results = azure\_crew.kickoff()  
print(results)

---

<div class="post-metadata">

**Author:** ![zinyando](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/zinyando/32/4435_2.png) [@zinyando](https://community.crewai.com/u/zinyando)\
**Post date:** [March 9, 2025, 9:01am UTC](https://community.crewai.com/t/issue-with-from-crewai-tools-import-tool/4530/5 "2025-03-09T09:01:30Z")

</div>

Did you run `crewai install` in your project root?

How did you initialise your project? Are you using the CLI via `crewai create crew my_crew`?

---

<div class="post-metadata">

**Author:** ![vidya\_thirumuru](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/vidya_thirumuru/32/2972_2.png) [@vidya\_thirumuru](https://community.crewai.com/u/vidya_thirumuru)\
**Post date:** [March 9, 2025, 9:15am UTC](https://community.crewai.com/t/issue-with-from-crewai-tools-import-tool/4530/6 "2025-03-09T09:15:33Z")

</div>

this is my project folder  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/crewai/original/2X/4/4090e40dcdb63c572ae92f9237c31f35201fa3ef.png) i ran crewai install and i dont know how to initialise project

---

<div class="post-metadata">

**Author:** ![zinyando](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/zinyando/32/4435_2.png) [@zinyando](https://community.crewai.com/u/zinyando)\
**Post date:** [March 9, 2025, 9:30am UTC](https://community.crewai.com/t/issue-with-from-crewai-tools-import-tool/4530/7 "2025-03-09T09:30:59Z")

</div>

You seem new to CrewAI, I suggest you create a new project via the CLI [CLI - CrewAI](https://docs.crewai.com/concepts/cli#1-create) and use that project structure for your application. You might run into fewer issues that way. Take a look at the quick start to get started [Quickstart - CrewAI](https://docs.crewai.com/quickstart)

Then for your tools define them in the way outlined in the guides and not how you are doing now [Tools - CrewAI](https://docs.crewai.com/concepts/tools#creating-your-own-tools)

---

<div class="post-metadata">

**Author:** ![vidya\_thirumuru](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/vidya_thirumuru/32/2972_2.png) [@vidya\_thirumuru](https://community.crewai.com/u/vidya_thirumuru)\
**Post date:** [March 9, 2025, 9:35am UTC](https://community.crewai.com/t/issue-with-from-crewai-tools-import-tool/4530/8 "2025-03-09T09:35:07Z")

</div>

you are right i am very new here are all files  
Azure\_helper.py  
from azure.identity import DefaultAzureCredential  
from azure.mgmt.resource import ResourceManagementClient  
from azure.mgmt.web import WebSiteManagementClient  
from azure.mgmt.containerregistry import ContainerRegistryManagementClient  
from azure.mgmt.sql import SqlManagementClient

# Authenticate with Azure

credential = DefaultAzureCredential()

# Function to create a Resource Group

def create\_resource\_group(subscription\_id, resource\_group, region):  
resource\_client = ResourceManagementClient(credential, subscription\_id)  
resource\_client.resource\_groups.create\_or\_update(resource\_group, {“location”: region})  
return f"Resource Group ‘{resource\_group}’ created successfully!"

# Function to create an App Service Plan

def create\_app\_service\_plan(subscription\_id, resource\_group, plan\_name, region):  
web\_client = WebSiteManagementClient(credential, subscription\_id)  
web\_client.app\_service\_plans.begin\_create\_or\_update(  
resource\_group, plan\_name,  
{“location”: region, “sku”: {“name”: “B1”, “tier”: “Basic”}}  
).result()  
return f"App Service Plan ‘{plan\_name}’ created successfully!"

# Function to create a Web App

def create\_web\_app(subscription\_id, resource\_group, app\_name, plan\_name, region):  
web\_client = WebSiteManagementClient(credential, subscription\_id)  
web\_client.web\_apps.begin\_create\_or\_update(  
resource\_group, app\_name,  
{“location”: region, “server\_farm\_id”: plan\_name, “kind”: “app”}  
).result()  
return f"Web App ‘{app\_name}’ created successfully!"

# Function to create a Container Registry

def create\_container\_registry(subscription\_id, resource\_group, registry\_name, region):  
acr\_client = ContainerRegistryManagementClient(credential, subscription\_id)  
acr\_client.registries.begin\_create(  
resource\_group, registry\_name,  
{“location”: region, “sku”: {“name”: “Basic”}, “admin\_user\_enabled”: True}  
).result()  
return f"Container Registry ‘{registry\_name}’ created successfully!"

# Function to create an Azure SQL Database

# def create\_database(subscription\_id, resource\_group, server\_name, database\_name, region):

# sql\_client = SqlManagementClient(credential, subscription\_id)

# sql\_client.servers.begin\_create\_or\_update(

# resource\_group, server\_name,

# {“location”: region, “administrator\_login”: “adminuser”, “administrator\_login\_password”: “Password@123”}

# ).result()

# sql\_client.databases.begin\_create\_or\_update(

# resource\_group, server\_name, database\_name,

# {“location”: region, “sku”: {“name”: “S0”, “tier”: “Standard”}}

# ).result()

# return f"Database ‘{database\_name}’ created successfully on server ‘{server\_name}’!"

azure\_agents.py

from crewai import Agent, Task, Crew  
from crewai\_tools import CrewTool  
from pydantic import BaseModel  
import json

# Import Azure helper functions

from azure\_helper import create\_resource\_group, create\_web\_app, create\_app\_service\_plan, create\_container\_registry

# ✅ Load JSON Config

def load\_json\_config():  
try:  
with open(“config.json”, “r”) as file:  
return json.load(file)  
except FileNotFoundError:  
print(“❌ ERROR: ‘config.json’ not found!”)  
exit(1)  
except json.JSONDecodeError:  
print(“❌ ERROR: Invalid JSON format in ‘config.json’!”)  
exit(1)

config = load\_json\_config()

# ✅ Define Input Schemas

class ResourceGroupInput(BaseModel):  
subscription\_id: str  
resource\_group: str  
region: str

class AppServicePlanInput(BaseModel):  
subscription\_id: str  
resource\_group: str  
app\_service\_plan\_name: str  
region: str

class WebAppInput(BaseModel):  
subscription\_id: str  
resource\_group: str  
web\_app\_name: str  
app\_service\_plan\_name: str  
region: str

class ContainerRegistryInput(BaseModel):  
subscription\_id: str  
resource\_group: str  
container\_registry\_name: str  
region: str

# ✅ Define Crew Tools

resource\_tool = CrewTool.from\_function(  
name=“Azure Resource Group Creator”,  
description=“Creates an Azure Resource Group in the specified region.”,  
args\_schema=ResourceGroupInput,  
func=lambda subscription\_id, resource\_group, region: create\_resource\_group(subscription\_id, resource\_group, region)  
)

app\_service\_tool = CrewTool.from\_function(  
name=“Azure App Service Plan Creator”,  
description=“Creates an Azure App Service Plan with the specified name and tier.”,  
args\_schema=AppServicePlanInput,  
func=lambda subscription\_id, resource\_group, app\_service\_plan\_name, region: create\_app\_service\_plan(  
subscription\_id, resource\_group, app\_service\_plan\_name, region  
)  
)

web\_app\_tool = CrewTool.from\_function(  
name=“Azure Web App Creator”,  
description=“Creates an Azure Web App and links it to an App Service Plan.”,  
args\_schema=WebAppInput,  
func=lambda subscription\_id, resource\_group, web\_app\_name, app\_service\_plan\_name, region: create\_web\_app(  
subscription\_id, resource\_group, web\_app\_name, app\_service\_plan\_name, region  
)  
)

acr\_tool = CrewTool.from\_function(  
name=“Azure Container Registry Creator”,  
description=“Creates an Azure Container Registry for storing container images.”,  
args\_schema=ContainerRegistryInput,  
func=lambda subscription\_id, resource\_group, container\_registry\_name, region: create\_container\_registry(  
subscription\_id, resource\_group, container\_registry\_name, region  
)  
)

# ✅ Define AI Agents

resource\_agent = Agent(  
role=“Resource Manager”,  
goal=“Create a Resource Group”,  
tools=[resource\_tool],  
backstory=“An experienced Azure cloud architect managing cloud resources.”  
)

app\_service\_agent = Agent(  
role=“App Service Manager”,  
goal=“Create an App Service Plan”,  
tools=[app\_service\_tool],  
backstory=“A cloud infrastructure specialist ensuring optimal deployments.”  
)

web\_app\_agent = Agent(  
role=“Web App Creator”,  
goal=“Deploy a Web App”,  
tools=[web\_app\_tool],  
backstory=“A DevOps engineer managing high-performance web applications.”  
)

acr\_agent = Agent(  
role=“Container Registry Manager”,  
goal=“Create a Container Registry”,  
tools=[acr\_tool],  
backstory=“A containerization expert managing secure image storage.”  
)

# ✅ Define Tasks

task1 = Task(description=“Create Resource Group”, agent=resource\_agent)  
task2 = Task(description=“Create App Service Plan”, agent=app\_service\_agent)  
task3 = Task(description=“Create Web App”, agent=web\_app\_agent)  
task4 = Task(description=“Create Container Registry”, agent=acr\_agent)

# ✅ Create AI Crew (Team)

azure\_crew = Crew(  
agents=[resource\_agent, app\_service\_agent, web\_app\_agent, acr\_agent],  
tasks=[task1, task2, task3, task4]  
)

# ✅ Execute AI Agents

if **name** == “ **main** ”:  
results = azure\_crew.kickoff()  
print(results)

the above are my two files I am facing the below error  
Traceback (most recent call last):  
File “C:\AgenticAIfeatures\Azureautomation\azure\_agents.py”, line 1, in   
from crewai import Agent, Task, Crew  
File “C:\Python311\Lib\site-packages\crewai\__init_\_.py”, line 3, in   
from crewai.agent import Agent  
File “C:\Python311\Lib\site-packages\crewai\agent.py”, line 9, in   
from crewai.agents.agent\_builder.base\_agent import BaseAgent  
File “C:\Python311\Lib\site-packages\crewai\agents\agent\_builder\base\_agent.py”, line 23, in   
from crewai.tools import BaseTool  
ImportError: cannot import name ‘BaseTool’ from ‘crewai.tools’ (C:\Python311\Lib\site-packages\crewai\tools\__init_\_.py)  
PS C:\AgenticAIfeatures\Azureautomation\>

---

<div class="post-metadata">

**Author:** ![vidya\_thirumuru](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/vidya_thirumuru/32/2972_2.png) [@vidya\_thirumuru](https://community.crewai.com/u/vidya_thirumuru)\
**Post date:** [March 9, 2025, 10:12am UTC](https://community.crewai.com/t/issue-with-from-crewai-tools-import-tool/4530/9 "2025-03-09T10:12:04Z")

</div>

pleae help me on this
