Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] SerperDevTool isn't working on the agent #2006

Open
matthsena opened this issue Jan 30, 2025 · 0 comments
Open

[BUG] SerperDevTool isn't working on the agent #2006

matthsena opened this issue Jan 30, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@matthsena
Copy link

Description

I'm using SerperDevTool from crewai_tools on my agent, and i'm getting the follow error:

I encountered an error while trying to use the tool. This was the error: Arguments validation failed: 1 validation error for SerperDevToolSchema
>  search_query
>    Field required [type=missing, input_value={'description': "CNAE 're... pavimento asfáltico'"}, input_type=dict]
>      For further information visit https://errors.pydantic.dev/2.10/v/missing.
>   Tool Search the internet with Serper accepts these inputs: Tool Name: Search the internet with Serper
>  Tool Arguments: {'search_query': {'description': 'Mandatory search query you want to use to search the internet', 'type': 'str'}}
>  Tool Description: A tool that can be used to search the internet with a search_query. Supports different search types: 'search' (default), 'news'.
>  Moving on then. I MUST either use a tool (use one at time) OR give my best final answer not both at the same time. When responding, I must use the following format:```

but when I add this tool to the task "research_task", it works correctly. Shouldn't it work both ways?

### Steps to Reproduce

1. Import https://docs.crewai.com/tools/serperdevtool#serperdevtool
2.  Add this tool to  agent, something like this:
```python @agent
	def research_analyst(self) -> Agent:
		return Agent(
			config=self.agents_config['research_analyst'],
   			tools=[search_tool],
			llm=llm,
			verbose=True
		)

Expected behavior

It works by defining the tool in the agent, just like it works in the task

Screenshots/Code snippets

@CrewBase
class AgentCNAE():
	"""AgentCNAE crew"""

	agents_config = 'config/agents.yaml'
	tasks_config = 'config/tasks.yaml'

	@agent
	def pre_section_analyst(self) -> Agent:
		return Agent(
			config=self.agents_config['pre_section_analyst'],
			llm=llm,
			verbose=True
		)

	@agent
	def research_analyst(self) -> Agent:
		return Agent(
			config=self.agents_config['research_analyst'],
			llm=llm,
   			tools=[search_tool],
			verbose=True
		)
  
	@agent
	def cnae_checker_sheet(self) -> Agent:
		return Agent(
			config=self.agents_config['cnae_checker_sheet'],
   			tools=[CheckCNAE(result_as_answer=True)],
			llm=llm,
			verbose=True
		)  

	@task
	def preprocessing_task(self) -> Task:
		return Task(
			config=self.tasks_config['preprocessing_task'],
		)

	@task
	def research_task(self) -> Task:
		return Task(
			config=self.tasks_config['research_task'],
		)
  
	@task
	def check_cnae_task(self) -> Task:
		return Task(
			config=self.tasks_config['check_cnae_task'],
			output_json=CNAEResponse
		)  

	@crew
	def crew(self) -> Crew:
		"""Creates the AgentsLicitacaoAi crew"""
		return Crew(
			agents=self.agents,
			tasks=self.tasks,
			process=Process.sequential,
			verbose=True
		)

Operating System

Ubuntu 24.04

Python Version

3.11

crewAI Version

0.100.0

crewAI Tools Version

0.33.0

Virtual Environment

Venv

Evidence

Image

Possible Solution

None

Additional context

None

@matthsena matthsena added the bug Something isn't working label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant