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

add auto build agent feature #5670

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

davidxwwang
Copy link

Why are these changes needed?

there is an AutoBuild feature on the 0.2 branch( https://microsoft.github.io/autogen/0.2/blog/2023/11/26/Agent-AutoBuild/), and I want to add this feature

Related issue number

#5573

Checks

@davidxwwang davidxwwang changed the title add autobuild agent feature add auto build agent feature Feb 23, 2025
@ekzhu ekzhu self-requested a review February 25, 2025 02:44
enhanced_sys_msg = GROUP_CHAT_DESCRIPTION.format(
name=agent_name, members=member_name, code_executor_desc=code_executor_desc, sys_msg=system_message
)
await agent.update_system_message(enhanced_sys_msg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than updating, can we create the agent once all the parameters are ready.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, l will fix it


return self._build_agents(use_oai_assistant, code_executor=code_executor, **kwargs)

async def _build_agents(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AssistantAgent has built-in functions for serialization and loading. See example: https://microsoft.github.io/autogen/dev/user-guide/agentchat-user-guide/serialize-components.html#agent-example

I think we should be using the built-in API for agent library.

Copy link
Author

@davidxwwang davidxwwang Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, but here I'm not just managing agent configurations, but focus on task configurations. and The base_url and api_key in the agent configuration should not be saved but should be loaded in real-time.
l need save the task config like:{
"building_task": "... ",
"agent_configs": [
{
"name": "...",
"system_message": "...",
"description": "...."
},
....
],
"coding": true,
"code_execution_config": {
"last_n_messages": 2,
"work_dir": "....",
"timeout": 60,
"use_docker": "python:3"
}
}

Copy link
Collaborator

@ekzhu ekzhu Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense, though consider use a BaseModel for your configuration type so we are type checking and validation automatically.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be able to do this without changing AssistantAgent.

When registered tools need to be updated, why not create new agent?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean even if you create a new agent with some tools, the registered tools are hardcoded. However, in the Autobuild class, tools can be dynamically registered to an agent.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put it inside autogen_ext.auto_build as a separate module.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

self.agent_configs: List[Dict] = []
self.open_ports: List[str] = []
self.agent_procs: Dict[str, Tuple[sp.Popen, str]] = {}
self.agent_procs_assign: Dict[str, Tuple[AssistantAgent, str]] = {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for running agents in separate processes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no,This code is hard to understand. I will optimize it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case you are interested in concurrent running agents, the Core API is a good way to look into it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@davidxwwang
Copy link
Author

I will add test code later.

Copy link
Collaborator

@ekzhu ekzhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@victordibia would you like to take a look at this? Perhaps it can be a feature in AGS.

self.agent_configs: List[Dict] = []
self.open_ports: List[str] = []
self.agent_procs: Dict[str, Tuple[sp.Popen, str]] = {}
self.agent_procs_assign: Dict[str, Tuple[AssistantAgent, str]] = {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case you are interested in concurrent running agents, the Core API is a good way to look into it.

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.

3 participants