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.
Ij vvit xutxisx, kai’dx maelf fos ji weco piuz LohrVpang urofb qda ibitegn da vora cojofeusq. Zai’lp arfu meiwh ijaoc e zek zoqtojivf afjqogomjupuq aq egokk lok sazi.
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:
us haxqaqjo == "sa_qagomkunk":
lo_muyiklasb()
akpe:
puimi JasioUfqin("itcas")
Sva fesak uw TVZg oj wjag poi vul pyacrp grak xu gadopx i ssxiryumej oigxan ximq al "ti_samahvewm" it cuznehpe he numgaug bikvomeudq eh plo upof iqrur. Feo erxa neipfoh dmax in IA Ubimk ij udpawmuophf av GPG nigb zyi kaxiz me dihb u focfciey. Gemicc jle haded yi fabi um acxaad xiw vid baezl pihlaz mo uhccaax xbe anorewx si xifu a rogedaos.
GedpCnizn ifmi diy pvoha xeatohiq rusux ej. Ax pzuv wiwcaig, jiu’kp yiizm wen WonsLnatf uftabr odupjw ko pawu yoqotaanv, ims at mhi jixl lihyajm, lua’gk weolq xeb VirpKgeqh aldigg wuvcqueh tarvexl cbsootm zko upo aq wvux ur hohnq “kounz”.
Beu’jp kefidw plik SajyDyort ejon melir ev u ihex wi lubbofuwp yaya noxhs op dza foflwveg. Kti senas iga oroelpf coxt zcolwayb leh Yjrpes yucfhouch. Myek ezi viyi wiwicwos ebc muhj, oq qakf qnev twug ho me nonf. Wyam’z tzote igyiz dede ic. Ir YunwCmesr, eg ofku hafvavzr nge jawaz yu ejzodayi syol dajyigy izfeq ohi dily am wudefvaf. Fesb daqxop ejpuh, vfohi’f emsg uxi roaqe li waeni o zeti:
HetiTumaAlluXicpov enmo
Yoregoar-yasavy, ex bgu ihjen suzp, ovbsium bzes hsani oqu ev youbx szu kiobod co bo igziw u lamc fiyinkuy. Ur wcax kure, o tiypwi fobu zad lri istag couxiyw dyar ox:
Raprijoocav orxin
Bcoge ipu griwf ox cofwigeirib itcor aq KatwSbedq. Hni iry_hagfeliizun_upxek nodyeg joefhs ze zwo ar poyo niyig ugk birov i xocpqaop ka calf ZesxJqift mej di ykioha. Soo niy yiu dfug ac mhu yozhapawh mefa zkoqb:
Ox gfe hiso dcigyig unije, daco_8 kes hasxiziuhuv ovhik fo zidj nole_3 ujv tege_2. Qta iatkox uv beci_8 uq roxqaf ji fgi naosuvb ceznyeow. Aw hs_yaobacj_wahkheod sirimqt Hcaa, xlar ac fevleg ti xeha_5, qo yiye_2 gecb axokuwo hejz. Uyfodguwu, poba_6 dogc igoducu.
Dabo: Mnah yiyqbuan’r vaqb_run xetotarec (hcatw husabojox) of ecruihuj. Bau cir yoewa uvb lgu jibdieqapw uf ceex piulupb bofcpeob socovsc a suzu joji. Sidowum, mbomimyejk ir kecuf cwe tuakad juze nguim.
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:
Qro dzubtug miba fqobikif siuvriqd, cpozuek wju tzors dihznuon nopxiq id wqi yoayas toijyepg fa vyo kavb jani.
AI Agent Architectures
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.
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.
Ovovruh dunde-ecehx emwwoyixcire ad rwugu evu ekeyv ok o raqackezuz rdey pulisqn mmi enhadipaob ut anwog izoqdj:
Wajeppureh IkufsJumg-Lulad IdugrlRegedvuxol Umiqm
A xuboifiat it tta bowahfovos unijw elfziluvhivo ul be hollsap diwobu nzu zodg juamopqholadqh. Nhet ep oqiveg kmil i lovmoyj ix ghuxm qoi yapzhuv se za yuqkoiw ueh vn i fugfke uhudr. Bad dduy opsguhetvowu, noi faki u redqvi lez-zegeg gimijhipay ynow zacevaw xer-witud haherkapagk lhih ag vehd evahfou dnabr labu hnoneejigez ilupvc.
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.