KeiStory

반응형

A2A  샘플 실행해 보기

 

Google에서 공개한 A2A (Agent-to-Agent) 오픈 프로토콜은 서로 다른 에이전트 애플리케이션 간의 상호 운용성 및 통신을 위한 강력한 프레임워크를 제공합니다. 이번 포스팅에서는 A2A 저장소를 클론하고, LangGraph 에이전트와 Google ADK 에이전트를 실행해보며 A2A의 실제 작동하는 방법을 알아봅니다.

 

먼저 작업할 폴더(A2A)를 하나 만들고 아래 깃저장소에서 주소를 가져와 소스를 클론합니다.

https://github.com/google-a2a/A2A

 

GitHub - google-a2a/A2A: An open protocol enabling communication and interoperability between opaque agentic applications.

An open protocol enabling communication and interoperability between opaque agentic applications. - google-a2a/A2A

github.com

git clone https://github.com/google-a2a/A2A.git

A2A 폴더로 이동해 code . 명령으로 visual studio code 를 실행합니다.

저희가 agent 테스트 해볼건 아래 경로에 있는 langgraph 와 google_adk 입니다.

 

 

이 두가시 agent 를 실행하기 위해서는 google api key 가 필요합니다.

아래 사이트로 들어가 (로그인 필요)

https://aistudio.google.com/apikey

 

로그인 - Google 계정

이메일 또는 휴대전화

accounts.google.com

API Key 를 생성하고 값을 복사합니다.

google_adk, langgraph 폴더에 .dev 파일을 만들어  key 값을 넣습니다.

GOOGLE_API_KEY=AIza*******

 

langgraph agent 실행

추가했으면 langgraph 폴더로 이동해 실행합니다.

uv run .

실행하면 필요한 패키지가 설치되고 아래처럼 http://localhost:10000 이라고 보이면 정상적으로 실행이 완료된 것입니다.

 

이제 아래 링크로 이동하면

http://localhost:10000/.well-known/agent.json

아래와 같이 해당 agent 가 하는 일에 대한 설명이 뜨게됩니다.

{
  "capabilities": {
    "pushNotifications": true,
    "streaming": true
  },
  "defaultInputModes": [
    "text",
    "text/plain"
  ],
  "defaultOutputModes": [
    "text",
    "text/plain"
  ],
  "description": "Helps with exchange rates for currencies",
  "name": "Currency Agent",
  "skills": [
    {
      "description": "Helps with exchange values between various currencies",
      "examples": [
        "What is exchange rate between USD and GBP?"
      ],
      "id": "convert_currency",
      "name": "Currency Exchange Rates Tool",
      "tags": [
        "currency conversion",
        "currency exchange"
      ]
    }
  ],
  "url": "http://localhost:10000/",
  "version": "1.0.0"
}

 

google_adk agent 실행

이제 google_adk 폴더로 이동해 실행합니다.

uv run .

이번에는 10002 포트로 실행됩니다.

이제 아래 링크로 이동하면

http://localhost:10002/.well-known/agent.json

아래와 같이 해당 agent 가 하는 일에 대한 설명이 뜨게됩니다.

{
  "capabilities": {
    "streaming": true
  },
  "defaultInputModes": [
    "text",
    "text/plain"
  ],
  "defaultOutputModes": [
    "text",
    "text/plain"
  ],
  "description": "This agent handles the reimbursement process for the employees given the amount and purpose of the reimbursement.",
  "name": "Reimbursement Agent",
  "skills": [
    {
      "description": "Helps with the reimbursement process for users given the amount and purpose of the reimbursement.",
      "examples": [
        "Can you reimburse me $20 for my lunch with the clients?"
      ],
      "id": "process_reimbursement",
      "name": "Process Reimbursement Tool",
      "tags": [
        "reimbursement"
      ]
    }
  ],
  "url": "http://localhost:10002/",
  "version": "1.0.0"
}

 

UI 실행

이제 두 agent 를 사용해보겠습니다.

demo/ui 폴더로 이동합니다.

main.py 내용중에서 A2A_UI_HOST 를 localhost 로 수정합니다.

    host = os.environ.get('A2A_UI_HOST', 'localhost')
    port = int(os.environ.get('A2A_UI_PORT', '12000'))

실행합니다.

uv run main.py

http://localhost:12000 사이트를 열면 아래와 같은 화면이 나옵니다.

두번째 메뉴의 agent 로 이동해 앞서 실행한 agent 를 추가합니다.

 

langgraph agent 추가


google_adk agnet 추가

각각의 Agent 의 기능은 아래와 같습니다.

항목 LangGraph Agent Google ADK Agent
포트 10000 10002
기능 환율 변환 경비 정산 처리
API 호출 외부 환율 API Gemini LLM 호출
특징 텍스트 입출력, 스트리밍 지원 Google ADK 기반 LLM 통신

 

환율변환과 환불작업이 동시에 처리되는걸 확인할 수 있습니다.

 

A2A는 향후 다양한 에이전트 애플리케이션들이 독립적으로 작동하면서도 상호 소통할 수 있는 생태계를 구축하는 데 핵심적인 역할을 할 것으로 보입니다. 이번 포스팅에서을 통해 그 가능성을 엿볼 수 있었습니다. 실제 비즈니스 로직에 맞춘 커스텀 에이전트 구현도 가능하니 관심 있는 분들은 직접 활용해 보시길 추천드립니다!

반응형

'코딩 > Python_AI' 카테고리의 다른 글

OpenWebUI 사용하기  (0) 2025.06.03
langchain_mcp_adapters 를 이용해 Langchain 과 MCP 연동하기  (0) 2025.06.03
vLLM 사용하기  (0) 2025.05.26
MCP 서버 구축 및 사용하기  (0) 2025.04.04
OpenAI MCP Agents SDK 사용하기  (0) 2025.04.02

공유하기

facebook twitter kakaoTalk kakaostory naver band