AI Agent Architecture and Engineering Practices: From Model + Harness to Multi-Agent Systems

    This article breaks down the core architecture of AI agents and the engineering practices needed to run them reliably. It explains what makes an agent different from a script or workflow engine, why the Model + Harness structure matters, and how context management, tool calling, and task planning are implemented. It also covers exception self-healing, multi-agent orchestration, the L3 autonomy level, typical application patterns, and common pitfalls, along with a practical step-by-step approach to taking an agent from prototype to stable production use.

    1. From Q&A Tools to Goal Delivery: What Actually Changes

    Traditional human-computer interaction is built around a single question and a single answer. The user carries the entire cognitive load: breaking the task down, chaining the steps together, and judging whether the result is correct. An agent changes this division of labor. The user describes the outcome they want, and the system handles the decomposition, path planning, and capability invocation on its own. While it runs, it corrects itself based on feedback and delivers a usable result instead of a block of text.

    Three elements are non-negotiable in this definition. First, goal orientation: the input is an intent, not a sequence of instructions. Second, autonomy: the control flow is decided by the system rather than driven step by step by the user. Third, closure: there is a feedback loop of execute, observe, and correct. Without the third element, you have script orchestration. Without the second, you have a workflow engine. Without the first, you have a command interpreter. Only when all three are present do you have an agent in the real sense.

    2. Model + Harness: The Standard Agent Structure

    A runnable agent usually consists of two parts: the model and the harness that surrounds it, or Model + Harness = Agent. The model supplies reasoning, semantic understanding, and generation. The harness keeps those capabilities inside an engineering-deliverable boundary and takes on context management, tool invocation, task planning, file reads and writes, permission control, and runtime isolation.

    The immediate benefit of this split is separation of concerns. The model can be upgraded or swapped independently while the harness stays stable. One harness can host different models, and it can also be configured differently per business domain. In practice, the quality of the harness often determines the final outcome more than the choice of model, because it decides what the model can see, what it can do, and whether it can roll back after a mistake.

    2.1 Context Management

    Context is the agent’s working memory and the resource most likely to spiral out of control. Mature designs usually have four layers: the system layer (role, boundaries, output specification), the task layer (goal, constraints, acceptance criteria), the process layer (actions already taken and their observations), and the retrieval layer (external knowledge pulled in on demand). The key design principle is layered trimming and on-demand injection. The process layer keeps structured summaries rather than full raw text, and the retrieval layer is fetched dynamically for the current subtask, so the context does not expand indefinitely and dilute the information that matters.

    1. class ContextManager:
    2. def __init__(self, max_tokens):
    3. self.max_tokens = max_tokens
    4. self.system = "" # Role and boundaries
    5. self.task = "" # Goal and acceptance criteria
    6. self.trace = [] # Process summaries
    7. self.retriever = None # On-demand retrieval
    8. def build(self, query):
    9. parts = [self.system, self.task, self.summarize(self.trace)]
    10. if self.retriever:
    11. parts.append(self.retriever.fetch(query, top_k=5))
    12. return self.trim("\n".join(parts))
    13. def summarize(self, trace):
    14. # Keep only actions, conclusions, and failure reasons; drop redundant raw text
    15. return "\n".join(f"{t['action']} => {t['result']}" for t in trace[-8:])
    16. def trim(self, text):
    17. return text[: self.max_tokens]

    2.2 Tool Calling

    Tools are the agent’s only channel to the real world, and the quality of their design sets the ceiling on reliability. A few general rules apply. Tool granularity should match a business action rather than a low-level interface. Parameters should use strong types and enumerations to reduce ambiguity. Every tool should return a structured result with an explicit success or failure flag. Side-effect operations such as writing files, sending messages, and changing configuration need confirmation and idempotency protection. The tool description is itself part of the prompt, so a vague description leads directly to wrong invocations.

    2.3 Task Planning and Execution Control

    There are two common planning paradigms. The first decomposes before executing, breaking the goal into a task tree and advancing in dependency order. The second thinks while acting, deciding the next step from the observation at each point. The first offers stronger control and makes parallelism and auditing easier; the second is more flexible but drifts more easily. Engineering practice usually blends them: an explicit plan at the outer level keeps the direction from drifting, while local adaptation is allowed at the inner level.

    1. Goal -> Plan (an auditable task list)
    2. -> Execute step by step -> Observe results
    3. -> Check against acceptance criteria
    4. -> If not met, replan (with capped retries and rollback points)
    5. -> Deliver result + execution notes

    3. Exception Self-Healing: What Separates Agents from Scripts

    Real environments are full of uncertainty: tool timeouts, changing response formats, missing dependency data, insufficient permissions. The value of an agent shows up precisely in how it handles exceptions. Workable mechanisms include defining an executable recovery strategy for each error class (retry, switch tools, narrow the scope, request more information); setting maximum retry and maximum cost limits to prevent infinite loops; keeping checkpoints and rollback paths so a failure can return to a known state; and writing the failure reason into the context in structured form so the same mistake does not repeat. It is worth stressing that self-healing does not mean blind retrying. A retry with no new information simply wastes resources.

    4. Multi-Agent Collaboration: An Orchestrator Routing to Specialized Agents

    When a task spans several specialist domains, a single agent tends to fail through prompt bloat and tool overload. The structure to use here is one orchestrator plus multiple specialized agents. The orchestrator handles task decomposition, routing, result aggregation, and conflict resolution. Each specialized agent holds a restricted toolset and domain knowledge and only handles the subproblem assigned to it.

    Three problems have to be solved to make collaboration work. The first is the communication protocol: sub-agents should pass structured artifacts rather than long natural-language text. The second is shared state, which needs unified artifact storage with version identifiers so agents do not overwrite each other. The third is cost control: serial versus parallel execution should be chosen by dependency, and both the orchestration depth and the total call volume of a single task should be capped. Organizational knowledge reuse also depends on this layer, by distilling verified workflows into reusable skills that later tasks can call directly.

    5. The Capability Leap: From Process Automation to L3 Agents

    The industry commonly uses levels to describe the degree of automation. At the lower stage is process automation, where the path is fixed in advance by people. Further along are assistants with some reasoning and tool-use ability. Marked by task automation, the L3 agent refers to an AI system that can think and act on its own and is accountable for results, a concept that comes from public discussions of the AGI roadmap. Its starting point is generally traced to the emergence of agentic coding tools in the first half of 2025, which for the first time demonstrated the feasibility of long-chain autonomous execution and self-correction in real engineering tasks.

    After that, agent platforms and ecosystems kept evolving. The focus shifted from whether something could be demonstrated to multi-agent collaboration mechanisms and organizational knowledge reuse, and the competition settled on real application results and cost efficiency. For enterprises, the evaluation criteria should return to plain metrics: task completion rate, number of human interventions, cost per task, and auditability of results.

    6. Typical Applications and a General Path to Production

    In data analysis, an agent can chain data retrieval, cleaning, modeling, and visualization into a closed loop. The user states the analytical intent, and the system selects the data source and computation path automatically and outputs conclusions. In the assistant scenario, the emphasis is on the accuracy of intent recognition and tool routing. In healthcare, the common approach is to package domain capabilities as callable skills, such as interpreting health checkup reports, explaining metric trends, and sending follow-up reminders, while always keeping a human review step and strictly limiting the output boundary. In industrial manufacturing, agents can be used to organize equipment inspection records, consolidate anomaly tickets, and analyze operational metrics, which improves operational efficiency.

    Engineering rollout can follow these steps: pick a scenario with a clear boundary and quantifiable acceptance criteria; inventory the required tools and restructure them; build a minimal viable harness that guarantees observability and rollback first; set up an offline evaluation set and a human spot-check process; and only after the metrics stabilize, extend to multi-agent collaboration and knowledge reuse. For runtime support, a container platform can host the execution environment, object storage can hold artifacts, a message queue can decouple asynchronous tasks, and logging plus monitoring and alerting can provide observability. These are general cloud capability categories and do not imply dependence on any specific implementation.

    7. Common Pitfalls and Practical Advice

    The first pitfall is treating the prompt as everything and underinvesting in the engineering of the harness. The second is having too many tools that are too fine-grained, which makes selection hard and causes wrong invocations. The third is missing evaluation and regression, so results drift whenever the model or the prompt changes. The fourth is permissions that are too broad, with side-effect operations lacking confirmation and audit. The fifth is chasing multi-agent designs blindly and adding unnecessary orchestration overhead where a single agent is sufficient. The sensible path is to make the context, tools, and self-healing of a single agent solid first, then scale out in layers as needed.