Chapter 2 · Advanced Systems — Turn One-Time Wins Into a System

2.8 Appendix: How the AI Work System Runs

This appendix is not required for daily use. Its purpose is diagnostic: when a result misses, you can tell which layer failed instead of rephrasing the request.

Start with the attribution table below and check the most likely layer first.

SymptomLayer to check first
Fluent answer, wrong facts or figuresThe model and the input material
Forgot what was already statedContext and the workspace
Knows what to do but cannot executeTools, authorization, and permissions
The same task is done differently each timeThe Skill's steps and constraints
Cites an outdated policy or old priceThe knowledge base and Memory
A flow that should be fixed improvises every timeThe choice between workflow and agent

The Model: Generate Content from Input

A large language model learns patterns of language and knowledge from a corpus and generates subsequent content from its input. Summarization, rewriting, extraction, and code generation use this mechanism.

For internal material, supply the files or data and specify the version to use. To compare a summary with its source, ask:

Review this summary: list the source page for each conclusion and mark entries with no matching passage as "to verify". Finish with counts of entries with sources and entries to verify.

Context: How Much It Can Process at Once

A token is the basic unit the model processes; it is not a word. A character may be one or more tokens, and code and punctuation are counted differently. The context window is the total input, conversation history, and output a single inference can hold.

The input for a task consists of its goal, current material, and relevant history. Store long-term material separately and reference it as needed:

Where things belong: stable material in Library, structured data in Base, long-term rules in Memory, and the process of one piece of work in a workspace. The system retrieves what it needs instead of holding everything in one conversation.

Prompts: A Task Brief

A prompt carries the goal, background, material, constraints, examples, and expected output. Its quality is not a function of length but of whether it is sufficient to execute and to verify.

ElementWhat it answers
GoalWhich problem is being solved
InputWhich material or systems are involved
ActionAnalyse, organize, generate, or rewrite
ConstraintsWhat must not change, which standards apply
OutputWhich file or structure to deliver
VerificationWhat counts as correct and usable
Goal: turn this 30-page supplier technical document into an internal brief.
Input: "Supplier Docs/2026ss-tech-pack.pdf" in Library.
Action: extract fabric, certification, and delivery terms.
Constraints: use only the document's content; add no outside knowledge.
Output: a one-page Markdown brief with a page number for every conclusion.
Verification: each conclusion can be traced to a page in the source.

From a prompt to a capability, there are four levels:

LevelFormFits
PromptHow to do it this timeOne-off tasks
Task cardA fillable fixed structureRepetitive tasks with fixed fields
SOPFixed steps, roles, checkpoints, and exception handlingProcesses that get handed over
SkillA packaged SOP with scripts and resources, ready to runLong-term reuse

Not every prompt deserves packaging. Run it successfully three to five times, confirm the method is stable, then invest in packaging.

The Agent: A Loop Around a Goal

An agent does not "answer once". It runs a loop: receive the goal, observe material and state, plan the next step, call tools, read results and errors, then decide whether to finish, pause, or continue.

In practice the loop branches, retries, or pauses; it is not a straight line.

DimensionChat modeAgent
Core actionGenerate a responsePlan, call tools, execute, deliver
ScopeThe current conversationFiles, tools, systems, task state
ProcessUsually one passMultiple rounds of observation and action
ExecutionGenerate contentCall tools and process returned results
ControlPrompt and reviewPermissions, checkpoints, logs, rollback

Tools and Connectors: Knowing vs Doing

A tool is a concrete capability the agent can call: read a file, run a search, generate a spreadsheet, send a message. A Connector is a preconfigured external service connection that requires authorization.

The agent can explain how to send an email, but it can only draft or send one after the mail Connector is installed and authorized. It can write SQL, but it can only query the database after the database Connector is installed and authorized.

So when a task fails, the order of investigation is: is the tool connected and authorized → does the permission scope cover the target data → is the data somewhere it can reach. "Is it smart enough" is rarely the first question.

Skills: Fixing the Process

A Skill is not a smarter model. It is a set of instructions, scripts, knowledge, and templates organized around one class of task, so execution stays consistent.

Its value is not "making the model stronger" but locking down the steps that are easy to get wrong or skip. Give the same batch of invoices to a model ten times and you may get three approaches; give it to a Skill and all ten runs follow the same verified path.

invoice-skill/
├── SKILL.md          # Triggers, steps, boundaries, output
├── references/       # Fields, categories, business rules
├── scripts/          # OCR, validation, table processing
├── templates/        # Excel and report templates
└── tests/            # Normal and edge-case samples

SKILL.md is the entry point: when to use it, how to execute, where the boundaries are. References hold business knowledge, scripts hold the running code, templates keep output consistent, and tests cover edge cases.

ComparisonPromptSkill
ScopeThe current conversationReuse across tasks
CarriesTextInstructions, scripts, resources, templates
LoadingEnters context directlyLoaded on demand
ConsistencyDepends on how clearly this run was writtenThe same path every time

Read the Skill's SKILL.md, scripts, and templates, then configure the external services and execution environment listed there.

MCP: A Standard for Tool Access

MCP (Model Context Protocol) defines how an AI client discovers and calls external tools, reads resources, or retrieves prompt templates. It standardizes access; it does not change what the tool can do.

It solves an integration-count problem: without a common standard, every AI product builds an adapter for every system; with MCP, a provider exposes its capability once and every MCP-capable client can call it.

API and MCP

An API is an interface between systems, for example querying data or creating a record over HTTP. An MCP server calls one or more APIs internally and exposes them as tools.

With direct API calls, the caller handles authentication, parameters, errors, and rate limits. With MCP, the server organizes those interfaces as tools that clients can discover and call.

Knowledge Base, RAG, and Memory

These provide different kinds of context:

ConceptWhat it storesHow it is used
Conversation contextThe current task discussionCarry forward requirements and intermediate results
Knowledge base / RAGSearchable facts and referencesRetrieve relevant passages and cite sources
MemoryPreferences and long-term rulesApply personal settings in later tasks

A knowledge base holds policies, product material, cases, and SOPs for retrieval.

RAG (retrieval-augmented generation) finds relevant passages and supplies them to the model to compose an answer. File versions, chunking, metadata, and search terms determine the passages returned. Source references let you open the original material for further reading.

Memory holds preferences and long-term rules. When a working habit or rule changes, enter the new requirement on the 【Memory】 page.

Workflow and Agent: Who Decides the Path

They are not substitutes; they are two ways of organizing action.

DimensionWorkflowAgent
In one lineA standardized production lineAn executor that works toward a goal
PathFixed at design timeDetermined at run time
Decision pointDesign stageExecution stage
ControllabilityHigh, easy to predict and roll backLower, paths may vary
DebuggingStep-by-step tracingRequires logs and intermediate state
FitsClear steps, repeatable, high complianceUnclear path, needs environmental feedback, open goal

Workflows fit: fixed SOPs (ticket received → classify → assign), batch processing (compress and watermark 100 images), approvals that need step-by-step audit, reports that must be regenerated the same way.

Agents fit: a clear goal with an unclear path (research competitors and produce a comparison), tasks that need several tools explored, environments that change, open-ended work that cannot be written as fixed steps.

Three common misjudgements:

  • Assuming an agent is always better than a workflow. For deterministic tasks a workflow is more stable, cheaper, and easier to audit.
  • Assuming a workflow cannot be intelligent. Workflow nodes can call a model to summarize, classify, or extract; the model makes judgements and the flow decides the route.
  • Assuming more autonomy is better. More freedom makes failures harder to diagnose; complex systems usually let an upper agent decide and hand stable subtasks to a workflow.

How they nest: an agent writes stable subtasks as fixed processes (a Skill backed by a workflow) and decides only where uncertainty remains; a workflow's judgement node hands unstructured input to an agent.

See these mechanisms in use in the existing demos: Connector Authorization, Knowledge Retrieval, and Create and Run a Workflow.

Summary

The model generates, tools execute, Skills fix the method, the knowledge base supplies evidence, workflows fix the path, and Memory together with the workspace maintains continuity.