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

Configuration based agents #5593

Open
fniedtner opened this issue Feb 18, 2025 · 1 comment
Open

Configuration based agents #5593

fniedtner opened this issue Feb 18, 2025 · 1 comment
Labels
roadmap Issues related to roadmap of AutoGen

Comments

@fniedtner
Copy link
Collaborator

Allow users to specify through a config file the agents used in the application (includes tools etc.)in code and studio.

@fniedtner fniedtner added the roadmap Issues related to roadmap of AutoGen label Feb 18, 2025
@victordibia
Copy link
Collaborator

victordibia commented Feb 18, 2025

Hi @fniedtner ,

We have some version of this already through the component config interface. Does this fit the use case you had in mind here?

Component Config Interface

The general idea is

  • Any component (agents, teams, tools) that inherit this interface can be serialized to a config file .dump_component() , or defined or loaded from a config file .load_component().
  • Currently ~all components in AgentChat already inherit this interface and can be serialized (teams, agents, tools, memory etc).
  • If a developer has a csutom agents (agentchat or core), will have to inherit the config interface to make it have similar behaviour.

Note: This is the same infrastructure used in AutoGen Studio. Since AgentChat components already inherit the config interface, AGS can load and work with that same spec.

https://microsoft.github.io/autogen/dev/user-guide/autogenstudio-user-guide/usage.html#declarative-specification-of-componenents

Here's an example of an agent team and how it is converted to a JSON file:

from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_agentchat.conditions import  TextMentionTermination

agent = AssistantAgent(
        name="weather_agent",
        model_client=OpenAIChatCompletionClient(
            model="gpt-4o-mini",
        ),
    )

agent_team = RoundRobinGroupChat([agent], termination_condition=TextMentionTermination("TERMINATE"))
config = agent_team.dump_component()
print(config.model_dump_json())
{
  "provider": "autogen_agentchat.teams.RoundRobinGroupChat",
  "component_type": "team",
  "version": 1,
  "component_version": 1,
  "description": "A team that runs a group chat with participants taking turns in a round-robin fashion\n    to publish a message to all.",
  "label": "RoundRobinGroupChat",
  "config": {
    "participants": [
      {
        "provider": "autogen_agentchat.agents.AssistantAgent",
        "component_type": "agent",
        "version": 1,
        "component_version": 1,
        "description": "An agent that provides assistance with tool use.",
        "label": "AssistantAgent",
        "config": {
          "name": "weather_agent",
          "model_client": {
            "provider": "autogen_ext.models.openai.OpenAIChatCompletionClient",
            "component_type": "model",
            "version": 1,
            "component_version": 1,
            "description": "Chat completion client for OpenAI hosted models.",
            "label": "OpenAIChatCompletionClient",
            "config": { "model": "gpt-4o-mini" }
          },
          "tools": [],
          "handoffs": [],
          "model_context": {
            "provider": "autogen_core.model_context.UnboundedChatCompletionContext",
            "component_type": "chat_completion_context",
            "version": 1,
            "component_version": 1,
            "description": "An unbounded chat completion context that keeps a view of the all the messages.",
            "label": "UnboundedChatCompletionContext",
            "config": {}
          },
          "description": "An agent that provides assistance with ability to use tools.",
          "system_message": "You are a helpful AI assistant. Solve tasks using your tools. Reply with TERMINATE when the task has been completed.",
          "model_client_stream": false,
          "reflect_on_tool_use": false,
          "tool_call_summary_format": "{result}"
        }
      }
    ],
    "termination_condition": {
      "provider": "autogen_agentchat.conditions.TextMentionTermination",
      "component_type": "termination",
      "version": 1,
      "component_version": 1,
      "description": "Terminate the conversation if a specific text is mentioned.",
      "label": "TextMentionTermination",
      "config": { "text": "TERMINATE" }
    }
  }
}

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

No branches or pull requests

3 participants