Enterprise AI Quick Reference

One page of numbers, rules of thumb, comparisons and decision guides for quick review: tokens and cost, latency, context, chunking, retrieval, vector indexes, evaluation metrics, agent patterns, MCP, security and governance.

On this page

Numbers to know#

Item Rule of thumb
Token ↔ text 1 token ≈ 4 characters ≈ 0.75 English words; 1,000 tokens ≈ 750 words ≈ 1.5 pages
Output vs input price Output tokens typically cost 3–5× input tokens
Prompt caching Cached input often ~90% cheaper; needs a stable prefix
Batch APIs ~50% cheaper; results within hours
Generation speed Tens to a few hundred tokens/s depending on model and load
Total latency ≈ TTFT + output tokens ÷ tokens per second
Context windows ~128K to 1M+ tokens on current frontier models
Weights memory Parameters × bytes per parameter (FP16 = 2, INT8 = 1, INT4 = 0.5); 70B FP16 ≈ 140 GB
Vector storage vectors × dimensions × 4 bytes (float32); +~50% for HNSW graph
Chunk size 300–800 tokens, 10–20% overlap, plus heading context
Retrieval Retrieve 20–100 candidates → rerank → send 3–8
Golden dataset Start with 50–100 cases, grow to several hundred
Error compounding 0.95 per step over 10 steps ≈ 60% success

Cost formula#

monthly cost = requests/month × (input tokens × input price + output tokens × output price)
peak TPM     = peak requests/min × (input + output tokens per request)

Prompting vs RAG vs fine-tuning#

Need Use
Task definition, format, tone Prompting (+ few-shot)
Private, fresh, citable, permissioned knowledge RAG
Consistent behaviour, domain style, cheaper small model Fine-tuning (LoRA)
Actions and live data Tools / agents

RAG pipeline at a glance#

RAG in one line each
flowchart LR
    A["Load"] --> B["Parse"] --> C["Chunk"] --> D["Enrich + ACL"] --> E["Embed"] --> F[("Index")]
    Q["Query"] --> R["Rewrite"] --> S["Hybrid search + filter"] --> T["Rerank"] --> U["Augment"] --> V["Generate + cite"]
    F --> S

Top upgrades by impact: parsing & structure-aware chunking → hybrid search → reranking → metadata/ACL filters → query rewriting → contextual retrieval → agentic/graph retrieval.

Vector index comparison#

Index Recall Speed Memory Use
Flat 100% Slow at scale High Small sets, ground truth
HNSW Very high Very fast High Default
IVF High Fast Medium Large, static
IVF-PQ / quantized Medium–high Very fast Very low Huge scale

Evaluation metrics#

Stage Metrics
Retrieval Recall@k, precision@k, hit rate, MRR, nDCG
Generation Faithfulness, answer relevance, correctness, citation accuracy
RAG triad Context relevance, groundedness, answer relevance
Agents Task success, final state, trajectory match, forbidden actions, steps/cost, pass^k
Business Deflection/resolution rate, time saved, CSAT, escalation rate

Agent patterns#

Pattern One-liner
Prompt chaining Fixed sequence of LLM steps with gates
Routing Classify, then specialised handler
Parallelization Sectioning (split) or voting (repeat)
Orchestrator–workers Dynamic sub-tasks delegated and synthesised
Evaluator–optimizer Generate → critique → revise loop
Plan-and-execute Explicit plan, execute, re-plan
ReAct agent Think → act → observe loop
Human-in-the-loop Pause for approval on risky actions

Multi-agent topologies: supervisor, hierarchical, sequential pipeline, handoff/swarm, network, debate, blackboard.

MCP in 30 seconds#

  • Why: N×M integrations → N+M.
  • Who: host (AI app) → one client per server → server.
  • What: server offers tools (model-controlled), resources (app-controlled), prompts (user-controlled); client offers sampling, roots, elicitation.
  • How: JSON-RPC 2.0; initialize + capability negotiation; stdio (local) or Streamable HTTP (remote); OAuth 2.1 for remote auth.
  • Risks: tool poisoning, rug pulls, shadowing, indirect injection, over-privilege, token passthrough, supply chain.
  • A2A: agent ↔ agent (agent cards, tasks); MCP: agent ↔ tools.

Agent protocol stack#

Standard Connects Key ideas
MCP Agent ↔ tools & data Host/client/server; tools, resources, prompts; stdio, Streamable HTTP; OAuth
A2A Agent ↔ agent Agent Card; task lifecycle; messages, artifacts; streaming, push
AG-UI Agent ↔ UI Typed event stream: lifecycle, text, tool calls, state
Agent Skills Agent ↔ know-how SKILL.md + scripts; progressive disclosure
AGENTS.md Agent ↔ repository Build, test and style instructions for coding agents

Agent frameworks at a glance#

Need Default picks
Explicit, durable control flow (Python/TS) LangGraph
Lightweight agents + handoffs OpenAI Agents SDK, Pydantic AI, Strands
Long-running autonomous harness Claude Agent SDK, Deep Agents
Google Cloud Google ADK (+ Vertex AI Agent Engine)
.NET / Azure Microsoft Agent Framework (+ Foundry Agent Service)
AWS Strands Agents (+ Bedrock AgentCore)
Role-based multi-agent prototype CrewAI
Document-heavy agents LlamaIndex
Spring Boot Spring AI (+ Embabel for goal-driven planning)
Non-Spring Java / Kotlin LangChain4j / Koog

Spring AI map#

Need Spring AI
Call a model ChatClient (.prompt().user().call().content())
Typed output .entity(MyRecord.class)
RAG QuestionAnswerAdvisor, RetrievalAugmentationAdvisor
Ingestion DocumentReader → TokenTextSplitter → VectorStore.add()
Tools @Tool, ToolContext, ToolCallingAdvisor
MCP spring-ai-starter-mcp-client, spring-ai-starter-mcp-server-webmvc, @McpTool
Memory MessageWindowChatMemory + JdbcChatMemoryRepository + MessageChatMemoryAdvisor
Observability Micrometer observations, gen_ai.client.token.usage
Evaluation RelevancyEvaluator, FactCheckingEvaluator

Security checklist#

  • OWASP LLM Top 10 (2025): injection, sensitive info disclosure, supply chain, poisoning, improper output handling, excessive agency, system prompt leakage, vector/embedding weaknesses, misinformation, unbounded consumption.
  • Break the lethal trifecta (private data + untrusted content + external comms).
  • Permissions at retrieval and in tools; identity from the session, never from model arguments.
  • Approvals for irreversible actions; limits enforced in code.
  • Sanitise output (no live links/images from untrusted generations).
  • Red-team continuously.

Governance checklist#

  • EU AI Act tiers: unacceptable / high / limited / minimal (+ GPAI obligations).
  • NIST AI RMF: Govern, Map, Measure, Manage (+ GenAI profile NIST AI 600-1).
  • ISO/IEC 42001: AI management system.
  • Artefacts: AI inventory, system card, impact assessment/DPIA, evaluation report, monitoring plan, AI-BOM.
  • Controls via architecture: AI gateway, tracing with versions, eval gates, approval workflows, kill switches.

Decision quick-guides#

Simplest thing that works
flowchart LR
    A["Single prompt"] -->|"needs knowledge"| B["+ RAG"]
    B -->|"needs actions"| C["+ Tools in a workflow"]
    C -->|"path unknowable"| D["Single agent"]
    D -->|"parallel / isolated / many domains"| E["Multi-agent"]
Question Default answer
Which vector store? pgvector or your existing search engine, until measurements say otherwise
Which model? Mid-tier by default; route easy to small, hard to frontier; keep a fallback
Agent or workflow? Workflow, unless the path cannot be known in advance
Fine-tune? Only after prompting + RAG baseline, with an evaluation set
How much autonomy? By impact and reversibility of each action
Where should it run? By the highest data class in the assembled prompt: public API → cloud tenancy → on-prem → air-gapped
On-prem for cost? Only if GPUs stay busy most of the time; count staff and redundancy
Regulated critical function? Pinned versions, validation evidence, and a weight-owned or second-provider fallback