가장 기본적인 패턴입니다. 에이전트 A의 출력이 에이전트 B의 입력이 됩니다.
from agentscope.agent import ReActAgent
from agentscope.model import OpenAIChatModel
from agentscope.memory import InMemoryMemory
from agentscope.formatter import OpenAIChatFormatter
from agentscope.pipeline import SequentialPipeline
import os, asyncio
model = OpenAIChatModel(
model_name="gpt-4o",
api_key=os.environ["OPENAI_API_KEY"],
stream=True,
)
# 리서처 에이전트
researcher = ReActAgent(
name="Researcher",
sys_prompt="You are a research specialist. Given a topic, produce detailed research notes with key facts, statistics, and insights.",
model=model,
memory=InMemoryMemory(),
formatter=OpenAIChatFormatter(),
)
# 분석가 에이전트
analyst = ReActAgent(
name="Analyst",
sys_prompt="You are a data analyst. Take research notes and extract actionable insights, patterns, and recommendations.",
model=model,
memory=InMemoryMemory(),
formatter=OpenAIChatFormatter(),
)
# 라이터 에이전트
writer = ReActAgent(
name="Writer",
sys_prompt="You are a technical writer. Take analysis results and write a clear, well-structured report for a non-technical audience.",
model=model,
memory=InMemoryMemory(),
formatter=OpenAIChatFormatter(),
)
# 파이프라인 구성
pipeline = SequentialPipeline([researcher, analyst, writer])