Added a new feature to log the final thoughts of each agent 🚀 #1283
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A really helpful feature to have is that we know what each agent produced as their final answer (not the entire chain of thought) which was fed to the next agent in line in a sequential system.
For example, one agent
X
writes code and another agentY
explains that code. Then instead of having just the final explanation, it would be nice to retrieve what code was actually written byX
. See my project on this here.I have added a class variable called
logs
in theCrew
class. Every time_execute_tasks()
is called,logs
is updated (overwritten) with the latest thoughts of the current agent. The idea is - for eachtask_index
the last update will always be the agent's final thought - which is the final answer (seetranslations/en.json
for more clarity).Thus, after
kickoff()
completes execution,logs
has the final answer of each intermediate agent stored as a dictionary with the integer keys denoting the order of execution of tasks starting from0
.If somebody wants just the raw output and not the entire mess of TaskOutput, then just write -
logs[<task_number>][0].raw
Hope this helps 😀