Mark Ku's Blog
Podcast ConversationAI dialogue version of this article · Mandarin audio

Foreword: The Pain Points of Moving from Chatbot to Production-Ready

Having recently used many AI Agent applications on the market and observed the implementations of numerous teams, I've come to a realization: many people have an overly rosy picture of AI Agents, thinking that by simply connecting a Large Language Model (LLM) to a prompt, it can handle everything for us like Jarvis from Iron Man. However, in the process of actual business implementation, we discover that an agent lacking systematization and workflow is essentially just a "randomly adapting chatbot," which is extremely prone to failure in real-world business scenarios.

In a previous article, From Multi-Agent to Vibe Coding: A Practical Reflection, we discussed that while AI is diligent, it may not understand what you're doing. The core reason behind this is the lack of controllable process orchestration. According to industry research, a staggering 78% of Multi-Agent projects end up stuck in the lab, unable to be successfully deployed 6. Many developers adopt a simpler "Bag of Agents" architecture, allowing multiple agents to converse freely, which ironically leads to a 17x multiplicative error effect 6.

To solve this problem, we must understand the core formula for systematizing AI Agents:

Agent=LLM+Memory+Tools+Workflow / Planning\text{Agent} = \text{LLM} + \text{Memory} + \text{Tools} + \text{Workflow / Planning} 3

Here, Workflow plays the role of a "navigation system" and is the key to transforming randomness into high reliability.

Why Intuition-Driven Development Falls Short: The Cost and Execution Gap Between Prototypes and Production-Grade Agents

In the early stages of development, it's easy to create a cool-looking prototype with a simple prompt. But when you try to push it to a production-ready environment, you'll find a massive gap between the two.

First is the cost disparity. It's estimated that developing a proof-of-concept (PoC) prototype might only cost 8,000to8,000 to 35,000 and take 2 to 6 weeks to complete 4. However, the annual cost for a truly production-grade agent with high availability, including maintenance, API consumption, cloud hosting, and continuous optimization, can soar to over 120,000to120,000 to 450,000 per year, a difference of 5 to 10 times 4.

Most people's instinct is that this 5x to 10x gap is spent on the model. It isn't. When we dissect Claude Code's architecture later on, we'll see which layer the money actually burns in.

Second, without workflow management, systems typically encounter the following three major execution pain points in real-world operation 5:

  1. Uncontrollable Execution: The agent can easily fall into an infinite loop or execute tasks in completely unexpected ways, causing API costs to skyrocket.
  2. Unstable Output: The same input can lead to vastly different execution steps and results each time, failing to meet the strict accuracy requirements of enterprise businesses.
  3. Extremely Difficult Debugging: When a task fails, the lack of a clear state and step-by-step records makes it impossible for developers to pinpoint which part of the process went wrong. If you've ever tried to build an AI agent with memory, you'll know how painful debugging can be when state management gets out of control.

To bridge this gap, the industry trend is shifting from dialogue-driven frameworks like CrewAI, which are suitable for rapid validation, to "Graph State Machine" architectures like LangGraph, which offer high control and auditability 2.

📊 A Multi-dimensional Comparison of Prototype vs. Production-Ready Agents

DimensionWithout Systematization/Workflow (Random Chatbot)With Systematization/Workflow (e.g., LangGraph) 12
Task ExecutionLets the LLM improvise, prone to going off-topicDecomposes large goals into an SOP (Directed Acyclic Graph, DAG)
Tool CallingRandomly selects tools, prone to passing incorrect parametersStrictly defines when and how tools are used with input boundaries
Error HandlingFails by getting stuck or giving wrong answersIncludes automatic retries and Human-in-the-loop for verification
State ManagementForgets context, leading to information chaosPrecisely tracks current progress and variables (State)
Development & Maintenance CostLow initial cost (8K8K–35K) 4High operational & maintenance cost (120K120K–450K/year) 4

Classic Case Study: Design Insights from Claude Code's Workflow

To understand how to take workflow implementation to the extreme, we can look at Anthropic's recently launched CLI tool, Claude Code 78.

Many people assume Claude Code is just another terminal tool connected to an LLM. However, a deeper look at its architecture reveals that it is essentially a workflow-driven agent for the programming domain, using a strict SOP to guide the LLM 78.

Loading diagram…

Claude Code's architecture offers several crucial insights 8:

  • Single-threaded Master Loop: It doesn't allow multiple agents to converse randomly. Instead, a master loop firmly controls the execution rhythm, complemented by disciplined tool calls and a planning mechanism similar to a TODO list.
  • Minimalist State and Memory Management: It avoids complex and hard-to-maintain Vector Databases for memory management. Instead, it uses a plain text file, CLAUDE.md, in the project's root directory to record project specifications and the current state. This approach not only makes the state transparent but also achieves an impressive 92% prompt caching reuse rate, significantly reducing API latency and costs.
  • Controlled Parallel Expansion: When extensive code exploration is needed, the master loop parallelly launches sub-agents (up to 7 at a time) to perform specific tasks, then consolidates the results back into the main thread.

This teaches us that a useful agent doesn't require complex black magic, but rather extremely disciplined, clear processes and state control.

Subtract the LLM, and What's Left Is What You're Paying For

After studying Claude Code's architecture, something clicked for me: take the large language model out, and what remains of Claude Code is a human-orchestrated agent purpose-built for one domain, programming.

The rhythm of the master loop, the boundaries of each tool call, the state format of CLAUDE.md, when sub-agents fan out and how many at once, how a TODO gets decomposed, whether a failure is retried: not a single one of these emerged from the model. Every one of them is an SOP that a human sat down and designed, line by line. The model is simply one node placed inside that SOP, handling the part it is best at.

That leads to a conclusion which is easy to overlook: the cost of software development may be falling, but the cost of building a genuinely useful agent is still high.

An agent isn't a replacement for software. It is a layer stacked on top of an existing system workflow. You need the workflow first before there is anything to orchestrate, and the domain knowledge, exception handling, boundary conditions, and acceptance criteria of that workflow are things the model will not figure out for you. This is why the same LangGraph produces a demo in two weeks for one team and six months of work that still can't ship for another. The difference isn't the framework. It's whether the workflow underneath was ever thought through.

Loading diagram…

Look back at the cost table with this lens and it makes sense: 8,000to8,000 to 35,000 buys you "LLM + prompt," while 120,000to120,000 to 450,000 buys the orchestration layer above it. That 5x to 10x gap is spent almost entirely on orchestration, not on the model. Models will only get cheaper (the Asian market section below is the proof), but the orchestration layer is domain-knowledge-intensive engineering. It does not get cheaper just because the model got smarter. If anything, the more a model can do, the more boundaries you have to define.

Implementation Steps: Embedding Agents into Existing Workflows

In real-world enterprise applications, I don't recommend trying to build a fully autonomous agent from scratch at the outset. Instead, embedding agents into existing workflows is currently the most robust approach with the highest ROI (Return on Investment) [14].

Taking my own blog as an example, the generation of audio, video, and podcasts are all automated applications built on existing system processes. We can replace specific nodes within these existing pipelines with AI agents, rather than letting an agent drive the entire process.

Here are the recommended steps for implementing a systematized AI agent:

Step 1: Identify and Target High-ROI Starting Points

Don't try to have AI write an entire book for you. Instead, let it automatically categorize your written articles, generate summaries, or slice long videos into clips. Start by targeting high-repetition tasks with clear boundaries [14].

Step 2: Define States and Boundaries

Use a framework like LangGraph to strictly define the system's state. This is similar to what we discussed in Building a Natural Language BI Reporting System with AI Agents + LangChain, where we must give the LLM strict tool-calling scopes and database boundaries to ensure data security and system stability.

Step 3: Establish Error Handling and Human-in-the-Loop Mechanisms

Design an automatic retry mechanism and introduce Human-in-the-loop checkpoints at critical nodes. As we mentioned in Why I Chose the Supervisor Pattern to Coordinate AI Agents, clear role division and state transitions are essential to truly reduce system randomness.

Here is a Python code example using LangGraph to define a State and a simple workflow (Nodes & Edges):

from typing import Annotated, TypedDict
from langgraph.graph import StateGraph, START, END

# 1. Define the state model (State): shared memory across every node
class AgentState(TypedDict):
    input_query: str
    processed_data: str
    steps_completed: list[str]
    retry_count: int

# 2. Define the nodes: each one is a concrete step in the workflow
def fetch_data_node(state: AgentState):
    print(f"💡 [Node 1] Processing input: {state['input_query']}")
    # Database queries or API calls go here
    return {
        "processed_data": "simulated database content",
        "steps_completed": state["steps_completed"] + ["fetch_data"]
    }

def process_with_llm_node(state: AgentState):
    print("💡 [Node 2] LLM analyzing data and drafting the report...")
    # LLM invocation and prompt handling go here
    return {
        "steps_completed": state["steps_completed"] + ["llm_process"]
    }

# 3. Build the graph state machine
workflow = StateGraph(AgentState)

# Register the nodes
workflow.add_node("fetch_data", fetch_data_node)
workflow.add_node("llm_process", process_with_llm_node)

# 4. Define the edges and the flow
workflow.add_edge(START, "fetch_data")         # start by fetching data
workflow.add_edge("fetch_data", "llm_process") # then hand it to the LLM
workflow.add_edge("llm_process", END)          # done, terminate the run

# Compile the workflow
app = workflow.compile()

# Run it
inputs = {
    "input_query": "Pull yesterday's system operations report",
    "processed_data": "",
    "steps_completed": [],
    "retry_count": 0
}
app.invoke(inputs)

Through this method, we constrain the otherwise uncontrollable LLM calls onto the tracks of a Directed Acyclic Graph (DAG), ensuring that every execution follows the expected SOP.

Trend Watch: The Explosion of Low-Cost Models and Ecosystems in the Asian Market

Besides architectural evolution, we must also pay attention to the cost changes of foundation models. In the Asian market, especially in China's AI ecosystem, the development and explosion of agents have been astonishing 11.

For instance, MiniMax recently launched its M2.5 (a 230B MoE architecture that activates only 10B parameters per inference) and M3 models, specializing in Agentic Reasoning and Tool Calling 910. What's most surprising is their cost-effectiveness, with prices dropping to about $0.15 per million tokens, significantly lower than Claude Opus 10. Such low-cost, high-performance models drastically lower the barrier for enterprises to deploy production-grade agents.

In terms of policy and infrastructure, China has adopted a "deploy first, govern as you go" approach [13]. IDC predicts that by 2026, the number of enterprise AI agents deployed in China will reach 5 million 11. They are even beginning to plan an "Intelligent Internet," including agent registration platforms, digital identities, and interoperability protocols, in an attempt to build a complete agent ecosystem [13]. This means that in the near future, collaboration between agents could become as common as Web APIs are today.

Conclusion: The Long-Term Benefits of Systematization and Next Steps

Systematizing and creating workflows for AI agents requires a higher upfront investment in architectural design and development, but it is the only viable path for commercial deployment. A workflow-driven approach transforms the randomness of LLMs into predictable business value, turning AI from a "toy" that occasionally makes mistakes into a "tool" that can genuinely offload work and boost productivity for enterprises.

Which brings me back to what Claude Code made clear: subtract the large language model and it is a human-orchestrated agent built for one domain, programming. Models will keep getting cheaper and stronger, but the judgment calls, when to stop, how to back out of a failure, what the state should look like, which step must carry a human signature, remain human engineering. The cost of software development is falling. The cost of building a genuinely useful agent is not, because that agent is a layer stacked on a system workflow, and whether you can articulate your own workflow is the real barrier to entry for that layer.

Recommended Next Steps:

  1. Audit existing workflows: Identify high-repetition automation pipelines in your team that currently rely on manual processing.
  2. Write the workflow down in plain language first: Before writing a single line of agent code, spell out the steps, boundaries, and exceptions as an SOP. Whatever you can't write down is exactly what the agent won't be able to do either.
  3. Adopt a state machine mindset: Try using LangGraph or a similar graph state machine framework to break down complex tasks into clear nodes and boundaries.
  4. Start small: Don't try to build an all-knowing, all-powerful agent. Begin by "AI-enabling steps in existing workflows" to validate feasibility and gain debugging experience.

The era of AI is moving fast, but only solid engineering practices will allow our applications to go the distance. I hope these practical insights have been helpful to you!

References

Author

Mark Ku

擁有 10+ 年經驗的資深軟體工程師,現為 AI 應用 Builder,專注於大型平台架構與簡化複雜系統設計,從電商系統到訂閱與收費平台,結合 AI Agent、AI 整合與自動化開發,打造高效率且可持續演進的產品技術基礎。Read More

Found this useful?

The author's free tools, daily podcasts and newsletter are all here.

Mark Ku · This article is licensed under CC BY 4.0. Credit the author and link back to the original when reusing it.

Comments

Subscribe to Newsletter

Subscribe to get new posts delivered instantly — never miss a tech share.

By submitting, you agree to receive emails. You can anytime.

Popular Posts

View all
Mark Ku
··597

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution
Mark Ku
··469

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.
Mark Ku
··327

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki
Mark Ku
··239

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1
Mark Ku
··233

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning
Mark Ku
··220

Setting Up Samba on Ubuntu to Share Folders with Windows 11

Setting Up Samba on Ubuntu to Share Folders with Windows 11
告別隨機 Chatbot:如何透過系統化與流程化打造 Production-Ready 的 AI Agent? - Mark Ku's Tech Notes