[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-682227-105":3,"detail-sidebar-cat-0-en-105":81,"doc-detail-682227-en":131,"doc-similar-682227":206},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":74,"head_meta":76,"extra_data":78,"updated_unix":80},105,"en","the-comprehensive-guide-to-ai-agent-engineering-march-2026","The Comprehensive Guide to AI Agent Engineering - March 2026","","A comprehensive guide to building modern AI agents, organizing concepts from agent foundations through the agent loop, system prompts, and context management. It explains core mechanisms such as ReAct loops, loop variants, termination, and in-loop error handling, then deep-dives into context window limitations, context compaction, context rot, and practical defenses. The document further covers memory hierarchies, tool calling architectures (including MCP), sub-agent orchestration, planning and reasoning, human-in-the-loop models, state management, security, testing and evaluation, deployment operations, and a synthesized reference architecture.",{"@graph":14,"@context":73},[15,34,56],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/the-comprehensive-guide-to-ai-agent-engineering-march-2026/682227/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/the-comprehensive-guide-to-ai-agent-engineering-march-2026/682227.png","ImageObject",300,407,{"name":42,"@type":43},"Mabel","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-29","2026-11-06",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",14,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"What distinguishes an AI agent from a pipeline or workflow?","Question",{"text":63,"@type":64},"An agent lets the model decide what to do next based on context, rather than using a hardcoded sequence like a pipeline or fixed branching like a workflow. The model dynamically controls control flow and tool usage.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"What is the basic ReAct loop described in the guide?",{"text":68,"@type":64},"The basic ReAct loop is a kernel where the LLM produces responses and, when tool calls are present, executes those tool calls, appends results to messages, and continues until it returns final text.",{"name":70,"@type":61,"acceptedAnswer":71},"How does the guide address context degradation over time?",{"text":72,"@type":64},"It defines context rot, explains key mechanisms such as instruction fade-out and agent drift, and provides measurement approaches plus multiple defenses. It also compares context engineering with prompt engineering and discusses impacts in multi-agent systems.","https://schema.org",{"og:url":32,"og:type":75,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":77,"canonical":32},"index,follow",{"doc_id":79,"site_id":7},682227,1793963049,{"code":4,"msg":82,"data":83},"success",[84,88,92,96,101,105,110,115,120,123,127],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":85,"show_sort_weight":86,"slug":87},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":89,"show_sort_weight":90,"slug":91},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":93,"show_sort_weight":94,"slug":95},"Exam",70,"exam",{"id":97,"doc_module":4,"doc_module_name":25,"category_name":98,"show_sort_weight":99,"slug":100},5,"Comic",60,"comic",{"id":102,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":103,"slug":104},6,50,"technology",{"id":106,"doc_module":4,"doc_module_name":25,"category_name":107,"show_sort_weight":108,"slug":109},7,"Healthcare",40,"healthcare",{"id":111,"doc_module":4,"doc_module_name":25,"category_name":112,"show_sort_weight":113,"slug":114},8,"Research & Report",30,"research-report",{"id":116,"doc_module":4,"doc_module_name":25,"category_name":117,"show_sort_weight":118,"slug":119},9,"Religion & Spirituality",20,"religion-spirituality",{"id":118,"doc_module":4,"doc_module_name":25,"category_name":121,"show_sort_weight":118,"slug":122},"World Cup","world-cup",{"id":124,"doc_module":4,"doc_module_name":25,"category_name":125,"show_sort_weight":124,"slug":126},10,"Lifestyle","lifestyle",{"id":128,"doc_module":4,"doc_module_name":25,"category_name":129,"show_sort_weight":97,"slug":130},19,"General","general",{"code":4,"msg":82,"data":132},{"doc_id":79,"user_id":133,"nickname":42,"user_avatar":134,"doc_module":4,"category_id":102,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":135,"file_id":136,"file_url":137,"file_type":138,"file_size":139,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":140,"language":141,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":142,"faqs":143,"seo_title":144,"seo_description":12,"update_tm":80,"read_time":145,"preview_page_count":55,"preview_urls":146},7971474920318,"https://ap-avatar.wpscdn.com/avatar/74000ee537e6b0ca360?x-image-process=image/resize,m_fixed,w_180,h_180&k=1788430171632181674","The Comprehensive Guide to AI Agent Engineering ( March 2026)  \nHow Modern AI Agents Are Built: Loops, Prompts, Memory, Orchestration, Tools, and Everything In Between  \nDmitriy Vasilyev · March 2026  \n[github.com/vasilyevdm/ai-agent-handbook](github.com/vasilyevdm/ai-agent-handbook)  \nBased on analysis of 30+ open-source AI agent frameworks  \nTable of Contents  \n Part I: Foundations  \n 1. What Is an Agent  \n 2. Taxonomy of Agents  \n 3. The Agent Spectrum  \n Part II: The Agent Loop  \n 4. The Basic ReAct Loop  \n 5. Loop Variants  \n 6. Loop Termination  \n 7. Error Handling Inside the Loop  \n Part III: System Prompts  \n 8. Anatomy of a System Prompt  \n 9. Assembly Patterns  \n [10. The SOUL.md / AGENTS.md](10. The SOUL.md / AGENTS.md) Pattern  \n 11. Prompt Anti-Patterns  \n 12. Skill Catalogs and On-Demand Loading  \n Part IV: Context Management & Compaction  \n 13. The Context Window Problem  \n 14. Compaction Strategies  \n 15. Compaction Prompts: Real Examples  \n 16. When and How to Trigger Compaction  \n 17. What Survives Compaction  \n Part IV-B: Context Rot  \n 18. What Is Context Rot  \n 19. The Three Mechanisms  \n 20. Instruction Fade-Out and Agent Drift  \n 21. Measuring Context Rot  \n 22. The 12 Defenses Against Context Rot  \n 23. The 40-60% Rule  \n 24. Agent Cognitive Compressor (ACC)  \n 25. Context Engineering vs. Prompt Engineering  \n 26. Context Rot in Multi-Agent Systems  \n Part V: Memory Systems  \n 18. The Memory Hierarchy  \n 19. Working Memory (Context Window)  \n 20. Short-Term / Session Memory  \n 21. Long-Term Memory  \n 22. Episodic Memory  \n 23. Observational Memory  \n 24. User Modeling  \n 25. Memory Implementations Compared  \n Part VI: Tool Architecture  \n 26. Tool Calling Fundamentals  \n 27. MCP (Model Context Protocol)  \n 28. Code-as-Action  \n 29. Skills as Markdown  \n 30. JIT Tool Loading  \n 31. The Tool Sprawl Crisis  \n 32. Solving Tool Sprawl: 7 Patterns  \n 33. Tool Sandboxing  \n Part VII: Sub-Agent Orchestration  \n 32. Why Multi-Agent  \n 33. Orchestration Patterns  \n 34. State Passing Between Agents  \n 35. Agent-to-Agent Protocols  \n 36. Sizing and Topology  \n Part VIII: Planning & Reasoning  \n 37. Planning Strategies  \n 38. Reﬂection and Self-Correction  \n 39. Plan/Act Separation  \n Part IX: Human-in-the-Loop  \n 40. Permission Models  \n 41. Approval Workﬂows  \n 42. Escalation Patterns  \n Part X: State Management  \n 43. Conversation State  \n 44. Checkpointing  \n 45. Durable Execution  \n Part XI: Security  \n 46. Sandboxing Strategies  \n 47. Prompt Injection Defense  \n 48. Credential Management  \n Part XII: Testing & Evaluation  \n 49. Benchmarks  \n 50. Testing Strategies  \n 51. Evals in Production  \n Part XIII: Deployment & Operations  \n 52. Deployment Models  \n 53. Cost Optimization  \n 54. Observability  \n 55. Gateway Architecture  \n Part XIV: Synthesis  \n 56. The Reference Architecture  \n 57. The 25 Commandments  \n 58. Decision Framework  \nPart I: Foundations  \n\n| 1. What Is an Agent |\n| --- |\n| An agent is a system where an LLM dynamically decides the control ﬂow of an application. That 's it. Everything else —tools, memory, planning, multi-agent — is an enhancement ontop of this core idea.\u003Cbr>The simplest possible agent: |\n| while True :\u003Cbr>response = llm(messages)\u003Cbr>if response .has_tool_calls :\u003Cbr>results = execute( response .tool_calls) messages .append( results)\u003Cbr>else :\u003Cbr>return response .text |\n\nThis 7-line loop is the kernel that powers everything from mini-swe-agent (100 lines, 74% on SWE-bench) to OpenClaw (210k GitHub stars) . The sophistication is in what wraps this loop, not the loop itself.  \nAnthropic's deﬁnition: \"The model determines its own control ﬂow and tool usage based on context. \" The key distinction from a pipeline: in a pipeline, the developer hardcodes the sequence of LLM calls. In an agent, the model decides what to do next.  \nOpenAI's deﬁnition: \"An agent is a system that independently accomplishes tasks on behalf of a user, using tools and reasoning to handle ambiguity and make dec","cbCaitBdd0mAr0SR","https://ap.wps.com/l/cbCaitBdd0mAr0SR","pdf",2304620,138,"English","# Part I: Foundations\n## 1. What Is an Agent\n## 2. Taxonomy of Agents\n# Part II: The Agent Loop\n## 4. The Basic ReAct Loop\n## 5. Loop Variants\n# Part III: System Prompts\n## 8. Anatomy of a System Prompt\n## 9. Assembly Patterns","[{\"question\":\"What distinguishes an AI agent from a pipeline or workflow?\",\"answer\":\"An agent lets the model decide what to do next based on context, rather than using a hardcoded sequence like a pipeline or fixed branching like a workflow. The model dynamically controls control flow and tool usage.\"},{\"question\":\"What is the basic ReAct loop described in the guide?\",\"answer\":\"The basic ReAct loop is a kernel where the LLM produces responses and, when tool calls are present, executes those tool calls, appends results to messages, and continues until it returns final text.\"},{\"question\":\"How does the guide address context degradation over time?\",\"answer\":\"It defines context rot, explains key mechanisms such as instruction fade-out and agent drift, and provides measurement approaches plus multiple defenses. It also compares context engineering with prompt engineering and discusses impacts in multi-agent systems.\"}]","The Comprehensive Guide to AI Agent Engineering - March 2026 | PDF",348,[147,151,155,159,163,167,171,175,179,183,187,192,197,202],{"page_no":22,"url":148,"width":149,"height":150},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/e3e6ffd020b10ce7f38e4869e45a44b8.webp",983,1391,{"page_no":26,"url":152,"width":153,"height":154},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/11ab81fd6b6a4ffce868a3aa3d70d1e0.webp",982,1389,{"page_no":30,"url":156,"width":157,"height":158},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/cf83bc278a1fa462a5bdad066dce5ee6.webp",981,1388,{"page_no":33,"url":160,"width":161,"height":162},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/28ae0d911f287883c287207a9da8181f.webp",980,1386,{"page_no":97,"url":164,"width":165,"height":166},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/cb251d600718fa19bf23065fa1f5e39f.webp",979,1385,{"page_no":102,"url":168,"width":169,"height":170},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/ca71dce6e587a756d0d913979327ddfc.webp",978,1384,{"page_no":106,"url":172,"width":173,"height":174},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/b1a2f5b9dc709308f4ae2ceef92904ab.webp",977,1382,{"page_no":111,"url":176,"width":177,"height":178},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/377f09230dbfcfed2c93c521325da344.webp",976,1381,{"page_no":116,"url":180,"width":181,"height":182},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/717e1c86e842eaa28003611cc5375d8d.webp",975,1379,{"page_no":124,"url":184,"width":185,"height":186},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/e5ad209f2173e47e26398cd1ae419a58.webp",974,1378,{"page_no":188,"url":189,"width":190,"height":191},11,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/4e1d9b5cb52190235bd2eca6357edd79.webp",973,1377,{"page_no":193,"url":194,"width":195,"height":196},12,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/d87e9ce01d36f060fd676a6b2376c9f0.webp",972,1375,{"page_no":198,"url":199,"width":200,"height":201},13,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/b392d623dc06cbbf12d45cbb8b3ca0ae.webp",971,1374,{"page_no":55,"url":203,"width":204,"height":205},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/35181b2faa2b18d0a57412ff3badb3de.webp",970,1372,{"list":207,"token":11},[208,214,220,227,233,240,247,254,261,267],{"doc_id":209,"doc_title":210,"file_type":138,"home_preview_img_url":211,"slug":212,"view_count":188,"category_name":29,"create_tm":213},698656,"Claude Code Cheat Sheet - Commands, context, automation, and workflows","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010390242/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796108159&Signature=yBBVtZ%2BTPD1kgyyCZMELbFfIv6I%3D","claude-code-cheat-sheet-commands-context-automation-and-workflows",1794454283,{"doc_id":215,"doc_title":216,"file_type":138,"home_preview_img_url":217,"slug":218,"view_count":111,"category_name":29,"create_tm":219},687623,"AI Coding Workshop - Workshop Outline","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000649717/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796108159&Signature=CvtyrdCHga8DltL28yDIwfMSVSU%3D","ai-coding-workshop-workshop-outline",1794084332,{"doc_id":221,"doc_title":222,"file_type":138,"home_preview_img_url":223,"slug":224,"view_count":225,"category_name":29,"create_tm":226},654636,"Automatic Generation of technical Drawings using Model Context Protocol - paper","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229974533624/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796108159&Signature=9qE4IBr3klkY4Sq5huC7s2gv7K0%3D","automatic-generation-of-technical-drawings-using-model-context-protocol-paper",17,1792929139,{"doc_id":228,"doc_title":229,"file_type":138,"home_preview_img_url":230,"slug":231,"view_count":30,"category_name":29,"create_tm":232},732947,"How to AI an AI for Almost Anything - Lecture 5 - Harness Engineering","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031781390/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796108159&Signature=MwpHlER8BmSok%2FLhMUZUhebPs3I%3D","how-to-ai-an-ai-for-almost-anything-lecture-5-harness-engineering",1795383041,{"doc_id":234,"doc_title":235,"file_type":138,"home_preview_img_url":236,"slug":237,"view_count":238,"category_name":29,"create_tm":239},701270,"Claude-Code-Architect-Handbook-2026 - Foundations Handbook - Comprehensive Preparation Guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230012064908/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796108159&Signature=am0dPHIWX7TspTVYUWMSgUIiSmw%3D","claude-code-architect-handbook-2026-foundations-handbook-comprehensive-preparation-guide",22,1794525282,{"doc_id":241,"doc_title":242,"file_type":138,"home_preview_img_url":243,"slug":244,"view_count":245,"category_name":29,"create_tm":246},84039,"MCP Enabled Agentic AI for Autonomous IPoDWDM Network Lifecycle Automation","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229809126618/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796108159&Signature=zmEIEUK%2BBdB3%2FT2D0I1dpasbXBE%3D","mcp-enabled-agentic-ai-for-autonomous-ipodwdm-network-lifecycle-automation",33,1784192177,{"doc_id":248,"doc_title":249,"file_type":138,"home_preview_img_url":250,"slug":251,"view_count":252,"category_name":29,"create_tm":253},84869,"Agentic AI for IPoDWDM Network Lifecycle Automation MCP Enabled Architecture","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229809214503/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796108159&Signature=sfBZehQcYIudBw2xMYpC6vjrbDU%3D","agentic-ai-for-ipodwdm-network-lifecycle-automation-mcp-enabled-architecture",29,1784198925,{"doc_id":255,"doc_title":256,"file_type":138,"home_preview_img_url":257,"slug":258,"view_count":259,"category_name":29,"create_tm":260},82992,"Unicode TAG-Block Concealment of Tool-Metadata Payloads in the Model Context Protocol","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229808925285/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796108159&Signature=WLDW9bIz5DJ8ymcuKrW4zfnv5hs%3D","unicode-tag-block-concealment-of-tool-metadata-payloads-in-the-model-context-protocol",26,1784184510,{"doc_id":262,"doc_title":263,"file_type":138,"home_preview_img_url":264,"slug":265,"view_count":26,"category_name":29,"create_tm":266},733010,"Agent From a User’s Perspective II - Multi-agent and Best Practice","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031782350/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796108159&Signature=OiCknrfkARqxExyItqa0y94y0wI%3D","agent-from-a-users-perspective-ii-multi-agent-and-best-practice",1795383315,{"doc_id":268,"doc_title":269,"file_type":138,"home_preview_img_url":270,"slug":271,"view_count":272,"category_name":29,"create_tm":273},114467,"Practical Multi-Agent AI Systems - Murali Kashaboina","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229830543128/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796108159&Signature=YXjRTmd3wnoLfEfI0yMnnEhbJ5s%3D","practical-multi-agent-ai-systems-murali-kashaboina",164,1785400162]