<?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: Subham Kumar</title>
    <description>The latest articles on DEV Community by Subham Kumar (@digital_subham).</description>
    <link>https://dev.to/digital_subham</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1233525%2F463bf8d0-7a4b-40ba-8394-988c5ca37564.jpg</url>
      <title>DEV Community: Subham Kumar</title>
      <link>https://dev.to/digital_subham</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/digital_subham"/>
    <language>en</language>
    <item>
      <title>Multi-Agent Systems Explained: Coordinator Pattern, Task Tool &amp; Context Injection</title>
      <dc:creator>Subham Kumar</dc:creator>
      <pubDate>Thu, 11 Jun 2026 04:15:15 +0000</pubDate>
      <link>https://dev.to/digital_subham/multi-agent-systems-explained-coordinator-pattern-task-tool-context-injection-4b8c</link>
      <guid>https://dev.to/digital_subham/multi-agent-systems-explained-coordinator-pattern-task-tool-context-injection-4b8c</guid>
      <description>&lt;p&gt;As AI applications become more powerful, developers often discover a problem:&lt;/p&gt;

&lt;p&gt;One AI agent is not always enough.&lt;/p&gt;

&lt;p&gt;A single agent can answer questions, use tools, and complete simple tasks.&lt;/p&gt;

&lt;p&gt;But what happens when the task becomes very large?&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Writing a complete market research report&lt;/li&gt;
&lt;li&gt;Analyzing hundreds of documents&lt;/li&gt;
&lt;li&gt;Collecting data from multiple sources&lt;/li&gt;
&lt;li&gt;Researching and summarizing complex topics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One agent can quickly become overloaded.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;Multi-Agent Systems&lt;/strong&gt; become useful.&lt;/p&gt;

&lt;p&gt;Instead of one AI doing everything, we create multiple specialized AI agents.&lt;/p&gt;

&lt;p&gt;Each agent gets a specific job.&lt;/p&gt;

&lt;p&gt;One agent researches.&lt;/p&gt;

&lt;p&gt;One agent analyzes.&lt;/p&gt;

&lt;p&gt;One agent writes.&lt;/p&gt;

&lt;p&gt;One agent validates information.&lt;/p&gt;

&lt;p&gt;A special agent called the &lt;strong&gt;Coordinator&lt;/strong&gt; manages all of them.&lt;/p&gt;

&lt;p&gt;Think of it like a sports team.&lt;/p&gt;

&lt;p&gt;A football team does not have one player doing everything.&lt;/p&gt;

&lt;p&gt;Different players have different responsibilities.&lt;/p&gt;

&lt;p&gt;Multi-agent systems work the same way.&lt;/p&gt;

&lt;p&gt;In this guide, you'll learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What multi-agent systems are&lt;/li&gt;
&lt;li&gt;Why single agents fail&lt;/li&gt;
&lt;li&gt;What a coordinator pattern is&lt;/li&gt;
&lt;li&gt;How the Claude Task Tool works&lt;/li&gt;
&lt;li&gt;What context injection means&lt;/li&gt;
&lt;li&gt;How parallel agent execution improves speed&lt;/li&gt;
&lt;li&gt;Common mistakes to avoid&lt;/li&gt;
&lt;li&gt;Important Claude Certified Architect exam concepts&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Why Single AI Agents Can Fail
&lt;/h1&gt;

&lt;p&gt;Before learning multi-agent systems, let's understand why a single agent can struggle.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem 1: Context Overflow
&lt;/h2&gt;

&lt;p&gt;Every Large Language Model (LLM) has a memory limit called a &lt;strong&gt;context window&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Simple Analogy
&lt;/h3&gt;

&lt;p&gt;Imagine a student carrying books in a backpack.&lt;/p&gt;

&lt;p&gt;If the backpack becomes too full, the student cannot carry anything else.&lt;/p&gt;

&lt;p&gt;The same thing happens with AI agents.&lt;/p&gt;

&lt;p&gt;As the conversation grows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User messages increase&lt;/li&gt;
&lt;li&gt;Tool results increase&lt;/li&gt;
&lt;li&gt;Previous responses increase&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Eventually the context becomes too large.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Messages
      +
Tool Results
      +
Previous Responses
      ↓
Context Window Fills Up
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is called &lt;strong&gt;Context Overflow&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Problem 2: Sequential Bottlenecks
&lt;/h2&gt;

&lt;p&gt;A single agent usually performs tasks one after another.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Research Papers
      ↓
Read News
      ↓
Analyze Reports
      ↓
Write Summary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything happens sequentially.&lt;/p&gt;

&lt;p&gt;This takes time.&lt;/p&gt;




&lt;h2&gt;
  
  
  Problem 3: Specialization Gap
&lt;/h2&gt;

&lt;p&gt;A single agent tries to do everything.&lt;/p&gt;

&lt;p&gt;It may be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;researcher&lt;/li&gt;
&lt;li&gt;analyst&lt;/li&gt;
&lt;li&gt;writer&lt;/li&gt;
&lt;li&gt;editor&lt;/li&gt;
&lt;li&gt;validator&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;at the same time.&lt;/p&gt;

&lt;p&gt;This often leads to average-quality results.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real-Life Analogy
&lt;/h3&gt;

&lt;p&gt;Imagine hiring one person to be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;doctor&lt;/li&gt;
&lt;li&gt;lawyer&lt;/li&gt;
&lt;li&gt;teacher&lt;/li&gt;
&lt;li&gt;engineer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;at the same time.&lt;/p&gt;

&lt;p&gt;Possible?&lt;/p&gt;

&lt;p&gt;Maybe.&lt;/p&gt;

&lt;p&gt;Ideal?&lt;/p&gt;

&lt;p&gt;Not really.&lt;/p&gt;

&lt;p&gt;Specialists usually perform better.&lt;/p&gt;




&lt;h1&gt;
  
  
  What Is a Multi-Agent System?
&lt;/h1&gt;

&lt;p&gt;A Multi-Agent System uses multiple AI agents working together.&lt;/p&gt;

&lt;p&gt;Each agent has a specific responsibility.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Research Agent
      ↓
Analysis Agent
      ↓
Writing Agent
      ↓
Validation Agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of one overloaded agent, work is divided into smaller tasks.&lt;/p&gt;




&lt;h1&gt;
  
  
  Real-Life Team Analogy
&lt;/h1&gt;

&lt;p&gt;Imagine building a house.&lt;/p&gt;

&lt;p&gt;You don't hire one person to do everything.&lt;/p&gt;

&lt;p&gt;You have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Architect&lt;/li&gt;
&lt;li&gt;Electrician&lt;/li&gt;
&lt;li&gt;Plumber&lt;/li&gt;
&lt;li&gt;Painter&lt;/li&gt;
&lt;li&gt;Carpenter&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each specialist focuses on one job.&lt;/p&gt;

&lt;p&gt;A Multi-Agent System follows the same idea.&lt;/p&gt;




&lt;h1&gt;
  
  
  Understanding the Hub-and-Spoke Architecture
&lt;/h1&gt;

&lt;p&gt;The most common architecture is called the &lt;strong&gt;Hub-and-Spoke Pattern&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Sounds complicated.&lt;/p&gt;

&lt;p&gt;It's actually simple.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is a Hub?
&lt;/h2&gt;

&lt;p&gt;The hub is the center.&lt;/p&gt;

&lt;p&gt;In AI systems, the hub is called the &lt;strong&gt;Coordinator&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are Spokes?
&lt;/h2&gt;

&lt;p&gt;The spokes are specialized sub-agents.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;           Research Agent
                  |
                  |
Analysis Agent --- Coordinator --- Writing Agent
                  |
                  |
          Validation Agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The coordinator sits in the middle.&lt;/p&gt;




&lt;h1&gt;
  
  
  Important Rule: All Communication Goes Through the Coordinator
&lt;/h1&gt;

&lt;p&gt;This is one of the most important concepts.&lt;/p&gt;

&lt;p&gt;Good:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Research Agent
      ↓
Coordinator
      ↓
Writing Agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bad:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Research Agent
      ↓
Writing Agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sub-agents should not communicate directly.&lt;/p&gt;

&lt;p&gt;Everything goes through the coordinator.&lt;/p&gt;




&lt;h1&gt;
  
  
  Responsibilities of the Coordinator
&lt;/h1&gt;

&lt;p&gt;The coordinator is like a project manager.&lt;/p&gt;

&lt;p&gt;Its job is not to do all the work.&lt;/p&gt;

&lt;p&gt;Its job is to manage the work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Task Decomposition
&lt;/h2&gt;

&lt;p&gt;Large tasks are broken into smaller tasks.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;User asks:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Create a market research report about electric vehicles.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Coordinator breaks it into:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Research Market Size
Research Competitors
Analyze Government Policies
Study Customer Trends
Write Final Report
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Delegation
&lt;/h2&gt;

&lt;p&gt;After splitting tasks, the coordinator assigns work.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Research Agent → Market Data
Analysis Agent → Trends
Writing Agent → Final Report
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Result Aggregation
&lt;/h2&gt;

&lt;p&gt;After agents finish their work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Agent Outputs
      ↓
Coordinator
      ↓
Final Report
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The coordinator combines everything.&lt;/p&gt;




&lt;h2&gt;
  
  
  Error Handling
&lt;/h2&gt;

&lt;p&gt;If an agent fails:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Agent Error
      ↓
Coordinator Detects Problem
      ↓
Retry or Assign New Agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The coordinator manages failures.&lt;/p&gt;




&lt;h1&gt;
  
  
  What Is the Claude Task Tool?
&lt;/h1&gt;

&lt;p&gt;The Task Tool allows a coordinator to create sub-agents.&lt;/p&gt;

&lt;p&gt;Think of it as an agent factory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Coordinator
      ↓
Task Tool
      ↓
New Sub-Agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without the Task Tool, the coordinator cannot create new agents.&lt;/p&gt;




&lt;h1&gt;
  
  
  Why the Coordinator Needs Task Tool Access
&lt;/h1&gt;

&lt;p&gt;The coordinator must have permission to use the Task Tool.&lt;/p&gt;

&lt;p&gt;Without it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;No Task Tool
      ↓
No Sub-Agent Creation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an important Claude Certified Architect exam concept.&lt;/p&gt;




&lt;h1&gt;
  
  
  Creating a Sub-Agent
&lt;/h1&gt;

&lt;p&gt;When creating a sub-agent, we provide an agent definition.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example Agent Definition
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;research_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Research specialist&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;prompt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Find recent EV market trends&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;allowed_tools&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;web_search&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;

    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-sonnet&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Line-by-Line Explanation
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Description
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Research specialist&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Defines the role.&lt;/p&gt;




&lt;h2&gt;
  
  
  Prompt
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;prompt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Find recent EV market trends&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Defines the task.&lt;/p&gt;




&lt;h2&gt;
  
  
  Allowed Tools
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;allowed_tools&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;web_search&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Defines what the agent can access.&lt;/p&gt;




&lt;h2&gt;
  
  
  Model
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-sonnet&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Defines which Claude model will be used.&lt;/p&gt;




&lt;h1&gt;
  
  
  Context Isolation Explained
&lt;/h1&gt;

&lt;p&gt;One of the most misunderstood concepts is &lt;strong&gt;Context Isolation&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Does Context Isolation Mean?
&lt;/h2&gt;

&lt;p&gt;Sub-agents start with an empty memory.&lt;/p&gt;

&lt;p&gt;They do not automatically know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;previous conversations&lt;/li&gt;
&lt;li&gt;user preferences&lt;/li&gt;
&lt;li&gt;previous tool results&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Real-Life Analogy
&lt;/h2&gt;

&lt;p&gt;Imagine hiring a contractor.&lt;/p&gt;

&lt;p&gt;The project manager knows the full project history.&lt;/p&gt;

&lt;p&gt;The contractor does not.&lt;/p&gt;

&lt;p&gt;The contractor only knows what the manager explains.&lt;/p&gt;

&lt;p&gt;The same applies to sub-agents.&lt;/p&gt;




&lt;h1&gt;
  
  
  What Is Context Injection?
&lt;/h1&gt;

&lt;p&gt;Context Injection means passing important information into the sub-agent prompt.&lt;/p&gt;

&lt;p&gt;Bad Prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Research this topic.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good Prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Research electric vehicle market trends.
Focus on reports from the last 5 years.
Return 5 key findings.
Avoid duplicate sources.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second prompt gives useful context.&lt;/p&gt;




&lt;h1&gt;
  
  
  Parallel vs Sequential Agent Execution
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Sequential Execution
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Agent 1
   ↓
Agent 2
   ↓
Agent 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Total Time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A1 + A2 + A3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Slow.&lt;/p&gt;




&lt;h2&gt;
  
  
  Parallel Execution
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Agent 1
Agent 2
Agent 3
   ↓
Coordinator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Total Time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;max(A1, A2, A3)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Much faster.&lt;/p&gt;




&lt;h1&gt;
  
  
  Practical Example: Market Research System
&lt;/h1&gt;

&lt;p&gt;Imagine a company wants a report on electric vehicles.&lt;/p&gt;

&lt;p&gt;The coordinator creates:&lt;/p&gt;

&lt;h3&gt;
  
  
  Research Agent
&lt;/h3&gt;

&lt;p&gt;Find market size.&lt;/p&gt;

&lt;h3&gt;
  
  
  Competitor Agent
&lt;/h3&gt;

&lt;p&gt;Research competitors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Policy Agent
&lt;/h3&gt;

&lt;p&gt;Analyze regulations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Writing Agent
&lt;/h3&gt;

&lt;p&gt;Prepare final report.&lt;/p&gt;




&lt;h2&gt;
  
  
  Workflow Diagram
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Request
      ↓
Coordinator
      ↓
-------------------------
|     |      |         |
Research Competitor Policy Writing
Agent   Agent    Agent   Agent
-------------------------
      ↓
Coordinator
      ↓
Final Report
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Task Tool Access Rules
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Who Should Have Access?
&lt;/h2&gt;

&lt;p&gt;Coordinator.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Coordinator
      ↓
Task Tool Access
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Who Should Not Have Access?
&lt;/h2&gt;

&lt;p&gt;Normal worker agents.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Research Agent
Writing Agent
Analysis Agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Usually no Task Tool access.&lt;/p&gt;




&lt;h1&gt;
  
  
  Hierarchical Architecture Exception
&lt;/h1&gt;

&lt;p&gt;Sometimes an agent can act as another coordinator.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Main Coordinator
       ↓
Research Coordinator
   ↙     ↓      ↘
Paper   News   Policy
Agent   Agent  Agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, the Research Coordinator may receive Task Tool access.&lt;/p&gt;




&lt;h1&gt;
  
  
  Common Mistakes
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Mistake 1: Giving Every Agent Task Tool Access
&lt;/h2&gt;

&lt;p&gt;This creates chaos.&lt;/p&gt;

&lt;p&gt;Agents may keep creating more agents.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mistake 2: Sequential Spawning
&lt;/h2&gt;

&lt;p&gt;Bad:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create Agent 1
Wait
Create Agent 2
Wait
Create Agent 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create Agent 1
Create Agent 2
Create Agent 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;at the same time.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mistake 3: Poor Context Injection
&lt;/h2&gt;

&lt;p&gt;Bad:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Research this topic.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Research EV market trends from the last five years.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Mistake 4: Letting Sub-Agents Communicate Directly
&lt;/h2&gt;

&lt;p&gt;Always route communication through the coordinator.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mistake 5: Simply Merging Outputs
&lt;/h2&gt;

&lt;p&gt;The coordinator should synthesize results.&lt;/p&gt;

&lt;p&gt;Not just copy and paste them.&lt;/p&gt;




&lt;h1&gt;
  
  
  Claude Certified Architect Exam Tips
&lt;/h1&gt;

&lt;p&gt;Remember these facts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Coordinator = Central Control
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Task Tool = Creates Sub-Agents
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sub-Agents Start With Empty Context
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Context Must Be Injected
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Parallel Execution Is Faster
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;All Communication Goes Through Coordinator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Key Takeaways
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Multi-Agent Systems divide work among specialized AI agents.&lt;/li&gt;
&lt;li&gt;A coordinator manages all sub-agents.&lt;/li&gt;
&lt;li&gt;The Hub-and-Spoke pattern is a common architecture.&lt;/li&gt;
&lt;li&gt;The Task Tool allows coordinators to create sub-agents.&lt;/li&gt;
&lt;li&gt;Sub-agents start with blank context.&lt;/li&gt;
&lt;li&gt;Context Injection provides required information.&lt;/li&gt;
&lt;li&gt;Parallel execution is faster than sequential execution.&lt;/li&gt;
&lt;li&gt;Coordinators handle delegation, aggregation, and error handling.&lt;/li&gt;
&lt;li&gt;Worker agents usually should not have Task Tool access.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  FAQ
&lt;/h1&gt;

&lt;h2&gt;
  
  
  What is a Multi-Agent System?
&lt;/h2&gt;

&lt;p&gt;A system where multiple AI agents work together to complete tasks.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is a Coordinator Agent?
&lt;/h2&gt;

&lt;p&gt;An agent that manages sub-agents and combines their results.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is the Task Tool?
&lt;/h2&gt;

&lt;p&gt;A Claude tool that allows coordinators to create sub-agents.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why do sub-agents start with blank context?
&lt;/h2&gt;

&lt;p&gt;Because context is isolated. They only know what is passed in their prompt.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Context Injection?
&lt;/h2&gt;

&lt;p&gt;Providing important information to a sub-agent through its prompt.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why is Parallel Execution Important?
&lt;/h2&gt;

&lt;p&gt;It reduces latency and improves performance.&lt;/p&gt;




&lt;h2&gt;
  
  
  Should all agents have Task Tool access?
&lt;/h2&gt;

&lt;p&gt;No. Usually only coordinators should have it.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is the Hub-and-Spoke Pattern?
&lt;/h2&gt;

&lt;p&gt;A design where a coordinator sits at the center and manages multiple specialized agents.&lt;/p&gt;




&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;As AI applications become more advanced, one agent is often not enough.&lt;/p&gt;

&lt;p&gt;Multi-Agent Systems solve this problem by dividing work among specialized agents.&lt;/p&gt;

&lt;p&gt;The coordinator acts like a project manager, assigning tasks, collecting results, and producing the final answer.&lt;/p&gt;

&lt;p&gt;Understanding coordinators, Task Tools, context injection, and parallel execution is essential for building modern AI systems and passing the Claude Certified Architect certification.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>architecture</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Claude Agentic Loop Explained: Guide to stop_reason, Tool Use, and Claude Agents</title>
      <dc:creator>Subham Kumar</dc:creator>
      <pubDate>Thu, 11 Jun 2026 03:56:48 +0000</pubDate>
      <link>https://dev.to/digital_subham/claude-agentic-loop-explained-guide-to-stopreason-tool-use-and-claude-agents-1p17</link>
      <guid>https://dev.to/digital_subham/claude-agentic-loop-explained-guide-to-stopreason-tool-use-and-claude-agents-1p17</guid>
      <description>&lt;p&gt;If you are learning the Anthropic Claude API, preparing for the Claude Certified Architect exam, or building AI agents, there is one concept you must understand:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Claude Agentic Loop.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At first, terms like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Agentic AI&lt;/li&gt;
&lt;li&gt;Tool Use&lt;/li&gt;
&lt;li&gt;stop_reason&lt;/li&gt;
&lt;li&gt;Claude Agents&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;can feel confusing.&lt;/p&gt;

&lt;p&gt;But don't worry.&lt;/p&gt;

&lt;p&gt;This guide explains everything in very simple language.&lt;/p&gt;

&lt;p&gt;Think of Claude as a smart person.&lt;/p&gt;

&lt;p&gt;A smart person can answer questions.&lt;/p&gt;

&lt;p&gt;But sometimes they need information from somewhere else.&lt;/p&gt;

&lt;p&gt;They may need to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check a database&lt;/li&gt;
&lt;li&gt;Search for information&lt;/li&gt;
&lt;li&gt;Look up an order&lt;/li&gt;
&lt;li&gt;Call another service&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is exactly how Claude agents work.&lt;/p&gt;

&lt;p&gt;By the end of this guide, you will understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What an agentic loop is&lt;/li&gt;
&lt;li&gt;What &lt;code&gt;stop_reason&lt;/code&gt; means&lt;/li&gt;
&lt;li&gt;Difference between &lt;code&gt;tool_use&lt;/code&gt; and &lt;code&gt;end_turn&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;How Claude tools work&lt;/li&gt;
&lt;li&gt;Why Claude API is stateless&lt;/li&gt;
&lt;li&gt;How to build a simple Claude agent&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What Is a Claude Agent?
&lt;/h2&gt;

&lt;p&gt;An AI agent is an AI system that can:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Think&lt;/li&gt;
&lt;li&gt;Decide&lt;/li&gt;
&lt;li&gt;Use tools&lt;/li&gt;
&lt;li&gt;Observe results&lt;/li&gt;
&lt;li&gt;Continue working until a task is complete&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Real-Life Analogy
&lt;/h3&gt;

&lt;p&gt;Imagine a chef.&lt;/p&gt;

&lt;p&gt;The chef is the brain.&lt;/p&gt;

&lt;p&gt;Kitchen tools are the hands.&lt;/p&gt;

&lt;p&gt;The chef decides:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I need a knife."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But the knife does not move by itself.&lt;/p&gt;

&lt;p&gt;Someone must pick it up and use it.&lt;/p&gt;

&lt;p&gt;Similarly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude = Brain&lt;/li&gt;
&lt;li&gt;Tools = Hands&lt;/li&gt;
&lt;li&gt;Your Code = Worker who executes actions&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Chatbot vs Agent
&lt;/h2&gt;

&lt;p&gt;Many beginners think a chatbot and an agent are the same thing.&lt;/p&gt;

&lt;p&gt;They are not.&lt;/p&gt;

&lt;h3&gt;
  
  
  Normal Chatbot
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User asks question
       ↓
Claude answers
       ↓
Conversation ends
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;User:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;What is the capital of India?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Claude:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;New Delhi.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Done.&lt;/p&gt;




&lt;h3&gt;
  
  
  Agent
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User asks question
       ↓
Claude thinks
       ↓
Needs tool?
   /      \
 Yes      No
  ↓        ↓
Use Tool  Final Answer
  ↓
Get Result
  ↓
Think Again
  ↓
Final Answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Where is my order 4821?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude cannot know this information automatically.&lt;/p&gt;

&lt;p&gt;It needs to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use an order lookup tool&lt;/li&gt;
&lt;li&gt;Receive order information&lt;/li&gt;
&lt;li&gt;Generate a final answer&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This process is called an &lt;strong&gt;Agentic Loop&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is a Claude Agentic Loop?
&lt;/h2&gt;

&lt;p&gt;The Claude Agentic Loop is the repeated process where Claude:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Receives a request&lt;/li&gt;
&lt;li&gt;Thinks about it&lt;/li&gt;
&lt;li&gt;Decides whether a tool is needed&lt;/li&gt;
&lt;li&gt;Uses a tool if required&lt;/li&gt;
&lt;li&gt;Receives the result&lt;/li&gt;
&lt;li&gt;Thinks again&lt;/li&gt;
&lt;li&gt;Returns the final answer&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Flow Diagram
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Request
      ↓
Claude Reasons
      ↓
Need Tool?
   /      \
 Yes      No
  ↓        ↓
Tool Call  Final Answer
  ↓
Tool Result
  ↓
Claude Reasons Again
  ↓
Final Answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This loop continues until Claude decides the task is complete.&lt;/p&gt;




&lt;h2&gt;
  
  
  Understanding Conversation Roles
&lt;/h2&gt;

&lt;p&gt;Claude conversations contain roles.&lt;/p&gt;

&lt;h3&gt;
  
  
  System Role
&lt;/h3&gt;

&lt;p&gt;The system role defines Claude's behavior.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are a helpful customer support agent.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Think of it as Claude's job description.&lt;/p&gt;




&lt;h3&gt;
  
  
  User Role
&lt;/h3&gt;

&lt;p&gt;Represents messages from the human.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Where is my order?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Assistant Role
&lt;/h3&gt;

&lt;p&gt;Represents Claude's responses.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;assistant&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;I can help with that.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Why Roles Matter
&lt;/h2&gt;

&lt;p&gt;Think of a play.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;System = Director
User = Customer
Assistant = Claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each role has a different responsibility.&lt;/p&gt;

&lt;p&gt;Claude uses these roles to understand context.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is stop_reason?
&lt;/h2&gt;

&lt;p&gt;This is one of the most important concepts in Claude agent development.&lt;/p&gt;

&lt;h3&gt;
  
  
  Simple Definition
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;stop_reason&lt;/code&gt; tells your application:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Why Claude stopped generating the current response.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Your code should always check it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Important stop_reason Values
&lt;/h2&gt;

&lt;h3&gt;
  
  
  tool_use
&lt;/h3&gt;

&lt;p&gt;Meaning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I need a tool.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude is asking your application to execute a tool.&lt;/p&gt;

&lt;p&gt;Claude does not execute tools itself.&lt;/p&gt;

&lt;p&gt;Your code must do it.&lt;/p&gt;




&lt;h3&gt;
  
  
  end_turn
&lt;/h3&gt;

&lt;p&gt;Meaning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I am finished.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude is telling your application:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The task is complete.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The agent loop should stop.&lt;/p&gt;




&lt;h2&gt;
  
  
  tool_use vs end_turn
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;stop_reason&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;tool_use&lt;/td&gt;
&lt;td&gt;Claude needs a tool&lt;/td&gt;
&lt;td&gt;Execute tool and continue&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;end_turn&lt;/td&gt;
&lt;td&gt;Claude is finished&lt;/td&gt;
&lt;td&gt;Stop the loop&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Easy Memory Trick
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tool_use  = Continue Working
end_turn  = Stop Working
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Simple Order Lookup Example
&lt;/h2&gt;

&lt;p&gt;Suppose a user asks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Where is my order 4821?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude identifies that this is an order lookup request.&lt;/p&gt;

&lt;p&gt;Claude requests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lookup_order
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude returns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stop_reason = tool_use
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your application executes the tool.&lt;/p&gt;

&lt;p&gt;Tool returns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Status: Shipped
Carrier: DHL
Delivery: Tomorrow
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude receives the result and generates:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your order has been shipped and will arrive tomorrow.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now Claude returns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stop_reason = end_turn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The loop stops.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Claude API Is Stateless
&lt;/h2&gt;

&lt;p&gt;Another very important concept.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Does Stateless Mean?
&lt;/h3&gt;

&lt;p&gt;Stateless means:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Claude does not automatically remember previous API calls.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every request starts fresh.&lt;/p&gt;




&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;

&lt;p&gt;First API request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;My name is Akash.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Second API request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;What is my name?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude will not know unless the first message is included again.&lt;/p&gt;




&lt;h1&gt;
  
  
  Maintaining Conversation History
&lt;/h1&gt;

&lt;p&gt;You must send previous messages every time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;messages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;My name is Akash&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;assistant&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Nice to meet you Akash&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What is my name?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now Claude has context.&lt;/p&gt;




&lt;h2&gt;
  
  
  Defining a Tool
&lt;/h2&gt;

&lt;p&gt;Let's create a simple tool.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;lookup_order_tool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;lookup_order&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Look up order information&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input_schema&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;object&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;properties&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;order_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;string&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Line-by-Line Explanation
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Name
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;lookup_order&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The tool identifier.&lt;/p&gt;

&lt;p&gt;Claude uses this name when requesting the tool.&lt;/p&gt;

&lt;h3&gt;
  
  
  Description
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Look up order information&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Helps Claude understand when to use the tool.&lt;/p&gt;

&lt;h4&gt;
  
  
  Input Schema
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input_schema&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Defines the expected inputs.&lt;/p&gt;

&lt;h4&gt;
  
  
  order_id
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;order_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The order number provided by the user.&lt;/p&gt;




&lt;h2&gt;
  
  
  Claude Does Not Execute Functions
&lt;/h2&gt;

&lt;p&gt;Many beginners assume Claude can run Python code.&lt;/p&gt;

&lt;p&gt;It cannot.&lt;/p&gt;

&lt;p&gt;Claude only requests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Please call lookup_order
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your application executes the function.&lt;/p&gt;




&lt;h2&gt;
  
  
  Tool Function Example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;## Simple mock database lookup
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lookup_order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;4821&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;status&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Shipped&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;carrier&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DHL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Order not found&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Explanation
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Create Function
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lookup_order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Creates the tool function.&lt;/p&gt;

&lt;h4&gt;
  
  
  Mock Database
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stores sample order information.&lt;/p&gt;

&lt;h4&gt;
  
  
  Order Details
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;4821&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;status&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Shipped&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sample data.&lt;/p&gt;

&lt;h4&gt;
  
  
  Return Result
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Order not found&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Returns matching order details.&lt;/p&gt;




&lt;h2&gt;
  
  
  Building the Agent Loop
&lt;/h2&gt;

&lt;p&gt;A simplified example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;call_claude&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stop_reason&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;end_turn&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stop_reason&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tool_use&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;execute_tool&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Line-by-Line Explanation
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Infinite Loop
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Continue until Claude finishes.&lt;/p&gt;

&lt;h4&gt;
  
  
  Call Claude
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;call_claude&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Send conversation history.&lt;/p&gt;

&lt;h4&gt;
  
  
  Check Completion
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stop_reason&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;end_turn&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude is finished.&lt;/p&gt;

&lt;h4&gt;
  
  
  Stop Loop
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;break&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Exit the loop.&lt;/p&gt;

&lt;h4&gt;
  
  
  Check Tool Request
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stop_reason&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tool_use&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude needs a tool.&lt;/p&gt;

&lt;h4&gt;
  
  
  Execute Tool
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;execute_tool&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the requested tool.&lt;/p&gt;

&lt;h4&gt;
  
  
  Save Tool Result
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add result back to the conversation history.&lt;/p&gt;




&lt;h2&gt;
  
  
  Correct Message Order
&lt;/h2&gt;

&lt;p&gt;Always follow this order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Question
      ↓
Assistant Tool Request
      ↓
Tool Result
      ↓
Assistant Final Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This order is important because Claude needs the complete context.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real-World Example
&lt;/h2&gt;

&lt;p&gt;Imagine a travel booking agent.&lt;/p&gt;

&lt;p&gt;User:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Book me a flight from India to Australia.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude may:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Search flights&lt;/li&gt;
&lt;li&gt;Compare prices&lt;/li&gt;
&lt;li&gt;Select best option&lt;/li&gt;
&lt;li&gt;Book ticket&lt;/li&gt;
&lt;li&gt;Generate confirmation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is agentic behavior.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Tool Selection Should Be Model-Driven
&lt;/h2&gt;

&lt;p&gt;Bad approach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Always call Tool A
Always call Tool B
Always call Tool C
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Expensive&lt;/li&gt;
&lt;li&gt;Inflexible&lt;/li&gt;
&lt;li&gt;Unnecessary&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Better approach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Provide available tools
Let Claude decide
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is what makes a system agentic.&lt;/p&gt;




&lt;h2&gt;
  
  
  Common Mistakes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Mistake 1: Reading Claude's Words Instead of stop_reason
&lt;/h3&gt;

&lt;p&gt;Bad:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;done&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stop_reason&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;end_turn&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Mistake 2: Using Loop Count as Main Exit Condition
&lt;/h3&gt;

&lt;p&gt;Bad:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;iteration&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stop_reason&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;end_turn&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Mistake 3: Forgetting Conversation History
&lt;/h3&gt;

&lt;p&gt;Without history, Claude loses context.&lt;/p&gt;

&lt;p&gt;Always maintain the messages array.&lt;/p&gt;




&lt;h3&gt;
  
  
  Mistake 4: Assuming Claude Executes Tools
&lt;/h3&gt;

&lt;p&gt;Claude only requests tools.&lt;/p&gt;

&lt;p&gt;Your application executes them.&lt;/p&gt;




&lt;h3&gt;
  
  
  Mistake 5: Wrong Message Order
&lt;/h3&gt;

&lt;p&gt;Always append:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Assistant Tool Request
       ↓
Tool Result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;in that sequence.&lt;/p&gt;




&lt;h2&gt;
  
  
  Claude Certified Architect Exam Tips
&lt;/h2&gt;

&lt;p&gt;Remember these facts:&lt;/p&gt;

&lt;h4&gt;
  
  
  Fact 1
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tool_use = Continue Loop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Fact 2
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;end_turn = Stop Loop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Fact 3
&lt;/h4&gt;

&lt;p&gt;Claude API is stateless.&lt;/p&gt;

&lt;h4&gt;
  
  
  Fact 4
&lt;/h4&gt;

&lt;p&gt;Always send full conversation history.&lt;/p&gt;

&lt;h4&gt;
  
  
  Fact 5
&lt;/h4&gt;

&lt;p&gt;Claude chooses tools.&lt;/p&gt;

&lt;h4&gt;
  
  
  Fact 6
&lt;/h4&gt;

&lt;p&gt;Your code executes tools.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Claude agents can think, use tools, and continue working until a task is complete.&lt;/li&gt;
&lt;li&gt;The repeated cycle is called an Agentic Loop.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;stop_reason&lt;/code&gt; tells your application why Claude stopped.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tool_use&lt;/code&gt; means execute a tool and continue.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;end_turn&lt;/code&gt; means stop the loop.&lt;/li&gt;
&lt;li&gt;Claude does not execute tools directly.&lt;/li&gt;
&lt;li&gt;Your application executes tools.&lt;/li&gt;
&lt;li&gt;Claude API is stateless.&lt;/li&gt;
&lt;li&gt;Always send conversation history with every request.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is a Claude Agentic Loop?
&lt;/h3&gt;

&lt;p&gt;A repeated cycle where Claude reasons, requests tools, receives results, and completes a task.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does tool_use mean?
&lt;/h3&gt;

&lt;p&gt;Claude wants your application to execute a tool.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does end_turn mean?
&lt;/h3&gt;

&lt;p&gt;Claude has finished and the loop should stop.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does Claude execute Python functions?
&lt;/h3&gt;

&lt;p&gt;No. Claude only requests tool calls.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why is Claude API stateless?
&lt;/h3&gt;

&lt;p&gt;Because it does not automatically remember previous API requests.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the difference between a chatbot and an agent?
&lt;/h3&gt;

&lt;p&gt;A chatbot answers and stops. An agent can use tools and continue working.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I stop when Claude says "I'm done"?
&lt;/h3&gt;

&lt;p&gt;No. Use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stop_reason&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;end_turn&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why is stop_reason important?
&lt;/h3&gt;

&lt;p&gt;It is the official mechanism for controlling Claude agent loops.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The foundation of modern Claude agents is the &lt;strong&gt;Agentic Loop&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Claude can decide when it needs tools, request them, receive results, and continue reasoning until the task is complete.&lt;/p&gt;

&lt;p&gt;The key signal controlling this process is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stop_reason
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tool_use = Continue
end_turn = Stop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you understand these concepts, you will have a strong foundation for building Claude agents and preparing for the Claude Certified Architect certification.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>api</category>
      <category>claude</category>
    </item>
    <item>
      <title>26. Remove Duplicates from Sorted Array</title>
      <dc:creator>Subham Kumar</dc:creator>
      <pubDate>Thu, 27 Nov 2025 17:03:07 +0000</pubDate>
      <link>https://dev.to/digital_subham/26-remove-duplicates-from-sorted-array-33ah</link>
      <guid>https://dev.to/digital_subham/26-remove-duplicates-from-sorted-array-33ah</guid>
      <description>&lt;p&gt;Given an integer array nums &lt;strong&gt;sorted in non-decreasing order&lt;/strong&gt;, remove the duplicates &lt;strong&gt;in-place&lt;/strong&gt; such that each unique element appears only once. The &lt;strong&gt;relative order&lt;/strong&gt; of the elements should be kept the same.&lt;/p&gt;

&lt;p&gt;Consider the number of unique elements in nums to be k​​​​​​​​​​​​​​. After removing duplicates, return the &lt;strong&gt;number of unique elements&lt;/strong&gt; k.&lt;/p&gt;

&lt;p&gt;The first k elements of nums should contain the &lt;strong&gt;unique numbers in sorted order&lt;/strong&gt;. The remaining elements beyond index k - 1 can be ignored.&lt;/p&gt;

&lt;p&gt;Input: nums = [1,1,2]&lt;br&gt;
Output: 2, nums = [1,2,_]&lt;br&gt;
Explanation: Your function should return k = 2, with the first two elements of nums being 1 and 2 respectively.&lt;br&gt;
It does not matter what you leave beyond the returned k (hence they are underscores).&lt;/p&gt;
&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;So the array is sorted, means numbers are in increasing order but duplicates can be there like [0,0,1,1,2,2].&lt;/p&gt;

&lt;p&gt;The question says remove duplicates in place, which basically means we don’t create new array.&lt;br&gt;
We just take the same array and push all unique values to the front.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My way to think is very simple:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Take two variables&lt;/li&gt;
&lt;li&gt;x stays at the place where the last unique element is&lt;/li&gt;
&lt;li&gt;i runs the whole array&lt;/li&gt;
&lt;li&gt;whenever I find a value bigger than nums[x], that means it’s a new unique value&lt;/li&gt;
&lt;li&gt;so I increase x and put that value at nums[x]&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s it.&lt;/p&gt;

&lt;p&gt;Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var removeDuplicates = function(nums) {
    let x = 0
    for(let i = 0 ; i &amp;lt; nums.length; i++){
        if(nums[x] &amp;lt; nums[i]){
            x = x + 1
            nums[x] = nums[i]
        }
    }
    return x + 1
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now why x + 1?&lt;/p&gt;

&lt;p&gt;Because x is index.&lt;br&gt;
Index starts from 0.&lt;br&gt;
But the answer they want is count of unique values.&lt;br&gt;
So if last unique element is at index 2, then total unique are 3 → that’s why x + 1.&lt;/p&gt;

&lt;p&gt;This is literally the whole logic. Simple two-pointer trick. If you want I can also explain the dry-run in the same simple tone.&lt;/p&gt;

&lt;p&gt;Similar to this question there is one more question can solve to get better at it.&lt;/p&gt;

&lt;h2&gt;
  
  
  leetCode Question no 27.
&lt;/h2&gt;

&lt;p&gt;Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the elements may be changed. Then return the number of elements in nums which are not equal to val.&lt;/p&gt;

&lt;p&gt;Consider the number of elements in nums which are not equal to val be k, to get accepted, you need to do the following things:&lt;/p&gt;

&lt;p&gt;Change the array nums such that the first k elements of nums contain the elements which are not equal to val. The remaining elements of nums are not important as well as the size of nums.&lt;br&gt;
Return k.&lt;/p&gt;

&lt;p&gt;Input: nums = [3,2,2,3], val = 3&lt;br&gt;
Output: 2, nums = [2,2,&lt;em&gt;,&lt;/em&gt;]&lt;br&gt;
Explanation: Your function should return k = 2, with the first two elements of nums being 2.&lt;br&gt;
It does not matter what you leave beyond the returned k (hence they are underscores).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftjr45m9qsbeb8s4yc05g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftjr45m9qsbeb8s4yc05g.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>coding</category>
      <category>interview</category>
      <category>leetcode</category>
    </item>
    <item>
      <title>How to Update a React Native App Without Play Store (Using Google Drive + JSON)</title>
      <dc:creator>Subham Kumar</dc:creator>
      <pubDate>Fri, 21 Nov 2025 03:12:38 +0000</pubDate>
      <link>https://dev.to/digital_subham/how-to-update-a-react-native-app-without-play-store-using-google-drive-json-2id6</link>
      <guid>https://dev.to/digital_subham/how-to-update-a-react-native-app-without-play-store-using-google-drive-json-2id6</guid>
      <description>&lt;p&gt;Publishing an Android app on the Play Store takes time.&lt;br&gt;
But what if you want to share your app immediately with your users and still push updates easily?&lt;/p&gt;

&lt;p&gt;Good news:&lt;br&gt;
You can build your own mini update system without any server — just using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Google Drive&lt;/li&gt;
&lt;li&gt;One JSON file&lt;/li&gt;
&lt;li&gt;One APK file&lt;/li&gt;
&lt;li&gt;A few lines of React Native code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this article i will explains the whole process step-by-step in a clean, simple way.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why Do We Need This?
&lt;/h2&gt;

&lt;p&gt;When you distribute your app as an APK (e.g., via Google Drive, WhatsApp, Telegram), users will install it once.&lt;/p&gt;

&lt;p&gt;But what happens when you release a new version?&lt;/p&gt;

&lt;p&gt;They don’t automatically know.&lt;/p&gt;

&lt;p&gt;So we create a small, smart system where:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You upload a new APK to Google Drive&lt;/li&gt;
&lt;li&gt;You update a JSON file on Google Drive&lt;/li&gt;
&lt;li&gt;Your app checks the JSON every time it opens&lt;/li&gt;
&lt;li&gt;If a new version is available → show update popup&lt;/li&gt;
&lt;li&gt;User downloads &amp;amp; installs the latest APK&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This feels like a real update system — but without servers or Play Store.&lt;/p&gt;
&lt;h2&gt;
  
  
  How the System Works
&lt;/h2&gt;

&lt;p&gt;Think of your app as a student.&lt;br&gt;
Think of your JSON file as the teacher.&lt;/p&gt;

&lt;p&gt;Every time the app opens, it asks:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Teacher, what’s the latest version?&lt;br&gt;
The JSON replies:&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "latestVersion": "1.0.5",
  "downloadUrl": "YOUR_APK_LINK"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your app compares:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Installed version (e.g., 1.0.0)&lt;/li&gt;
&lt;li&gt;Latest version from JSON (e.g., 1.0.5)&lt;/li&gt;
&lt;li&gt;If JSON version is higher → app shows an Update alert.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s it!&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1 — Create a JSON File on Google Drive
&lt;/h2&gt;

&lt;p&gt;Make a file: update.json&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "latestVersion": "1.0.5",
  "changelog": "• Faster performance\n• Bug fixes\n• Small UI changes",
  "downloadUrl": "https://drive.google.com/uc?export=download&amp;amp;id=APK_FILE_ID",
  "forceUpdate": false
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Upload to Google Drive → Right-click → Share →&lt;br&gt;
Anyone with link → Viewer&lt;/p&gt;

&lt;p&gt;Now convert the Drive URL:&lt;br&gt;
Example Drive link:&lt;br&gt;
&lt;code&gt;https://drive.google.com/file/d/1abcXYZ/view?usp=sharing&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Direct JSON link:&lt;br&gt;
&lt;code&gt;https://drive.google.com/uc?export=download&amp;amp;id=1abcXYZ&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Save this — your app will fetch this URL.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 2 — Update Version in Your React Native App
&lt;/h2&gt;

&lt;p&gt;Go to:&lt;br&gt;
&lt;code&gt;android/app/build.gradle&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Update:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;versionCode 2
versionName "1.0.1"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Always increase versionCode before building a new APK.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 — React Native Code to Check for Updates
&lt;/h2&gt;

&lt;p&gt;Use this code in App.js or your root screen:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Alert, Linking } from "react-native";
import DeviceInfo from "react-native-device-info";
import { useEffect } from "react";

const CHECK_URL = "https://drive.google.com/uc?export=download&amp;amp;id=YOUR_JSON_ID";

export default function App() {

  useEffect(() =&amp;gt; {
    checkForUpdate();
  }, []);

  async function checkForUpdate() {
    try {
      const response = await fetch(CHECK_URL);
      const data = await response.json();

      const current = DeviceInfo.getVersion();
      const latest = data.latestVersion;

      if (isUpdateNeeded(current, latest)) {
        Alert.alert(
          "Update Available",
          data.changelog,
          [
            { text: "Update", onPress: () =&amp;gt; Linking.openURL(data.downloadUrl) },
            { text: "Later", style: "cancel" }
          ]
        );
      }
    } catch (err) {
      console.log("Failed to check update:", err);
    }
  }

  function isUpdateNeeded(current, latest) {
    const c = current.split('.').map(Number);
    const l = latest.split('.').map(Number);

    for (let i = 0; i &amp;lt; 3; i++) {
      if ((l[i] || 0) &amp;gt; (c[i] || 0)) return true;
      if ((l[i] || 0) &amp;lt; (c[i] || 0)) return false;
    }
    return false;
  }

  return (
    // Your app UI
  );
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4 — What Happens When New APK Is Released?
&lt;/h2&gt;

&lt;p&gt;Whenever you upload a new APK:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Upload new APK to Google Drive&lt;/li&gt;
&lt;li&gt;Get direct APK link:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;https://drive.google.com/uc?export=download&amp;amp;id=APK_ID&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
**&lt;br&gt;
Update JSON:&lt;br&gt;
**&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "latestVersion": "1.0.6",
  "downloadUrl": "NEW_APK_LINK",
  "changelog": "New features added"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once JSON is updated → All users get update popup next time they open the app.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Update JSON on Google Drive (Correct Method)
&lt;/h2&gt;

&lt;p&gt;There are two correct ways, and you should pick only ONE:&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;METHOD 1: Replace the JSON File (BEST &amp;amp; EASIEST)&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
If you replace the file using Google Drive’s “Manage versions”, then:&lt;/p&gt;

&lt;p&gt;The public link stays the same&lt;/p&gt;

&lt;p&gt;Your app will always get the newest JSON file&lt;/p&gt;

&lt;p&gt;You don’t need to recreate the link ever again&lt;/p&gt;

&lt;h3&gt;
  
  
  Steps
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to Google Drive&lt;/li&gt;
&lt;li&gt;Right-click your JSON file&lt;/li&gt;
&lt;li&gt;Manage versions&lt;/li&gt;
&lt;li&gt;Click Upload New Version&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Upload the updated JSON file&lt;/p&gt;

&lt;p&gt;Done (The link remains same → app fetches updated JSON automatically)&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;METHOD 2: Upload New JSON &amp;amp; Update the FILE_ID&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you upload a brand-new JSON file instead of replacing:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Google Drive creates a new File ID (ID changes)&lt;/li&gt;
&lt;li&gt;Your app will continue reading the OLD JSON&lt;/li&gt;
&lt;li&gt;You must update FILE_ID in the app&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;BTW I never used 2nd method.&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>tutorial</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>Complete Guide: Setting up React Native CLI for Android on macOS (2026 Edition)</title>
      <dc:creator>Subham Kumar</dc:creator>
      <pubDate>Thu, 30 Oct 2025 03:38:06 +0000</pubDate>
      <link>https://dev.to/digital_subham/complete-guide-setting-up-react-native-cli-for-android-on-macos-2025-edition-58h3</link>
      <guid>https://dev.to/digital_subham/complete-guide-setting-up-react-native-cli-for-android-on-macos-2025-edition-58h3</guid>
      <description>&lt;p&gt;If you’re on macOS and want to develop React Native apps using the CLI (not Expo), this guide walks you through everything — from installing Java to running your first Android emulator and building an APK.&lt;/p&gt;

&lt;p&gt;`🧩 Prerequisites&lt;/p&gt;

&lt;p&gt;You’ll need:&lt;/p&gt;

&lt;p&gt;macOS (Intel or Apple Silicon)&lt;/p&gt;

&lt;p&gt;Node.js &amp;amp; npm installed&lt;/p&gt;

&lt;p&gt;Terminal (zsh or bash)`&lt;/p&gt;

&lt;p&gt;⚙️ Step 1 — Install Watchman&lt;/p&gt;

&lt;p&gt;Watchman is a file watcher used by React Native to track code changes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install watchman
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify installation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;watchman --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2 — Install OpenJDK 17 (via Zulu)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install --cask zulu@17
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;React Native requires Java for Android builds.&lt;br&gt;
The Zulu distribution is stable and widely recommended.&lt;/p&gt;

&lt;p&gt;Verify:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; java -version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see:&lt;br&gt;
&lt;code&gt;openjdk version "17.0.17" 2025-10-21 LTS&lt;br&gt;
OpenJDK Runtime Environment Zulu17.62+17-CA&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Step 3 — Install React Native CLI&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g react-native-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;react-native --version&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Step 4 — Install Android Studio (Recommended)&lt;/p&gt;

&lt;p&gt;Although you can install SDKs manually, using Android Studio is the easiest and most reliable way.&lt;/p&gt;

&lt;p&gt;Option 1 (Recommended UI method)&lt;br&gt;
Download from&lt;br&gt;
👉 &lt;a href="https://developer.android.com/studio" rel="noopener noreferrer"&gt;https://developer.android.com/studio&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Choose the macOS (Apple Silicon or Intel) version.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open .dmg → drag Android Studio to Applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Launch it → follow the Standard installation wizard.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;It will install:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Android SDK&lt;/li&gt;
&lt;li&gt;Platform Tools (adb)&lt;/li&gt;
&lt;li&gt;Emulator&lt;/li&gt;
&lt;li&gt;Build Tools&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Accept all SDK licenses when prompted.&lt;/p&gt;

&lt;p&gt;Option 2: Install Android Studio via Homebrew Cask (semi-automated)&lt;/p&gt;

&lt;p&gt;You can install the Android Studio app itself using Homebrew, but you’ll still need to open it once to complete SDK &amp;amp; emulator setup.&lt;/p&gt;

&lt;p&gt;Steps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install --cask android-studio

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then open it once:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;open -a "Android Studio"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside the Android Studio UI:&lt;/p&gt;

&lt;p&gt;Choose Standard Installation&lt;/p&gt;

&lt;p&gt;Accept all SDK licenses&lt;/p&gt;

&lt;p&gt;Wait for SDK, Platform Tools, and Emulator to install&lt;/p&gt;

&lt;p&gt;After that, you can manage SDKs &amp;amp; virtual devices (AVDs) from command line later&lt;/p&gt;

&lt;p&gt;Step 5 — Confirm SDK Location&lt;/p&gt;

&lt;p&gt;Open Android Studio →&lt;br&gt;
Preferences → Appearance &amp;amp; Behavior → System Settings → Android SDK&lt;/p&gt;

&lt;p&gt;You’ll see something like:&lt;br&gt;
&lt;code&gt;/Users/&amp;lt;your-username&amp;gt;/Library/Android/sdk&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
That’s your $ANDROID_HOME.&lt;/p&gt;

&lt;p&gt;🌿 Step 6 — Add Environment Variables&lt;/p&gt;

&lt;p&gt;Open Terminal and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo 'export ANDROID_HOME=$HOME/Library/Android/sdk' &amp;gt;&amp;gt; ~/.zshrc
echo 'export PATH=$PATH:$ANDROID_HOME/emulator' &amp;gt;&amp;gt; ~/.zshrc
echo 'export PATH=$PATH:$ANDROID_HOME/platform-tools' &amp;gt;&amp;gt; ~/.zshrc
echo 'export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin' &amp;gt;&amp;gt; ~/.zshrc
source ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo $ANDROID_HOME
adb --version
sdkmanager --list | head
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 7 — Create an Android Emulator&lt;/p&gt;

&lt;p&gt;Open Android Studio → Tools → Device Manager → Create Device&lt;br&gt;
Then:&lt;/p&gt;

&lt;p&gt;Select a Pixel device (e.g. Pixel 7)&lt;/p&gt;

&lt;p&gt;Choose a system image (Android 13 or 14 recommended)&lt;/p&gt;

&lt;p&gt;Download → Next → Finish&lt;/p&gt;

&lt;p&gt;Click ▶️ (Play) to launch the emulator&lt;/p&gt;

&lt;p&gt;Once it boots up, verify via terminal:&lt;br&gt;
&lt;code&gt;adb devices&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
✅ You should see:&lt;br&gt;
&lt;code&gt;emulator-5554   device&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Step 8 — Run Your React Native App&lt;br&gt;
Inside your project folder:&lt;/p&gt;

&lt;p&gt;cd your-project&lt;br&gt;
npx react-native run-android&lt;/p&gt;

&lt;p&gt;This will:&lt;/p&gt;

&lt;p&gt;Build the app using Gradle&lt;/p&gt;

&lt;p&gt;Install it on your running emulator&lt;/p&gt;

&lt;p&gt;Launch it automatically 🎉&lt;/p&gt;

&lt;p&gt;To generate an APK file:&lt;br&gt;
&lt;code&gt;cd android&lt;br&gt;
./gradlew assembleDebug&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You’ll find your APK here:&lt;br&gt;
&lt;code&gt;android/app/build/outputs/apk/debug/app-debug.apk&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can install it on any Android phone:&lt;br&gt;
&lt;code&gt;adb install app-debug.apk&lt;/code&gt;&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>cli</category>
      <category>android</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>A Curated Guide to Frontend System Design: Essential Concepts and Topics</title>
      <dc:creator>Subham Kumar</dc:creator>
      <pubDate>Sun, 07 Jul 2024 10:50:56 +0000</pubDate>
      <link>https://dev.to/digital_subham/a-curated-guide-to-frontend-system-design-essential-concepts-and-topics-n2i</link>
      <guid>https://dev.to/digital_subham/a-curated-guide-to-frontend-system-design-essential-concepts-and-topics-n2i</guid>
      <description>&lt;p&gt;In today's tech landscape, mastering system design is crucial for cracking coding interviews and advancing your career. This guide covers key areas and concepts essential for frontend system design.&lt;/p&gt;

&lt;p&gt;But thinking of what to study in system design is very confusing there are lots of thing that comes inside it.&lt;/p&gt;

&lt;p&gt;so i google it and created a list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mastering Frontend System Design: A Comprehensive Guide
&lt;/h2&gt;

&lt;p&gt;In today's tech landscape, mastering system design is crucial for cracking coding interviews and advancing your career. This guide covers key areas and concepts essential for frontend system design.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Areas in System Design
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Networking&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How the Web Works&lt;/strong&gt;: Understand the fundamentals of how data travels across the web.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Communication Protocols&lt;/strong&gt;: Learn about HTTP, HTTPS, and other protocols that enable web communication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;REST APIs&lt;/strong&gt;: Explore REST principles for building scalable web services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GraphQL&lt;/strong&gt;: Discover how GraphQL allows for more efficient and flexible data queries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;gRPC&lt;/strong&gt;: Investigate gRPC for high-performance remote procedure calls.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Communication&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Short Polling&lt;/strong&gt;: Poll the server at regular intervals for updates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Long Polling&lt;/strong&gt;: Maintain a connection until the server has new information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web Sockets&lt;/strong&gt;: Enable real-time, bidirectional communication between client and server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server-Side Events&lt;/strong&gt;: Push updates from the server to the client over a single connection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web Hooks&lt;/strong&gt;: Set up HTTP callbacks to notify external systems of events.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;XSS (Cross-Site Scripting)&lt;/strong&gt;: Protect against malicious scripts injected into web pages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;iFrame Protection&lt;/strong&gt;: Prevent clickjacking and other iFrame-based attacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Headers&lt;/strong&gt;: Use HTTP headers to enhance security measures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client-Side Security&lt;/strong&gt;: Safeguard data and interactions on the client side.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secure Communication (HTTPS)&lt;/strong&gt;: Encrypt data in transit to protect against interception.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dependency Security&lt;/strong&gt;: Manage and secure third-party dependencies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compliance and Regulations&lt;/strong&gt;: Adhere to legal and industry standards.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Input Validation and Sanitization&lt;/strong&gt;: Ensure input data is clean and safe.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSRF (Server-Side Request Forgery)&lt;/strong&gt;: Mitigate attacks where the server makes unintended requests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feature Policy&lt;/strong&gt;: Control which web features can be used in your application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server-Side JavaScript Injection&lt;/strong&gt;: Prevent unauthorized code execution on the server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SRI (Subresource Integrity)&lt;/strong&gt;: Verify the integrity of resources loaded externally.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CORS (Cross-Origin Resource Sharing)&lt;/strong&gt;: Manage cross-origin requests securely.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CSRF (Cross-Site Request Forgery)&lt;/strong&gt;: Protect against unauthorized actions on behalf of a user.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Testing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unit and Integration Testing&lt;/strong&gt;: Test individual units and their integration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;E2E and Automation Testing&lt;/strong&gt;: Perform end-to-end tests to simulate real user interactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A/B Testing&lt;/strong&gt;: Compare two versions of a webpage to determine which performs better.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance Testing&lt;/strong&gt;: Measure the responsiveness and stability of your application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test-Driven Development&lt;/strong&gt;: Write tests before coding to ensure functionality.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Testing&lt;/strong&gt;: Assess the security of your application against vulnerabilities.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Performance&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Performance Overview&lt;/strong&gt;: Understand the key aspects of web performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance Importance&lt;/strong&gt;: Learn why performance matters for user experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance Monitoring&lt;/strong&gt;: Continuously track performance metrics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance Tools&lt;/strong&gt;: Use tools to diagnose and fix performance issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rendering Patterns&lt;/strong&gt;: Optimize how content is rendered on the screen.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Database &amp;amp; Caching&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Local Storage&lt;/strong&gt;: Store data locally within the user's browser.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Session Storage&lt;/strong&gt;: Keep data available for the duration of the page session.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cookie Storage&lt;/strong&gt;: Use cookies to store small amounts of data persistently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IndexedDB&lt;/strong&gt;: Utilize a low-level API for large-scale storage in the browser.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Normalization&lt;/strong&gt;: Structure your database to reduce redundancy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTP Caching&lt;/strong&gt;: Cache HTTP responses to improve load times.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Service Worker Caching&lt;/strong&gt;: Use service workers for offline capabilities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Caching&lt;/strong&gt;: Cache API responses to reduce load on servers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State Management&lt;/strong&gt;: Manage the state of your application efficiently.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Logging and Monitoring&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Telemetry&lt;/strong&gt;: Collect and analyze data about application usage and performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alerting&lt;/strong&gt;: Set up alerts for critical issues and performance degradation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fixing Issues&lt;/strong&gt;: Identify and resolve issues based on logs and monitoring data.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Accessibility&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Keyboard Accessibility&lt;/strong&gt;: Ensure all functionality is accessible via keyboard.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Screen Reader&lt;/strong&gt;: Support screen readers for visually impaired users.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Focus Management&lt;/strong&gt;: Manage focus order for a seamless user experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Color Contrast&lt;/strong&gt;: Maintain sufficient contrast for readability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accessibility Tools&lt;/strong&gt;: Use tools to identify and fix accessibility issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fixing Accessibility Issues&lt;/strong&gt;: Implement fixes to improve accessibility compliance.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Detailed Design Concepts
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Low-Level Design (LLD)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Component Design&lt;/strong&gt;: Design reusable and modular UI components.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Config-Driven UI&lt;/strong&gt;: Create UIs driven by configuration data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shimmer UI&lt;/strong&gt;: Implement loading animations to enhance user experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Routing &amp;amp; Protected Routes&lt;/strong&gt;: Manage navigation and protect routes in your app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State Management + Libraries&lt;/strong&gt;: Handle application state using libraries like Redux.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-Language Support&lt;/strong&gt;: Support multiple languages in your application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infinite Scroll&lt;/strong&gt;: Load content dynamically as the user scrolls.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accordion&lt;/strong&gt;: Implement collapsible sections for content organization.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nested Comments&lt;/strong&gt;: Design a system for threaded comments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image Slider&lt;/strong&gt;: Create interactive image sliders for media content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pagination&lt;/strong&gt;: Divide content into pages for better navigation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real-Time Updates&lt;/strong&gt;: Push updates to the UI in real time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live Chat&lt;/strong&gt;: Implement a live chat feature.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search&lt;/strong&gt;: Build an efficient search functionality.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  High-Level Design (HLD)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Photo Sharing App (Instagram)&lt;/strong&gt;: Design a scalable photo-sharing platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ecommerce App (Amazon, Flipkart)&lt;/strong&gt;: Architect an online shopping system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;News Media Feed (X)&lt;/strong&gt;: Create a news feed system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Video Streaming (Netflix)&lt;/strong&gt;: Design a video streaming service.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Music Streaming (Spotify)&lt;/strong&gt;: Architect a music streaming platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live Commentary (CricBuzz)&lt;/strong&gt;: Build a system for live sports commentary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Email Client (Gmail)&lt;/strong&gt;: Design an email client with advanced features.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Docs&lt;/strong&gt;: Create a collaborative document editing tool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Sheets&lt;/strong&gt;: Architect a collaborative spreadsheet application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Diagram Tools (Excalidraw)&lt;/strong&gt;: Design an interactive diagramming tool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cab Services (Uber, Ola, Rapido)&lt;/strong&gt;: Build a ride-hailing service.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analytics Dashboard (Google Analytics)&lt;/strong&gt;: Create an analytics dashboard.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edtech Platform (Bloom Tuition)&lt;/strong&gt;: Design an online education platform.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;System design is a vast field, but breaking it down into these categories can make it more manageable. Dive into each area, understand the core concepts, and practice designing systems. Happy learning!&lt;/p&gt;

&lt;p&gt;In upcoming articles, I will delve deeper into each topic and provide detailed explanations.&lt;/p&gt;

&lt;p&gt;If there are any topics I haven't listed, please let me know in the comments, and I will update the article accordingly.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>systemdesign</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
