AI glossary in one image: token, embedding, RAG, agent, harness, and MCP
Six essential artificial intelligence concepts explained with technical clarity: how text is tokenized, vectorized, retrieved, and connected to external tools.

Token, embedding, RAG, agent, harness, and MCP are foundational terms in modern discussions around enterprise software and applied artificial intelligence. They are neither interchangeable buzzwords nor simple synonyms: they describe distinct functional layers in modern application architectures, spanning from statistical text fragmentation to open protocols that allow foundation models to safely interact with production databases and external APIs.
This glossary unpacks all six concepts with technical rigor, practical engineering examples, and operational boundaries to help you design and assess AI systems pragmatically.
1. Token: the fundamental unit of compute and billing
A token is the atomic piece of text that a language model ingests, processes, generates, and bills for. Unlike traditional compilers or lexers, LLMs do not manipulate raw characters or complete dictionary words directly; instead, they operate on sequences of subword chunks produced by statistical algorithms (such as Byte Pair Encoding).
- In English, a standard rule of thumb is that 1,000 tokens equal roughly 750 words (approximately 4 characters per token).
- In languages with complex verb inflections and accents, the ratio is often higher: between 1.2 and 1.5 tokens per word, as prefixes and suffixes are split into separate subword units.
- Source code (
Python,JSON,SQL) displays distinct tokenization patterns driven by indentation whitespace and special syntax characters.
Input text: "Monthly financial summary"
Tokens: ["Monthly", " financial", " summary"] (3 tokens)
Token IDs: [34821, 5819, 14201]
In practice: token counts govern two critical engineering constraints: the model’s effective context window and API inference expenses (which are billed per million input and output tokens).
2. Embedding: meaning projected into vector geometry
An embedding is a high-dimensional mathematical vector (typically spanning between 768 and 3,072 dimensions) representing the semantic meaning of a given text passage.
In this continuous vector space, sentences carrying similar intent or meaning are positioned closer together mathematically (commonly measured via cosine similarity), even if they share almost no literal vocabulary:
Sentence A: "Product return guidelines"
Sentence B: "How do I request a refund?"
Cosine similarity: 0.89 (strong semantic proximity, distinct vocabulary)
In practice: embeddings power semantic search, intent classification, and duplicate detection. However, they do not equate to conceptual comprehension: their fidelity depends on the underlying embedding model, training domain, language, and chunking strategy.
3. RAG: grounding generation with retrieved context
RAG (Retrieval-Augmented Generation) is an architectural pattern that separates enterprise-specific domain knowledge from the static weights of the language model.
Rather than fine-tuning or retraining a model to absorb proprietary documentation, RAG operates in three systematic stages:
- Indexing: internal documents (policies, technical manuals, contracts) are chunked into passages, mapped into embeddings, and stored in a vector database or hybrid search index.
- Retrieval: when an incoming query arrives, the system searches the index for the most relevant snippets using both vector similarity and lexical matching (such as BM25).
- Generation: the retrieved passages are injected directly into the prompt alongside the user prompt, commanding the model to answer based strictly on the provided context.
User Query ──► Vector Index Search ──► Context Injection ──► LLM Generation
(Company Knowledge) (Grounded Prompt) (Cited Response)
In practice: RAG avoids costly model retraining and drastically cuts hallucinations by anchoring responses in authoritative sources. System performance hinges on chunking quality, retrieval relevance, and avoiding context window bloat.
4. Agent: autonomous reasoning loops and tool execution
An AI agent is an architecture in which the language model acts as a reasoning engine within a closed execution loop: it evaluates an assigned goal, decides which concrete steps to take, calls external tools to gather facts or trigger side effects, and observes the results before proceeding.
Unlike traditional deterministic automation (a hardcoded sequence like Step A -> Step B -> Step C), an agent can adapt its plan dynamically when a query returns an error or when unexpected data requires an extra lookup:
Goal: "Process account cancellation for Customer 402"
Step 1: Agent calls Customers API to check contract status.
Step 2: Agent identifies unsettled balance -> Decides to fetch debt policy.
Step 3: Agent drafts resolution proposal and requests human sign-off.
In practice: autonomy increases operational failure modes. Production agents require strict boundaries: loop iteration limits, schema-enforced tool parameters, and human checkpoints for high-risk actions.
5. Harness: the infrastructure that governs the model
The term harness describes the operational software infrastructure surrounding the model that makes the agent loop viable in real software environments. While the LLM provides raw linguistic and reasoning inference, the harness supplies the runtime machinery needed to interact safely with the world:
- Execution loop: drives turn-taking, tool calls, and termination signals.
- Context management: curates, trims, and summarizes conversation history to stay within token budgets.
- Tool registry and dispatcher: routes and executes requested functions while handling network retries and timeouts.
- Permissions and security guardrails: verifies whether a proposed command (e.g.,
DELETE /records) is allowed or requires human approval. - Observability: traces latency, token usage, and execution histories across sessions.
In practice: the model only emits structured text declaring its intent; the harness is the software layer that either executes or rejects that call. Tools like Claude Code or agent orchestration SDKs operate as harnesses.
6. MCP: the open standard for tool and resource integration
MCP (Model Context Protocol) is an open standard introduced by Anthropic designed to solve the $M \times N$ integration bottleneck: rather than requiring every AI application to write bespoke integrations for every database, issue tracker, or SaaS API, MCP standardizes how AI clients discover and consume external capabilities.
Its architecture is built on three pillars:
- Host: the parent application orchestrating the user session (such as Claude Desktop or a custom enterprise agent).
- MCP Client: the client library inside the host that negotiates connections with servers.
- MCP Servers: lightweight microservices exposing specific capabilities over the standard protocol.
MCP standardizes three key primitives:
- Tools: executable routines that the model can invoke (e.g.,
query_postgres,create_pull_request). - Resources: read-only data streams supplying contextual documents (files, database schemas, system logs).
- Prompts: pre-packaged, parameterized prompt templates that guide structured tasks.
[ Host Application ] ── (MCP Client) ◄─── MCP Protocol ───► [ MCP Server ] ──► PostgreSQL Database
◄─── MCP Protocol ───► [ MCP Server ] ──► GitHub API
In practice: MCP decouples capability development from model interfaces. Host applications retain full authority over which servers to connect and which tool invocations require user approval.
How the six concepts connect in a real-world stack
In an enterprise-grade AI deployment, the six concepts work together in harmony:
- A user enters a query that is broken down into tokens.
- An embedding model calculates vector representations of the query.
- The RAG pipeline retrieves authoritative domain passages from the corporate index.
- If the request requires inspecting order records or triggering actions, the agent plans the sequence of steps.
- The harness orchestrates the execution cycle, manages working memory, and enforces security policies.
- The agent interacts with external enterprise databases and APIs via standardized MCP servers.
Not every project demands all six pieces. A search engine can thrive on RAG without agents; internal scripts can benefit from MCP without complex vector embeddings. The goal is to select the exact primitives that solve the business problem while keeping architecture simple and maintainable.
Primary sources and technical references
- Anthropic Documentation (2024): Model Pricing and Tokenization Mechanics. platform.claude.com
- Anthropic Documentation (2024): Embeddings and Semantic Search. platform.claude.com
- Anthropic Engineering (2024): Introducing Contextual Retrieval (Advanced RAG). anthropic.com/engineering
- Anthropic Engineering (2024): Building Effective Agents. anthropic.com/engineering
- Anthropic Docs (2024): Claude Agent SDK & Harness Architecture. code.claude.com
- Model Context Protocol (2024): Architecture Overview: Hosts, Clients, and Servers. modelcontextprotocol.io
Related articles
What is an LLM? Architecture, mechanics, and production limits
What a large language model (LLM) is, how it processes tokens through transformers, its real hallucination and context limits, and how to integrate it in production systems with RAG.
How much does it cost for AI to read an invoice (and how we cap it)
The real cost of automating invoices with AI isn't just tokens. How we measure per-operation cost, the levers that lower it, and why human review is part of the formula.
Django or Supabase: why our ERP and our apps use different stacks
Almeebar uses Django REST and PostgreSQL; BIT Project, BIT Talents and our CMMS use React and Supabase. The criteria we use to choose backends for each project.


