-
Notifications
You must be signed in to change notification settings - Fork 43.1k
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
feat(agent): Draft of agent group feature #6896
base: master
Are you sure you want to change the base?
Conversation
This PR exceeds the recommended size of 500 lines. Please make sure you are NOT addressing multiple issues with one PR. |
✅ Deploy Preview for auto-gpt-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
This PR needs to be changed. This was just for review. |
|
||
class AgentGroup: | ||
|
||
ceo: AgentMember |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leader and member?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better. I'll change it
37ebf3a
to
82f1425
Compare
I updated the pull request description. This is a just draft version and needs to be improved. |
One problem I have right now is that we need to have a field as sub_tasks in the |
82f1425
to
a9f2288
Compare
a9f2288
to
c3a9e78
Compare
members: list['AgentMember'] | ||
create_agent: bool | ||
db: AgentDB | ||
group: 'AgentGroup' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd clarify how group is conceptually different than members
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a diagram and some description of the difference between them.
Have you read the roadmap items in discussion? I think this mayyy be covered in one? |
Could you give me the link of discussion? |
|
I wrote another sh file to run multi agent mode. But it's not over yet. I am working on it right now. |
c3a9e78
to
7f2e413
Compare
I change the proposed action of the agent member.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very interesting concept, and decently structured code! Check out my comments on divide_and_conquer.py, there may be something useful in there to get it to work.
@@ -63,7 +65,7 @@ class AgentConfiguration(BaseAgentConfiguration): | |||
|
|||
class AgentSettings(BaseAgentSettings): | |||
config: AgentConfiguration = Field(default_factory=AgentConfiguration) | |||
prompt_config: OneShotAgentPromptConfiguration = Field( | |||
prompt_config: SystemConfiguration = Field( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please specify the specific types that are valid here, not just the base class
@@ -84,7 +86,7 @@ class Agent( | |||
description=__doc__, | |||
) | |||
|
|||
prompt_strategy: OneShotAgentPromptStrategy | |||
prompt_strategy: PromptStrategy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same request as above
autogpts/autogpt/autogpt/agents/prompt_strategies/divide_and_conquer.py
Outdated
Show resolved
Hide resolved
autogpts/autogpt/autogpt/agents/prompt_strategies/divide_and_conquer.py
Outdated
Show resolved
Hide resolved
cd78676
to
c3d2edc
Compare
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
c3d2edc
to
9324306
Compare
For support multi-agent, you commented this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting and potentially worth merging!
We're working on Component-based Agents (this linked PR doesn't move code to the forge yet - it'll be done in a separate PR) which may be merged any day now. It's going to make the forge more effective and easier to build Agents. Given that, this PR will need a refactor (let me know if you need help, can be on Discord @kcze). I recommend you have a look at the Component Agents PR and linked docs.
Please use black
, isort
, flake8
to fix linting (docs).
self.id = str(uuid.uuid4()) | ||
settings.agent_id = self.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This creates two sources of truth for agent_id
and so a potential for errors. If you want to have self.id
better make it a @property
of AgentMember
. The same applies to the role
(settings.ai_profile.ai_role
).
id: str | ||
role: str | ||
initial_prompt: str | ||
boss: Optional["AgentMember"] | ||
recruiter: Optional["AgentMember"] | ||
tasks: list["AgentTask"] | ||
members: list["AgentMember"] | ||
create_agent: bool | ||
group: "AgentGroup" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it may be better to move what possible to AgentMemberSettings
. AgentMember
may be tricky to de/serialize (circular deps in pydantic?) @Pwuts
autogpts/autogpt/autogpt/agents/prompt_strategies/divide_and_conquer.py
Outdated
Show resolved
Hide resolved
This is out of scope for this PR and I doubt you will get better results at least on OpenAI which is optimized for json.
I wouldn't worry about DB for now; don't change it. Just make sure to store all data that the agent needs in |
Thank you @kcze for your great review. I'll check them as soon as I can. |
Yes, you are right.
Yeah. I found it recently. I will fix this one too for benchmark. |
* Add `divider_and_conquer` strategy for using in agent members * Add `AgentMember` class * Add `AgentGroup` class * Add `hire_agent` and `create_agent` and `create_task` * Add `test_agent_group` as an intergration test with VCR * Add `AgentTaskStatus` for flow of doing tasks * Add `autogpt_multi_agent.sh` file to run autogpt in multi agent mode
9324306
to
571985a
Compare
@CodiumAI-Agent /review |
PR Review
Code feedback:
✨ Review tool usage guide:Overview: The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
See the review usage page for a comprehensive guide on using this tool. |
divider_and_conquer
strategy for use in agent membersAgentMember
classAgentGroup
classhire_agent
andcreate_agent
andcreate_task
test_agent_group
as an integration test with VCRautogpt_multi_agent.sh
file to run autogpt in multi-agent modeBackground
In this PR we want to add AgentGroup feature as discussed in #6824.
The base of this PR is the
AgentGroup
class. This class can create a group of agents like a company. The name of this agent will beAgentMember
and it will extend from Agent.Each
AgentGroup
has oneleader
.leader
is kind ofAgentMember
. EachAgentMember
can have severalAgentMember
to do some task for its boss.Main classes
AgentGroup
AgentMember
Strategies
divide_and_conquer
This strategy is like one_shot strategy with some different. Every agent has a thread to check its
task_queue
all the time. in each iterateAgentMember
loads tasks and its members and gives these values to llm_provider to get a list of commands that we want (unlike one_shot we will have a list of commands). We will have two more commands in the list of commands.Commands
create_agent
If the
create_agent
property of an agent is true this agent can create a new agent for an agent.We need these properties for this action.
After this one, we will have a member for an agent with boss_id id with prompt description.
hire_agent
If the
create_agent
property of an agent is false and this agent wants a member, it should say to its boss or its recruiter to hire someone for it.create_task
If they need to create a task for others, they can use this command.
task (str): The description of that task
agent_id (str): The id of the agent will be the owner of this task.
father_task_id (str): The task id that is the cause of this task.
tests
test_agent_group
This test is an integration test that will support all code that we will write. The scenario is a
create best shooter game in the world
. This test uses VCR for LLM responses. The VCR files have been changed (It is not the direct response of LLM). In this test we'll create anAgentGroup
with the CEO asleader
and the CEO will have an hr_lead as its member.How we can run Autogpt in multi-agent mode
autogpt_multi_agent.sh
We can run Autogpt in multi-agent cli mode by this script. It is like
autogpt.sh
. It has just one more argument and it ismember-description
. The structure ofmember-description
will be like this.--member-description "{role_name}:{description of this member}:{boolean of can create new agent or no}:{boss_index}:{recruiter_index}"
. It's just for starting and it will need to get better. An example of running this command and creating a new agent group can be this:Changes 🏗️
We didn't change something in here. We added some classes as we talked about in the Background part.
PR Quality Scorecard ✨
+2 pts
+5 pts
+5 pts
+5 pts
-4 pts
+4 pts
+5 pts
-5 pts
agbenchmark
to verify that these changes do not regress performance?+10 pts