import{s as oe,o as ie,n as Vt}from"../chunks/scheduler.37c15a92.js";import{S as re,i as pe,g as r,s,r as d,A as ue,h as p,f as n,c as a,j as ae,u as h,x as m,k as tt,y as me,a as l,v as J,d as T,t as g,w as b,m as et,n as nt}from"../chunks/index.2bf4358c.js";import{T as kt}from"../chunks/Tip.363c041f.js";import{C as Qt}from"../chunks/CodeBlock.4e987730.js";import{H as _t}from"../chunks/Heading.8ada512a.js";import{E as ce}from"../chunks/index.e71982be.js";function ye(j){let u,o,M="BaseWorkflowAgent";return{c(){u=et("Find more information on advanced agents on "),o=r("a"),o.textContent=M,this.h()},l(c){u=nt(c,"Find more information on advanced agents on "),o=p(c,"A",{href:!0,"data-svelte-h":!0}),m(o)!=="svelte-1l6wzqu"&&(o.textContent=M),this.h()},h(){tt(o,"href","https://github.com/run-llama/llama_index/blob/main/llama-index-core/llama_index/core/agent/workflow/base_agent.py")},m(c,i){l(c,u,i),l(c,o,i)},p:Vt,d(c){c&&(n(u),n(o))}}}function Me(j){let u,o,M="this notebook",c;return{c(){u=et("You can follow the code in "),o=r("a"),o.textContent=M,c=et(" that you can run using Google Colab."),this.h()},l(i){u=nt(i,"You can follow the code in "),o=p(i,"A",{href:!0,target:!0,"data-svelte-h":!0}),m(o)!=="svelte-1yc57o8"&&(o.textContent=M),c=nt(i," that you can run using Google Colab."),this.h()},h(){tt(o,"href","https://huggingface.co/agents-course/notebooks/blob/main/unit2/llama-index/agents.ipynb"),tt(o,"target","_blank")},m(i,f){l(i,u,f),l(i,o,f),l(i,c,f)},p:Vt,d(i){i&&(n(u),n(o),n(c))}}}function we(j){let u,o,M="AgentWorkflow Basic Introduction",c,i,f="Agent Learning Guide",w;return{c(){u=et("Haven't learned enough yet? There is a lot more to discover about agents and tools in LlamaIndex within the "),o=r("a"),o.textContent=M,c=et(" or the "),i=r("a"),i.textContent=f,w=et(", where you can read more about streaming, context serialization, and human-in-the-loop!"),this.h()},l(y){u=nt(y,"Haven't learned enough yet? There is a lot more to discover about agents and tools in LlamaIndex within the "),o=p(y,"A",{href:!0,"data-svelte-h":!0}),m(o)!=="svelte-ogskyl"&&(o.textContent=M),c=nt(y," or the "),i=p(y,"A",{href:!0,"data-svelte-h":!0}),m(i)!=="svelte-tyusc2"&&(i.textContent=f),w=nt(y,", where you can read more about streaming, context serialization, and human-in-the-loop!"),this.h()},h(){tt(o,"href","https://docs.llamaindex.ai/en/stable/examples/agent/agent_workflow_basic/"),tt(i,"href","https://docs.llamaindex.ai/en/stable/understanding/agent/")},m(y,U){l(y,u,U),l(y,o,U),l(y,c,U),l(y,i,U),l(y,w,U)},p:Vt,d(y){y&&(n(u),n(o),n(c),n(i),n(w))}}}function de(j){let u,o,M,c,i,f,w,y=`Remember Alfred, our helpful butler agent from earlier? Well, he’s about to get an upgrade!
Now that we understand the tools available in LlamaIndex, we can give Alfred new capabilities to serve us better.`,U,x,At=`But before we continue, let’s remind ourselves what makes an agent like Alfred tick.
Back in Unit 1, we learned that:`,st,G,Rt="<p>An Agent is a system that leverages an AI model to interact with its environment to achieve a user-defined objective. It combines reasoning, planning, and action execution (often via external tools) to fulfil tasks.</p>",at,v,Yt="LlamaIndex supports <strong>three main types of reasoning agents:</strong>",ot,Z,St='<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/llama-index/agents.png" alt="Agents"/>',it,W,Ht="<li><code>Function Calling Agents</code> - These work with AI models that can call specific functions.</li> <li><code>ReAct Agents</code> - These can work with any AI that does chat or text endpoint and deal with complex reasoning tasks.</li> <li><code>Advanced Custom Agents</code> - These use more complex methods to deal with more complex tasks and workflows.</li>",rt,I,pt,$,ut,C,mt,Q,Xt=`To create an agent, we start by providing it with a <strong>set of functions/tools that define its capabilities</strong>.
Let’s look at how to create an agent with some basic tools. As of this writing, the agent will automatically use the function calling API (if available), or a standard ReAct agent loop.`,ct,_,Et="LLMs that support a tools/functions API are relatively new, but they provide a powerful way to call tools by avoiding specific prompting and allowing the LLM to create tool calls based on provided schemas.",yt,k,Ft="ReAct agents are also good at complex reasoning tasks and can work with any LLM that has chat or text completion capabilities. They are more verbose, and show the reasoning behind certain actions that they take.",Mt,V,wt,A,qt=`<strong>Agents are stateless by default</strong>, add remembering past interactions is opt-in using a <code>Context</code> object
This might be useful if you want to use an agent that needs to remember previous interactions, like a chatbot that maintains context across multiple messages or a task manager that needs to track progress over time.`,dt,R,ht,Y,Nt='You’ll notice that agents in <code>LlamaIndex</code> are async because they use Python’s <code>await</code> operator. If you are new to async code in Python, or need a refresher, they have an <a href="https://docs.llamaindex.ai/en/stable/getting_started/async_python/" rel="nofollow">excellent async guide</a>.',Jt,S,Lt="Now we’ve gotten the basics, let’s take a look at how we can use more complex tools in our agents.",Tt,H,gt,X,zt=`<strong>Agentic RAG is a powerful way to use agents to answer questions about your data.</strong> We can pass various tools to Alfred to help him answer questions.
However, instead of answering the question on top of documents automatically, Alfred can decide to use any other tool or flow to answer the question.`,bt,E,Pt='<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/llama-index/agentic-rag.png" alt="Agentic RAG"/>',ft,F,Dt=`It is easy to <strong>wrap <code>QueryEngine</code> as a tool</strong> for an agent.
When doing so, we need to <strong>define a name and description</strong>. The LLM will use this information to correctly use the tool.
Let’s see how to load in a <code>QueryEngineTool</code> using the <code>QueryEngine</code> we created in the <a href="components">component section</a>.`,Ut,q,jt,N,It,L,Kt="The <code>AgentWorkflow</code> class also directly supports multi-agent systems. By giving each agent a name and description, the system maintains a single active speaker, with each agent having the ability to hand off to another agent.",Ct,z,Ot="By narrowing the scope of each agent, we can help increase their general accuracy when responding to user messages.",Bt,P,te="<strong>Agents in LlamaIndex can also directly be used as tools</strong> for other agents, for more complex and custom scenarios.",xt,D,Gt,B,vt,K,ee="Now that we understand the basics of agents and tools in LlamaIndex, let’s see how we can use LlamaIndex to <strong>create configurable and manageable workflows!</strong>",Zt,O,Wt,lt,$t;return i=new _t({props:{title:"Using Agents in LlamaIndex",local:"using-agents-in-llamaindex",headingTag:"h1"}}),I=new kt({props:{$$slots:{default:[ye]},$$scope:{ctx:j}}}),$=new _t({props:{title:"Initialising Agents",local:"initialising-agents",headingTag:"h2"}}),C=new kt({props:{$$slots:{default:[Me]},$$scope:{ctx:j}}}),V=new Qt({props:{code:"ZnJvbSUyMGxsYW1hX2luZGV4LmxsbXMuaHVnZ2luZ2ZhY2VfYXBpJTIwaW1wb3J0JTIwSHVnZ2luZ0ZhY2VJbmZlcmVuY2VBUEklMEFmcm9tJTIwbGxhbWFfaW5kZXguY29yZS5hZ2VudC53b3JrZmxvdyUyMGltcG9ydCUyMEFnZW50V29ya2Zsb3clMEFmcm9tJTIwbGxhbWFfaW5kZXguY29yZS50b29scyUyMGltcG9ydCUyMEZ1bmN0aW9uVG9vbCUwQSUwQSUyMyUyMGRlZmluZSUyMHNhbXBsZSUyMFRvb2wlMjAtLSUyMHR5cGUlMjBhbm5vdGF0aW9ucyUyQyUyMGZ1bmN0aW9uJTIwbmFtZXMlMkMlMjBhbmQlMjBkb2NzdHJpbmdzJTJDJTIwYXJlJTIwYWxsJTIwaW5jbHVkZWQlMjBpbiUyMHBhcnNlZCUyMHNjaGVtYXMhJTBBZGVmJTIwbXVsdGlwbHkoYSUzQSUyMGludCUyQyUyMGIlM0ElMjBpbnQpJTIwLSUzRSUyMGludCUzQSUwQSUyMCUyMCUyMCUyMCUyMiUyMiUyMk11bHRpcGxpZXMlMjB0d28lMjBpbnRlZ2VycyUyMGFuZCUyMHJldHVybnMlMjB0aGUlMjByZXN1bHRpbmclMjBpbnRlZ2VyJTIyJTIyJTIyJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwYSUyMColMjBiJTBBJTBBJTIzJTIwaW5pdGlhbGl6ZSUyMGxsbSUwQWxsbSUyMCUzRCUyMEh1Z2dpbmdGYWNlSW5mZXJlbmNlQVBJKG1vZGVsX25hbWUlM0QlMjJRd2VuJTJGUXdlbjIuNS1Db2Rlci0zMkItSW5zdHJ1Y3QlMjIpJTBBJTBBJTIzJTIwaW5pdGlhbGl6ZSUyMGFnZW50JTBBYWdlbnQlMjAlM0QlMjBBZ2VudFdvcmtmbG93LmZyb21fdG9vbHNfb3JfZnVuY3Rpb25zKCUwQSUyMCUyMCUyMCUyMCU1QkZ1bmN0aW9uVG9vbC5mcm9tX2RlZmF1bHRzKG11bHRpcGx5KSU1RCUyQyUwQSUyMCUyMCUyMCUyMGxsbSUzRGxsbSUwQSk=",highlighted:`<span class="hljs-keyword">from</span> llama_index.llms.huggingface_api <span class="hljs-keyword">import</span> HuggingFaceInferenceAPI
<span class="hljs-keyword">from</span> llama_index.core.agent.workflow <span class="hljs-keyword">import</span> AgentWorkflow
<span class="hljs-keyword">from</span> llama_index.core.tools <span class="hljs-keyword">import</span> FunctionTool

<span class="hljs-comment"># define sample Tool -- type annotations, function names, and docstrings, are all included in parsed schemas!</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">multiply</span>(<span class="hljs-params">a: <span class="hljs-built_in">int</span>, b: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-built_in">int</span>:
    <span class="hljs-string">&quot;&quot;&quot;Multiplies two integers and returns the resulting integer&quot;&quot;&quot;</span>
    <span class="hljs-keyword">return</span> a * b

<span class="hljs-comment"># initialize llm</span>
llm = HuggingFaceInferenceAPI(model_name=<span class="hljs-string">&quot;Qwen/Qwen2.5-Coder-32B-Instruct&quot;</span>)

<span class="hljs-comment"># initialize agent</span>
agent = AgentWorkflow.from_tools_or_functions(
    [FunctionTool.from_defaults(multiply)],
    llm=llm
)`,wrap:!1}}),R=new Qt({props:{code:"JTIzJTIwc3RhdGVsZXNzJTBBcmVzcG9uc2UlMjAlM0QlMjBhd2FpdCUyMGFnZW50LnJ1biglMjJXaGF0JTIwaXMlMjAyJTIwdGltZXMlMjAyJTNGJTIyKSUwQSUwQSUyMyUyMHJlbWVtYmVyaW5nJTIwc3RhdGUlMEFmcm9tJTIwbGxhbWFfaW5kZXguY29yZS53b3JrZmxvdyUyMGltcG9ydCUyMENvbnRleHQlMEElMEFjdHglMjAlM0QlMjBDb250ZXh0KGFnZW50KSUwQSUwQXJlc3BvbnNlJTIwJTNEJTIwYXdhaXQlMjBhZ2VudC5ydW4oJTIyTXklMjBuYW1lJTIwaXMlMjBCb2IuJTIyJTJDJTIwY3R4JTNEY3R4KSUwQXJlc3BvbnNlJTIwJTNEJTIwYXdhaXQlMjBhZ2VudC5ydW4oJTIyV2hhdCUyMHdhcyUyMG15JTIwbmFtZSUyMGFnYWluJTNGJTIyJTJDJTIwY3R4JTNEY3R4KQ==",highlighted:`<span class="hljs-comment"># stateless</span>
response = <span class="hljs-keyword">await</span> agent.run(<span class="hljs-string">&quot;What is 2 times 2?&quot;</span>)

<span class="hljs-comment"># remembering state</span>
<span class="hljs-keyword">from</span> llama_index.core.workflow <span class="hljs-keyword">import</span> Context

ctx = Context(agent)

response = <span class="hljs-keyword">await</span> agent.run(<span class="hljs-string">&quot;My name is Bob.&quot;</span>, ctx=ctx)
response = <span class="hljs-keyword">await</span> agent.run(<span class="hljs-string">&quot;What was my name again?&quot;</span>, ctx=ctx)`,wrap:!1}}),H=new _t({props:{title:"Creating RAG Agents with QueryEngineTools",local:"creating-rag-agents-with-queryenginetools",headingTag:"h2"}}),q=new Qt({props:{code:"ZnJvbSUyMGxsYW1hX2luZGV4LmNvcmUudG9vbHMlMjBpbXBvcnQlMjBRdWVyeUVuZ2luZVRvb2wlMEElMEFxdWVyeV9lbmdpbmUlMjAlM0QlMjBpbmRleC5hc19xdWVyeV9lbmdpbmUobGxtJTNEbGxtJTJDJTIwc2ltaWxhcml0eV90b3BfayUzRDMpJTIwJTIzJTIwYXMlMjBzaG93biUyMGluJTIwdGhlJTIwQ29tcG9uZW50cyUyMGluJTIwTGxhbWFJbmRleCUyMHNlY3Rpb24lMEElMEFxdWVyeV9lbmdpbmVfdG9vbCUyMCUzRCUyMFF1ZXJ5RW5naW5lVG9vbC5mcm9tX2RlZmF1bHRzKCUwQSUyMCUyMCUyMCUyMHF1ZXJ5X2VuZ2luZSUzRHF1ZXJ5X2VuZ2luZSUyQyUwQSUyMCUyMCUyMCUyMG5hbWUlM0QlMjJuYW1lJTIyJTJDJTBBJTIwJTIwJTIwJTIwZGVzY3JpcHRpb24lM0QlMjJhJTIwc3BlY2lmaWMlMjBkZXNjcmlwdGlvbiUyMiUyQyUwQSUyMCUyMCUyMCUyMHJldHVybl9kaXJlY3QlM0RGYWxzZSUyQyUwQSklMEFxdWVyeV9lbmdpbmVfYWdlbnQlMjAlM0QlMjBBZ2VudFdvcmtmbG93LmZyb21fdG9vbHNfb3JfZnVuY3Rpb25zKCUwQSUyMCUyMCUyMCUyMCU1QnF1ZXJ5X2VuZ2luZV90b29sJTVEJTJDJTBBJTIwJTIwJTIwJTIwbGxtJTNEbGxtJTJDJTBBJTIwJTIwJTIwJTIwc3lzdGVtX3Byb21wdCUzRCUyMllvdSUyMGFyZSUyMGElMjBoZWxwZnVsJTIwYXNzaXN0YW50JTIwdGhhdCUyMGhhcyUyMGFjY2VzcyUyMHRvJTIwYSUyMGRhdGFiYXNlJTIwY29udGFpbmluZyUyMHBlcnNvbmElMjBkZXNjcmlwdGlvbnMuJTIwJTIyJTBBKQ==",highlighted:`<span class="hljs-keyword">from</span> llama_index.core.tools <span class="hljs-keyword">import</span> QueryEngineTool

query_engine = index.as_query_engine(llm=llm, similarity_top_k=<span class="hljs-number">3</span>) <span class="hljs-comment"># as shown in the Components in LlamaIndex section</span>

query_engine_tool = QueryEngineTool.from_defaults(
    query_engine=query_engine,
    name=<span class="hljs-string">&quot;name&quot;</span>,
    description=<span class="hljs-string">&quot;a specific description&quot;</span>,
    return_direct=<span class="hljs-literal">False</span>,
)
query_engine_agent = AgentWorkflow.from_tools_or_functions(
    [query_engine_tool],
    llm=llm,
    system_prompt=<span class="hljs-string">&quot;You are a helpful assistant that has access to a database containing persona descriptions. &quot;</span>
)`,wrap:!1}}),N=new _t({props:{title:"Creating Multi-agent systems",local:"creating-multi-agent-systems",headingTag:"h2"}}),D=new Qt({props:{code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TJDJTIwcXVlcnlfYWdlbnQlNUQlMkMlMjByb290X2FnZW50JTNEJTIyY2FsY3VsYXRvciUyMiUwQSklMEElMEElMjMlMjBSdW4lMjB0aGUlMjBzeXN0ZW0lMEFyZXNwb25zZSUyMCUzRCUyMGF3YWl0JTIwYWdlbnQucnVuKHVzZXJfbXNnJTNEJTIyQ2FuJTIweW91JTIwYWRkJTIwNSUyMGFuZCUyMDMlM0YlMjIp",highlighted:`<span class="hljs-keyword">from</span> llama_index.core.agent.workflow <span class="hljs-keyword">import</span> (
    AgentWorkflow,
    FunctionAgent,
    ReActAgent,
)

<span class="hljs-comment"># Define some tools</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">add</span>(<span class="hljs-params">a: <span class="hljs-built_in">int</span>, b: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-built_in">int</span>:
    <span class="hljs-string">&quot;&quot;&quot;Add two numbers.&quot;&quot;&quot;</span>
    <span class="hljs-keyword">return</span> a + b


<span class="hljs-keyword">def</span> <span class="hljs-title function_">subtract</span>(<span class="hljs-params">a: <span class="hljs-built_in">int</span>, b: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-built_in">int</span>:
    <span class="hljs-string">&quot;&quot;&quot;Subtract two numbers.&quot;&quot;&quot;</span>
    <span class="hljs-keyword">return</span> a - b


<span class="hljs-comment"># Create agent configs</span>
<span class="hljs-comment"># <span class="hljs-doctag">NOTE:</span> we can use FunctionAgent or ReActAgent here.</span>
<span class="hljs-comment"># FunctionAgent works for LLMs with a function calling API.</span>
<span class="hljs-comment"># ReActAgent works for any LLM.</span>
calculator_agent = ReActAgent(
    name=<span class="hljs-string">&quot;calculator&quot;</span>,
    description=<span class="hljs-string">&quot;Performs basic arithmetic operations&quot;</span>,
    system_prompt=<span class="hljs-string">&quot;You are a calculator assistant. Use your tools for any math operation.&quot;</span>,
    tools=[add, subtract],
    llm=llm,
)

query_agent = ReActAgent(
    name=<span class="hljs-string">&quot;info_lookup&quot;</span>,
    description=<span class="hljs-string">&quot;Looks up information about XYZ&quot;</span>,
    system_prompt=<span class="hljs-string">&quot;Use your tool to query a RAG system to answer information about XYZ&quot;</span>,
    tools=[query_engine_tool],
    llm=llm
)

<span class="hljs-comment"># Create and run the workflow</span>
agent = AgentWorkflow(
    agents=[calculator_agent, query_agent], root_agent=<span class="hljs-string">&quot;calculator&quot;</span>
)

<span class="hljs-comment"># Run the system</span>
response = <span class="hljs-keyword">await</span> agent.run(user_msg=<span class="hljs-string">&quot;Can you add 5 and 3?&quot;</span>)`,wrap:!1}}),B=new kt({props:{$$slots:{default:[we]},$$scope:{ctx:j}}}),O=new ce({props:{source:"https://github.com/huggingface/agents-course/blob/main/units/en/unit2/llama-index/agents.mdx"}}),{c(){u=r("meta"),o=s(),M=r("p"),c=s(),d(i.$$.fragment),f=s(),w=r("p"),w.textContent=y,U=s(),x=r("p"),x.textContent=At,st=s(),G=r("blockquote"),G.innerHTML=Rt,at=s(),v=r("p"),v.innerHTML=Yt,ot=s(),Z=r("p"),Z.innerHTML=St,it=s(),W=r("ol"),W.innerHTML=Ht,rt=s(),d(I.$$.fragment),pt=s(),d($.$$.fragment),ut=s(),d(C.$$.fragment),mt=s(),Q=r("p"),Q.innerHTML=Xt,ct=s(),_=r("p"),_.textContent=Et,yt=s(),k=r("p"),k.textContent=Ft,Mt=s(),d(V.$$.fragment),wt=s(),A=r("p"),A.innerHTML=qt,dt=s(),d(R.$$.fragment),ht=s(),Y=r("p"),Y.innerHTML=Nt,Jt=s(),S=r("p"),S.textContent=Lt,Tt=s(),d(H.$$.fragment),gt=s(),X=r("p"),X.innerHTML=zt,bt=s(),E=r("p"),E.innerHTML=Pt,ft=s(),F=r("p"),F.innerHTML=Dt,Ut=s(),d(q.$$.fragment),jt=s(),d(N.$$.fragment),It=s(),L=r("p"),L.innerHTML=Kt,Ct=s(),z=r("p"),z.textContent=Ot,Bt=s(),P=r("p"),P.innerHTML=te,xt=s(),d(D.$$.fragment),Gt=s(),d(B.$$.fragment),vt=s(),K=r("p"),K.innerHTML=ee,Zt=s(),d(O.$$.fragment),Wt=s(),lt=r("p"),this.h()},l(t){const e=ue("svelte-u9bgzb",document.head);u=p(e,"META",{name:!0,content:!0}),e.forEach(n),o=a(t),M=p(t,"P",{}),ae(M).forEach(n),c=a(t),h(i.$$.fragment,t),f=a(t),w=p(t,"P",{"data-svelte-h":!0}),m(w)!=="svelte-k20nvn"&&(w.textContent=y),U=a(t),x=p(t,"P",{"data-svelte-h":!0}),m(x)!=="svelte-1hjwxub"&&(x.textContent=At),st=a(t),G=p(t,"BLOCKQUOTE",{"data-svelte-h":!0}),m(G)!=="svelte-15o6tbi"&&(G.innerHTML=Rt),at=a(t),v=p(t,"P",{"data-svelte-h":!0}),m(v)!=="svelte-1i02awx"&&(v.innerHTML=Yt),ot=a(t),Z=p(t,"P",{"data-svelte-h":!0}),m(Z)!=="svelte-14dee9q"&&(Z.innerHTML=St),it=a(t),W=p(t,"OL",{"data-svelte-h":!0}),m(W)!=="svelte-1bz4j87"&&(W.innerHTML=Ht),rt=a(t),h(I.$$.fragment,t),pt=a(t),h($.$$.fragment,t),ut=a(t),h(C.$$.fragment,t),mt=a(t),Q=p(t,"P",{"data-svelte-h":!0}),m(Q)!=="svelte-1k9r5ws"&&(Q.innerHTML=Xt),ct=a(t),_=p(t,"P",{"data-svelte-h":!0}),m(_)!=="svelte-gafhou"&&(_.textContent=Et),yt=a(t),k=p(t,"P",{"data-svelte-h":!0}),m(k)!=="svelte-dm7947"&&(k.textContent=Ft),Mt=a(t),h(V.$$.fragment,t),wt=a(t),A=p(t,"P",{"data-svelte-h":!0}),m(A)!=="svelte-1j4mjjh"&&(A.innerHTML=qt),dt=a(t),h(R.$$.fragment,t),ht=a(t),Y=p(t,"P",{"data-svelte-h":!0}),m(Y)!=="svelte-18kp6fu"&&(Y.innerHTML=Nt),Jt=a(t),S=p(t,"P",{"data-svelte-h":!0}),m(S)!=="svelte-epz1ho"&&(S.textContent=Lt),Tt=a(t),h(H.$$.fragment,t),gt=a(t),X=p(t,"P",{"data-svelte-h":!0}),m(X)!=="svelte-cdj536"&&(X.innerHTML=zt),bt=a(t),E=p(t,"P",{"data-svelte-h":!0}),m(E)!=="svelte-1srircl"&&(E.innerHTML=Pt),ft=a(t),F=p(t,"P",{"data-svelte-h":!0}),m(F)!=="svelte-sogywd"&&(F.innerHTML=Dt),Ut=a(t),h(q.$$.fragment,t),jt=a(t),h(N.$$.fragment,t),It=a(t),L=p(t,"P",{"data-svelte-h":!0}),m(L)!=="svelte-pnrrlw"&&(L.innerHTML=Kt),Ct=a(t),z=p(t,"P",{"data-svelte-h":!0}),m(z)!=="svelte-1lnlpu9"&&(z.textContent=Ot),Bt=a(t),P=p(t,"P",{"data-svelte-h":!0}),m(P)!=="svelte-19na4nh"&&(P.innerHTML=te),xt=a(t),h(D.$$.fragment,t),Gt=a(t),h(B.$$.fragment,t),vt=a(t),K=p(t,"P",{"data-svelte-h":!0}),m(K)!=="svelte-1synfbm"&&(K.innerHTML=ee),Zt=a(t),h(O.$$.fragment,t),Wt=a(t),lt=p(t,"P",{}),ae(lt).forEach(n),this.h()},h(){tt(u,"name","hf:doc:metadata"),tt(u,"content",he)},m(t,e){me(document.head,u),l(t,o,e),l(t,M,e),l(t,c,e),J(i,t,e),l(t,f,e),l(t,w,e),l(t,U,e),l(t,x,e),l(t,st,e),l(t,G,e),l(t,at,e),l(t,v,e),l(t,ot,e),l(t,Z,e),l(t,it,e),l(t,W,e),l(t,rt,e),J(I,t,e),l(t,pt,e),J($,t,e),l(t,ut,e),J(C,t,e),l(t,mt,e),l(t,Q,e),l(t,ct,e),l(t,_,e),l(t,yt,e),l(t,k,e),l(t,Mt,e),J(V,t,e),l(t,wt,e),l(t,A,e),l(t,dt,e),J(R,t,e),l(t,ht,e),l(t,Y,e),l(t,Jt,e),l(t,S,e),l(t,Tt,e),J(H,t,e),l(t,gt,e),l(t,X,e),l(t,bt,e),l(t,E,e),l(t,ft,e),l(t,F,e),l(t,Ut,e),J(q,t,e),l(t,jt,e),J(N,t,e),l(t,It,e),l(t,L,e),l(t,Ct,e),l(t,z,e),l(t,Bt,e),l(t,P,e),l(t,xt,e),J(D,t,e),l(t,Gt,e),J(B,t,e),l(t,vt,e),l(t,K,e),l(t,Zt,e),J(O,t,e),l(t,Wt,e),l(t,lt,e),$t=!0},p(t,[e]){const ne={};e&2&&(ne.$$scope={dirty:e,ctx:t}),I.$set(ne);const le={};e&2&&(le.$$scope={dirty:e,ctx:t}),C.$set(le);const se={};e&2&&(se.$$scope={dirty:e,ctx:t}),B.$set(se)},i(t){$t||(T(i.$$.fragment,t),T(I.$$.fragment,t),T($.$$.fragment,t),T(C.$$.fragment,t),T(V.$$.fragment,t),T(R.$$.fragment,t),T(H.$$.fragment,t),T(q.$$.fragment,t),T(N.$$.fragment,t),T(D.$$.fragment,t),T(B.$$.fragment,t),T(O.$$.fragment,t),$t=!0)},o(t){g(i.$$.fragment,t),g(I.$$.fragment,t),g($.$$.fragment,t),g(C.$$.fragment,t),g(V.$$.fragment,t),g(R.$$.fragment,t),g(H.$$.fragment,t),g(q.$$.fragment,t),g(N.$$.fragment,t),g(D.$$.fragment,t),g(B.$$.fragment,t),g(O.$$.fragment,t),$t=!1},d(t){t&&(n(o),n(M),n(c),n(f),n(w),n(U),n(x),n(st),n(G),n(at),n(v),n(ot),n(Z),n(it),n(W),n(rt),n(pt),n(ut),n(mt),n(Q),n(ct),n(_),n(yt),n(k),n(Mt),n(wt),n(A),n(dt),n(ht),n(Y),n(Jt),n(S),n(Tt),n(gt),n(X),n(bt),n(E),n(ft),n(F),n(Ut),n(jt),n(It),n(L),n(Ct),n(z),n(Bt),n(P),n(xt),n(Gt),n(vt),n(K),n(Zt),n(Wt),n(lt)),n(u),b(i,t),b(I,t),b($,t),b(C,t),b(V,t),b(R,t),b(H,t),b(q,t),b(N,t),b(D,t),b(B,t),b(O,t)}}}const he='{"title":"Using Agents in LlamaIndex","local":"using-agents-in-llamaindex","sections":[{"title":"Initialising Agents","local":"initialising-agents","sections":[],"depth":2},{"title":"Creating RAG Agents with QueryEngineTools","local":"creating-rag-agents-with-queryenginetools","sections":[],"depth":2},{"title":"Creating Multi-agent systems","local":"creating-multi-agent-systems","sections":[],"depth":2}],"depth":1}';function Je(j){return ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ie extends re{constructor(u){super(),pe(this,u,Je,de,oe,{})}}export{Ie as component};
