수달이네 기술 블로그

8. 논문기반 Reflexion 구현 본문

AI공부/AI Agent

8. 논문기반 Reflexion 구현

슬픈 수달이 2026. 4. 9. 17:02

https://mariblossom.tistory.com/175

내가 작성한 Reflexion논문 리뷰 확인

구현 초기

  • Actor(LM): 실제 행동(답안 작성, 코드 생성 등)을 출력하는 언어 모델
  • Evaluator(LM): Actor가 낸 결과를 평가해 점수 출력(정확성, 형식, 샘플 테스트 통과 여부)
  • Self-reflection(LM): 평가 결과를 바탕으로 언어적 피드백(Reflective text)구성
  • Trajectory(shrot-term memory): 이번 시도에서의 행동/관찰 기록을 담는 단기 메모리(슬라이딩 윈도우)
  • Experience(long-term memory): 누적된 반성문을 쌓아두는 장기 메모리(중요한 기억 저장)
  • Environment: 외부에서 관찰/보상을 제공한다. 만약 외부 피드백이 있으면 Evaluator의 판단과 함께 제공

만들 에이전트

import os
import getpass

def _set_env(var:str):
    if not os.environ.get(var):
        os.environ[var] = getpass.getpass(f"{var}: ")

_set_env("TAVILY_API_KEY")
_set_env("OPENAI_API_KEY")
  • 검색을 위한 TAVILY와 LLM으로 사용할 GPT 키를 입력해준다.
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(model = "gpt-5-nano")
  • LLM모델은 gpt-5 nano로 설정했다.
from langchain_tavily import TavilySearch

tavily_tool = TavilySearch(max_result=5)
  • tool call을 위한 TavilySearch객체를 생성해준다.

데이터 클래스

from langchain_core.messages import HumanMessage, ToolMessage
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from pydantic import BaseModel, Field

class Reflection(BaseModel):
    missing: str = Field(description = "누락되거나 부족한 부분에 대한 비평")
    superfluous: str = Field(description= "불필요한 부분에 대한 비평")

BaseModel: 텍스트 데이터를 정형화된 데이터(JSON)으로 강제하는 역할

Field의 description은 실제로 LLM에게 프롬프트에게 주어지며, 필드 내에 이런 내용을 채워 넣으라 알려준다.

  • 위 코드에선 Reflection즉, 자기 반성에 대한 내용을 담는 클래스이다.
class AnswerQuestion(BaseModel):
    answer: str = Field(description="질문에 대한 10문장 이내의 자세한 답변")
    search_queries: list[str] = Field(
        description = "현재 답변에 대한 비평을 해결하기 위한 추가 조사를 위한 1~3개의 웹 검색 쿼리"
    )
    reflection: Reflection = Field(description="답변에 대한 자기반성 내용")
  • 질문에 대한 답변, 해당 답변의 반성, 반성을 보고 개선하는 쿼리
class Responder:
    def __init__(self, runnable):
        self.runnable = runnable
    def respond(self, state:dict):
        response = self.runnable.invoke(
            {"messages": state["messages"]}
        )
        return {"messages": response}

__init__: 실행 가능한 LLM 체인(runnable)을 주입(injection) 받는다.

  • runnable: Actor모델 그 자체(프롬프트가 포함된 LLM엔진)

respond(self, runnable) : 현재 그래프의 상태(State)를 입력 받아 LLM을 실행, 결과를 상태에 업데이트함.

  • runnable.invoke(): Actor 모델로 추론 시작 → 상태의 메세지를 통해 새 메세지를 출력

초기 답변기 생성(프롬프트엔지니어링)

import datetime

actor_prompt_template = ChatPromptTemplate.from_messages(
    [
        (
            "system",
            """당신은 전문 연구자 입니다.
            
            1. {first_instruction}
            2. <Reflect> 생성한 답변을 다시 되돌아보고 개선할 수 있도록 비판하세요.
            3. <Recommend search queries> 답변의 질을 높이기 위해 추가적으로 조사해야할 정보에 대한 웹 검색 쿼리를 추천하세요.""",
        ),
        MessagesPlaceholder(variable_name = "messages"),
        (
            "user",
            "\\n\\n<Reflect> 사용자 원래 질문과 지금까지의 행동을 되돌아보세요"
        ),
    ]
)

initial_answer_chain = actor_prompt_template.partial(
    first_instruction="질문에 대한 10문장 이내의 자세한 답변을 제공해주세요.",
) | llm.bind_tools(tools = [AnswerQuestion], tool_choice="any")

Actor내부에서 생성→비판→수정의 세 단계를 한번에 구현한 프롬프트 모델

  • 3개로 나눈 모델은 LLM을 세 번 호출해야 하지만, 여기서는 스스로 성찰 후 답변을 출력해낸다.
  1. first_instruction : 논문의 Task와 같은 부분. 처음 물어볼 질문을 전달함.
  2. <Reflect> : Self-Reflection을 Actor자체에 녹여냄(답변을 내놓기 전에 스스로 비판해봄.
  3. <Recommend search queries> : Action(행동)부분, 부족한 정보를 외부 환경에서 검색해서 채움.

MessagesPlaceholder: 단기 기억(Short-term memory)가 들어갈 자리

  • 단기 기억에 들어간 내용을 통해 이걸 통해 성찰 하라는 명령을 내린 것.

LLM이 단순 이야기를 하는 것이 아닌 AnswerQuestion 클래스를 통해 답변하도록 강제하는 역할을 함.

1. 성찰 없이 출력

llm_with_tool = llm.bind_tools(tools = [AnswerQuestion], tool_choice ="any")
response = llm_with_tool.invoke([HumanMessage(content="랭그래프 Reflexion의 장점은 무엇인가요?")])
response.tool_calls[0]['args']
  • 만약 프롬프트 없이 출력했을때는 아래와 같이 출력된다.
  • {'answer': 'LangGraph Reflexion의 구체적 이점은 공식 자료를 확인해야 정확하지만, 일반적으로 다음과 같은 장점이 자주 언급됩니다. 1) 학습 경로 최적화: 사용자의 학습 이력과 반응 데이터를 바탕으로 맞춤형 학습 경로를 제시합니다. 2) 인사이트 자동화: 데이터를 시각화하고 자동 분석해 학습 효과를 빠르게 파악할 수 있습니다. 3) 실시간 피드백: 즉각적인 피드백과 개선 권고를 제공합니다. 4) 협업 강화: 팀 간 분석 공유와 협업용 대시보드를 지원합니다. 5) 확장성과 커스터마이즈: 다양한 데이터 소스와 모듈을 확장해 사용할 수 있습니다. 6) 리포트와 추적성: 주간/월간 리포트를 통해 진행 상황을 쉽게 추적합니다. 7) 보안과 개인 정보 보호: 역할 기반 접근 제어와 데이터 보호 기능을 제공합니다. 8) 멀티 플랫폼 접근성: 웹과 모바일 간 seamless 접근이 가능합니다. 9) 학습 효과 측정 도구: 초기 상태와 개선 상태를 비교하는 지표를 제공합니다. 10) 빠른 도입 및 유지 관리: 구성 요소가 모듈화되어 초기 구축과 유지 관리가 용이하다는 평가가 있습니다.\n\n참고: 위 내용은 일반적인 장점에 대한 요약이며, 구체적인 기능 목록과 실사용 사례는 공식 문서나 최신 자료를 확인하는 것이 좋습니다.', 'search_queries': ['LangGraph Reflexion 공식 기능', 'LangGraph Reflexion 장점', 'LangGraph Reflexion 기능 및 문서'], 'reflection': {'missing': '구체적 기능 목록, 사용 사례, 경쟁 분석 및 가격 정보에 대한 공식 자료 확인 필요.', 'superfluous': '장점의 일반화된 개요가 많아, 실제 구현 세부나 최신 버전에 따른 차이는 반영되지 않았음.'}}

2. 성찰 후 수정하고 출력

first_responder = Responder(runnable = initial_answer_chain)

example_question = "랭그래프 Reflexion의 장점은 무엇인가요?"
initial = first_responder.respond(
    {"messages": [HumanMessage(content=example_question)]}
)
initial["messages"].tool_calls[0]["args"]
  • 위는 Responder를 적용해, Actor에 성찰을 보여주었다.
  • {'answer': 'LangGraph Reflexion은 모델의 응답 창출 과정에서 내부 추론 과정을 반성하고 개선점을 식별하는 기능으로 간주할 수 있습니다. 주요 장점으로는 먼저 오류 가능 영역과 불확실성을 표면화해 더 안전하고 신뢰할 수 있는 답변을 만들도록 돕는 점이 있습니다. 둘째, 판단 근거를 재확인하고 필요한 경우 보완 정보를 요청해 대화의 정확성을 높입니다. 셋째, 단계별로 문제를 분해하고 각 단계의 타당성을 점검해 설명의 투명성과 재현성을 향상시킵니다. 넷째, 반복적인 피드백 루프를 통해 장기적으로 응답 품질을 개선하는 학습 신호를 남길 수 있습니다. 다섯째, 정책 준수와 안전성 점검을 강화해 민감한 주제에서의 위험을 줄이고 일관된 기준을 유지합니다. 여섯째, 복잡한 문제에서도 대화 흐름을 안정적으로 유지하고 적절한 후속 질문을 유도할 수 있습니다. 마지막으로, 관리 가능한 비용으로 품질 향상을 도모하는 설계가 가능하나, 내부 반성이 항상 정답으로 이어지지는 않으며 특정 도메인에 한정된 효과일 수 있습니다.', 'search_queries': ['LangGraph Reflexion 장점', 'self-reflection reasoning language model benefits', 'AI 모델 자기반성 안전성 및 신뢰성 개선'], 'reflection': {'missing': '구체적 구현 사례, 벤치마크 수치, 비용-성능 트레이드오프에 대한 정보가 필요합니다.', 'superfluous': '일부 문장을 지나치게 일반화하여 실무 적용 시 구체성이 떨어질 수 있습니다.'}}
  • 성찰 결과를 보면 AnswerQuestion의 형식에 따라 출력된 것을 확인 할 수 있다.

수정 단계(Revision)

class ReviseAnswer(AnswerQuestion):
    """Revise your original answer to your question. Provide an answer, reflection,
    
    cite your reflection with references, and finally
    add search queries to imporve the answer."""

    references: list[str] = Field(
        description = "업데이트된 답변에 사용된 인용 출처"
    )

프롬프트를 사용해 수정 단계를 구성해주었다.

  • 답변과 그 답변에 인용된 출처를 밝힐 수 있는 구조를 만들어줌.
revise_instructions = """이전 답변을 새로운 정보를 바탕으로 수정하세요.
- 이전 비평 내용을 활용해 중요한 정보를 추가해야 합니다.  
  - 수정된 답변에는 반드시 숫자로 된 인용 표시를 포함하여 검증 가능하도록 해야 합니다.  
  - 답변 하단에 "참고문헌" 섹션을 추가하세요 (이 부분은 단어 수 제한에 포함되지 않습니다). 형식은 다음과 같습니다:  
    - [1] <https://example.com>  
    - [2] <https://example.com>  

- 이전 비평 내용을 바탕으로 불필요한 정보를 제거하고, 최종 답변은 반드시 200자를 넘지 않도록 하세요.
"""

revision_chain = actor_prompt_template.partial(
    first_instruction = revise_instructions,
) | llm.bind_tools(tools = [ReviseAnswer], tool_choice = "any")

revisor = Responder(runnable=revision_chain)
  • 해당 구조를 통해 출력해낼 것이다.
import json

revised = revisor.respond(
    {
        "messages":[
            HumanMessage(content = example_question),
            initial["messages"],
            ToolMessage(
                tool_call_id=initial['messages'].tool_calls[0]['id'],
                content = json.dumps(
                    tavily_tool.invoke(
                        {
                            "query":initial["messages"].tool_calls[0]["args"]["search_queries"][0]

                        }
                    )
                ),
            ),
        ]
    }
)
import os
import getpass

def _set_env(var:str):
    if not os.environ.get(var):
        os.environ[var] = getpass.getpass(f"{var}: ")

_set_env("TAVILY_API_KEY")
_set_env("OPENAI_API_KEY")
  • 검색을 위한 TAVILY와 LLM으로 사용할 GPT 키를 입력해준다.
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(model = "gpt-5-nano")
  • LLM모델은 gpt-5 nano로 설정했다.
from langchain_tavily import TavilySearch

tavily_tool = TavilySearch(max_result=5)
  • tool call을 위한 TavilySearch객체를 생성해준다.

데이터 클래스

from langchain_core.messages import HumanMessage, ToolMessage
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from pydantic import BaseModel, Field

class Reflection(BaseModel):
    missing: str = Field(description = "누락되거나 부족한 부분에 대한 비평")
    superfluous: str = Field(description= "불필요한 부분에 대한 비평")

BaseModel: 텍스트 데이터를 정형화된 데이터(JSON)으로 강제하는 역할

Field의 description은 실제로 LLM에게 프롬프트에게 주어지며, 필드 내에 이런 내용을 채워 넣으라 알려준다.

  • 위 코드에선 Reflection즉, 자기 반성에 대한 내용을 담는 클래스이다.
class AnswerQuestion(BaseModel):
    answer: str = Field(description="질문에 대한 10문장 이내의 자세한 답변")
    search_queries: list[str] = Field(
        description = "현재 답변에 대한 비평을 해결하기 위한 추가 조사를 위한 1~3개의 웹 검색 쿼리"
    )
    reflection: Reflection = Field(description="답변에 대한 자기반성 내용")
  • 질문에 대한 답변, 해당 답변의 반성, 반성을 보고 개선하는 쿼리
class Responder:
    def __init__(self, runnable):
        self.runnable = runnable
    def respond(self, state:dict):
        response = self.runnable.invoke(
            {"messages": state["messages"]}
        )
        return {"messages": response}

__init__: 실행 가능한 LLM 체인(runnable)을 주입(injection) 받는다.

  • runnable: Actor모델 그 자체(프롬프트가 포함된 LLM엔진)

respond(self, runnable) : 현재 그래프의 상태(State)를 입력 받아 LLM을 실행, 결과를 상태에 업데이트함.

  • runnable.invoke(): Actor 모델로 추론 시작 → 상태의 메세지를 통해 새 메세지를 출력

초기 답변기 생성(프롬프트엔지니어링)

import datetime

actor_prompt_template = ChatPromptTemplate.from_messages(
    [
        (
            "system",
            """당신은 전문 연구자 입니다.
            
            1. {first_instruction}
            2. <Reflect> 생성한 답변을 다시 되돌아보고 개선할 수 있도록 비판하세요.
            3. <Recommend search queries> 답변의 질을 높이기 위해 추가적으로 조사해야할 정보에 대한 웹 검색 쿼리를 추천하세요.""",
        ),
        MessagesPlaceholder(variable_name = "messages"),
        (
            "user",
            "\\n\\n<Reflect> 사용자 원래 질문과 지금까지의 행동을 되돌아보세요"
        ),
    ]
)

initial_answer_chain = actor_prompt_template.partial(
    first_instruction="질문에 대한 10문장 이내의 자세한 답변을 제공해주세요.",
) | llm.bind_tools(tools = [AnswerQuestion], tool_choice="any")

Actor내부에서 생성→비판→수정의 세 단계를 한번에 구현한 프롬프트 모델

  • 3개로 나눈 모델은 LLM을 세 번 호출해야 하지만, 여기서는 스스로 성찰 후 답변을 출력해낸다.
  1. first_instruction : 논문의 Task와 같은 부분. 처음 물어볼 질문을 전달함.
  2. <Reflect> : Self-Reflection을 Actor자체에 녹여냄(답변을 내놓기 전에 스스로 비판해봄.
  3. <Recommend search queries> : Action(행동)부분, 부족한 정보를 외부 환경에서 검색해서 채움.

MessagesPlaceholder: 단기 기억(Short-term memory)가 들어갈 자리

  • 단기 기억에 들어간 내용을 통해 이걸 통해 성찰 하라는 명령을 내린 것.

LLM이 단순 이야기를 하는 것이 아닌 AnswerQuestion 클래스를 통해 답변하도록 강제하는 역할을 함.

1. 성찰 없이 출력

llm_with_tool = llm.bind_tools(tools = [AnswerQuestion], tool_choice ="any")
response = llm_with_tool.invoke([HumanMessage(content="랭그래프 Reflexion의 장점은 무엇인가요?")])
response.tool_calls[0]['args']
  • 만약 프롬프트 없이 출력했을때는 아래와 같이 출력된다.
  • {'answer': 'LangGraph Reflexion의 구체적 이점은 공식 자료를 확인해야 정확하지만, 일반적으로 다음과 같은 장점이 자주 언급됩니다. 1) 학습 경로 최적화: 사용자의 학습 이력과 반응 데이터를 바탕으로 맞춤형 학습 경로를 제시합니다. 2) 인사이트 자동화: 데이터를 시각화하고 자동 분석해 학습 효과를 빠르게 파악할 수 있습니다. 3) 실시간 피드백: 즉각적인 피드백과 개선 권고를 제공합니다. 4) 협업 강화: 팀 간 분석 공유와 협업용 대시보드를 지원합니다. 5) 확장성과 커스터마이즈: 다양한 데이터 소스와 모듈을 확장해 사용할 수 있습니다. 6) 리포트와 추적성: 주간/월간 리포트를 통해 진행 상황을 쉽게 추적합니다. 7) 보안과 개인 정보 보호: 역할 기반 접근 제어와 데이터 보호 기능을 제공합니다. 8) 멀티 플랫폼 접근성: 웹과 모바일 간 seamless 접근이 가능합니다. 9) 학습 효과 측정 도구: 초기 상태와 개선 상태를 비교하는 지표를 제공합니다. 10) 빠른 도입 및 유지 관리: 구성 요소가 모듈화되어 초기 구축과 유지 관리가 용이하다는 평가가 있습니다.\n\n참고: 위 내용은 일반적인 장점에 대한 요약이며, 구체적인 기능 목록과 실사용 사례는 공식 문서나 최신 자료를 확인하는 것이 좋습니다.', 'search_queries': ['LangGraph Reflexion 공식 기능', 'LangGraph Reflexion 장점', 'LangGraph Reflexion 기능 및 문서'], 'reflection': {'missing': '구체적 기능 목록, 사용 사례, 경쟁 분석 및 가격 정보에 대한 공식 자료 확인 필요.', 'superfluous': '장점의 일반화된 개요가 많아, 실제 구현 세부나 최신 버전에 따른 차이는 반영되지 않았음.'}}

2. 성찰 후 수정하고 출력

first_responder = Responder(runnable = initial_answer_chain)

example_question = "랭그래프 Reflexion의 장점은 무엇인가요?"
initial = first_responder.respond(
    {"messages": [HumanMessage(content=example_question)]}
)
initial["messages"].tool_calls[0]["args"]
  • 위는 Responder를 적용해, Actor에 성찰을 보여주었다.
  • {'answer': 'LangGraph Reflexion은 모델의 응답 창출 과정에서 내부 추론 과정을 반성하고 개선점을 식별하는 기능으로 간주할 수 있습니다. 주요 장점으로는 먼저 오류 가능 영역과 불확실성을 표면화해 더 안전하고 신뢰할 수 있는 답변을 만들도록 돕는 점이 있습니다. 둘째, 판단 근거를 재확인하고 필요한 경우 보완 정보를 요청해 대화의 정확성을 높입니다. 셋째, 단계별로 문제를 분해하고 각 단계의 타당성을 점검해 설명의 투명성과 재현성을 향상시킵니다. 넷째, 반복적인 피드백 루프를 통해 장기적으로 응답 품질을 개선하는 학습 신호를 남길 수 있습니다. 다섯째, 정책 준수와 안전성 점검을 강화해 민감한 주제에서의 위험을 줄이고 일관된 기준을 유지합니다. 여섯째, 복잡한 문제에서도 대화 흐름을 안정적으로 유지하고 적절한 후속 질문을 유도할 수 있습니다. 마지막으로, 관리 가능한 비용으로 품질 향상을 도모하는 설계가 가능하나, 내부 반성이 항상 정답으로 이어지지는 않으며 특정 도메인에 한정된 효과일 수 있습니다.', 'search_queries': ['LangGraph Reflexion 장점', 'self-reflection reasoning language model benefits', 'AI 모델 자기반성 안전성 및 신뢰성 개선'], 'reflection': {'missing': '구체적 구현 사례, 벤치마크 수치, 비용-성능 트레이드오프에 대한 정보가 필요합니다.', 'superfluous': '일부 문장을 지나치게 일반화하여 실무 적용 시 구체성이 떨어질 수 있습니다.'}}
  • 성찰 결과를 보면 AnswerQuestion의 형식에 따라 출력된 것을 확인 할 수 있다.

수정 단계(Revision)

class ReviseAnswer(AnswerQuestion):
    """Revise your original answer to your question. Provide an answer, reflection,
    
    cite your reflection with references, and finally
    add search queries to imporve the answer."""

    references: list[str] = Field(
        description = "업데이트된 답변에 사용된 인용 출처"
    )

프롬프트를 사용해 수정 단계를 구성해주었다.

  • 답변과 그 답변에 인용된 출처를 밝힐 수 있는 구조를 만들어줌.
revise_instructions = """이전 답변을 새로운 정보를 바탕으로 수정하세요.
- 이전 비평 내용을 활용해 중요한 정보를 추가해야 합니다.  
  - 수정된 답변에는 반드시 숫자로 된 인용 표시를 포함하여 검증 가능하도록 해야 합니다.  
  - 답변 하단에 "참고문헌" 섹션을 추가하세요 (이 부분은 단어 수 제한에 포함되지 않습니다). 형식은 다음과 같습니다:  
    - [1] <https://example.com>  
    - [2] <https://example.com>  

- 이전 비평 내용을 바탕으로 불필요한 정보를 제거하고, 최종 답변은 반드시 200자를 넘지 않도록 하세요.
"""

revision_chain = actor_prompt_template.partial(
    first_instruction = revise_instructions,
) | llm.bind_tools(tools = [ReviseAnswer], tool_choice = "any")

revisor = Responder(runnable=revision_chain)
  • 해당 구조를 통해 출력해낼 것이다.
import json

revised = revisor.respond(
    {
        "messages":[
            HumanMessage(content = example_question),
            initial["messages"],
            ToolMessage(
                tool_call_id=initial['messages'].tool_calls[0]['id'],
                content = json.dumps(
                    tavily_tool.invoke(
                        {
                            "query":initial["messages"].tool_calls[0]["args"]["search_queries"][0]

                        }
                    )
                ),
            ),
        ]
    }
)

revised["messages"].tool_calls[0]['args']

{'answer': 'LangGraph Reflexion은 불확실성 표면화, 근거 재확인, 단계적 검토로 정확성과 안전성을 높이고 학습 신호를 남깁니다. 다만 구현 비용과 도메인 의존성이 고려됩니다 [1][2].', 'search_queries': ['LangGraph Reflexion 장점 벤치마크', 'Reflexion AI 사례', '자기반성 기반 AI 성능 트레이드오프'], 'reflection': {'missing': '구체적 수치 벤치마크와 도메인별 적용 사례가 부족합니다.', 'superfluous': '일부 일반적 진술은 구체성을 떨어뜨립니다.'}, 'references': ['https://medium.com/towardsdev/built-with-langgraph-29-reflection-reflexion-10cc1cf96f35', 'https://velog.io/@hyeonybraincloud/LLM-LangGraph-Reflexion-Agent']}

  • 위와 같이 답변에 대한 reflect를 내놓았다.

웹검색을 위한 툴 노드 생성

tavily_tool.batch(
    [
        {"query": initial["messages"].tool_calls[0]["args"]['search_queries'][0]}
    ]
)
from langchain_core.tools import StructuredTool
from langgraph.prebuilt import ToolNode

def run_queries(search_queries: list[str], **kargs):
    """Run the generated queries."""
    return tavily_tool.batch([{"query": query}for query in search_queries])

tool_node = ToolNode(
    [
        StructuredTool.from_function(run_queries, name=AnswerQuestion.__name__),
        StructuredTool.from_function(run_queries, name=ReviseAnswer.__name__),
    ]
)

그래프 생성

from langgraph.graph import END, StateGraph, START
from langgraph.graph.message import add_messages
from typing import Annotated
from typing_extensions import TypedDict

class State(TypedDict):
    messages: Annotated[list, add_messages]
  • 상태 그래프 생성
MAX_ITERATIONS = 5
graph_builder = StateGraph(State)
graph_builder.add_node("draft", first_responder.respond)

graph_builder.add_node("execute_tools", tool_node)
graph_builder.add_node("revise", revisor.respond)

graph_builder.add_edge("draft","execute_tools")
graph_builder.add_edge("execute_tools", "revise")
  • 노드와 엣지 연결
def _get_num_iterations(state:list):
    i = 0
    for m in state[::-1]:
        if m.type not in {"tool", "ai"}:
            break
        i += 1
    return i

def event_loop(state:list):
    num_iterations = _get_num_iterations(state["messages"])
    if num_iterations > MAX_ITERATIONS:
        return END
    return "execute_tools"

graph_builder.add_conditional_edges("revise", event_loop,["execute_tools", END])
graph_builder.add_edge(START,"draft")
graph = graph_builder.compile()
graph

  • 그래프로 루프를 생성
events = graph.stream(
    {"messages": [HumanMessage(content="AI Agent가 무엇인가요?")]},
    stream_mode="values",
)
for i, step in enumerate(events):
    print(f"Step {i}")
    step["messages"][-1].pretty_print()
  • 루프 수행 이후 아래는 출력 내용인데 처음 출럭 → 수정 반복을 한다.

Step 0 ================================[1m Human Message [0m=================================

랭그래프 Reflexion의 장점은 무엇인가요? Step 1 ==================================[1m Ai Message [0m================================== Tool Calls: AnswerQuestion (call_TXidJKqhCVJmY8lB1QjftTCu) Call ID: call_TXidJKqhCVJmY8lB1QjftTCu Args: answer: 랭그래프 Reflexion은 문제를 단계적으로 분해하고 각 단계의 추론을 스스로 반영하도록 설계되어 최종 출력의 정확도를 높입니다. 이 반성 과정은 최종 답을 내리기 전에 내부 점검과 수정 루프를 가능하게 합니다. 추론 과정의 중간 결과를 명확히 드러내어 설명가능성과 감사추적성을 크게 개선합니다. 특정 추론 단계에서의 오류를 더 쉽게 식별하고 원인을 파악할 수 있어 디버깅이 빨라집니다. 데이터와 제약 조건에 대한 교차 검증으로 환각(hallucination) 가능성을 줄이는 데 도움이 됩니다. 각 단계에서 불확실성을 추정하고 표기함으로써 더 안정적인 의사결정을 지원합니다. 모듈형 추론을 촉진하여 재사용 가능한 부분해를 구축하고 전체 시스템의 유지보수를 용이하게 합니다. 사용자의 목표와 제약에 단계적으로 부합하도록 추론 과정을 점검합니다. 고위험 작업이나 규제가 엄격한 분야에서 더 안전하고 통제된 출력을 제공하는 경향이 있습니다. 피드백 루프를 통해 반복적으로 개선할 수 있어 개발자나 사용자가 추론 방향을 조정하기 쉽습니다. search_queries: ['LangGraph Reflexion 장점 실증 벤치마크', 'Reflective reasoning LLM 장점 비교', '랭그래프 Reflexion 구성 가이드 프롬프트 예시'] reflection: {'missing': '실제 성능 수치/벤치마크, 도메인별 한계, 비용/레이턴시, 구성 방법 및 프롬프트 예제에 대한 구체적 정보가 부족합니다. 다양한 데이터셋과 시나리오에서의 작동 예시가 누락되어 있습니다.', 'superfluous': '장점 설명 중 지나치게 일반적이고 구체적 가이드가 없어 불필요하게 느껴지거나 실제 적용에 바로 활용되기 어렵다고 느껴질 수 있습니다.'} Step 2 =================================[1m Tool Message [0m================================= Name: AnswerQuestion

[{"query": "LangGraph Reflexion 장점 실증 벤치마크", "follow_up_questions": null, "answer": null, "images": [], "results": [{"url": "https://medium.com/towardsdev/built-with-langgraph-29-reflection-reflexion-10cc1cf96f35", "title": "Built with LangGraph! #29: Reflection & Reflexion - Medium", "content": "Enhanced Decision-Making: Through reflective practices, AI can make more informed decisions in complex scenarios by analyzing past performances and outcomes, ultimately leading to more robust solutions.\\n\\nIn summary, reflection is essential in AI as it fosters a cycle of learning and growth, optimizes performance, enhances decision-making, and contributes to creating more reliable and ethical AI systems.', 'reflection': {'missing': 'The answer could benefit from examples of reflection in practice, specifically in different AI domains such as reinforcement learning or natural language processing.', 'superfluous': 'Some aspects may have been explained with unnecessary details such as the deep dive into various benefits, which could be more concise.'}, 'search_queries': ['examples of reflection in AI', 'importance of reflection in reinforcement learning', 'how reflection improves machine learning models']}, 'id': 'call_OYVSBPto5VYHnHaDZ42XSEqW', 'type': 'tool_call'}], usage_metadata={'input_tokens': 223, 'output_tokens': 385, 'total_tokens': 608, 'input_token_details': {'audio': 0, 'cache_read': 0}, 'output_token_details': {'audio': 0, 'reasoning': 0}})} 'messages AIMessage 'tool_calls 'id 'call_OYVSBPto5VYHnHaDZ42XSEqW 'function 'arguments \"answer\"\"Reflection in artificial intelligence (AI) is a crucial component that enhances the learning, adaptation, and performance of AI systems.", "score": 0.5999311, "raw_content": null}, {"url": "https://velog.io/@hyeonybraincloud/LLM-LangGraph-Reflexion-Agent", "title": "LangGraph - Reflexion Agent - velog", "content": "최근 LLM 기반 Agents은 단순히 입력에 반응하는 수준을 넘어서, 생성된 결과물을 스스로 점검하고 보강하여 성능과 일관성을 크게 향상시키고 있다.", "score": 0.39452806, "raw_content": null}, {"url": "https://levelup.gitconnected.com/building-a-self-improvement-agent-with-langgraph-reflection-vs-reflexion-1d1abcc5865d", "title": "Building a Self-Improvement Agent with LangGraph: Reflection Vs ...", "content": "# Building a Self-Improvement Agent with LangGraph: Reflection Vs Reflexion. > Reflection is a prompting strategy used to improve the quality and success rate of agents and similar AI systems. In this post, we’ll focus on Reflection and Reflexion agents, explore their workflows, and implement them step-by-step using LangChain and LangGraph. The idea of alternating generation and review in a Basic Reflection Agent seems practical for improving draft quality efficiently. Building Agentic RAG with LangGraph: Mastering Adaptive RAG for Production. ## Building Agentic RAG with LangGraph: Mastering Adaptive RAG for Production. Agentic AI Project: Build a Multi-Agent system with LangGraph and Open AI. [## Agentic AI Project: Build a Multi-Agent system with LangGraph and Open AI. ### This is an end to end project on building a multi-agent insurance support system using Agentic AI [LangGraph and OpenAI API]. Building the 7 Layers of a Production-Grade Agentic AI System. ## Building the 7 Layers of a Production-Grade Agentic AI System.", "score": 0.35033303, "raw_content": null}, {"url": "https://medium.com/@avicsebooks/langchain-langgraph-reflexion-agent-5-d937bdbede70", "title": "LangChain & LangGraph: Reflexion Agent-5 | by Avicsebooks", "content": "The Reflexion Agent is an advanced architectural pattern that moves beyond immediate self-correction (Basic Reflection) by incorporating", "score": 0.32827148, "raw_content": null}, {"url": "https://www.reddit.com/r/LangChain/comments/1fs3qn9/what_are_pros_and_cons_of_lang_graph_vs_llama/?tl=ko", "title": "Lang graph vs Llama index Multiple Agent 시스템의 장단점은 무엇 ...", "content": "langgraph 써봤는데 재밌더라. LLM/에이전트 호출의 상태 머신을 정의하는 데 사용할 수 있어. 루프랑 분기가 필요하고 상태 기반 언어 애플리케이션", "score": 0.21596229, "raw_content": null}], "response_time": 0.7, "request_id": "d02e2dc1-bfd9-4d5e-a4d7-313173180699"}, {"query": "Reflective reasoning LLM 장점 비교", "follow_up_questions": null, "answer": null, "images": [], "results": [{"url": "https://velog.io/@yunseo4401/논문리뷰Reflexion-Language-Agents-with-Verbal-Reinforcement-Learning", "title": "[논문리뷰]Reflexion : Language Agents with Verbal Reinforcement ...", "content": "Reflextion은 전통적인 강화 학습 접근 방식과 비교하여 여러 장점을 가진다. 1) LLM의 finetuning을 필요로 하지 않아 가볍다 2) 스칼라 또는 벡터", "score": 0.99996114, "raw_content": null}, {"url": "https://www.youtube.com/watch?v=cguaU6Bpehw", "title": "Self-Reflective Reasoning 기반 LLM 추론 안정화 프레임워크 분석", "content": "... Reasoning 방식(CoT, ToT)과 성능 비교 실험 결과 정리 장문 추론(Long-Context Reasoning) 안정화 기법 소개 차세대 Agentic AI 및 신뢰형 LLM", "score": 0.9998969, "raw_content": null}, {"url": "https://cartinoe5930.tistory.com/entry/Reflexion-Language-Agents-with-Verbal-Reinforcement-Learning-논문-리뷰", "title": "Language Agents with Verbal Reinforcement Learning 논문 리뷰", "content": "또한, Reflexion은 전통적인 RL 방식들과 비교해서 다음과 같은 여러 장점을 가진다. 동시에 LLM의 자가 평가 역량의 힘에 의존하고, 성공에 대한", "score": 0.99982053, "raw_content": null}, {"url": "https://tulip-phalange-a1e.notion.site/Reasoning-LLMs-190c32470be2806d834ee0ad98aaa0b6", "title": "Reasoning LLMs에 관한 비주얼 가이드 - Notion", "content": "일반적인 LLMs와 비교했을 때, reasoning LLMs는 주어진 질문에 답하기 전에 문제를 더 작은 단계(일반적으로 reasoning steps 또는 thought processes라고 불림)로 나누", "score": 0.99903786, "raw_content": null}, {"url": "https://jik9210.tistory.com/49", "title": "[논문리뷰]27. SELF-RAG: LEARNING TO RETRIEVE, GENERATE ...", "content": "장점:검색기와 LLM이 동시에 학습되기 때문에, 모델이 더 효율적으로 검색된 정보를 활용할 수 있습니다. few-shot 파인튜닝을 통해 작업별로 모델을", "score": 0.9976949, "raw_content": null}], "response_time": 0.65, "request_id": "3a43a2ef-e396-42e4-888c-add8412cf47a"}, {"query": "랭그래프 Reflexion 구성 가이드 프롬프트 예시", "follow_up_questions": null, "answer": null, "images": [], "results": [{"url": "https://www.promptingguide.ai/kr/techniques/reflexion", "title": "Reflexion | Prompt Engineering Guide", "content": "(2023) (opens in a new tab)에 따르면, \"Reflexion은 LLM 매개변수의 선택과 쌍을 이루는 에이전트의 메모리 인코딩으로 정책을 매개변수화하여 이루어 낸 '언어적' 강화 패러다임입니다.\". Reflection 에이전트가 의사 결정, 프로그래밍 또는 추론과 같은 다양한 작업을 해결하기 위한 반복적 행동을 최적화하는 방법을 배우는 예시를 아래의 그림을 통해 볼 수 있습니다. 실험 결과에 따르면 Reflexion 에이전트는 의사 결정 AlfWorld 작업, HotPotQA의 추론 질문 및 HumanEval의 Python 프로그래밍 작업에서 성능을 크게 향상시키는 것으로 나타났습니다. 3. 어감에 따른 피드백이 필요합니다: Reflexion은 언어 피드백을 활용하며, 이는 기존 강화 학습(Reinforcement Learning)에서 사용되는 scalar 보상보다 더 미묘하고 구체적일 수 있습니다. 4. 해석 가능성(Interpretability)과 명시적 기억이 중요합니다: Reflexion은 기존 강화 학습(Reinforcement Learning) 방법에 비해 더 해석 가능하고 명시적인 형태의 에피소드 메모리를 제공합니다. 에이전트의 자기 성찰(self-reflection)은 메모리에 저장되어 학습 과정을 더 쉽게 분석하고 이해할 수 있습니다. Figures 출처: Reflexion: Language Agents with Verbal Reinforcement Learning (opens in a new tab). * Reflexion: Language Agents with Verbal Reinforcement Learning (opens in a new tab).", "score": 0.9999485, "raw_content": null}, {"url": "https://kr.linkedin.com/pulse/ai-agents-langgraph-part-5-my-agent-series-blogs-ajay-taneja-pnsff?tl=ko", "title": "LangGraph의 AI 에이전트: 제 에이전트 시리즈 블로그 5부 - LinkedIn", "content": "랭그래프 구성 요소: 1) 프롬프트 템플릿: 프롬프트 템플릿은 재사용 ... Reflection Node는 Reflection Prompt를 시스템 프롬프트로 받아 초안을 처리", "score": 0.9995987, "raw_content": null}, {"url": "https://www.youtube.com/watch?v=d_erf5LggAQ", "title": "LangGraph Crash Course #10 - Reflexion Agent - Introduction", "content": "Building an AI product or feature? Let's talk → https://openslate.ai/ Want to master AI Engineering?", "score": 0.9882222, "raw_content": null}, {"url": "https://medium.com/towardsdev/built-with-langgraph-29-reflection-reflexion-10cc1cf96f35", "title": "Built with LangGraph! #29: Reflection & Reflexion - Medium", "content": "Enhanced Decision-Making: Through reflective practices, AI can make more informed decisions in complex scenarios by analyzing past performances and outcomes, ultimately leading to more robust solutions.\\n\\nIn summary, reflection is essential in AI as it fosters a cycle of learning and growth, optimizes performance, enhances decision-making, and contributes to creating more reliable and ethical AI systems.', 'reflection': {'missing': 'The answer could benefit from examples of reflection in practice, specifically in different AI domains such as reinforcement learning or natural language processing.', 'superfluous': 'Some aspects may have been explained with unnecessary details such as the deep dive into various benefits, which could be more concise.'}, 'search_queries': ['examples of reflection in AI', 'importance of reflection in reinforcement learning', 'how reflection improves machine learning models']}, 'id': 'call_OYVSBPto5VYHnHaDZ42XSEqW', 'type': 'tool_call'}], usage_metadata={'input_tokens': 223, 'output_tokens': 385, 'total_tokens': 608, 'input_token_details': {'audio': 0, 'cache_read': 0}, 'output_token_details': {'audio': 0, 'reasoning': 0}})} 'messages AIMessage 'tool_calls 'id 'call_OYVSBPto5VYHnHaDZ42XSEqW 'function 'arguments \"answer\"\"Reflection in artificial intelligence (AI) is a crucial component that enhances the learning, adaptation, and performance of AI systems.", "score": 0.93439513, "raw_content": null}, {"url": "https://www.reddit.com/r/LangChain/comments/1rilpms/guidance_for_langgraph_implementation/?tl=ko", "title": "Langgraph 구현 가이드 : r/LangChain - Reddit", "content": "제가 직접 경험한 최고의 방법은 그냥 시작해서 다양한 그래프 설정을 실험해 보는 거예요. 예를 들어, 서로 다른 패턴, 감독자 및 하위 에이전트, 병렬", "score": 0.77321637, "raw_content": null}], "response_time": 0.82, "request_id": "8830a417-5b7b-496d-b0c4-d95473b9b53c"}]


Step 6 =================================[1m Tool Message [0m================================= Name: ReviseAnswer

[{"query": "LangGraph Reflexion 벤치마크 수치", "response_time": 0.46, "follow_up_questions": null, "answer": null, "images": [], "results": [{"url": "https://www.threads.com/@feelfree_ai/post/DT6pVjfgXpe/langgraph-유저분들-주목-ai-에이전트에게-토큰-걱정-없이-반영구적-장기-기억을-심어주는-hmlr이-등장했는데-심지어-ragas-벤치마크", "title": "LangGraph 유저분들 주목! AI 에이전트에게 토큰 걱정 없이 '반영구적 ...", "content": "실제 핵심 벤치마크 테스트에서도 기존 메모리 방식보다 압도적으로 높은 점수를 기록했다고 하네요.이제 진짜 나를 잘 아는 '개인 비서' 같은 AI 봇을", "score": 0.44189036, "raw_content": null}, {"url": "https://medium.com/@okanyenigun/built-with-langgraph-29-reflection-reflexion-10cc1cf96f35", "title": "Built with LangGraph! #29: Reflection & Reflexion | by Okan Yenigün", "content": "In agentic AI, the reflection pattern is a feedback loop in which the agent reviews its own output, critiques it, and produces an improved", "score": 0.32791626, "raw_content": null}, {"url": "https://rudaks.tistory.com/entry/langgraphReflection-Critique-Reflexion", "title": "[langgraph][Reflection & Critique] Reflexion - [루닥스 블로그] 연습만 ...", "content": "또한, 기후 위기 해결에 대한 국제적 협력의 중요성을 간과했다.', 'superfluous': '일부 내용이 중복되거나 너무 일반적일 수 있으며, 예를 들어 재생 가능 에너지원의 종류에 대한 세부 설명이 필요하지 않았다.'} search_queries: ['기후 위기 해결 사례', '재생 가능 에너지의 효과', '기후 변화 국제 협력 사례'] Step 2 ================================= Tool Message ================================= Name: AnswerQuestion [[{\"url\": \"https://m.blog.naver.com/econow/223137241328\\\\", \"content\": \"기후위기 원인 사례 해결방안 총정리 : 네이버 블로그 기후위기 원인 사례 해결방안 총정리 기후위기 해결방안 원인 사례 총정리 기후위기 원인 기후변화는 주로 인간 활동, 특히 인위적인 온실가스 배출이 가장 큰 원인으로 지목받고 있어요. 태양 에너지는 태양 복사열을 이용하는 깨끗하고 널리 이용 가능한 재생 에너지 형태입니다.\"}], [{\"url\": \"https://www.yna.co.kr/view/AKR20220907046400530\\\\", \"content\": \"(서울=연합뉴스) 계승현 기자 = 기후변화, 코로나19 등 세계적인 문제를 해결하기 위해 우리 정부가 여러 국가와 함께 노력한 '다자혁신' 사례가 경제협력개발기구(oecd) 회원국에 공유됐다.\"}, {\"url\": \"https://info.greennews360.com/climate-change-solutions/\\\\", \"content\": \"기후 변화 해결 방안 24가지 (개인, 국가, 사회) - Green Info 360 이를 통해 개인의 에너지 소비를 지속 가능하게 할 수 있습니다.", "score": 0.23246734, "raw_content": null}, {"url": "https://velog.io/@hyeonybraincloud/LLM-LangGraph-Reflection-agent", "title": "LangGraph - Reflection Agent - velog", "content": "Reflector Chain은 단순히 트윗을 생성하는 것을 넘어, 모델 스스로 결과물을 평가하고 개선점을 찾아내는 메타-프롬프트 기법을 학습하기 위해 설계", "score": 0.17943022, "raw_content": null}, {"url": "https://velog.io/@hyeonybraincloud/LLM-LangGraph-Reflexion-Agent", "title": "LangGraph - Reflexion Agent - velog", "content": "본 포스트는 LLM 기반 LangGraph를 활용해 Actor‑Reflection‑Revisor 구조를 구현하고, 생성된 답변을 스스로 비판·개선하는 Reflexion Agent 워크", "score": 0.13870688, "raw_content": null}], "request_id": "83892304-583c-4db6-8d2a-ab088ade0e7e"}, {"query": "Reflexion 프롬프트 예시", "response_time": 0.5, "follow_up_questions": null, "answer": null, "images": [], "results": [{"url": "https://kr.linkedin.com/pulse/day-16-reflection-prompting-teaching-ai-self-evaluate-gupta-uvyye?tl=ko", "title": "16일차: 반성 촉구 – AI가 스스로 평가하고 출력을 개선하도록 가르치기", "content": "예시 프롬프트: \"이전 답변을 검토하고 누락된 부분이나 개선할 수 있는 부분을 찾아라.\" Y: AI가 답변을 비판적으로 평가하도록 안내하며, 빈틈과 대안적", "score": 0.7845341, "raw_content": null}, {"url": "https://www.promptingguide.ai/kr/techniques/reflexion", "title": "Reflexion | Prompt Engineering Guide", "content": "(2023) (opens in a new tab)에 따르면, \"Reflexion은 LLM 매개변수의 선택과 쌍을 이루는 에이전트의 메모리 인코딩으로 정책을 매개변수화하여 이루어 낸 '언어적' 강화 패러다임입니다.\". Reflection 에이전트가 의사 결정, 프로그래밍 또는 추론과 같은 다양한 작업을 해결하기 위한 반복적 행동을 최적화하는 방법을 배우는 예시를 아래의 그림을 통해 볼 수 있습니다. 실험 결과에 따르면 Reflexion 에이전트는 의사 결정 AlfWorld 작업, HotPotQA의 추론 질문 및 HumanEval의 Python 프로그래밍 작업에서 성능을 크게 향상시키는 것으로 나타났습니다. 3. 어감에 따른 피드백이 필요합니다: Reflexion은 언어 피드백을 활용하며, 이는 기존 강화 학습(Reinforcement Learning)에서 사용되는 scalar 보상보다 더 미묘하고 구체적일 수 있습니다. 4. 해석 가능성(Interpretability)과 명시적 기억이 중요합니다: Reflexion은 기존 강화 학습(Reinforcement Learning) 방법에 비해 더 해석 가능하고 명시적인 형태의 에피소드 메모리를 제공합니다. 에이전트의 자기 성찰(self-reflection)은 메모리에 저장되어 학습 과정을 더 쉽게 분석하고 이해할 수 있습니다. Figures 출처: Reflexion: Language Agents with Verbal Reinforcement Learning (opens in a new tab). * Reflexion: Language Agents with Verbal Reinforcement Learning (opens in a new tab).", "score": 0.75355774, "raw_content": null}, {"url": "https://mingyu6952.tistory.com/entry/Paper-Review-Code-Reflexion-Language-Agents-with-Verbal-Reinforcement-Learning", "title": "[Paper Review] Reflexion : Language Agents with Verbal ...", "content": "CoT 구현의 경우 6-shot prompt를 사용하고 ReAct의 경우 2-shot prompt를 사용한다. 예시는 아래와 같다. CoT + Reflexion HotPotQA CoT + Reflexion.", "score": 0.694241, "raw_content": null}, {"url": "https://velog.io/@letluvrule/프롬프트-패턴-요약", "title": "프롬프트 패턴 요약 - velog", "content": "개선 사이클 형성: 초기 답변 → Reflection 요청 → 개선된 답변 → 다시 Reflection 요청 등 점진적 개선. ... 예시 구현: \"지금부터 'a → b'는 노드 a와 b를", "score": 0.65940565, "raw_content": null}, {"url": "https://brunch.co.kr/@bobbyryu/24", "title": "18화 AI를 위한 자기성찰의 거울, “리플렉션” 패턴 - 브런치", "content": "\"리플렉션(Reflection)\" 패턴은 대형언어모델이 자신의 사고 과정을 성찰하고 설명하도록 요구하는 방법입니다. · 프롬프트 예시를 통해 살펴보죠.", "score": 0.6356076, "raw_content": null}], "request_id": "93bcd283-5e89-44fc-b009-fff9408e13bb"}, {"query": "Reflexion vs Reflection 비교 한계", "response_time": 0.72, "follow_up_questions": null, "answer": null, "images": [], "results": [{"url": "https://english.stackexchange.com/questions/48519/difference-between-reflection-and-reflexion", "title": "Difference between \"reflection\" and \"reflexion\" [closed]", "content": "Both are the same word with different spellings, I like to think of reflections as contemplations, while reflexions seem more like spontaneous responses.", "score": 0.5889134, "raw_content": null}, {"url": "https://redkiwiapp.com/ko/english-guide/synonyms/reflexion-reflection", "title": "Reflexion와 reflection 뜻/의미/차이점을 알아보세요 - RedKiwi", "content": "1의미: Reflexion 또한 자동적이고 비자발적인 신체적 또는 정신적 반응을 나타낼 수 있는 반면, reflection는 반사 표면에 있는 자신이나 다른 것의 거울 이미지를 나타낼", "score": 0.55709904, "raw_content": null}, {"url": "https://taewan2002.medium.com/reflexion-스스로-성찰하고-개선하기-7541ecfb8d74", "title": "Reflexion: 스스로 성찰하고 개선하기 - Taewan Cho", "content": "Self-Refine은 효과적이지만 단일 생성 추론 작업에 한정된다는 한계가 있습니다. ... 이 과정을 반복하면서 Actor, Evaluator, Self-reflection 모델이", "score": 0.41009519, "raw_content": null}, {"url": "https://www.youtube.com/watch?v=vbYH8yaIVQw", "title": "Reflection vs Reflexion - YouTube", "content": "Reflective vs Reflexive; Reflection vs Reflexion Glanville, R. (2013). Cybernetics: Thinking Through The Technology. In Arnold, D. (Ed.).", "score": 0.39229083, "raw_content": null}, {"url": "https://ko.hinative.com/questions/4337824", "title": "차이점은 무엇 입니까? \"reflection\" 그리고 \"reflexion\" - HiNative", "content": "reflection의 동의어 no difference. Reflexion is British spelling. ... 이들 reflection 그리고 reflexion 의 차이점은 무엇인가요?예문 만이라도", "score": 0.37896514, "raw_content": null}], "request_id": "656facf3-7b7b-497a-96a9-2c68e99ba1c8"}] Step 7 ==================================[1m Ai Message [0m================================== Tool Calls: ReviseAnswer (call_ACfUz8uGG1ywr6pcjMXJ9Jdz) Call ID: call_ACfUz8uGG1ywr6pcjMXJ9Jdz Args: answer: Reflexion의 주요 장점은 의사결정 개선과 추론 안정성으로, 내부 점검·수정 루프를 통한 품질 향상이다[1][2]. 다만 벤치마크 수치, 도메인별 한계, 비용/레이턴시, 프롬프트 예시의 구체화가 필요하다. search_queries: ['LangGraph Reflexion 벤치마크 수치', 'Reflexion 프롬프트 예시', 'Reflexion vs Reflection 비교 한계'] reflection: {'missing': '실제 벤치마크 수치/벤치마크 방법, 도메인별 한계, 비용/레이턴시 분석, 구현 팁 구체화', 'superfluous': '장점 일반 설명은 제거하고 핵심 포인트에 집중'} references: ['https://medium.com/towardsdev/built-with-langgraph-29-reflection-reflexion-10cc1cf96f35', 'https://promptingguide.ai/kr/techniques/reflexion']