# How to add Tools to Agents and Tasks Yaml Files: Proper Format/Syntax

**URL:** <https://community.crewai.com/t/how-to-add-tools-to-agents-and-tasks-yaml-files-proper-format-syntax/3321>\
**Category:** CrewAI Community Support\
**Tags:** tools\_issues, crewai\
**Created:** [January 29, 2025, 2:48am UTC](https://community.crewai.com/t/how-to-add-tools-to-agents-and-tasks-yaml-files-proper-format-syntax/3321 "2025-01-29T02:48:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rthidden](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/rthidden/32/2302_2.png) [@rthidden](https://community.crewai.com/u/rthidden)\
**Post date:** [January 29, 2025, 2:48am UTC](https://community.crewai.com/t/how-to-add-tools-to-agents-and-tasks-yaml-files-proper-format-syntax/3321/1 "2025-01-29T02:48:35Z")

</div>

Hello,

I am curious. What is the proper format/syntax to add tools to tasks.yml and agents.yaml?

This is how I have it currently, but I have tried many variations:

```yaml
analyze_topic:
  description: >
    Analyze {niche_topic} in detail. Your output must start with "Topic Analysis:" and include:
    1) Key concepts and terminology
    2) Current trends and developments
    3) Major challenges and opportunities
    4) Different perspectives and approaches in the field
  expected_output: >
    A comprehensive analysis covering key aspects,
    current state, trends, and various perspectives of {niche_topic}.
    Structure your response with clear sections and bullet points.
  llm: OpenAI_gpt-4o
  tools:
    - SerperDevTool
    - ScrapeWebsiteTool

```

I get this error:

```ps
Traceback (most recent call last):
  File "C:\Users\rthid\myapps\speaker_finder\backend\main.py", line 15, in <module>
    run()
  File "C:\Users\rthid\myapps\speaker_finder\backend\main.py", line 12, in run
    SpeakerFinders().crew().kickoff(inputs=inputs)
    ^^^^^^^^^^^^^^^^
  File "C:\Users\rthid\myapps\speaker_finder\.venv\Lib\site-packages\crewai\project\crew_base.py", line 36, in __init__
    self.map_all_task_variables()
  File "C:\Users\rthid\myapps\speaker_finder\.venv\Lib\site-packages\crewai\project\crew_base.py", line 203, in map_all_task_variables
    self._map_task_variables(
  File "C:\Users\rthid\myapps\speaker_finder\.venv\Lib\site-packages\crewai\project\crew_base.py", line 232, in _map_task_variables
    tool_functions[tool]() for tool in tools
    ~~~~~~~~~~~~~~ ^^^^^^
KeyError: 'SerperDevTool'

```

I notice errors on lines 12 and 15 in main.py. Is that causing the KeyError with the tool?

Thanks In Advance,  
Ryan

---

<div class="post-metadata">

**Author:** ![Tony\_Wood](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/tony_wood/32/1876_2.png) [@Tony\_Wood](https://community.crewai.com/u/Tony_Wood)\
**Post date:** [January 29, 2025, 8:34am UTC](https://community.crewai.com/t/how-to-add-tools-to-agents-and-tasks-yaml-files-proper-format-syntax/3321/2 "2025-01-29T08:34:10Z")

</div>

Good question as I think I remember seeing this in an example a while ago so can understand the confusion.  
However as of the current crewai version 0.100.0 latest version.

I use the tools line.

```
	config=self.tasks_config['notes_task'],
	llm=llm,
	verbose=True,
	***tools=[docs_tool, file_tool, CSVSearchTool()]***,

```

For completeness I tried adding to the yaml files and I got the same error.  
If in doubt I look here [GitHub - crewAIInc/crewAI: Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.](https://github.com/crewAIInc/crewAI) for the [READ.me](http://READ.me) and also run ‘crewai create crew \<project\_name\>’ and it will give me a template.
