From LLMs to Multi-Agent Systems: A Layered Architecture Guide

    Understand how large language models, tokens, prompts, agents, skills, tool interfaces, and multi-agent orchestration fit into a single architecture. This guide explains each layer’s responsibilities, shows how they work together in a software development task, and outlines practical principles for permissions, cost control, execution, and observability.

    AI terminology often appears as a collection of unrelated trends: reusable skills one day, multi-agent systems the next, and AI coding tools after that. Each discussion may make sense on its own, yet the pieces do not always fit together. These concepts are not competing product categories. They are components at different layers of the same system.

    Think of that system as a company. The large language model is the expert brain in the office. Tokens measure its workload and available desk space. Prompts are task briefs. Agents are employees who carry out work. Skills are reusable operating manuals. Tool integration protocols provide standard interfaces to external systems. Multi-agent orchestration defines departments, responsibilities, and scheduling.

    Understanding where each component belongs helps distinguish a system that can describe an action from one that can actually perform it.

    1. The Foundation: Large Language Models and Tokens

    A large language model, or LLM, provides the foundation for language processing and reasoning. It generates content by predicting likely continuations from the available context. This allows it to explain concepts, rewrite documents, draft code, and compare approaches.

    Its default boundary is equally important: it generates responses within the current context. It does not automatically have access to your file system, business databases, email, or production environment. If you ask it to retrieve live data, modify a repository, or send a notification without connecting tools and an execution environment, it can only produce text based on what it already knows.

    That limitation explains why agents and tool interfaces are needed.

    Tokens Are More Than a Word Count

    Tokens are units used by a model to process text, not another name for words or characters. Tokenization depends on the model and tokenizer. English words, Chinese characters, punctuation, and code symbols do not map to tokens in the same way, so character counts cannot provide an exact conversion.

    Tokens affect three major aspects of system design.

    Cost. Usage-based model calls are commonly billed by input and output tokens, with separate treatment for cached input in some cases. Long, repetitive prompts, indiscriminately loading an entire repository, and repeatedly restating known information all increase costs. The first step in cost control is reducing unnecessary tokens, not reducing model capability.

    Context capacity. The context window is the workspace the model can see during a particular inference. Conversation history, system instructions, tool results, and code snippets all occupy that space. It is not unlimited memory. Excess content may be truncated, summarized, or displace earlier information, making the model appear to forget something already discussed.

    System design should distinguish between constraints that must remain intact in context and reference material that can stay in retrieval systems, files, or external tools.

    Response quality and latency. Longer context can introduce more noise, bury important instructions, and increase processing time. More information does not automatically produce a more accurate answer. A better approach is to provide the goal, constraints, and acceptance criteria first, then retrieve the necessary material as each step requires it.

    2. The Task Brief: Prompts

    A prompt is a task brief for the model, not a magic formula. An effective prompt typically specifies role boundaries, goals, inputs, constraints, output format, and completion criteria.

    Prompting does not give the model new weights. It guides generation within the current context.

    Prompts address how the model should reason and respond, but they do not grant access to external systems. Even detailed instructions cannot make a model read an internal network, execute a command, or update a ticket unless the surrounding system exposes those actions and returns their results to the context.

    Prompting is therefore necessary, but not sufficient.

    For engineering purposes, prompt templates should be versioned. Separate stable system instructions from task-specific variables, and identify which information must come from tools rather than model-generated assumptions.

    Clear output requirements—for example, “state the conclusion first, then the steps, and identify missing information if the task fails”—usually provide more stability than layers of descriptive adjectives.

    3. The Employee: Agents

    An agent is an execution loop that can plan, invoke tools, and act again based on the results. It is not simply a longer prompt.

    A typical loop is:

    1. Interpret the goal.
    2. Break it into steps.
    3. Select a tool or skill.
    4. Execute an action.
    5. Read the result.
    6. Decide whether to continue.
    7. Stop when the completion criteria are met or report a clear failure.

    The division of responsibility is straightforward: the LLM reasons and generates at each step; the agent turns that reasoning into a sequence of actions and manages their execution.

    In this architecture, the model supplies judgment, while the agent supplies access to actions and the state machine that connects them.

    A usable agent needs at least four components:

    • A goal and explicit permission boundaries.
    • A list of available tools.
    • Short-term memory containing the current plan and observations.
    • Defined stopping conditions.

    Permissions should follow least privilege by default. Read access does not imply write access, and permission to execute in a test environment does not imply permission to operate in production.

    Enforcing allowed actions through runtime policy is more reliable than asking the model to “be careful” in a prompt.

    4. The Operating Manual: Skills

    A skill captures a recurring task as reusable instructions. It describes when to use the procedure, expected inputs and outputs, recommended steps, prohibited actions, required tools, and completion criteria.

    A skill is not another model. It is an operating procedure that an agent can load when needed.

    Its value lies in narrowing the search space. Rather than including every rule in every prompt, the agent can identify the task type and load the relevant skill. This saves tokens and makes behavior easier to audit. When something goes wrong, the investigation can distinguish among an incorrect skill, a failed tool, and a model that did not follow the procedure.

    Skills should be executable instructions, not slogans. A code-change skill, for example, should require the agent to:

    • Locate the relevant files first.
    • Describe the intended scope of the change.
    • Run the agreed checks after making modifications.
    • Use error messages to narrow the investigation when checks fail.
    • Avoid large rewrites before reading the existing implementation.

    Skills should also avoid contradictory instructions, especially when multiple agents may load them during the same workflow.

    5. The Standard Interface: Tools and Context Integration

    The model operates on the context it receives. Tools connect that context to the outside world.

    A common approach is to use a standardized tool and context integration protocol to describe available tools, parameters, authentication, result structures, and error representations.

    Names and implementations may differ, but the purpose is consistent: let agents discover and call search services, databases, ticketing systems, repositories, browsers, and internal APIs through a common interface rather than building separate proprietary glue for every model.

    The protocol layer should support interoperability and security—not expose unlimited capabilities.

    Each tool should have clearly defined:

    • Inputs and outputs.
    • Timeouts.
    • Idempotency behavior.
    • Permissions.

    Read-only queries should be separate from write operations with side effects. Results sent to the model should be bounded and structured, rather than dumping an entire database into context. Sensitive fields should be redacted before reaching the model.

    Without this connection, a model may merely produce text claiming that it checked something. With it, tool responses provide evidence of whether a query or modification actually occurred.

    This is also an engineering approach to reducing hallucinations: external facts should be grounded in tool results, while the model interprets those results and makes decisions rather than inventing missing values.

    6. The Coordination Layer: Multi-Agent Systems

    When one agent handles planning, retrieval, coding, and review in a single context, both its responsibilities and context requirements grow.

    A multi-agent system separates those responsibilities into roles. One agent may clarify requirements, another retrieve information, another implement changes, another review them, and another summarize the outcome. They share a goal, but can have different contexts, tools, permissions, and skills.

    Opening several conversations does not automatically create effective collaboration. Three aspects require explicit design.

    Division of Responsibilities

    Define each role’s inputs, outputs, and authority boundaries.

    An implementation agent may edit a draft. A review agent should normally have read-only access and return a list of issues. This avoids two roles modifying the same material at the same time.

    Communication

    Agents should exchange structured results: conclusions, evidence, and unresolved questions.

    Forwarding the entire conversation history at every handoff can cause token costs to grow linearly or faster, while burying the information that matters.

    Scheduling

    Specify who acts first, when parallel execution is allowed, who resolves conflicts, and how failures trigger retries or human escalation.

    Parallel execution suits independent retrieval tasks. Changes with strong dependencies should run sequentially. Maximum step counts and budgets prevent agents from entering indefinite loops.

    Multi-agent systems offer specialization and risk isolation, but introduce coordination overhead. A single agent is often clearer for simple tasks with few tools. Separate roles become more useful when work spans systems, requires many steps, or needs independent review under different permissions.

    7. How the Layers Work Together in a Real Task

    Consider a task to modify part of a service based on a requirement and run the appropriate checks.

    The layers fit together as follows:

    1. The LLM interprets the requirement and generates the proposed changes.
    2. The token budget determines how much requirement detail and code can fit into context.
    3. The prompt requires an explanation of the change, its impact, and the verification method.
    4. The agent maintains the plan: locate the relevant modules, make the change, and run checks.
    5. The skill defines the code-change procedure and prohibited actions.
    6. The tool interface exposes code reading, patch application, and check execution, then returns standard output and errors.
    7. Multi-agent orchestration, if used, separates implementation from review. The reviewer identifies issues from the diff and check results without directly editing files.
    8. A human provides final confirmation before merging.

    Missing layers produce recognizable failures. A model alone may offer advice it cannot execute. An ambiguous prompt leaves the direction unstable. Without skills, the workflow is reinvented every time. Without tool responses, factual claims are difficult to trust. Without permissions and budgets, multiple agents may overwrite one another’s work or keep running without progress.

    8. Practical Principles for Deployment

    Map the Data Flow Before Choosing the Number of Agents

    Identify which information must enter the model’s context and which should remain in external systems for on-demand retrieval.

    The data flow should guide the role design, not the other way around.

    Manage Prompts, Skills, and Tool Descriptions Like Code

    Use versioning, review, and rollback.

    Models change over time. If operating procedures are not versioned, behavior becomes difficult to reproduce.

    Use Stopping Conditions to Prevent Busywork

    A workflow should terminate when it completes, reaches a clear failure, exceeds its step limit, or exhausts its budget.

    Each outcome should leave a readable record, rather than merely creating the appearance of activity.

    Observe Every Step

    Record which skill was loaded, which tool was called, how many tokens were used, and which results were truncated.

    Without these logs, it is difficult to determine whether a problem requires changes to the prompt, skill, tool configuration, or permissions.

    Put Cloud Infrastructure in the Right Layer

    Object storage, message queues, container platforms, logging, monitoring, and alerting can support artifact storage, task delivery, isolated execution, and operational tracing.

    These are general-purpose capabilities that support agent execution. They do not replace the layered architecture.

    If using a provider such as Baidu AI Cloud, place its general-purpose infrastructure in the execution and observability layers rather than treating it as part of the model’s reasoning capability.

    Conclusion

    These concepts occupy different positions within the same system.

    The LLM provides language and reasoning capabilities, while tokens constrain context capacity and usage cost. Prompts guide the current task. Agents turn model outputs into repeated actions. Skills capture reusable procedures. Tool and context interfaces connect external systems. Multi-agent orchestration manages responsibilities, communication, and scheduling.

    Once those boundaries are clear, new terminology becomes easier to evaluate. Ask whether a component belongs to the brain, the employee, the operating manual, the interface, or the coordination layer—rather than treating every new term as a separate system.