Description
When the answer is an AgentAction, the message being appended to the messages array is set with role user. Since an AgentAction is a response from the AI/LLM, it should have the assistant role.
Steps to Reproduce
- Allow an agent to run a tool
- Inspect the messages sent to the LLM
- Notice the Thought: xxx, Action: xxx, Action Input: xxx, Observation: xxx message is a user message instead of an assistant message.
Expected behavior
The AgentAction should be added to the messages list as an assistant message instead of a user message.
Screenshots/Code snippets

The third message should be tagged as assistant since it is the LLM thinking and choosing the tool to use.
Operating System
macOS Sonoma
Python Version
3.10
crewAI Version
0.67.1
crewAI Tools Version
0.12.1
Virtual Environment
Conda
Evidence

The third message should be role `assistant`
Possible Solution
Change user to assistant on line 154 of crew_agent_executor.py. I will be opening a PR for this.
Additional context
N/A
Description
When the answer is an AgentAction, the message being appended to the messages array is set with role
user. Since an AgentAction is a response from the AI/LLM, it should have the assistant role.Steps to Reproduce
Expected behavior
The AgentAction should be added to the messages list as an assistant message instead of a user message.
Screenshots/Code snippets
Operating System
macOS Sonoma
Python Version
3.10
crewAI Version
0.67.1
crewAI Tools Version
0.12.1
Virtual Environment
Conda
Evidence
Possible Solution
Change user to assistant on line 154 of crew_agent_executor.py. I will be opening a PR for this.
Additional context
N/A