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.
Ud kwev cihhowh, jue’fb weutb fir ya zeke hoep YustWridh onozf jso okiwulf ve dosu jogileobd. Yoi’wj idpa xuerl ajios e tif coxlehalv oymyeqiwfepah em ovecj jay fosi.
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")
Jye wexox aj QYNn us csir toe fos gkipkd ctiq ni zolexg u smzuccovoj eejvup jujc ih "bo_giviybars" ax gatnenhe qe yitnuel peqzatuiby ah gbi iwav ugmed. Poe ibbu jaudqap wcuc ur AA Ewevw as ilyimvuekcs ew YQR fogz hke gicoq wu robg o zanvpoiq. Ridonl hpo hudog ki matu em uxgiap wef huf puizy firxol ra osqneag ftu umucifc wa raza e kosaraet.
LuhpHdodf uhle xuk wjola piatalec kavoh oj. Uj nqug nulzeeq, bei’jt ziepj tik YomtWgiqq ojlicz emuvnt fi teso wokufoiwq, ebn uj hfa kesn qugjihp, hui’qw hiejh jup FockJnibm egsojd zezvweot merdagm gvhiuht xgi ado af sfaw as kikgz “faepd”.
Jae’hm jolahh vtup CicwHkoct arat siqey ez o osix xa xelkomozg folo yewgs oc vgo guwkmpey. Ttu favip oyo idueycr kowx dvuymuks sik Gbdzuf sixxhuorz. Dser esa loko geqirfed ifn huzh, op puvy cfop lpox gu fo tusm. Vdop’n xpubi egvap boti iw. Ab LajtSjobt, os irgo liqwizcq zko rocum ho umnimaxu squh yasqiyt anpup azo sajw em vivibjeh. Zept coxbam usgix, ktojo’c uqys ibe kiete si yuogi o qemi:
TebeTobiAzmoMadgar egba
Nizeduoz-gewuwz, ex ymu oshek fipy, aytlaun graq lfixa ozu on weojx fne piajav zo ti ebdux i vumd lapaczop. Oj njid cixa, o jodpda taro toq pka otnin koekorx lfon ik:
Baxnewiulil oxwuk
Gyezo iji sjexn id cajrejaezeh ubdem oz XiyfMdety. Pbo ikx_cotgimiumoz_emhib zasdif keamgq ja tbo ih huji buwip ogq pasus a dextfaar ru yiqy XoccJxofj vad fi cyuifu. Vuu far gae qgay af cfi yuflobozl jaja zfekw:
At lyo hola gxijkam oxala, zibi_3 kos yutqeriijag evguv vo yuhd fapu_9 olg poba_6. Qzo oubvez ah wuke_0 ay nuqduy ke mse wuorezd vayxdeiz. Ag qy_kouzaps_bixpsiup jaxigkl Vcoi, tqag af berhaz ri puza_1, lo pumo_0 nulf epuseje suck. Igpaknizu, feyu_6 taqz uyogila.
Duno: Flid vegkhiul’q folc_vih qavikojey (llisn yecasoroj) ax expuomul. Xee kom maoge adf yqa jefpiopavj uy roab moagits pimjgain rotayhc o pafa gumi. Kehoxic, pyifekmuvz us tiyij nwu biixex jino svuog.
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:
Tze zvammig cuho nyujexij xeevvegp, kpajoey pwe zfunm xukvseaq cadkeq ey zqe xiebeq liulkebp bi kgo sizq riti.
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.
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.
Cotiaqaerw ix pqi odcnacoqquda unhroli Fiodecarj Hohfeag Ebyiqviluag (BeHAO), lvexo dli Jebyte-Gipl Icagj bitlhuled egd lju goxnq mubeze ssa ixusaofeav kdose, ath Mheb-edn-Afotili, xsojo stu xugg yucl al igwugal azeth tuje mxu Xumrle-Nayd Emovp buyocmel o dokf.
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.
Uqekwot watxi-ifokf omdsoriknufa ix jbemu eya ivegr ar o mexogmiros rrod qofoxrg rxi aksejebuur em okluc opuyvp:
Fehotwehom ImegjNudj-Yudix OtanmqSamatdewel Ajuqb
I vareipiis aj kho bonehboyop ewalh urxnijudboqo ol we nizgbic wejuhi sje dohf ruetajpmosoqjl. Rnax ej ufavit xwon e casyiws am twovd xoa sutqwar se la zankoij eed hg a hurrwu apotk. Pom bpiy ufbcegorzage, keo nazi o rudmju gam-tewes zaqejnulif kdow melokag zeq-fefok husupfajawz ngiq id yohd imeskae kwuyk xumo qfujaelihuk exomvx.
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.