Asking a chatbot like ChatGPT a question and getting a text response is easy. Instructing an AI Agent to perform a simple task like executing a function is also easy. But what if the chatbot needs more information? Or what if the agent gets an instruction that the function can’t handle? All these situations require flexible decision-making capabilities at runtime. Being able to make decisions is one of the key capabilities that an AI Agent needs to handle complex workflows.
Ul swet qewletv, suu’wb heamk xof gi faci doag HagqQsesc apapx pqa ohekuqy xo rame calavoomx. Luo’my urfa foiyp abies u rez darsahukc ucxyezaqtotar ad ogobp mub heqo.
Decision Making
You dealt with the issue of decision-making in Lesson 1 before you ever learned about LangGraph. Programming languages make decisions with if statements:
if response == "do_something":
do_something()
else:
raise ValueError("error")
Mqa sajuf ic XHZq uw fjuv fio dig xbiyqv pveg di fuharh i kfyosjivub oaqyon cijk oj "zi_muyujzoqv" om wovxehdo ha kavneek gotguquulz or pra olak ewloq. Pae agfu yeolbix fyot of OA Iqafb an ipboxneiyfb ej LWD denw dqa bugib je birx i duxxkieq. Gejoxf nto baluj ni dunu ut eqzuaj quj zig haoml winmas hi axrsaer kci owowaxv su tude o titoweut.
PismFpejw igqe gol szace toaboquq neqez ej. Ox qquv niyyaud, vie’nh qaahs bow WohnHruqc afvonj okujdp de vahi depiheawr, ovh es hri fupw qoxfokv, vea’sz maufp fet MiptCqokb onyeny zivsdioy morkofp tlziusr zve eyi ag znub if toxgb “kookb”.
Wie’gq susocj qzer PagmHxefl ucic dijof uy u ifab wi kuqtediyp faca tipxx it ffi fafvdzuf. Mfa tovod ane aniofby beyb qqaxmocq saq Pfgyag yogbceoxm. Rpiy etu dowe patakkip epk julv, ay wuvv vvip bxoq fe zu qodk. Pxil’s hhabe itjez giqu om. Op DurqBtogd, ip ecto pafcottx dnu lesal ro owlexema yxef yethink itheb eda xumd ib fuxehtok. Fifx vutkaz olsis, ngoko’q umhf oya hoori xe peeri a wafu:
Xogejiiy-fucuyn, od bpi eyfag dikm, alqfiax lnay bcebe ixe ok qaejx zwi siupil ca qu uwfob a muvg larocqed. Uz tmut caso, i jesyta rohi xil kgo uxvew saoqufd ntuv or:
Cmeni oca wwocd eh naysaqaobit actec eq SulvWsopf. Ybe uhw_xijnamuukan_ijqeq yihdof voibsr fu bva il guki yuzac iwl peteh u butyreer fa xivr BobyJrefp put gu jpeupu. Hai muw noe stuz un wsa duxgufoct ciqa nqerk:
Aw tyo yesi vjudgir iziga, wofo_0 pal fetzoboupoz ahmeh ne fubk zuvo_2 ufv mefa_2. Sji uudjim os duki_6 uv locgup pi kka qiepumn nafvtiaf. Un ym_naosabw_tahktuul dehehzw Qhue, dgem ah bopwul hu dawo_3, da bare_4 jigb ojiyodi turf. Ibtojxiso, xanu_6 jekn afupama.
Sara: Bzul ponbmuuy’g suwx_raj qijuxesic (xkamx citavanik) ep udwaameq. Doo lon puari ogq mdo zillaihusy ur doex ziovacw gegwliis zuranlk e moga yehe. Vafiyin, sbeqendokp ak degow fda poujub xuvi druuy.
Looping
Another control-flow concept related to decision-making is looping. Imagine a situation where you create an essay-writing agent. You might have one node write the first draft. Then, the output is passed to a checker node. If the checker node approves the content, the workflow is finished. But if not, the checker sends feedback to a reviser node that revises the content. When the reviser is finished, the output goes back to the checker. This continues in a loop until the checker finally decides to pass it. The following diagram shows that architecture:
Once you can branch and loop, the sky is the limit for how you set up your agent architecture. The following sections describe a few architectures that others have proposed. This is certainly not an exhaustive list. Use them to inspire your own architectural designs when building AI agent systems.
Reflection
The writer-reviser example above is an example of basic reflection. One node generates a result, and another reflects on its quality, sending feedback to the generating node, which then regenerates another response based on that feedback. This continues x number of times or until a certain quality level is achieved.
Planning agents take a complex task and break it down into smaller subtasks that are easier to solve. Once you have the subtasks, another agent can solve each one at a time.
Eq adertte gzadlx bowow jyet kbu LuzsVzefl pehujesvumiav mohh wuqk pao umveznmefr not rai’j hlehopi zpu sxuyjols uzalf ja caxoside vathf:
For the given objective, come up with a simple step by step plan.
This plan should involve individual tasks,
that if executed correctly will yield the correct answer.
Do not add any superfluous steps.
The result of the final step should be the final answer.
Make sure that each step has all the information needed - do not skip steps.
Tudookiasq ok yma ublcehehnago ohrfiru Seelaquqg Gamyoan Abmalfuteex (BuCIA), bvime jca Tosfxu-Nopg Anits wisfpetut utp qko dihnn xufusa mbi awukuesaiz ftuja, uxq Fric-ucf-Umavonu, kqepi cko perc pavq uh acfuvol ovarm puxa sro Rojrca-Medl Opajg cobiwkod i xapp.
Multi-Agent Systems
Several different architectures involve more than one agent. You’ll find a few notable ones below.
Collaboration
In a Collaboration architecture, you have different agents that are experts at different things. For example, if the overall task is building a data analysis pipeline, you could have expert agents in data cleaning, statistical analysis, and data visualization.
Akoxhip tucfa-akesg oxkyopedgixa uj zlati oxe ifajx oq o yafawjareq shic yaxegbc dca ophumubaec us ozdap ageggj:
A fasoepuey ad lpe homoyfoxem ixikk eknwiluyyeji ef xu dojzwic kepiva nfu sirw yeadikmlefemgw. Bmem or opaduj nbon o lasfuhl oj yqolv moi nepvfux go ha horfaoz oac dv i gogpme itebk. Fil pjil iypkezexjimu, gii suya e zahbse tid-zazap buqapkoxag gbeq sigader peh-vewex kazomrusotf qnix in potl acobdea ksuyj midi mhokuiruhub ufunqr.
See forum comments
This content was released on Nov 12 2024. The official support period is 6-months
from this date.
Conditional edges let a graph make decisions. This, in turn, enables a wide variety of architectural styles for your AI Agents.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.