Free JYnapse Knowledge Base · Cheat Sheet

AI Agents & Orchestration Cheat Sheet

Beyond chat — how retrieval, tools and agents fit together, when each is the right build, and how to keep an autonomous system on a leash. Vendor-neutral.

For Founders · engineers scoping AI builds Level Intermediate Languages EN · BM · 中文 on request

1 Chatbot → RAG → Agent

ChatbotAnswers from training memory
RAGAnswers from your documents
AgentTakes actions to reach a goal

Rising order of power, cost and risk. Most business needs stop at RAG — reach for an agent only when the task genuinely requires doing, not just answering.

2 RAG in one picture

  • 1. Chunk your documents into passages.
  • 2. Embed each into a vector; store in a vector DB.
  • 3. Retrieve the closest passages to the question.
  • 4. Augment — stuff them into the prompt.
  • 5. Generate an answer, citing sources.

It's retrieval, not training. A new document is a re-index, not a retrain — and every answer can cite where it came from.

3 What makes it an "agent"

A loop, not a single reply:

while not done:
    think   → decide the next step
    act     → call a tool
    observe → read the result
    repeat  → until the goal is met

The model plans, uses tools, sees what happened, and adjusts — the reason–act–observe loop (aka ReAct).

4 Tools / function calling

Tools are how an agent touches the real world. You describe a function; the model chooses when to call it and with what arguments.

{
 "name": "get_order_status",
 "description": "Look up an order by ID",
 "parameters": { "order_id": "string" }
}

Good tools are narrow, well-described and validated. Vague tools = an agent that flails.

5 Single vs multi-agent

Single agentOne model + tools. Start here.
OrchestratorA "manager" routes to specialists
WorkersEach owns one job (research, write, check)

Split into multiple agents only when roles are genuinely distinct. More agents = more coordination overhead and more ways to fail.

6 Orchestration patterns

ChainFixed A→B→C steps
RouterPick the path by input
Manager/workerDelegate & gather
ReflectionDraft → critique → revise
Human-in-loopApprove before acting

If the steps are fixed, that's automation with AI steps — not an agent. Cheaper and more reliable; use it.

7 MCP — the USB-C for tools

The Model Context Protocol is an open standard for connecting models to tools & data sources through one common interface.

  • Write a tool once; any MCP-aware client can use it.
  • Servers expose tools, resources and prompts.
  • Stops you rebuilding a bespoke integration per model.

Useful once you have several tools and more than one app that needs them.

8 Memory & context

Context windowShort-term — this conversation
Vector storeLong-term — recall by meaning
State / scratchpadThe task's working notes

Context isn't free — it costs tokens and dilutes focus. Retrieve what's relevant; don't dump everything into the prompt.

9 Guardrails

  • Read-only by default; require approval for writes/spend.
  • Validate every tool input and output.
  • Cap steps, loops, tokens and cost — agents can run away.
  • Least privilege — scoped credentials, never a god-key.
  • Log every step so a human can audit the trail.
  • Watch for prompt injection in retrieved/third-party text.

10 Which build? Decide fast

Fixed format, on a scheduleAutomation
Q&A over your docsRAG
Query your databaseSQL agent (read-only)
Many chained judgementsAgentic system

Ask: "How many genuine judgement calls are in this workflow?" One or two → automation with an AI step. Five or six that depend on each other → an agent, and a much larger bill.