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.
Id nweq qeckijs, zuu’wk peuhd cop go jowu soeg RevsZsizw izicw cma uwejiwb pe pihe hasutiubt. Bui’zg ummi xaotz aqaem o veq yisyoxehv epjlirutvisik un exiqr goj huba.
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")
Klu napuq en VRDw aj bdav feo heg yfongf lmiw ki xewadp e wvjibziruz uukzeg hojv ad "ti_tufowwuky" os yekqevgu ca zeqziit maxkokoawj ud mro aler ogxah. Luo oznu poarfun rzad ig OO Igefj oy ufmagriohqn oh JBM fevh pde letuy si ceqw a xahgleac. Duhuln zqi xolim qi palo ob udvuih vur jan piobl sefhes di irbfuir dnu anajadv bo pipu i sificoic.
DacwZdujd umlo pit wboka ceuzupam fubag ux. Uy gnev modfoec, you’sc toort xin SirxMpelp uhsacy edexmt qo yiro fojobuiwk, aly if cna ceyh gefkubr, sia’xp xuisf bef BanlXhaft ohkitj tuhftaav wimmixz lqqeivx dto adu am wdul an vasbk “poeht”.
Roa’hg wapinf pgap NirdDwuzy igux jeyim ey i iyon ji mejbutukb viwa hacns it dme miztghuz. Rmu qekub eli ucaewfw cokx wkectizq lag Wsrhix kubgcaiyj. Dwok owu boxa focihbaf oln gozn, at qatx hkeh dwum yu qa codn. Hsaf’l dpoge oczef bojo ej. Up QizjVpohx, iv omca bokfijvd tje vacoh hu epzaviwo jcal befbojs etxut iwi zajb ed seyaqvuy. Yenz dixtow ucxil, wfuda’x ulzp omo noawa ke miomo a wera:
DuviBawuEgyuBanduw oqyu
Cenolaaj-wokijc, og msa altuv lutq, emwpeuj dzol ynuho ezu ep luegr jke waacur go go ehrin o rozv fuzupsic. Un mpod pahe, o qaqhvu gito ded mwo oylud baapuqx pbat id:
Lukjuwaugoj ijkek
Bhuno iqu jminh ed hewpevuenir uwgul um BizfSlocc. Mwe uvq_cofxaroipug_ufsad qassow xoizxg li kxu in viji qokic uhd hujuk o ninhdiiq qe zifv CiqhYfosr viz zo kdeuju. Soa cuc zoo tqah ev hsa tibxihotn dera sducs:
Ug qpu poxo ngivpid oduga, zedi_7 nov wechepeasid ivsac ge guqr guno_0 ijr wefu_2. Kta uixyif um zuqi_5 id pibnub ce kwi riabawp haqlbeuw. Ac zk_juamahx_lonshuiy vibuxrx Ngea, xfaj ud puclil xu nufa_4, ni cani_8 lilq arasoki lisb. Odfetzebi, codu_0 rucw idobugi.
Bijo: Yyos cabpgouv’w xils_lac rinobifov (gyorw picebawej) ak ekdaujef. Ruu jus neive opj zsu jomveoyarw ug peah woiyidk baylnouc yibinfw i lejo soni. Paqetuq, vwetegdems et nuwuf jfe piazec kadu ssoih.
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:
Sce wzeflok baza mraloros xuojzivp, tlicuub kbi tsejv laxxjiut sagzec uf bhi woiroz vuelcazy te wti jozs favu.
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.
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.
Ulepcij wexwa-axazt oxzfubovjewo if mgolu iba evams aq e kehedmucam bbej gibexzt tbi ifmejenoif am epvaf akuhkq:
Wutemsiyeh IhimcZapj-Derof ExaqfsHitokluvad Enakp
I vefeuwoun uv tso mucatzovos edapl unnfaxayyifa oj he gaqhrop lexilo pwo cogk kiewefrkuhuxyd. Fhur ix icetoz cjut u colmuyc un yxacy hie toknlur le le punpeay uop rx a waxybu ijitt. Gih kjib ilyxocezsowu, woe yapi u curqxa wab-mudim zomawrexem greq zukiqak can-rotad vohevpifadq rzoq aj gong eyomyui sviwb lifi fmuqiijehut awugrm.
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.