AutoGen Studio 사용법

AutoGen Studio 사용법

AutoGen Studio(AGS)는 Team Builder 인터페이스를 제공해요. 개발자가 여러 컴포넌트와 동작을 정의할 수 있게 해주는 화면이죠. 여기서 팀을 만들고, 팀에 에이전트를 추가하고, 에이전트에 도구·모델을 붙이고, 팀의 종료 조건을 정의할 수 있어요.

팀을 정의한 뒤에는 팀 빌더 화면에서 바로 테스트하거나, 세션에 연결해 **Playground 뷰(플레이그라운드 화면)**에서 쓸 수 있어요.

출처: 공식문서 - AutoGen Studio 사용법

API 키 설정

대부분의 에이전트는 API 키가 필요해요. OPENAI_API_KEY 환경 변수(OpenAI 모델을 쓴다고 가정)를 설정하면, AutoGen이 에이전트나 팀에 지정한 OpenAI 모델 클라이언트에 이 키를 자동으로 사용해요. 아니면 팀이나 에이전트 설정의 일부로 API 키를 직접 지정할 수도 있어요.

에이전트 팀을 만드는 방법(시각적 빌더 또는 JSON 설정 직접 편집)은 아래에서 다룰게요.

에이전트 팀 만들기

AutoGen Studio는 AutoGen AgentChat이 제공하는 모든 컴포넌트 추상화와 밀접하게 연동돼요. 여기에는 teams, agents, models, tools, 그리고 종료 conditions가 포함돼요.

AGS의 Team Builder 화면은 시각적 팀 빌더를 제공해요. 드래그앤드랍 기능을 쓰거나 팀의 JSON 설정을 직접 편집해서 컴포넌트를 정의할 수 있죠.

시각적 빌더 사용하기

시각적 빌더는 기본적으로 활성화돼 있고, **Component Library(컴포넌트 라이브러리)**에서 컴포넌트를 캔버스로 드래그앤드랍 할 수 있게 해줘요. 캔버스는 하나의 팀을 나타내고, 메인 팀 노드와 연결된 에이전트 노드들로 이뤄져 있어요.

핵심 동작은 이렇습니다:

  • 새 팀 만들기: Team Builder 화면의 "New Team" 버튼을 클릭하거나, 기본 AGS 갤러리에 포함된 기본 팀을 선택하면 돼요. 그러면 캔버스에 새 팀 노드와 에이전트 노드가 생겨요.
  • 컴포넌트 드래그앤드랍: 라이브러리에서 팀이나 에이전트 노드로 드래그하면 돼요.
    • : 에이전트와 종료 조건을 팀 노드로 드래그 (이 컴포넌트들에 특화된 드롭존이 있어요)
    • 에이전트: 모델과 도구를 에이전트 노드로 드래그
  • 팀/에이전트 노드 편집: 노드 오른쪽 위의 편집 아이콘을 클릭하면 속성을 보고 편집할 수 있어요. 패널이 열리면서 노드의 필드를 고칠 수 있죠. 어떤 경우엔 스크롤해서 특정 섹션을 클릭해야 해요. 예를 들어 모델 클라이언트가 있는 에이전트라면 모델 클라이언트 섹션에 들어가서 그 속성을 편집해야 해요. 편집이 끝나면 저장(save) 버튼을 눌러 변경을 반영하세요.

JSON 에디터 사용하기

AGS는 팀의 JSON 설정을 직접 수정하게도 해줘요. 시각적 빌더 모드를 끄면 팀의 JSON 설정이 보이고, 그걸 직접 편집하면 돼요.

팁: 에이전트를 파이썬으로 정의하고 JSON으로 내보낸 뒤, 그걸 JSON 에디터에 붙여넣을 수 있다는 걸 아셨나요? 아래에서 그 방법을 보여드릴게요.

컴포넌트의 선언적 정의

AutoGen Studio는 AutoGen AgentChat의 선언적 명세(declarative specification) 동작 위에 지어졌어요. 즉 팀·에이전트·모델·도구·종료 조건을 파이썬으로 정의하고, 그걸 JSON 파일로 덤프해서 AutoGen Studio에서 쓸 수 있다는 뜻이에요.

에이전트 팀 하나를 JSON 파일로 변환하는 예시를 볼게요.

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" }
    }
  }
}

이 예시는 RoundRobinGroupChat 타입과 TextMentionTermination 조건을 쓰는 단일 에이전트 팀을 보여줘요. 모델 클라이언트가 OpenAIChatCompletionClient인데 모델 이름만 지정됐죠. 이 경우 API 키는 환경 변수 OPENAI_API_KEY로 설정돼 있다고 가정해요. API 키를 모델 클라이언트 설정의 일부로 지정할 수도 있어요.

모델 클라이언트의 전체 설정을 이해하려면 AutoGen Model Clients 문서를 참고하세요.

마찬가지로 모델 클라이언트를 파이썬으로 정의하고 dump_component()을 호출해 JSON 설정을 얻은 뒤, 팀이나 에이전트 설정의 모델 클라이언트 섹션을 갱신하는 데 쓸 수 있어요.

마지막으로 load_component() 메서드로 JSON 파일에서 팀 설정을 로드할 수도 있어요.


import json
from autogen_agentchat.teams import BaseGroupChat
team_config = json.load(open("team.json"))
team = BaseGroupChat.load_component(team_config)

AGS는 Gallery(갤러리) 뷰를 제공해요. 갤러리는 컴포넌트 — 팀·에이전트·모델·도구·종료 조건 — 의 모음이고, 프로젝트 전반에 걸쳐 공유·재사용할 수 있어요.

사용자는 로컬 갤러리를 만들거나 (URL에서, JSON 파일 가져오기로, 또는 JSON을 그냥 복붙해서) 갤러리를 가져올 수 있어요. 언제든 현재 갤러리 항목 중 하나를 **기본 갤러리(default gallery)**로 선택할 수 있어요. 이 기본 갤러리는 Team Builder 사이드바에 컴포넌트를 채우는 데 쓰여요.

  • Gallery -> New Gallery 로 새 갤러리 생성
  • 필요에 따라 갤러리 JSON 편집
  • 사이드바의 핀(pin) 아이콘으로 기본 갤러리 설정 → Team Builder에서 컴포넌트를 쓸 수 있게 됨

팀을 대화형으로 실행하기

AutoGen Studio **Playground(플레이그라운드)**로 다음을 할 수 있어요:

  • 특정 태스크로 팀 테스트
  • 생성된 아티팩트(이미지·코드·텍스트) 검토
  • 작업 실행 중 팀의 "내적 독백(inner monologue)" 모니터링
  • 성능 지표(턴 수, 토큰 사용량) 확인
  • 에이전트 동작(도구 사용, 코드 실행 결과) 추적

팀 설정 가져오기와 재사용

AutoGen Studio의 Gallery 뷰는 기본 컴포넌트 컬렉션을 제공하고 외부 설정 가져오기를 지원해요:

  • Gallery -> New Gallery -> Import 로 갤러리 생성/가져오기
  • 사이드바 핀 아이콘으로 기본 갤러리 설정
  • Sidebar -> From Gallery 로 Team Builder에서 컴포넌트 접근

파이썬 통합

팀 설정은 TeamManager 클래스를 사용해 파이썬 애플리케이션에 통합할 수 있어요.

from autogenstudio.teammanager import TeamManager

tm = TeamManager()
result_stream = tm.run(task="What is the weather in New York?", team_config="team.json") # or tm.run_stream(..)

팀 설정을 내보내려면 Team Builder의 내보내기(export) 버튼을 사용해 파이썬 애플리케이션에서 쓸 JSON 파일을 생성하면 돼요.

더 알아보기 (Learn more)