AttributeError: ‘str’ object has no attribute ‘get’
I am new to CrewAI and I would like to know what I could do to fix it, here is the whole error:
(smart-agents-dev) PS C:\Users\IA-User\Documents\smart-agents-dev\smart_agents> crewai run
Running the Crew
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\IA-User\Documents\smart-agents-dev\smart_agents\src\smart_agents\main.py”, line 26, in run
SmartAgentsCrew().crew().kickoff(inputs=inputs)
^^^^^^^^^^^^^^^^^
File “C:\Users\IA-User\Documents\smart-agents-dev\Lib\site-packages\crewai\project\crew_base.py”, line 35, in init
self.map_all_task_variables()
File “C:\Users\IA-User\Documents\smart-agents-dev\Lib\site-packages\crewai\project\crew_base.py”, line 133, in map_all_task_variables
self._map_task_variables(
File “C:\Users\IA-User\Documents\smart-agents-dev\Lib\site-packages\crewai\project\crew_base.py”, line 155, in _map_task_variables
if context_list := task_info.get(“context”):
^^^^^^^^^^^^^
AttributeError: ‘str’ object has no attribute ‘get’
An error occurred while running the crew: Command ‘[‘poetry’, ‘run’, ‘run_crew’]’ returned non-zero exit status 1.
Hi rokbenko, the error still persists and i have tried both commands.
(smart-agents-dev) PS C:\Users\IA-User\Documents\smart-agents-dev\smart_agents> poetry run smart_agents
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\IA-User\Documents\smart-agents-dev\smart_agents\src\smart_agents\main.py”, line 26, in run
SmartAgentsCrew().crew().kickoff(inputs=inputs)
^^^^^^^^^^^^^^^^^
File “C:\Users\IA-User\Documents\smart-agents-dev\Lib\site-packages\crewai\project\crew_base.py”, line 35, in init
self.map_all_task_variables()
File “C:\Users\IA-User\Documents\smart-agents-dev\Lib\site-packages\crewai\project\crew_base.py”, line 133, in map_all_task_variables
self._map_task_variables(
File “C:\Users\IA-User\Documents\smart-agents-dev\Lib\site-packages\crewai\project\crew_base.py”, line 155, in _map_task_variables
if context_list := task_info.get(“context”):
^^^^^^^^^^^^^
AttributeError: ‘str’ object has no attribute ‘get’
Thanks for the fast reply. On the other hand, i’ve already installed poetry so it did not take long. Here is what transpired, and I am still getting the same issues. Thank you for your help and patience.
(smart-agents-dev) PS C:\Users\IA-User\Documents\smart-agents-dev\smart_agents> poetry install
Installing dependencies from lock file
No dependencies to install or update
Installing the current project: smart_agents (0.1.0)
(smart-agents-dev) PS C:\Users\IA-User\Documents\smart-agents-dev\smart_agents> poetry shell
Virtual environment already activated: C:\Users\IA-User\Documents\smart-agents-dev
(smart-agents-dev) PS C:\Users\IA-User\Documents\smart-agents-dev\smart_agents> poetry run smart_agents
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\IA-User\Documents\smart-agents-dev\smart_agents\src\smart_agents\main.py”, line 26, in run
SmartAgentsCrew().crew().kickoff(inputs=inputs)
^^^^^^^^^^^^^^^^^
File “C:\Users\IA-User\Documents\smart-agents-dev\Lib\site-packages\crewai\project\crew_base.py”, line 35, in init
self.map_all_task_variables()
File “C:\Users\IA-User\Documents\smart-agents-dev\Lib\site-packages\crewai\project\crew_base.py”, line 133, in map_all_task_variables
self._map_task_variables(
File “C:\Users\IA-User\Documents\smart-agents-dev\Lib\site-packages\crewai\project\crew_base.py”, line 155, in _map_task_variables
if context_list := task_info.get(“context”):
^^^^^^^^^^^^^
AttributeError: ‘str’ object has no attribute ‘get’
Seems like something is wrong with how you defined context. Context should point to tasks. So if you go to your tasks.yaml, do you have context defined there ?
data_extracting_task:
description: >
From the ESI File {ESI}, extract the Booking Number information from the Booking Number field.
expected_output: >
Booking Number :
agent: data_extractor
sanction_task:
description: >
Instructions:
1. From the ESI File {ESI} extract every country name mentioned.
2. Cross-reference the extracted country names with the country names column in the list of sanctioned countries file {sanction_country}.
3. If there is a match, print there is a match.
expected_output: >
Extracted Country Names - Country Status
agent: sanction_agent