microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
34.85k stars 5.05k forks source link

v1 of AutoGen Studio on AgentChat #4097

Closed victordibia closed 2 weeks ago

victordibia commented 2 weeks ago

Why are these changes needed?

First step in platforming AutoGen Studio on the AgentChat api. Primary goal is to create a too that enables rapid prototyping and experiments.

This PR introduces a teammanager class that can take a declarative agent spect and return AgentChat runtime instances, streaming agent updates over a websocker and an updated backend api.

image

Declarative Specification and Team Manager

{
  "name": "weather_team",
  "component_type": "team",
  "participants": [
    {
      "name": "writing_agent",
      "component_type": "agent",
      "model_client": {
        "model": "gpt-4o-2024-08-06",
        "model_type": "OpenAIChatCompletionClient",
        "component_type": "model"
      },
      "tools": [
        {
          "name": "get_weather",
          "description": "Get the weather for a city",
          "content": "async def get_weather(city: str) -> str:\n    return f\"The weather in {city} is 73 degrees and Sunny.\"",
          "tool_type": "PythonFunction",
          "component_type": "tool"
        }
      ],
      "agent_type": "AssistantAgent"
    }
  ],
  "termination_condition": {
    "termination_type": "MaxMessageTermination",
    "max_messages": 5,
    "component_type": "termination"
  },
  "team_type": "RoundRobinGroupChat",
  "model_client": null
}

The team specification can be loaded as follows:

from autogenstudio.teammanager import TeamManager
import json 

wm = TeamManager()  
result = await wm.run(task="What is the weather in New York?", team_config= json.load(open("team.json")) ) 
print(result)

UI

Current updates to the UI include the ability to create a session, attach a team spec (as json) and run tasks. Intermediate agent steps are streamed to the UI and can be stopped as the task proceeds.

image

Related issue number

- [x] Closes #4007 - [x] Closes #4008 - [x] Closes #4009 - [x] Closes #4010 - [x] Closes #4095 - [x] Closes #3824 - [x] Closes #4098 ## Checks - [ ] I've included any doc changes needed for https://microsoft.github.io/autogen/. See https://microsoft.github.io/autogen/docs/Contribute#documentation to build and test documentation locally. - [ ] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [ ] I've made sure all auto checks have passed.
ekzhu commented 2 weeks ago

Looks like uv lock needs to be updated.