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

Added a new feature to log the final thoughts of each agent 🚀 #1283

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shiladityasarkar
Copy link

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 agent Y explains that code. Then instead of having just the final explanation, it would be nice to retrieve what code was actually written by X. See my project on this here.

Screenshot (325)

I have added a class variable called logs in the Crew class. Every time _execute_tasks() is called, logs is updated (overwritten) with the latest thoughts of the current agent. The idea is - for each task_index the last update will always be the agent's final thought - which is the final answer (see translations/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 from 0.

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 😀

added `logs` class variable, which logs the final answer of each agent.
@shiladityasarkar shiladityasarkar changed the title Added a new feature to log the final answers of each agent 🚀 Added a new feature to log the final thoughts of each agent 🚀 Sep 3, 2024
@joaomdmoura
Copy link
Collaborator

Hey @shiladityasarkar at the end of the crew execution you should be able to get the final result and call .tasks_output on it to get the results of each individual task, isn't that exactly what you need? I might be missing something, sorry if that is the case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants