<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hansheng Li</title>
    <description>The latest articles on DEV Community by Hansheng Li (@lum_18).</description>
    <link>https://dev.to/lum_18</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4192760%2F7b4bc575-ced9-415a-a2ec-f095efb2c152.png</url>
      <title>DEV Community: Hansheng Li</title>
      <link>https://dev.to/lum_18</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lum_18"/>
    <language>en</language>
    <item>
      <title>A Better Workflow for AI-Assisted Coding: Lessons from Matt Pocock</title>
      <dc:creator>Hansheng Li</dc:creator>
      <pubDate>Mon, 19 Oct 2026 05:34:10 +0000</pubDate>
      <link>https://dev.to/lum_18/a-better-workflow-for-ai-assisted-coding-lessons-from-matt-pocock-143h</link>
      <guid>https://dev.to/lum_18/a-better-workflow-for-ai-assisted-coding-lessons-from-matt-pocock-143h</guid>
      <description>&lt;p&gt;I recently watched Matt Pocock's workshop, &lt;a href="https://www.youtube.com/watch?v=-QFHIoCo-Ko" rel="noopener noreferrer"&gt;Full Walkthrough: Workflow for AI Coding&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The main takeaway: &lt;strong&gt;Good AI-assisted coding is not about writing better prompts. It's about applying solid software engineering practices to AI agents.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here are the key lessons.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Keep AI Tasks Small and Context Fresh
&lt;/h2&gt;

&lt;p&gt;LLMs tend to become less reliable as their context grows.&lt;/p&gt;

&lt;p&gt;Matt describes two zones:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Smart Zone:&lt;/strong&gt; Fresh context, focused tasks, better decisions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dumb Zone:&lt;/strong&gt; Bloated context, reduced reliability, more mistakes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;He uses roughly 100K tokens as a practical warning threshold, not a universal technical limit.&lt;/p&gt;

&lt;p&gt;His recommendations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Break large tasks into smaller, independent tasks.&lt;/li&gt;
&lt;li&gt;Keep system instructions minimal.&lt;/li&gt;
&lt;li&gt;Prefer clearing context and restarting with well-defined tasks rather than repeatedly compacting long conversations.&lt;/li&gt;
&lt;li&gt;Use subagents for isolated exploration without filling the main agent's context.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Align Requirements Before Writing Code
&lt;/h2&gt;

&lt;p&gt;Instead of immediately asking AI to implement a feature, Matt uses a custom &lt;strong&gt;"Grill Me" skill&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The AI interviews the developer, asking questions one at a time and recommending possible answers.&lt;/p&gt;

&lt;p&gt;For example, when building a gamification feature:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which activities earn points?&lt;/li&gt;
&lt;li&gt;Should existing users receive retroactive points?&lt;/li&gt;
&lt;li&gt;How should levels work?&lt;/li&gt;
&lt;li&gt;Where should the UI appear?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is to reach a shared understanding before implementation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Planning requires human involvement. Coding can be delegated much more easily.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Turn Requirements into a PRD and Independent Tasks
&lt;/h2&gt;

&lt;p&gt;Once the requirements are clear, create a Product Requirements Document (PRD) covering:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Problem and proposed solution&lt;/li&gt;
&lt;li&gt;User stories and acceptance criteria&lt;/li&gt;
&lt;li&gt;Implementation decisions&lt;/li&gt;
&lt;li&gt;Testing requirements&lt;/li&gt;
&lt;li&gt;Out-of-scope features&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The PRD describes the &lt;strong&gt;destination&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Next, break it into independent issues with explicit dependencies. This creates a Kanban-style backlog that agents can work through, potentially in parallel.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Build Vertical Slices, Not Horizontal Layers
&lt;/h2&gt;

&lt;p&gt;AI often prefers implementing features horizontally:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Build the entire database layer.&lt;/li&gt;
&lt;li&gt;Build the APIs.&lt;/li&gt;
&lt;li&gt;Build the frontend.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The problem is that meaningful end-to-end feedback comes too late.&lt;/p&gt;

&lt;p&gt;Matt recommends &lt;strong&gt;vertical slices (tracer bullets)&lt;/strong&gt; instead.&lt;/p&gt;

&lt;p&gt;For example, implement one small feature that includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database changes&lt;/li&gt;
&lt;li&gt;Backend logic&lt;/li&gt;
&lt;li&gt;API integration&lt;/li&gt;
&lt;li&gt;A minimal frontend&lt;/li&gt;
&lt;li&gt;Tests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each slice delivers something functional and testable.&lt;/p&gt;

&lt;p&gt;This makes integration problems visible much earlier.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Use Ralph Loops for Automated Implementation
&lt;/h2&gt;

&lt;p&gt;Once the backlog is ready, implementation can become an automated loop:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select an unblocked issue.&lt;/li&gt;
&lt;li&gt;Explore the relevant code.&lt;/li&gt;
&lt;li&gt;Implement the feature.&lt;/li&gt;
&lt;li&gt;Run tests and type checks.&lt;/li&gt;
&lt;li&gt;Commit the changes.&lt;/li&gt;
&lt;li&gt;Repeat until the backlog is complete.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Matt demonstrates this with a Ralph-style loop.&lt;/p&gt;

&lt;p&gt;For parallel execution, he also introduces &lt;strong&gt;Sand Castle&lt;/strong&gt;, which uses isolated Git worktrees and Docker sandboxes for agents.&lt;/p&gt;

&lt;p&gt;Separate agents can handle planning, implementation, review, and merging.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Test-Driven Development Makes AI More Reliable
&lt;/h2&gt;

&lt;p&gt;Matt strongly recommends &lt;strong&gt;TDD (Test-Driven Development)&lt;/strong&gt; for AI agents.&lt;/p&gt;

&lt;p&gt;The process follows:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Red → Green → Refactor&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write a failing test.&lt;/li&gt;
&lt;li&gt;Implement the minimum code needed to pass.&lt;/li&gt;
&lt;li&gt;Refactor while keeping the tests green.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Writing tests first makes it harder for AI to generate weak tests that merely confirm its existing implementation.&lt;/p&gt;

&lt;p&gt;More importantly, AI needs fast feedback loops:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unit and integration tests&lt;/li&gt;
&lt;li&gt;Type checking&lt;/li&gt;
&lt;li&gt;Linting&lt;/li&gt;
&lt;li&gt;Automated code review&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The quality of your feedback loops often determines the quality of your AI-generated code.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Design Deep Modules with Simple Interfaces
&lt;/h2&gt;

&lt;p&gt;Another important lesson comes from &lt;em&gt;A Philosophy of Software Design&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Matt recommends &lt;strong&gt;deep modules&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Small, clear public interfaces&lt;/li&gt;
&lt;li&gt;Substantial functionality hidden internally&lt;/li&gt;
&lt;li&gt;Well-defined responsibilities&lt;/li&gt;
&lt;li&gt;Easy-to-test boundaries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is preferable to many tiny, tightly coupled modules.&lt;/p&gt;

&lt;p&gt;The developer should understand and control the overall architecture while delegating internal implementation details to AI.&lt;/p&gt;

&lt;p&gt;This helps prevent losing architectural understanding as AI generates more code.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Never Skip Human QA and Code Review
&lt;/h2&gt;

&lt;p&gt;Automated tests passing doesn't guarantee a good product.&lt;/p&gt;

&lt;p&gt;Matt emphasizes that humans still need to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify actual user behavior.&lt;/li&gt;
&lt;li&gt;Review important architectural decisions.&lt;/li&gt;
&lt;li&gt;Inspect tests and critical code.&lt;/li&gt;
&lt;li&gt;Evaluate frontend usability.&lt;/li&gt;
&lt;li&gt;Identify missing requirements.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;He also recommends using a fresh AI context for code review rather than asking an agent to review its own work after a long implementation session.&lt;/p&gt;

&lt;p&gt;QA findings can become new backlog issues, creating a continuous improvement cycle.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Complete Workflow
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Idea
  ↓
Grill Me (Requirements Alignment)
  ↓
PRD (Define the Destination)
  ↓
Independent Issues (Vertical Slices)
  ↓
AI Implementation (Ralph Loop)
  ↓
TDD + Automated Feedback
  ↓
AI Code Review
  ↓
Human QA
  ↓
New Issues / Improvements
  ↓
Repeat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;The biggest lesson from this workshop is that &lt;strong&gt;AI doesn't replace software engineering fundamentals. It makes them even more important.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Good architecture, small tasks, clear requirements, automated tests, and continuous feedback are what make AI coding agents effective.&lt;/p&gt;

&lt;p&gt;The developer's role increasingly shifts from writing every line of code to defining requirements, designing systems, providing feedback, and maintaining quality.&lt;/p&gt;

&lt;p&gt;AI can handle much of the implementation, but &lt;strong&gt;humans still need to own the decisions and the final product.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="https://www.youtube.com/watch?v=-QFHIoCo-Ko" rel="noopener noreferrer"&gt;Matt Pocock — Full Walkthrough: Workflow for AI Coding (YouTube)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Suggested DEV.to tags:&lt;/strong&gt; &lt;code&gt;#ai&lt;/code&gt; &lt;code&gt;#programming&lt;/code&gt; &lt;code&gt;#productivity&lt;/code&gt; &lt;code&gt;#softwareengineering&lt;/code&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>productivity</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>From AI Agent Demos to Production: 6 Essential Concepts for Agentic AI System Design</title>
      <dc:creator>Hansheng Li</dc:creator>
      <pubDate>Mon, 19 Oct 2026 04:41:49 +0000</pubDate>
      <link>https://dev.to/lum_18/from-ai-agent-demos-to-production-6-essential-concepts-for-agentic-ai-system-design-2kki</link>
      <guid>https://dev.to/lum_18/from-ai-agent-demos-to-production-6-essential-concepts-for-agentic-ai-system-design-2kki</guid>
      <description>&lt;p&gt;Building an AI agent demo is easy. Building one that is &lt;strong&gt;reliable, scalable, secure, and production-ready&lt;/strong&gt; is much harder.&lt;/p&gt;

&lt;p&gt;I recently watched &lt;a href="https://www.youtube.com/watch?v=UqnLqEcTm5s" rel="noopener noreferrer"&gt;Agentic AI System Design was HARD until I Learned these 6 Concepts&lt;/a&gt; and summarized six important concepts for designing production AI agents.&lt;/p&gt;

&lt;p&gt;Let's use a &lt;strong&gt;customer support agent&lt;/strong&gt; as an example. Imagine a customer asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I never received my order. Please cancel it and refund me."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The agent needs to understand the request, retrieve the order, check refund policies, execute authorized actions, and respond correctly.&lt;/p&gt;

&lt;p&gt;Here's what makes this challenging.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Agent Loop: Plan → Act → Observe → Repeat
&lt;/h2&gt;

&lt;p&gt;Unlike a traditional LLM application that simply generates a response, an AI agent can reason, call tools, observe results, and decide what to do next.&lt;/p&gt;

&lt;p&gt;A typical agent loop:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Plan:&lt;/strong&gt; Determine what needs to happen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Act:&lt;/strong&gt; Call a tool or execute an operation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Observe:&lt;/strong&gt; Examine the result.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repeat:&lt;/strong&gt; Continue until the task is complete.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The challenge is &lt;strong&gt;reliability decreases as the number of steps increases&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If each step has a 90% success rate, assuming independent failures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;3 steps: 72.9% success&lt;/li&gt;
&lt;li&gt;5 steps: 59.0% success&lt;/li&gt;
&lt;li&gt;8 steps: 43.0% success&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This illustrates why unnecessary complexity can make agents unreliable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key takeaway:&lt;/strong&gt; Minimize unnecessary steps, validate intermediate results, and implement retries, fallback strategies, and clear stopping conditions.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Model Routing: Use the Right Model for Each Task
&lt;/h2&gt;

&lt;p&gt;Using the most powerful LLM for every task increases cost and latency unnecessarily.&lt;/p&gt;

&lt;p&gt;Different tasks require different levels of intelligence.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Recommended approach&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Classify customer intent&lt;/td&gt;
&lt;td&gt;Small, fast model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Extract order ID&lt;/td&gt;
&lt;td&gt;Small model or code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Look up order information&lt;/td&gt;
&lt;td&gt;Database/API&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Understand complex complaints&lt;/td&gt;
&lt;td&gt;More capable LLM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Validate refund eligibility&lt;/td&gt;
&lt;td&gt;Deterministic business logic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generate customer response&lt;/td&gt;
&lt;td&gt;Small or mid-tier LLM&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This technique is called &lt;strong&gt;model routing&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The objective is to balance:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quality ↔ Cost ↔ Latency&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key takeaway:&lt;/strong&gt; Use expensive reasoning models only when additional reasoning improves the outcome.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Tool Design: Treat Tools Like Production APIs
&lt;/h2&gt;

&lt;p&gt;Tools allow agents to interact with external systems.&lt;/p&gt;

&lt;p&gt;Our customer support agent might have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;get_order_details&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;search_refund_policy&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;check_refund_eligibility&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;issue_refund&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, adding more tools also creates more opportunities for incorrect tool selection and execution failures.&lt;/p&gt;

&lt;p&gt;Well-designed tools should provide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clear names and descriptions.&lt;/li&gt;
&lt;li&gt;Strict input/output schemas.&lt;/li&gt;
&lt;li&gt;Structured error responses.&lt;/li&gt;
&lt;li&gt;Authentication and authorization.&lt;/li&gt;
&lt;li&gt;Separation between read and write operations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, retrieving an order is low-risk, while issuing a refund changes financial records.&lt;/p&gt;

&lt;p&gt;The video also introduces &lt;strong&gt;MCP (Model Context Protocol)&lt;/strong&gt;, an open standard for connecting AI applications with tools and external data.&lt;/p&gt;

&lt;p&gt;One additional production consideration is &lt;strong&gt;idempotency&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If a refund request succeeds but the API response times out, retrying it should not accidentally issue another refund.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key takeaway:&lt;/strong&gt; Let the LLM propose actions, but use backend code to validate and safely execute them.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Memory, State, and RAG: Give Agents the Right Context
&lt;/h2&gt;

&lt;p&gt;These concepts solve different problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;State&lt;/strong&gt; represents the current workflow execution:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Current step.&lt;/li&gt;
&lt;li&gt;Order ID.&lt;/li&gt;
&lt;li&gt;Approval status.&lt;/li&gt;
&lt;li&gt;Refund status.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Memory&lt;/strong&gt; represents longer-term information:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Previous conversations.&lt;/li&gt;
&lt;li&gt;Customer history.&lt;/li&gt;
&lt;li&gt;User preferences.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;RAG (Retrieval-Augmented Generation)&lt;/strong&gt; retrieves relevant external knowledge, such as company refund policies.&lt;/p&gt;

&lt;p&gt;Instead of loading an entire policy handbook into the prompt, RAG retrieves only the relevant passages.&lt;/p&gt;

&lt;p&gt;A typical RAG pipeline:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Documents → Chunking → Embeddings → Retrieval → Ranking → LLM&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But retrieval quality matters.&lt;/p&gt;

&lt;p&gt;If the system retrieves an outdated or incorrect policy, the LLM might confidently generate an incorrect answer.&lt;/p&gt;

&lt;p&gt;Important RAG considerations include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chunking strategy.&lt;/li&gt;
&lt;li&gt;Metadata filtering.&lt;/li&gt;
&lt;li&gt;Retrieval accuracy.&lt;/li&gt;
&lt;li&gt;Reranking.&lt;/li&gt;
&lt;li&gt;Document freshness.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Loading too much information into the context window can also introduce &lt;strong&gt;context rot&lt;/strong&gt;, where irrelevant information makes reasoning less effective and increases token costs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key takeaway:&lt;/strong&gt; Store workflow state separately, retrieve memory selectively, and provide only relevant context to the model.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Orchestration: Workflow vs. Single Agent vs. Multi-Agent
&lt;/h2&gt;

&lt;p&gt;Orchestration coordinates models, tools, memory, and execution steps.&lt;/p&gt;

&lt;p&gt;There are three common approaches:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Best for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Deterministic workflow&lt;/td&gt;
&lt;td&gt;Predictable business processes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Single agent&lt;/td&gt;
&lt;td&gt;Tasks requiring dynamic decisions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Multi-agent&lt;/td&gt;
&lt;td&gt;Complex tasks with distinct specialist responsibilities&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For example, a refund process usually follows a predictable workflow:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Classify → Retrieve → Validate → Approve → Execute → Respond&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A predefined workflow may be more reliable than allowing an autonomous agent to plan everything.&lt;/p&gt;

&lt;p&gt;Multi-agent systems introduce additional coordination, latency, and failure risks.&lt;/p&gt;

&lt;p&gt;Each handoff between agents creates another opportunity for context loss or mistakes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key takeaway:&lt;/strong&gt; Start with a simple workflow or single agent. Introduce multi-agent architecture only when it provides measurable benefits.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Evals, Observability, and Security: Production Controls
&lt;/h2&gt;

&lt;p&gt;This is what separates a working demo from a production system.&lt;/p&gt;

&lt;h3&gt;
  
  
  Evals: Is the agent doing the right thing?
&lt;/h3&gt;

&lt;p&gt;Traditional software uses deterministic tests.&lt;/p&gt;

&lt;p&gt;AI agents introduce nondeterministic behavior. An agent can return valid JSON while selecting the wrong tool or applying the wrong refund policy.&lt;/p&gt;

&lt;p&gt;Evaluation datasets should include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Normal requests.&lt;/li&gt;
&lt;li&gt;Ambiguous questions.&lt;/li&gt;
&lt;li&gt;Incorrect or missing information.&lt;/li&gt;
&lt;li&gt;Tool failures.&lt;/li&gt;
&lt;li&gt;Unauthorized requests.&lt;/li&gt;
&lt;li&gt;Prompt injection attempts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Rerun evaluations whenever prompts, models, tools, or workflows change.&lt;/p&gt;

&lt;h3&gt;
  
  
  Observability: What actually happened?
&lt;/h3&gt;

&lt;p&gt;When something goes wrong, we need to identify exactly which step failed.&lt;/p&gt;

&lt;p&gt;Track:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Model and prompt versions.&lt;/li&gt;
&lt;li&gt;Tool calls and results.&lt;/li&gt;
&lt;li&gt;Workflow execution traces.&lt;/li&gt;
&lt;li&gt;Latency and token costs.&lt;/li&gt;
&lt;li&gt;Errors, retries, and fallback decisions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tracing is especially important because one agent request may involve multiple LLM calls and external APIs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Security: What if the agent makes a mistake?
&lt;/h3&gt;

&lt;p&gt;Not all actions have the same risk.&lt;/p&gt;

&lt;p&gt;Reading order information is different from issuing a refund.&lt;/p&gt;

&lt;p&gt;For high-risk actions, follow:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LLM proposes → Backend validates → Human approves (if required) → Tool executes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Business rules and permissions must be enforced by application code, not just prompts.&lt;/p&gt;

&lt;p&gt;Also treat customer messages, retrieved documents, and external tool responses as untrusted input to defend against prompt injection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key takeaway:&lt;/strong&gt; Measure agent quality, trace execution, and restrict what the agent can do.&lt;/p&gt;




&lt;h2&gt;
  
  
  Putting It All Together
&lt;/h2&gt;

&lt;p&gt;A production customer support agent might use this architecture:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;th&gt;Example technology&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;API&lt;/td&gt;
&lt;td&gt;Receive requests&lt;/td&gt;
&lt;td&gt;FastAPI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Orchestration&lt;/td&gt;
&lt;td&gt;Coordinate workflow&lt;/td&gt;
&lt;td&gt;LangGraph&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Models&lt;/td&gt;
&lt;td&gt;Classification and reasoning&lt;/td&gt;
&lt;td&gt;LLM APIs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tools&lt;/td&gt;
&lt;td&gt;Execute operations&lt;/td&gt;
&lt;td&gt;Internal APIs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;State&lt;/td&gt;
&lt;td&gt;Persist workflow progress&lt;/td&gt;
&lt;td&gt;PostgreSQL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cache&lt;/td&gt;
&lt;td&gt;Temporary data&lt;/td&gt;
&lt;td&gt;Redis&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAG&lt;/td&gt;
&lt;td&gt;Retrieve relevant policies&lt;/td&gt;
&lt;td&gt;pgvector&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Observability&lt;/td&gt;
&lt;td&gt;Trace execution&lt;/td&gt;
&lt;td&gt;OpenTelemetry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Monitoring&lt;/td&gt;
&lt;td&gt;Detect errors&lt;/td&gt;
&lt;td&gt;Sentry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Approval&lt;/td&gt;
&lt;td&gt;Human-in-the-loop&lt;/td&gt;
&lt;td&gt;React/Next.js&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These are possible implementation choices rather than requirements from the video.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;The biggest lesson is that &lt;strong&gt;production AI agents are still software engineering systems&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;LLMs introduce flexible reasoning, but traditional engineering principles remain essential:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reliability and fault tolerance.&lt;/li&gt;
&lt;li&gt;API and database design.&lt;/li&gt;
&lt;li&gt;State management.&lt;/li&gt;
&lt;li&gt;Testing and evaluation.&lt;/li&gt;
&lt;li&gt;Logging and observability.&lt;/li&gt;
&lt;li&gt;Security and authorization.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A successful AI agent combines &lt;strong&gt;probabilistic AI reasoning with deterministic software controls&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The goal is not to build the most autonomous or complicated agent. It is to build the simplest agent that reliably solves a real problem.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Reference:&lt;/strong&gt; &lt;a href="https://www.youtube.com/watch?v=UqnLqEcTm5s" rel="noopener noreferrer"&gt;Agentic AI System Design was HARD until I Learned these 6 Concepts — YouTube&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;These are my learning notes based on the video, with a few additional engineering considerations and implementation examples.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>architecture</category>
      <category>systemdesign</category>
    </item>
  </channel>
</rss>
