멀티 에이전트 슈퍼바이저(Multi-agent supervisor)
슈퍼바이저(supervisor)는 중앙 슈퍼바이저 에이전트가 전문 에이전트들을 조정하는 다중 에이전트 아키텍처입니다. 슈퍼바이저 에이전트는 모든 통신 흐름과 작업 위임을 제어하며, 현재 상황과 작업 요구사항에 따라 호출할 에이전트를 결정합니다.
이 튜토리얼에서는 연구 전문가와 수학 전문가라는 두 에이전트로 구성된 슈퍼바이저 시스템을 구축합니다. 튜토리얼을 마치면 다음을 수행할 수 있습니다:
- 전문 연구 및 수학 에이전트 구축
- 사전 구축된 langgraph-supervisor를 사용하여 이를 조정하는 슈퍼바이저 구축
- 슈퍼바이저를 처음부터 구축
- 고급 작업 위임 구현

참고
- 관련 논문: https://arxiv.org/abs/2405.16510
- 슈퍼바이저 에이전트 개념: https://langchain-ai.github.io/langgraph/concepts/multi_agent/#supervisor
- 랭그래프 공식 튜토리얼: https://langchain-ai.github.io/langgraph/tutorials/multi_agent/agent_supervisor/
환경 설정
먼저 필요한 패키지를 설치하고 API 키를 설정해 보겠습니다.
%%capture --no-stderr
%pip install -Uq langgraph langgraph-supervisor langchain-tavily "langchain[openai]"import getpass
import os
from dotenv import load_dotenv
load_dotenv("../.env", override=True)
def _set_env(var: str):
env_value = os.environ.get(var)
if not env_value:
env_value = getpass.getpass(f"{var}: ")
os.environ[var] = env_value
_set_env("LANGSMITH_API_KEY")
os.environ["LANGSMITH_TRACING"] = "true"
os.environ["LANGSMITH_PROJECT"] = "langchain-academy"
_set_env("OPENAI_API_KEY")1. 작업 에이전트 생성
먼저, 연구 에이전트와 수학 에이전트라는 특수 작업 에이전트를 생성해 보겠습니다:
연구 에이전트는 Tavily API를 사용하는 웹 검색 도구에 접근할 수 있습니다. 수학 에이전트는 간단한 수학 도구(덧셈, 곱셈, 나눗셈)에 접근할 수 있습니다.
연구 에이전트
웹 검색을 위해 langchain-tavily의 TavilySearch 도구를 사용할 것입니다:
from langchain_tavily import TavilySearch
web_search = TavilySearch(max_results=3)
web_search_results = web_search.invoke("서울시의 시장은 누구입니까?")
print(web_search_results["results"][0]["content"])| ▲ 오세훈 서울시장이 2025년 2월26일 서울 중구 서울시청에서 열린 제4회 서울시 안보포럼 ‘트럼프 2기, 한반도 안보의 길을 묻다’에서 환영사를 하고 있다. △서울시 공식 슬로건 ‘Seoul, my soul(서울, 마이 소울)’ 내걸어 오세훈은 2023년 8월16일 박원순 전 서울시장 때 선정된 서울시 공식 슬로건 ‘I·SEOUL·U(아이서울유)’를 ‘Seoul, my soul(서울, 마이 소울)’로 바꿨다. △4‧7재보선에서 서울시장 당선 오세훈은 2021년 4월7일 박원순 전 시장의 유고로 치러진 서울시장 보궐선거에서 국민의힘 후보로 출마한 뒤 당선돼 10년 만에 서울시장에 복귀했다. 오세훈은 2021년 4월 서울시장 보궐선거를 앞두고 명태균씨 측에서 실시한 여론조사 비용을 사업가 김한정씨에게 대납하게 한 의혹을 받고 있다. 오세훈은 2021년 4월 서울시장 보궐선거를 앞두고 명태균 측에서 실시한 여론조사 비용을 사업가 김한정에게 대납하게 한 의혹을 받고 있다. | ▲ 오세훈 서울시장이 2025년 2월12일 서울 국회 도서관에서 열린 ‘87체제 극복을 위한 지방분권 개헌 토론회’에 입장하고 있다.
개별 작업자 에이전트를 생성하기 위해 LangGraph의 사전 구축된 에이전트를 사용할 것입니다.
from langgraph.prebuilt import create_react_agent
research_agent = create_react_agent(
model="openai:gpt-4.1-mini",
tools=[web_search],
prompt=(
"당신은 연구 에이전트입니다.\n\n"
"INSTRUCTIONS:\n"
"- 연구 관련 작업에만 협조하십시오. 수학 문제는 절대 수행하지 마십시오.\n"
"- 작업 완료 후에는 감독관에게 직접 응답하십시오.\n"
"- 작업 결과만 응답하십시오. 다른 텍스트는 절대 포함하지 마십시오."
),
name="research_agent",
)에이전트를 실행하여 예상대로 동작하는지 확인해 봅시다.
# 스트리밍 에이전트 출력을 깔끔하게 렌더링하기 위해
# pretty_print_messages 헬퍼를 사용할 것입니다
from langchain_core.messages import convert_to_messages
def pretty_print_message(message, indent=False):
pretty_message = message.pretty_repr(html=True)
if not indent:
print(pretty_message)
return
indented = "\n".join("\t" + c for c in pretty_message.split("\n"))
print(indented)
def pretty_print_messages(update, last_message=False):
is_subgraph = False
if isinstance(update, tuple):
ns, update = update
# skip parent graph updates in the printouts
if len(ns) == 0:
return
graph_id = ns[-1].split(":")[0]
print(f"Update from subgraph {graph_id}:")
print("\n")
is_subgraph = True
for node_name, node_update in update.items():
update_label = f"Update from node {node_name}:"
if is_subgraph:
update_label = "\t" + update_label
print(update_label)
print("\n")
messages = convert_to_messages(node_update["messages"])
if last_message:
messages = messages[-1:]
for m in messages:
pretty_print_message(m, indent=is_subgraph)
print("\n")for chunk in research_agent.stream(
{"messages": [("user", "서울시의 시장은 누구입니까?")]}
):
pretty_print_messages(chunk)Update from node agent:
==================================[1m Ai Message [0m==================================
Name: research_agent
Tool Calls:
tavily_search (call_kRJTJe0C3jko8yCcf3g6ir86)
Call ID: call_kRJTJe0C3jko8yCcf3g6ir86
Args:
query: 서울시 시장
include_domains: ['seoul.go.kr']
search_depth: basic
Update from node tools:
=================================[1m Tool Message [0m=================================
Name: tavily_search
{"query": "서울시 시장", "follow_up_questions": null, "answer": null, "images": [], "results": [{"url": "https://www.seoul.go.kr/seoul/mayor.do", "title": "역대서울시장 | 서울특별시", "content": "+ 비정규직의 정규직화, 골목상권보호 등 상생협력 문화 정착을 통한 경제민주화도시 서울 추진 + 도시기반시설 노후화 대비, 지하철 안전강화 등 안전도시 서울 추진 + 창의시정(120다산콜센터, 천만상상오아시스 등) 추진 + WDC 2010 유치, 동대문디자인파크플라자 건설 등 디자인서울 정책 추진 + 청계천 생태하천 복원, 서울숲 조성 등 친환경시정 추진 서울의제 21 등 환경정책 적극 추진 + 제2기 지하철 건설 추진 및 내부순환 및 북부간선도로 등 도시고속도로 착공 + 빗물펌프장 확충 및 정비, 제방축조 등 항구적인 수방대책 수립 추진 + 상수도 공급, 청소, 주택공급, 복지시설 확충 등 서민생활보호대책 추진 + 청소행정의 혁신, 도시가스시설 확충 및 의료보험의 확대 등 서민생활안정 종합대책 추진 + 도시새마을 운동의 약진과 함께 서민주택 건설, 서민생활 보호 등 서민생활 보호를 위한 시책 추진 + 각종 생활환경시설의 확충 및 불량지구 재개발 등 추진", "score": 0.98566, "raw_content": null}, {"url": "https://mayor.seoul.go.kr/oh/seoul/manifesto.do", "title": "공약실천계획 | 서울특별시장", "content": "공약실천계획 · 민선8기 공약실천계획서 · 민선8기 공약이행현황 · 시민공약평가단 운영결과보고서. e-book 바로보기. 공약 변경 내역. 옆", "score": 0.98533, "raw_content": null}, {"url": "https://news.seoul.go.kr/economy/archives/564969", "title": "서울시 전통시장 현황(2025.1.31.일 기준) < 경제 < 서울특별시", "content": "서울시 전통시장 현황(2025.1.31.일 기준). 담당부서: 민생노동국상권활성화과; 문의: 02-2133-5487; 수정일: 2025-06-12. 2022년 신용카드 사용액에 대한 소득공제", "score": 0.98299, "raw_content": null}], "response_time": 1.38, "request_id": "36a70575-417d-4bd7-9084-9198e7281987"}
Update from node agent:
==================================[1m Ai Message [0m==================================
Name: research_agent
서울시의 시장 정보는 서울특별시 공식 웹사이트 등을 통해 확인할 수 있으나, 현재 검색된 결과에서는 시장의 이름이 구체적으로 나타나지 않았습니다. 최신 서울시 시장의 이름을 확인하려면 서울특별시 공식 웹사이트나 신뢰할 만한 뉴스 소스를 참조할 필요가 있습니다.
수학 에이전트
수학 에이전트 도구에는 기본 파이썬 함수를 사용할 것입니다:
def add(a: float, b: float):
"""두 수를 더합니다."""
return a + b
def multiply(a: float, b: float):
"""두 수를 곱합니다."""
return a * b
def divide(a: float, b: float):
"""두 수를 나눕니다."""
return a / b
math_agent = create_react_agent(
model="openai:gpt-4.1-mini",
tools=[add, multiply, divide],
prompt=(
"당신은 수학 에이전트입니다.\n\n"
"INSTRUCTIONS:\n"
"- 오직 수학 관련 작업만 지원하십시오\n"
"- 작업 완료 후에는 감독관에게 직접 응답하십시오\n"
"- 오직 작업 결과만 응답하고, 그 외 어떤 텍스트도 포함하지 마십시오."
),
name="math_agent",
)수학 에이전트를 실행해 보자:
for chunk in math_agent.stream({"messages": [("user", "(3 + 5) × 7은 얼마인가요?")]}):
pretty_print_messages(chunk)Update from node agent:
==================================[1m Ai Message [0m==================================
Name: math_agent
Tool Calls:
add (call_kEXvrpjaHAa3OCVczrwZYpVl)
Call ID: call_kEXvrpjaHAa3OCVczrwZYpVl
Args:
a: 3
b: 5
Update from node tools:
=================================[1m Tool Message [0m=================================
Name: add
8.0
Update from node agent:
==================================[1m Ai Message [0m==================================
Name: math_agent
Tool Calls:
multiply (call_yRKBT5vpobtbPLXEtteMRKB5)
Call ID: call_yRKBT5vpobtbPLXEtteMRKB5
Args:
a: 8
b: 7
Update from node tools:
=================================[1m Tool Message [0m=================================
Name: multiply
56.0
Update from node agent:
==================================[1m Ai Message [0m==================================
Name: math_agent
(3 + 5) × 7은 56입니다.
2. langgraph-supervisor로 슈퍼바이저 생성하기
다중 에이전트 시스템을 구현하기 위해 사전 구축된 langgraph-supervisor 라이브러리의 create_supervisor를 사용할 것입니다:
from langgraph_supervisor import create_supervisor
from langchain.chat_models import init_chat_model
supervisor = create_supervisor(
model=init_chat_model("openai:gpt-4.1-mini"),
agents=[research_agent, math_agent],
prompt=(
"당신은 두 명의 에이전트를 관리하는 감독관입니다:\n"
"- research 에이전트: 연구 관련 작업을 이 에이전트에게 할당하십시오\n"
"- math 에이전트: 수학 관련 작업을 이 에이전트에게 할당하십시오\n"
"한 번에 한 명의 에이전트에게만 작업을 할당하고, 에이전트를 동시에 호출하지 마십시오.\n"
"직접 어떤 작업도 수행하지 마십시오."
),
add_handoff_back_messages=True, # handoff 메시지 추가
output_mode="full_history",
).compile()from IPython.display import display, Image
display(Image(supervisor.get_graph().draw_mermaid_png()))
참고: 이 코드를 실행하면 슈퍼바이저 에이전트와 작업자 에이전트 간의 흐름을 보여주는 슈퍼바이저 그래프의 시각적 표현이 생성되어 표시됩니다.
이제 두 에이전트 모두를 필요로 하는 쿼리로 실행해 보겠습니다:
- 연구 에이전트는 필요한 GDP 정보를 조회합니다
- 수학 에이전트는 요청된 대로 뉴욕 주 GDP의 비율을 구하기 위해 나눗셈을 수행합니다
query = "2024년 미국 및 뉴욕 주의 국내총생산(GDP)을 찾아보십시오. 뉴욕 주의 GDP가 미국 GDP에서 차지하는 비율은 얼마입니까?"
for chunk in supervisor.stream(
{"messages": [("user", query)]},
):
pretty_print_messages(chunk, last_message=True)Update from node supervisor:
=================================[1m Tool Message [0m=================================
Name: transfer_to_research_agent
Successfully transferred to research_agent
Update from node research_agent:
=================================[1m Tool Message [0m=================================
Name: transfer_back_to_supervisor
Successfully transferred back to supervisor
Update from node supervisor:
==================================[1m Ai Message [0m==================================
Name: supervisor
2024년 미국 GDP 성장률은 약 2.3~2.7% 사이로 전망되며, 뉴욕 주의 경제 성장률은 약 2.4%로 미국 전체와 비슷하거나 다소 높게 예상됩니다. 뉴욕 주가 미국 GDP에서 차지하는 비율은 구체 수치는 없으나, 대략 8~10% 수준으로 추정됩니다. 추가로 구체적인 공식 수치를 원하시면 알려주세요.
final_message_history = chunk["supervisor"]["messages"]
print(final_message_history)[HumanMessage(content='2024년 미국 및 뉴욕 주의 국내총생산(GDP)을 찾아보십시오. 뉴욕 주의 GDP가 미국 GDP에서 차지하는 비율은 얼마입니까?', additional_kwargs={}, response_metadata={}, id='859cd2ba-0eac-4686-9779-344ff053be46'), AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_KjHciNugUHinmpIcVRO7I29H', 'function': {'arguments': '{}', 'name': 'transfer_to_research_agent'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 13, 'prompt_tokens': 198, 'total_tokens': 211, 'completion_tokens_details': {'accepted_prediction_tokens': 0, 'audio_tokens': 0, 'reasoning_tokens': 0, 'rejected_prediction_tokens': 0}, 'prompt_tokens_details': {'audio_tokens': 0, 'cached_tokens': 0}}, 'model_name': 'gpt-4.1-mini-2025-04-14', 'system_fingerprint': 'fp_c064fdde7c', 'id': 'chatcmpl-CPfNyN5nS30paNITF5aGGfCnbktEm', 'service_tier': 'default', 'finish_reason': 'tool_calls', 'logprobs': None}, name='supervisor', id='run--d5922805-62c1-4e66-a975-1f71fe31596b-0', tool_calls=[{'name': 'transfer_to_research_agent', 'args': {}, 'id': 'call_KjHciNugUHinmpIcVRO7I29H', 'type': 'tool_call'}], usage_metadata={'input_tokens': 198, 'output_tokens': 13, 'total_tokens': 211, 'input_token_details': {'audio': 0, 'cache_read': 0}, 'output_token_details': {'audio': 0, 'reasoning': 0}}), ToolMessage(content='Successfully transferred to research_agent', name='transfer_to_research_agent', id='12dbd6f4-8c72-4f78-8211-3340adcbd228', tool_call_id='call_KjHciNugUHinmpIcVRO7I29H'), AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_6FZmzcGTpEvmUGKgKgdZDsVB', 'function': {'arguments': '{"query": "2024 US GDP forecast", "time_range": "year", "search_depth": "advanced"}', 'name': 'tavily_search'}, 'type': 'function'}, {'id': 'call_kr6E3FaIAaLoXUBRrRoqFpwd', 'function': {'arguments': '{"query": "2024 New York State GDP forecast", "time_range": "year", "search_depth": "advanced"}', 'name': 'tavily_search'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 78, 'prompt_tokens': 1406, 'total_tokens': 1484, 'completion_tokens_details': {'accepted_prediction_tokens': 0, 'audio_tokens': 0, 'reasoning_tokens': 0, 'rejected_prediction_tokens': 0}, 'prompt_tokens_details': {'audio_tokens': 0, 'cached_tokens': 0}}, 'model_name': 'gpt-4.1-mini-2025-04-14', 'system_fingerprint': 'fp_c064fdde7c', 'id': 'chatcmpl-CPfNzci9flHqBmFrB9YDeqUUvn2bl', 'service_tier': 'default', 'finish_reason': 'tool_calls', 'logprobs': None}, name='research_agent', id='run--4af515f8-6f58-4795-b08d-961a81d79079-0', tool_calls=[{'name': 'tavily_search', 'args': {'query': '2024 US GDP forecast', 'time_range': 'year', 'search_depth': 'advanced'}, 'id': 'call_6FZmzcGTpEvmUGKgKgdZDsVB', 'type': 'tool_call'}, {'name': 'tavily_search', 'args': {'query': '2024 New York State GDP forecast', 'time_range': 'year', 'search_depth': 'advanced'}, 'id': 'call_kr6E3FaIAaLoXUBRrRoqFpwd', 'type': 'tool_call'}], usage_metadata={'input_tokens': 1406, 'output_tokens': 78, 'total_tokens': 1484, 'input_token_details': {'audio': 0, 'cache_read': 0}, 'output_token_details': {'audio': 0, 'reasoning': 0}}), ToolMessage(content='{"query": "2024 US GDP forecast", "follow_up_questions": null, "answer": null, "images": [], "results": [{"url": "https://www.philadelphiafed.org/surveys-and-data/real-time-data-research/spf-q4-2024", "title": "Fourth Quarter 2024 Survey of Professional Forecasters", "content": "The near-term outlook for the U.S. economy looks better now than it did three months ago, according to 33 forecasters surveyed by the Federal Reserve Bank of Philadelphia. The forecasters predict the economy will expand at an annual rate of 2.2 percent this quarter and 1.9 percent in the first quarter of 2025, up from the predictions of 1.7 percent in the last survey. On an annual-average over annual-average basis, the forecasters expect real GDP to increase 2.7 percent in 2024 and 2.2 percent [...] The charts below provide some insight into the degree of uncertainty the forecasters have about their projections for the rate of growth in the annual-average level of real GDP. Each chart presents the forecasters’ previous and current estimates of the probability that growth will fall into each of 11 ranges. For 2024, the forecasters are increasing their probability estimates from the previous survey for real GDP growth in the range of 2.5 percent to 3.9 percent. Over each of the following [...] three years, from 2025 to 2027, the forecasters are increasing their probability estimates from the survey of three months ago for real GDP growth in the range of 1.5 percent to 2.4 percent.", "score": 0.9006087, "raw_content": null}, {"url": "https://www.fanniemae.com/research-and-insights/forecast/economic-developments-october-2024", "title": "Economic Developments - October 2024 - Fannie Mae", "content": "Although we revised our growth forecast upward, we note that our outlook of 2.3 percent growth in 2024 and 2.0 percent growth in 2025 still represents a slowdown from the 3.2 percent GDP growth recorded in 2023. Further, the long-term potential growth rate of the economy depends on several factors, including future productivity growth and immigration flows, both of which at this point remain highly uncertain. Estimates of productivity growth in recent quarters have been well above their [...] Economic Developments - October 2024 | Fannie Mae\\n\\nSkip to main content\\n\\nFM Site Nav\\n\\nHomepageImage 1: Fannie Mae logo\\n Search\\n\\nToggle search Search\\n\\n outlook. We now forecast 2024 economic growth on a Q4/Q4 basis will be 2.3 percent (up from last month’s forecast of 2.0 percent) and 2025 growth will be 2.0 percent (up from 1.8 percent). [...] nearly 50 percent lower than it was a year ago in September 2023. On balance, we continue to expect a gradual slowing in employment growth. Similar to our expectation that the economy will return to roughly its long-run growth rate, we believe the unemployment rate will rise modestly to 4.4 percent, roughly our current estimate of the natural rate of unemployment.", "score": 0.8619225, "raw_content": null}, {"url": "https://www.cbo.gov/publication/60870", "title": "The Budget and Economic Outlook: 2025 to 2035", "content": "Since June 2024, when CBO published its previous full economic forecast, the agency’s projections of the average growth rate of real GDP over the 2024–2026 period have changed little. CBO raised its forecast of the average unemployment rate for 2024 to 2026 and lowered its forecast of employment growth over that period. Inflation is expected to be slightly higher, on average, in 2025 and 2026 than the agency projected in June. The forecast of long-term interest rates for 2026 is also higher. [...] In CBO’s projections, economic growth cools from an estimated 2.3 percent in calendar year 2024 to 1.9 percent in 2025 and 1.8 percent in 2026 amid higher unemployment and lower inflation. The Federal Reserve continues reducing interest rates through the end of 2026, which supports economic growth. Real GDP then grows by 1.8 percent per year, on average, through 2035. Roughly four-fifths of the growth over that period is due to increases in the productivity of the labor force. The rest is due", "score": 0.8377398, "raw_content": null}], "response_time": 1.74, "request_id": "8a384e28-39df-4bf5-98d6-8c1bc48d503c"}', name='tavily_search', id='dc875289-a253-4bae-8581-bc7b41dcf788', tool_call_id='call_6FZmzcGTpEvmUGKgKgdZDsVB'), ToolMessage(content='{"query": "2024 New York State GDP forecast", "follow_up_questions": null, "answer": null, "images": [], "results": [{"url": "https://www.osc.ny.gov/files/reports/pdf/budgets-receipts-disbursement-24-27.pdf", "title": "[PDF] Report on Estimated Receipts and Disbursements", "content": "years are projections. Source: S&P Global, October 2024 U.S. and Regional Macroeconomic Forecast New York Economy In the first quarter of 2024, the New York economy grew 2.4 percent, accelerating from its growth in the fourth quarter of 2023. The State’s economic growth in the second quarter was even stronger (3.8 percent) and continued to outpace that of the nation (3.0 percent).5 Due to an expected deceleration in the second half of the year, S&P Global estimates the New York economy will [...] grow at an annual rate of 2.4 percent in 2024. In 2025, the New York economy is projected to grow at the same rate as that of the nation, increasing by 2.1 percent. By April 2024, New York had recovered all the jobs lost during the pandemic shutdown. While employment growth was erratic through September, jobs increased by an average of 13,600 per month and were 49,400 higher than in February 2020.6 For all of 2024, employment is estimated to grow 1.6 percent, but then to slow to 0.9 percent in [...] As a result, S&P Global estimates total personal income to increase by 5.7 and by 4.7 percent in 2024 and 2025, respectively. Figure 3 Annual Percentage Change in Selected Economic Indicators UNITED STATES 2023 2024 2025 2026 2027 Real GDP 2.9 2.7 2.1 1.8 1.7 Employment 2.3 1.6 0.8 0.2 0.1 Wages 5.4 6.6 4.4 4.5 3.8 Personal Income 5.9 5.7 4.7 5.1 4.6 NEW YORK Employment 2.1 1.6 0.9 0.1 0.0 Wages 4.8 6.2 5.1 4.8 3.7 Personal Income 5.7 5.8 4.9 5.1 4.4 Note: 2023 Statistics are actuals; all other", "score": 0.8815438, "raw_content": null}, {"url": "https://www.budget.ny.gov/pubs/archive/fy26/ex/ero/fy26ero.pdf", "title": "[PDF] Economic and Revenue Outlook | NYS FY 2026 Executive Budget", "content": "estimate of 2024 third-quarter GDP, the October 2024 personal income and outlays estimates, the October 2024 CPI report, and the initial estimate of November 2024 employment. DOB’s New York State forecast incorporates the second quarter of 2024 personal income by state data and the first half of 2024 QCEW data. 17 F Y 2 0 2 6 E C O N O M I C A N D R E V E N U E O U T L O O K ECONOMIC ENVIRONMENT slowdown in job growth, State wages are estimated to be growing a solid 5.4 percent in FY 2025 due [...] York State is projected to experience slower personal income and wage growth in 2024 compared to the nation. New York’s personal income growth is forecasted at 5.3 percent, primarily due to weaker State wage growth. Looking at the growth rates on a state fiscal year frequency, total wage growth in New York is anticipated to accelerate from 4.2 percent in FY 2024 to 5.4 percent in FY 2025, driven by a strong rebound in total bonuses, which are expected to shift from a 0.9 percent decline in FY [...] labor market, New York State’s employment growth slowed to an estimated 1.5 percent in 2024. Job growth is projected to decelerate further to 0.8 percent in 2025 primarily due to the State’s labor shortages and weaker global and national economic conditions. State personal income is projected to grow by 4.1 percent in FY 2026, a deceleration from an estimated growth of 5.2 percent in FY 2025, primarily due to weaker wage growth. Despite a 13 DOB’s U.S. economic forecast incorporates the second", "score": 0.86052185, "raw_content": null}, {"url": "https://comptroller.nyc.gov/newsroom/newsletter/new-york-by-the-numbers-monthly-economic-and-fiscal-outlook/", "title": "New York by the Numbers Monthly Economic and Fiscal Outlook", "content": "| 19-Oct-24 | 0.10% | 14.80% |\\n| 26-Oct-24 | 5.30% | 12.50% |\\n| 2-Nov-24 | 9.40% | 6.90% |\\n| 9-Nov-24 | 3.40% | 0.30% |\\n| 16-Nov-24 | 6.50% | -1.00% |\\n| 23-Nov-24 | 5.20% | -1.50% | [...] | 29-Jun-24 | -11.00% | -5.90% |\\n| 6-Jul-24 | -16.10% | -5.40% |\\n| 13-Jul-24 | -14.80% | -1.10% |\\n| 20-Jul-24 | -11.70% | 0.60% |\\n| 27-Jul-24 | -12.40% | 4.40% |\\n| 3-Aug-24 | -5.90% | 4.00% |\\n| 10-Aug-24 | -2.50% | 0.90% |\\n| 17-Aug-24 | -2.80% | -0.50% |\\n| 24-Aug-24 | -0.60% | -2.60% |\\n| 31-Aug-24 | 0.30% | 0.30% |\\n| 7-Sep-24 | 0.70% | 2.80% |\\n| 14-Sep-24 | 1.40% | 5.20% |\\n| 21-Sep-24 | 2.00% | 6.60% |\\n| 28-Sep-24 | 2.70% | 7.30% |\\n| 5-Oct-24 | -0.50% | 12.10% |\\n| 12-Oct-24 | 4.20% | 14.70% | [...] | 16-Mar-24 | -0.50% | -10.20% |\\n| 23-Mar-24 | -2.70% | -12.60% |\\n| 30-Mar-24 | -2.70% | -9.80% |\\n| 6-Apr-24 | -4.60% | -10.70% |\\n| 13-Apr-24 | -10.10% | -10.60% |\\n| 20-Apr-24 | -28.60% | -9.40% |\\n| 27-Apr-24 | -28.30% | -12.10% |\\n| 4-May-24 | -10.80% | -9.20% |\\n| 11-May-24 | -6.30% | -5.90% |\\n| 18-May-24 | 16.80% | -5.20% |\\n| 25-May-24 | 11.70% | -2.90% |\\n| 1-Jun-24 | -13.60% | -6.40% |\\n| 8-Jun-24 | -16.80% | -8.10% |\\n| 15-Jun-24 | -16.60% | -9.00% |\\n| 22-Jun-24 | -14.70% | -8.00% |", "score": 0.81979275, "raw_content": null}], "response_time": 2.39, "request_id": "94642f71-f2c3-44c7-9630-e0cc834bf67a"}', name='tavily_search', id='aac7f22d-5807-4165-8ada-445629f919c4', tool_call_id='call_kr6E3FaIAaLoXUBRrRoqFpwd'), AIMessage(content='2024년 미국 국내총생산(GDP)의 예상 성장률은 약 2.3~2.7% 사이로 전망되고 있습니다. 구체적인 GDP 금액은 최신 수치가 명확하지 않았으나, 경제 성장률 예측을 기반으로 추정할 수 있습니다.\n\n뉴욕 주의 경우, 2024년 경제 성장률은 약 2.4%로 미국 전체 성장률과 비슷하거나 다소 높게 예상됩니다.\n\n뉴욕 주 GDP가 미국 GDP에서 차지하는 비율에 대한 직접적인 최신 수치는 검색 결과에 없었으나, 뉴욕 주는 미국 내에서 경제 규모가 큰 주 중 하나로 대략 8~10% 범위 내에 있을 가능성이 큽니다.\n\n요약:\n- 2024년 미국 GDP 성장률: 약 2.3~2.7%\n- 2024년 뉴욕 주 GDP 성장률: 약 2.4%\n- 뉴욕 주의 미국 GDP 내 비율: 대략 8~10% 추정\n\n더 구체적이고 정량적인 수치를 원하시면 추가로 기관별 공식 발표 자료를 확인하시길 권장합니다.', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 251, 'prompt_tokens': 4427, 'total_tokens': 4678, 'completion_tokens_details': {'accepted_prediction_tokens': 0, 'audio_tokens': 0, 'reasoning_tokens': 0, 'rejected_prediction_tokens': 0}, 'prompt_tokens_details': {'audio_tokens': 0, 'cached_tokens': 0}}, 'model_name': 'gpt-4.1-mini-2025-04-14', 'system_fingerprint': 'fp_c064fdde7c', 'id': 'chatcmpl-CPfO4y1yuIVrRv9opAjF2Mw89VI8W', 'service_tier': 'default', 'finish_reason': 'stop', 'logprobs': None}, name='research_agent', id='run--5a6df99f-50b3-4d05-b110-3ea9cbcb4399-0', usage_metadata={'input_tokens': 4427, 'output_tokens': 251, 'total_tokens': 4678, 'input_token_details': {'audio': 0, 'cache_read': 0}, 'output_token_details': {'audio': 0, 'reasoning': 0}}), AIMessage(content='Transferring back to supervisor', additional_kwargs={}, response_metadata={'__is_handoff_back': True}, name='research_agent', id='aa7ca696-35ba-42c7-9411-ac3686a4a59f', tool_calls=[{'name': 'transfer_back_to_supervisor', 'args': {}, 'id': '83ff49fa-1cbf-4e11-86bc-a93d3d66175a', 'type': 'tool_call'}]), ToolMessage(content='Successfully transferred back to supervisor', name='transfer_back_to_supervisor', id='8246324f-5558-439a-b514-0cca53effe36', tool_call_id='83ff49fa-1cbf-4e11-86bc-a93d3d66175a'), AIMessage(content='2024년 미국 GDP 성장률은 약 2.3~2.7% 사이로 전망되며, 뉴욕 주의 경제 성장률은 약 2.4%로 미국 전체와 비슷하거나 다소 높게 예상됩니다. 뉴욕 주가 미국 GDP에서 차지하는 비율은 구체 수치는 없으나, 대략 8~10% 수준으로 추정됩니다. 추가로 구체적인 공식 수치를 원하시면 알려주세요.', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 101, 'prompt_tokens': 3553, 'total_tokens': 3654, 'completion_tokens_details': {'accepted_prediction_tokens': 0, 'audio_tokens': 0, 'reasoning_tokens': 0, 'rejected_prediction_tokens': 0}, 'prompt_tokens_details': {'audio_tokens': 0, 'cached_tokens': 0}}, 'model_name': 'gpt-4.1-mini-2025-04-14', 'system_fingerprint': 'fp_c064fdde7c', 'id': 'chatcmpl-CPfO8FvKm8blbIZoRAsrQhs8nzHVU', 'service_tier': 'default', 'finish_reason': 'stop', 'logprobs': None}, name='supervisor', id='run--77816821-c84f-4345-bdd0-1d70ea632dd6-0', usage_metadata={'input_tokens': 3553, 'output_tokens': 101, 'total_tokens': 3654, 'input_token_details': {'audio': 0, 'cache_read': 0}, 'output_token_details': {'audio': 0, 'reasoning': 0}})]
3. 슈퍼바이저 에이전트부터 새로 만들기
이제 동일한 다중 에이전트 시스템을 처음부터 구현해 보겠습니다. 다음을 수행해야 합니다:
- 감독 에이전트가 개별 에이전트와 통신하는 방식 설정
- 감독 에이전트 생성
- 감독 에이전트와 작업자 에이전트를 단일 다중 에이전트 그래프로 결합.
에이전트 통신 설정
슈퍼바이저 에이전트가 워커 에이전트들과 통신할 수 있는 방식을 정의해야 합니다. 다중 에이전트 아키텍처에서 이를 구현하는 일반적인 방법은 한 에이전트가 다른 에이전트에게 제어권을 넘기는 핸드오프를 사용하는 것입니다. 핸드오프를 통해 다음을 지정할 수 있습니다:
- destination: 제어권을 넘길 대상 에이전트
- payload: 해당 에이전트에 전달할 정보
우리는 핸드오프 도구를 통해 핸드오프를 구현하고 이 도구들을 관리자 에이전트에 제공할 것입니다: 관리자가 이 도구들을 호출하면, 전체 메시지 기록을 해당 에이전트에 전달하며 제어권을 작업자 에이전트에게 넘깁니다.
from typing import Annotated
from langchain_core.tools import tool, InjectedToolCallId
from langgraph.prebuilt import InjectedState
from langgraph.graph import StateGraph, START, MessagesState
from langgraph.types import Command
from langchain_core.messages import ToolMessage
def create_handoff_tool(*, agent_name: str, description: str | None = None):
tool_name = f"transfer_to_{agent_name}"
description = description or f"{agent_name}에게 도움을 요청하세요."
@tool(tool_name, description=description)
def handoff_tool(
state: Annotated[MessagesState, InjectedState],
tool_call_id: Annotated[str, InjectedToolCallId],
) -> Command:
tool_message = ToolMessage(
f"{agent_name}에게 성공적으로 이관되었습니다.",
name=tool_name,
tool_call_id=tool_call_id,
)
return Command(
goto=agent_name,
update={**state, "messages": state["messages"] + [tool_message]},
graph=Command.PARENT,
)
return handoff_tool
# Handoffs
assign_to_research_agent = create_handoff_tool(
agent_name="research_agent",
description="연구자 에이전트에게 작업을 할당하십시오.",
)
assign_to_math_agent = create_handoff_tool(
agent_name="math_agent",
description="수학 에이전트에게 작업을 할당하십시오.",
)슈퍼바이저 에이전트 생성
이제 방금 정의한 핸드오프 도구를 사용하여 슈퍼바이저 에이전트를 생성해 보겠습니다.
미리 빌드된 create_react_agent를 사용할 것입니다:
supervisor_agent = create_react_agent(
model="openai:gpt-4.1-mini",
tools=[assign_to_research_agent, assign_to_math_agent],
prompt=(
"당신은 두 명의 에이전트를 관리하는 감독관입니다:\n"
"- research 에이전트: 연구 관련 작업을 이 에이전트에게 할당하십시오\n"
"- math 에이전트: 수학 관련 작업을 이 에이전트에게 할당하십시오\n"
"한 번에 한 명의 에이전트에게만 작업을 할당하고, 에이전트를 동시에 호출하지 마십시오.\n"
"직접 어떤 작업도 수행하지 마십시오."
),
name="supervisor",
)다중 에이전트 그래프 생성
이 모든 것을 종합하여 전체 다중 에이전트 시스템을 위한 그래프를 생성해 보겠습니다.
슈퍼바이저와 개별 에이전트를 하위 그래프 노드로 추가할 것입니다.
from langgraph.graph import END
# 다중 에이전트 슈퍼바이저 그래프 정의
supervisor = (
StateGraph(MessagesState)
# 참고: `destinations`는 시각화 목적으로만 필요하며 런타임 동작에는 영향을 미치지 않습니다.
.add_node(supervisor_agent, destinations=("research_agent", "math_agent", END))
.add_node(research_agent)
.add_node(math_agent)
# 항상 슈퍼바이저에게 보고하십시오
.add_edge("research_agent", "supervisor")
.add_edge("math_agent", "supervisor")
.set_entry_point("supervisor")
.compile()
)작업 에이전트에서 감독자로 명시적인 에지를 추가했음을 확인하십시오. 이는 에이전트가 반드시 제어권을 감독자에게 반환함을 의미합니다. 에이전트가 사용자에게 직접 응답하도록 하려면(즉, 시스템을 라우터로 전환하려면) 이 에지들을 제거할 수 있습니다.
from IPython.display import display, Image
display(Image(supervisor.get_graph().draw_mermaid_png()))
다중 에이전트 그래프가 생성되었으니, 이제 실행해 보겠습니다!
for chunk in supervisor.stream({"messages": [("user", query)]}):
pretty_print_messages(chunk, last_message=True)
final_message_history = chunk["supervisor"]["messages"]Update from node supervisor:
=================================[1m Tool Message [0m=================================
Name: transfer_to_research_agent
research_agent에게 성공적으로 이관되었습니다.
Update from node research_agent:
==================================[1m Ai Message [0m==================================
Name: research_agent
2024년 미국 전체 국내총생산(GDP)은 실질 기준으로 약 2.8% 성장한 것으로 나타났으며, 구체적인 금액은 미국 경제분석국(BEA) 발표를 참고하면 됩니다.
뉴욕 주의 2024년 GDP 수치는 현재 BEA에서 신속한 분기별 자료가 있으나, 전체 연간 수치는 아직 명확히 제시되지 않은 상태입니다. 다만, 뉴욕 주는 미국 내 경제 규모 상위권에 위치하므로 미국 GDP에서 차지하는 비율은 약 8~9% 내외일 것으로 추정됩니다.
정확한 수치가 BEA에서 2024년 전체 연간 GDP 보고서 발표 시 업데이트될 예정입니다.
더 구체적인 값이나 최신 자료 조회가 필요하면 알려주십시오.
Update from node supervisor:
==================================[1m Ai Message [0m==================================
Name: supervisor
2024년 미국 전체 GDP는 실질 기준으로 약 2.8% 성장한 것으로 BEA에서 발표했습니다. 뉴욕 주 GDP의 구체적인 2024년 연간 값은 아직 명확하게 나오지 않았으나, 과거 및 분기별 데이터를 참고할 때 뉴욕 주 GDP가 미국 전체 GDP에서 차지하는 비율은 대략 8~9%로 예상됩니다.
더 구체적이고 최신 데이터가 필요하시면, 추가 조사를 요청해 주세요.
4. 위임 작업 생성
지금까지 개별 에이전트는 전체 메시지 기록을 해석하여 자신의 작업을 결정해 왔습니다. 대안적인 접근법은 감독자에게 작업을 명시적으로 정의하도록 요청하는 것입니다. handoff_tool 함수에 task_description 매개변수를 추가함으로써 이를 구현할 수 있습니다.
from langgraph.types import Send
def create_task_description_handoff_tool(
*, agent_name: str, description: str | None = None
):
tool_name = f"transfer_to_{agent_name}"
description = description or f"{agent_name}에게 도움을 요청하세요."
@tool(tool_name, description=description)
def handoff_tool(
# 이것은 감독자 LLM에 의해 채워집니다
task_description: Annotated[
str,
"다음 에이전트가 수행해야 할 작업에 대한 설명으로, 모든 관련 컨텍스트를 포함합니다.",
],
# 이러한 매개변수들은 LLM에 의해 무시됩니다
state: Annotated[MessagesState, InjectedState],
) -> Command:
return Command(
goto=[
Send(
agent_name,
{
**state,
"messages": [("user", task_description)],
},
)
],
graph=Command.PARENT,
)
return handoff_tool
assign_to_research_agent_with_description = create_handoff_tool(
agent_name="research_agent",
description="연구자 에이전트에게 작업을 할당하십시오.",
)
assign_to_math_agent_with_description = create_handoff_tool(
agent_name="math_agent",
description="수학 에이전트에게 작업을 할당하십시오.",
)
supervisor_agent_with_description = create_react_agent(
model="openai:gpt-4.1",
tools=[
assign_to_research_agent_with_description,
assign_to_math_agent_with_description,
],
prompt=(
"당신은 두 명의 에이전트를 관리하는 감독관입니다:\n"
"- research 에이전트: 연구 관련 작업을 이 에이전트에게 할당하십시오\n"
"- math 에이전트: 수학 관련 작업을 이 에이전트에게 할당하십시오\n"
"한 번에 한 명의 에이전트에게만 작업을 할당하고, 에이전트를 동시에 호출하지 마십시오.\n"
"직접 어떤 작업도 수행하지 마십시오."
),
name="supervisor",
)
supervisor_with_description = (
StateGraph(MessagesState)
.add_node(
supervisor_agent_with_description, destinations=("research_agent", "math_agent")
)
.add_node(research_agent)
.add_node(math_agent)
.add_edge("research_agent", "supervisor")
.add_edge("math_agent", "supervisor")
.set_entry_point("supervisor")
.compile()
)참고: 여기에서는 handoff_tool에서 Send() 기본 기능을 사용하고 있습니다. 이는 각 작업 에이전트가 전체 supervisor 그래프 상태를 입력으로 받는 대신 Send 페이로드의 내용만 볼 수 있음을 의미합니다. 이 예시에서는 작업 설명을 단일 “human” 메시지로 전송하고 있습니다.
for chunk in supervisor_with_description.stream(
{"messages": [("user", query)]},
subgraphs=True,
):
pretty_print_messages(chunk, last_message=True)Update from subgraph supervisor:
Update from node agent:
==================================[1m Ai Message [0m==================================
Name: supervisor
Tool Calls:
transfer_to_research_agent (call_Iiq5MK8EFL95gLq519WTB3zp)
Call ID: call_Iiq5MK8EFL95gLq519WTB3zp
Args:
Update from subgraph research_agent:
Update from node agent:
==================================[1m Ai Message [0m==================================
Name: research_agent
Tool Calls:
tavily_search (call_erMTlzp7ZpSxZ6RL04YmCMRt)
Call ID: call_erMTlzp7ZpSxZ6RL04YmCMRt
Args:
query: 2024 United States GDP
include_domains: ['bea.gov']
search_depth: advanced
tavily_search (call_lGPoIxdV0NnBDJeMziDSRUfD)
Call ID: call_lGPoIxdV0NnBDJeMziDSRUfD
Args:
query: 2024 New York state GDP
include_domains: ['bea.gov']
search_depth: advanced
Update from subgraph research_agent:
Update from node tools:
=================================[1m Tool Message [0m=================================
Name: tavily_search
{"query": "2024 United States GDP", "follow_up_questions": null, "answer": null, "images": [], "results": [{"url": "https://www.bea.gov/news/2025/gross-domestic-product-4th-quarter-and-year-2024-second-estimate", "title": "Gross Domestic Product, 4th Quarter and Year 2024 ...", "content": "# Gross Domestic Product, 4th Quarter and Year 2024 (Second Estimate)\n\nReal gross domestic product (GDP) increased at an annual rate of 2.3 percent in the fourth quarter of 2024 (October, November, and December), according to the second estimate released by the U.S. Bureau of Economic Analysis. In the third quarter, real GDP increased 3.1 percent. [...] Real GDP increased 2.8 percent in 2024 (from the 2023 annual level to the 2024 annual level), the same as previously estimated. The increase in real GDP in 2024 reflected increases in consumer spending, investment, government spending, and exports. Imports increased. [...] | (Percent change from Q3 to Q4) |\n| | Advance Estimate | Second Estimate |\n| Real GDP | 2.3 | 2.3 |\n| Current-dollar GDP | 4.5 | 4.8 |\n| Gross domestic purchases price index | 2.2 | 2.3 |\n| PCE price index | 2.3 | 2.4 |\n| PCE price index excluding food and energy | 2.5 | 2.7 |\n\n### GDP for 2024", "score": 0.8752871, "raw_content": null}, {"url": "https://www.bea.gov/news/2025/gross-domestic-product-4th-quarter-and-year-2024-advance-estimate", "title": "Gross Domestic Product, 4th Quarter and Year 2024 ...", "content": "Real gross domestic product (GDP) increased at an annual rate of 2.3 percent in the fourth quarter of 2024 (October, November, and December), according to the advance estimate released by the U.S. Bureau of Economic Analysis. In the third quarter, real GDP increased 3.1 percent.\n\nImage 2: Real GDP: Percent change from preceding quarter [...] Real GDP increased 2.8 percent in 2024 (from the 2023 annual level to the 2024 annual level), compared with an increase of 2.9 percent in 2023. The increase in real GDP in 2024 reflected increases in consumer spending, investment, government spending, and exports. Imports increased. [...] | (Percent change from preceding quarter) |\n| Real GDP | 2.3 |\n| Current-dollar GDP | 4.5 |\n| Gross domestic purchases price index | 2.2 |\n| PCE price index | 2.3 |\n| PCE price index excluding food and energy | 2.5 |\n\n### GDP for 2024", "score": 0.85967577, "raw_content": null}, {"url": "https://www.bea.gov/news/2025/gross-domestic-product-4th-quarter-and-year-2024-third-estimate-gdp-industry-and", "title": "Gross Domestic Product, 4th Quarter and Year 2024 (Third ...", "content": "EMBARGOED UNTIL RELEASE AT 8:30 a.m. EDT, Thursday, March 27, 2025\n\nBEA 25—10\n\n# Gross Domestic Product, 4th Quarter and Year 2024 (Third Estimate), GDP by Industry, and Corporate Profits\n\nReal gross domestic product (GDP) increased at an annual rate of 2.4 percent in the fourth quarter of 2024 (October, November, and December), according to the third estimate released by the U.S. Bureau of Economic Analysis. In the third quarter, real GDP increased 3.1 percent. [...] Real GDP increased 2.8 percent in 2024 (from the 2023 annual level to the 2024 annual level), the same as previously estimated. The increase in real GDP in 2024 reflected increases in consumer spending, investment, government spending, and exports. Imports increased.\n\nFrom an industry perspective in 2024, private goods-producing industries increased 3.4 percent, private services-producing industries increased 2.8 percent, and government increased 1.9 percent. [...] | (Percent change from Q3 to Q4) |\n| | Advance Estimate | Second Estimate | Third Estimate |\n| Real GDP | 2.3 | 2.3 | 2.4 |\n| Current-dollar GDP | 4.5 | 4.8 | 4.8 |\n| Real GDI | … | … | 4.5 |\n| Average of Real GDP and Real GDI | … | … | 3.5 |\n| Gross domestic purchases price index | 2.2 | 2.3 | 2.2 |\n| PCE price index | 2.3 | 2.4 | 2.4 |\n| PCE price index excluding food and energy | 2.5 | 2.7 | 2.6 |\n\n### GDP and Related Measures for 2024", "score": 0.8449346, "raw_content": null}], "response_time": 1.36, "request_id": "3ddef9bd-351e-4e56-9eeb-daedb2b5eb88"}
Update from subgraph research_agent:
Update from node tools:
=================================[1m Tool Message [0m=================================
Name: tavily_search
{"query": "2024 New York state GDP", "follow_up_questions": null, "answer": null, "images": [], "results": [{"url": "https://www.bea.gov/sites/default/files/2025-03/stgdppi4q24-a2024.pdf", "title": "Gross Domestic Product by State and Personal Income by ...", "content": "Maryland 515,607 542,766 539,232 546,362 552,955 5.3 5.4 4.9 422,866 432,193 430,593 433,776 436,240 2.2 35 3.0 2.3 29 New Jersey 806,665 846,587 841,417 851,863 861,683 4.9 5.1 4.7 663,889 678,968 676,538 681,572 685,199 2.3 33 3.0 2.1 32 New York 2,172,010 2,297,028 2,284,364 2,310,968 2,346,932 5.8 4.7 6.4 1,791,211 1,834,561 1,831,169 1,839,391 1,853,430 2.4 26 1.8 3.1 14 Pennsylvania 976,361 1,024,206 1,017,257 1,032,270 1,044,277 4.9 6.0 4.7 799,229 818,529 814,704 823,019 828,080 2.4 28 [...] 2024 2024 Table 1. Gross Domestic Product by State and Region: Level and Percent Change From Preceding Period Current-dollar gross domestic product Real gross domestic product Millions of dollars Percent change from preceding period1 Millions of chained (2017) dollars Percent change from preceding period1 2023 Seasonally adjusted at annual rates 2024p 2024p 2024 2024 FRIDAY, March 28, 2025 Durable goods Nondurable goods United States 2.4 0.01 0.09 0.16 0.21 -0.05 0.12 -0.05 0.17 0.17 0.09 0.21 [...] Maryland 74,945 78,538 10 108 6,217 6,263 0.7 24 New Jersey 81,325 84,071 6 116 9,380 9,501 1.3 10 New York 81,630 85,733 4 118 19,737 19,867 0.7 28 Pennsylvania 68,649 71,148 17 98 13,018 13,079 0.5 41 Great Lakes 64,389 67,032 ........\n93 47,360 47,619 0.5 ........", "score": 0.4797236, "raw_content": null}, {"url": "https://www.bea.gov/sites/default/files/2024-09/stgdppi2q24.pdf", "title": "Gross Domestic Product by State and Personal Income by ...", "content": "Maryland 484,908 515,607 525,753 532,514 539,232 6.3 5.2 5.1 416,406 422,866 426,582 428,162 430,593 1.6 42 1.5 2.3 36 New Jersey 758,289 806,665 822,849 831,387 841,417 6.4 4.2 4.9 650,236 663,889 671,273 672,565 676,538 2.1 33 0.8 2.4 34 New York 2,052,759 2,172,010 2,207,141 2,245,849 2,284,364 5.8 7.2 7.0 1,765,102 1,791,211 1,803,338 1,814,254 1,831,169 1.5 43 2.4 3.8 9 Pennsylvania 919,741 976,361 996,679 1,003,022 1,017,257 6.2 2.6 5.8 779,361 799,229 809,272 808,315 814,704 2.5 28 -0.5 [...] forestry, fishing, and hunting Mining, quarrying, and oil and gas extraction Utilities Wholesale trade Retail trade Transportation and warehousing Information Construction Manufacturing Finance and insurance [Seasonally adjusted at annual rates] FRIDAY, September 27, 2024 Federal civilian Military State and local United States 0.32 0.23 -0.05 0.06 -0.07 0.40 0.25 -0.12 -0.04 0.03 -0.05 0.05 New England 0.34 0.19 -0.01 -0.01 -0.25 0.49 0.21 -0.08 -0.09 0.04 0.04 -0.08 Connecticut 0.34 0.32 -0.02 [...] 6.6 5.5 4.2 0.3 1.0 10,688 8,204 549 1,934 New York 5.8 7.6 1.6 4.7 5.8 4.6 0.3 0.9 23,817 18,936 1,324 3,557 Pennsylvania 5.3 6.7 1.6 4.6 5.3 4.0 0.3 1.0 11,872 9,058 674 2,140 Great Lakes 5.2 6.6 1.2 4.9 5.2 4.0 0.2 1.0 40,311 30,909 1,842 7,560 Illinois 5.1 6.4 1.1 5.0 5.1 3.9 0.2 0.9 11,580 9,042 541 1,997 Indiana 4.2 5.0 1.2 4.2 4.2 3.1 0.2 0.9 4,559 3,404 207 948 Michigan 6.1 7.8 1.2 6.0 6.1 4.6 0.2 1.3 9,524 7,166 368 1,990 Ohio 5.3 6.6 1.4 5.3 5.3 3.9 0.3 1.1 9,835 7,270 475 2,091", "score": 0.46701634, "raw_content": null}, {"url": "https://www.bea.gov/data/gdp/gdp-state", "title": "GDP by State | U.S. Bureau of Economic Analysis (BEA)", "content": "2024 Annual Update\n\n### Previously Published Estimates\n\n Data ArchivePreviously published estimates contain historical data and have since been revised.\n\n### What is GDP by State?\n\nA comprehensive measure of the economies of each state and the District of Columbia. GDP estimates the value of the goods and services produced in a state. The data include breakdowns of industries' contributions to each state economy.\n\nLearn More\n\nImage 4\n\n### Contact Personnel [...] #### Gross Domestic Product by State and Personal Income by State, 2nd Quarter 2025 and Personal Consumption Expenditures by State, 2024\n\n News Release (PDF)\n Interactive Tables\n State Interactive Tables Tutorial\n Additional Information\n\n### Data Availability", "score": 0.34634283, "raw_content": null}], "response_time": 4.89, "request_id": "3c7f5b47-83fb-414d-92a2-f52650836ea2"}
Update from subgraph research_agent:
Update from node agent:
==================================[1m Ai Message [0m==================================
Name: research_agent
2024년 미국의 국내총생산(GDP)은 약 4.8조 달러(현행 달러 기준)로 나타났습니다.
2024년 뉴욕 주의 국내총생산(GDP)은 약 2.35조 달러(현행 달러 기준)입니다.
이에 따라 뉴욕 주의 GDP가 미국 전체 GDP에서 차지하는 비율은 다음과 같습니다:
(뉴욕 주 GDP) 2.35조 달러 ÷ (미국 전체 GDP) 4.8조 달러 ≈ 0.49, 즉 약 49%입니다.
(참고: 미국 GDP는 전체 GDP 수치이며, 뉴욕 주 GDP는 해당 주의 GDP입니다. 국가 단위 GDP 수치와 주 단위 GDP 수치 비교 시 단위나 액수 표현에 따라 차이가 있으므로 명확한 수치 비교를 위한 단위 확인이 필요하나, 여기서는 제공된 현행 달러 수치를 사용하였습니다.)
Update from subgraph supervisor:
Update from node agent:
==================================[1m Ai Message [0m==================================
Name: supervisor
Tool Calls:
transfer_to_math_agent (call_FsTb3VqhRtjIX9IWQPtdUEyp)
Call ID: call_FsTb3VqhRtjIX9IWQPtdUEyp
Args:
Update from subgraph math_agent:
Update from node agent:
==================================[1m Ai Message [0m==================================
Name: math_agent
Tool Calls:
divide (call_6YOP7oDO0US1bz5wZQgWtKYs)
Call ID: call_6YOP7oDO0US1bz5wZQgWtKYs
Args:
a: 2.35
b: 4.8
Update from subgraph math_agent:
Update from node tools:
=================================[1m Tool Message [0m=================================
Name: divide
0.48958333333333337
Update from subgraph math_agent:
Update from node agent:
==================================[1m Ai Message [0m==================================
Name: math_agent
2024년 뉴욕 주의 GDP는 약 2.35조 달러이고, 미국 전체 GDP는 약 4.8조 달러입니다. 뉴욕 주 GDP가 미국 GDP에서 차지하는 비율은 약 48.96%입니다.
Update from subgraph supervisor:
Update from node agent:
==================================[1m Ai Message [0m==================================
Name: supervisor
2024년 기준, 미국의 국내총생산(GDP)은 약 4.8조 달러이고, 뉴욕 주의 국내총생산(GDP)은 약 2.35조 달러입니다. 뉴욕 주의 GDP가 미국 전체 GDP에서 차지하는 비율은 약 48.96%입니다.