Buckets:

HuggingFaceDocBuilder's picture
download
raw
10.6 kB
<meta charset="utf-8" /><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;멀티스텝 에이전트는 어떻게 동작하나요?&quot;,&quot;local&quot;:&quot;how-do-multi-step-agents-work&quot;,&quot;sections&quot;:[],&quot;depth&quot;:1}">
<link href="/docs/smolagents/pr_2321/ko/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload">
<link rel="modulepreload" href="/docs/smolagents/pr_2321/ko/_app/immutable/entry/start.ca84f914.js">
<link rel="modulepreload" href="/docs/smolagents/pr_2321/ko/_app/immutable/chunks/scheduler.00b97157.js">
<link rel="modulepreload" href="/docs/smolagents/pr_2321/ko/_app/immutable/chunks/singletons.267d4408.js">
<link rel="modulepreload" href="/docs/smolagents/pr_2321/ko/_app/immutable/chunks/index.78ea7f15.js">
<link rel="modulepreload" href="/docs/smolagents/pr_2321/ko/_app/immutable/chunks/paths.c73d3216.js">
<link rel="modulepreload" href="/docs/smolagents/pr_2321/ko/_app/immutable/entry/app.e212187f.js">
<link rel="modulepreload" href="/docs/smolagents/pr_2321/ko/_app/immutable/chunks/preload-helper.ac32094c.js">
<link rel="modulepreload" href="/docs/smolagents/pr_2321/ko/_app/immutable/chunks/index.a7c1a7a1.js">
<link rel="modulepreload" href="/docs/smolagents/pr_2321/ko/_app/immutable/nodes/0.34d24179.js">
<link rel="modulepreload" href="/docs/smolagents/pr_2321/ko/_app/immutable/chunks/each.e59479a4.js">
<link rel="modulepreload" href="/docs/smolagents/pr_2321/ko/_app/immutable/nodes/2.d7f5dd65.js">
<link rel="modulepreload" href="/docs/smolagents/pr_2321/ko/_app/immutable/chunks/MermaidChart.svelte_svelte_type_style_lang.e24d3ba9.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;멀티스텝 에이전트는 어떻게 동작하나요?&quot;,&quot;local&quot;:&quot;how-do-multi-step-agents-work&quot;,&quot;sections&quot;:[],&quot;depth&quot;:1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"><div class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg></span> <span>Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg></button></div> </div> <h1 class="relative group"><a id="how-do-multi-step-agents-work" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#how-do-multi-step-agents-work"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>멀티스텝 에이전트는 어떻게 동작하나요?</span></h1> <p data-svelte-h="svelte-13vayok">ReAct 프레임워크(<a href="https://huggingface.co/papers/2210.03629" rel="nofollow">Yao et al., 2022</a>)는 현재 에이전트 구축하는 가장 일반적인 접근 방식입니다.</p> <p data-svelte-h="svelte-1uo4mp9">ReAct라는 이름은 “추론(Reason)“과 “행동(Act)“을 결합한 것입니다. 실제로 이 구조를 따르는 에이전트는 주어진 작업을 해결하기 위해 필요한 만큼 여러 단계를 거칩니다. 각 단계는 추론 단계와 행동 단계로 이루어져 있으며, 행동 단계에서는 작업 해결에 가까워지도록 다양한 도구를 호출합니다.</p> <p data-svelte-h="svelte-loq87x"><code>smolagents</code>가 제공하는 모든 에이전트는 ReAct 프레임워크를 추상화한 단일 <code>MultiStepAgent</code> 클래스를 기반으로 합니다.</p> <p data-svelte-h="svelte-191a7tl">이 클래스는 기본적으로 아래와 같은 루프로 동작하며, 기존 변수와 지식도 에이전트 로그에 함께 반영됩니다.</p> <p data-svelte-h="svelte-1dlvm3m">초기화: 시스템 프롬프트는 <code>SystemPromptStep</code>에 저장되고, 사용자가 입력한 쿼리는 <code>TaskStep</code>에 기록됩니다.</p> <p data-svelte-h="svelte-1wijwcj">While 루프 (ReAct 루프):</p> <ul data-svelte-h="svelte-1b1nsgo"><li><code>agent.write_memory_to_messages()</code>를 사용하여 에이전트 로그를 LLM이 읽을 수 있는 <a href="https://huggingface.co/docs/transformers/en/chat_templating" rel="nofollow">채팅 메시지</a> 목록에 작성합니다.</li> <li>이 메시지를 <code>Model</code> 객체에 전송하여 응답을 받습니다. 에이전트는 응답을 파싱하여 액션(<code>ToolCallingAgent</code>의 경우 JSON blob, <code>CodeAgent</code>의 경우 코드 스니펫)을 추출합니다.</li> <li>액션을 실행하고 결과를 메모리에 기록합니다(<code>ActionStep</code>).</li> <li>각 단계가 끝날 때마다 <code>agent.step_callbacks</code>에 정의된 모든 콜백 함수를 실행합니다.</li></ul> <p data-svelte-h="svelte-so9d9t"><strong>계획(planning)</strong>이 활성화된 경우에는 주기적으로 계획을 수정하고 이를 <code>PlanningStep</code>에 저장할 수 있습니다. 이 과정에는 현재 작업과 관련된 사실을 메모리에 기록하는 것도 포함됩니다.</p> <p data-svelte-h="svelte-16d10th"><code>CodeAgent</code>의 경우, 이 과정은 아래 그림과 같이 나타납니다.</p> <div class="flex justify-center" data-svelte-h="svelte-1hb194n"><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolagents/codeagent_docs.png"></div> <p data-svelte-h="svelte-1pi6d4z">비디오를 통해 동작 과정을 확인해보세요.</p> <div class="flex justify-center" data-svelte-h="svelte-4ra9xq"><img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/Agent_ManimCE.gif"> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/Agent_ManimCE.gif"></div> <p data-svelte-h="svelte-ck3hdm"><code>smolagents</code> 라이브러리는 두 가지 버전의 에이전트를 제공합니다.</p> <ul data-svelte-h="svelte-15q1civ"><li>도구 호출을 Python 코드 스니펫 형태로 생성하는 <a href="/docs/smolagents/pr_2321/ko/reference/agents#smolagents.CodeAgent">CodeAgent</a></li> <li>많은 프레임워크에서 일반적으로 사용하는 방식처럼 도구 호출을 JSON 형태로 작성하는 <a href="/docs/smolagents/pr_2321/ko/reference/agents#smolagents.ToolCallingAgent">ToolCallingAgent</a></li></ul> <p data-svelte-h="svelte-1n9s5pe">필요에 따라 두 방식 중 어느 것이든 사용할 수 있습니다. 예를 들어, 웹 브라우징처럼 각 페이지 상호작용 후 대기 시간이 필요한 경우 JSON 기반 도구 호출이 잘 맞을 수 있습니다.</p> <blockquote class="tip" data-svelte-h="svelte-9bv37i"><p>멀티스텝 에이전트에 대해 더 알고 싶다면 허깅페이스 블로그의 <a href="https://huggingface.co/blog/open-source-llms-as-agents" rel="nofollow">Open-source LLMs as LangChain Agents</a> 포스트를 읽어보세요.</p></blockquote> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/smolagents/blob/main/docs/source/ko/conceptual_guides/react.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg> <span data-svelte-h="svelte-zjs2n5"><span class="underline">Update</span> on GitHub</span></a> <p></p>
<script>
{
__sveltekit_h301i3 = {
assets: "/docs/smolagents/pr_2321/ko",
base: "/docs/smolagents/pr_2321/ko",
env: {}
};
const element = document.currentScript.parentElement;
const data = [null,null];
Promise.all([
import("/docs/smolagents/pr_2321/ko/_app/immutable/entry/start.ca84f914.js"),
import("/docs/smolagents/pr_2321/ko/_app/immutable/entry/app.e212187f.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 2],
data,
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
10.6 kB
·
Xet hash:
276c4a2522939ee43f01f75fd89707a531780f8f43f664bb51181b33099ef3d5

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.