Learn/Phase 1/AI, Generative AI, and LLMs

AI, Generative AI, and LLMs

Ch 01 · Foundations 45 min
LLM limitsContext windowTrace
Hands-on:MESHFLOW_MOCK=1 python3 hands_on/01_hello_mesh.py

Lesson 01: AI, Generative AI, And LLMs

Lesson Goal

By the end of this lesson, you should be able to explain:

  • What AI means in plain language.
  • What makes generative AI different from older AI systems.
  • What an LLM does and does not do.
  • Why an LLM alone is not the same thing as an agent or workflow.
  • Why MeshFlow-style orchestration starts with explicit steps and artifacts.

Estimated time: 35 to 50 minutes.

1. Start With The Big Picture

AI means software that performs tasks that normally require human-like judgment. That does not mean the software is conscious, alive, or truly understands the world the way a person does. It means the software can produce useful behavior from data, rules, statistics, search, optimization, or learned patterns.

Examples of AI:

  • A bank fraud detector that flags suspicious transactions.
  • A recommendation system that suggests videos or products.
  • A computer vision model that detects objects in an image.
  • A speech recognizer that turns audio into text.
  • A chatbot that answers questions.
  • A code assistant that drafts or edits source code.

The important idea is this:

AI is the broad field.
Generative AI is one category inside AI.
LLMs are one major kind of generative AI.
Agents and workflows are systems built around models.

2. Traditional AI vs Generative AI

Traditional AI often predicts, classifies, ranks, or detects.

Examples:

  • Is this email spam or not spam?
  • Is this transaction risky or normal?
  • Which product should appear first?
  • Does this image contain a stop sign?

Generative AI creates new content.

Examples:

  • Draft an email.
  • Summarize a meeting.
  • Write Python code.
  • Generate an image.
  • Create a project plan.
  • Turn a policy document into a checklist.

Traditional AI often outputs a label, score, category, or prediction. Generative AI outputs content.

That content can be useful, but it must be treated carefully. A generated answer can sound polished even when it is incomplete or wrong.

3. What Is An LLM?

An LLM, or large language model, is a model trained to work with text. You give it text input, and it generates text output.

In a simple application, the flow looks like this:

user question -> application -> LLM -> generated answer -> user

The input text is often called the prompt. In real systems, the prompt can contain much more than the user's visible question:

  • System instructions.
  • Developer instructions.
  • Conversation history.
  • Retrieved documents.
  • Tool descriptions.
  • Tool results.
  • User preferences.
  • Workflow artifacts.

All of that input is called context.

4. The Simplest Mental Model

Think of an LLM as a powerful text prediction engine that has learned many patterns from training data.

When you ask:

Explain what an AI agent is.

The model generates a likely useful answer based on patterns it learned and the context it was given.

This is why LLMs can feel intelligent. They can combine ideas, follow instructions, write fluent text, and adapt to many tasks.

This is also why LLMs need supervision. They can generate plausible text without checking whether every statement is true, current, or grounded in your private data.

5. What An LLM Does Not Automatically Have

An LLM call by itself does not automatically have:

  • Private project knowledge.
  • Durable memory.
  • Access to your files or databases.
  • Permission to use external APIs.
  • A way to verify facts.
  • A workflow state machine.
  • A human approval process.
  • A complete trace of why it produced an answer.

Applications add those capabilities around the model.

This is the first major reason orchestration matters. Real AI systems are not only "model in, answer out." They are controlled systems that decide what context to send, what tools to expose, what memory to retrieve, what outputs to check, and what steps to run next.

6. Common Beginner Confusions

AI vs LLM

AI is the broad category. An LLM is one type of AI model.

All LLMs are AI. Not all AI systems are LLMs.

Generative AI vs LLM

Generative AI creates content. LLMs generate text. Image generators, audio generators, and video generators are also generative AI, but they are not all LLMs.

LLM vs Chatbot

An LLM is the model. A chatbot is an application interface built around a model. A chatbot may include memory, tools, retrieval, safety filters, and custom instructions.

LLM vs Agent

An LLM responds to input. An agent uses an LLM inside a system that can pursue a goal, choose actions, call tools, observe results, and continue.

Agent vs Workflow

An agent can decide what action to take. A workflow defines a controlled process. In serious systems, you often combine them: an agent works inside workflow boundaries.

7. Why This Leads To MeshFlow

Imagine asking one LLM prompt:

Research MeshFlow, compare it with other orchestration frameworks, write a
tutorial, check it for quality, and publish it.

That prompt asks for many things at once:

  • Research.
  • Comparison.
  • Writing.
  • Review.
  • Approval.
  • Publishing.

If everything happens inside one prompt, it is hard to know:

  • What research was actually done.
  • Which facts were used.
  • Whether the comparison was checked.
  • Whether a human approved publishing.
  • Which step failed if the output is poor.

MeshFlow-style orchestration breaks the work into explicit pieces:

capture_goal
  -> research
    -> compare
      -> draft
        -> quality_check
          -> approval_gate
            -> publish

Each step can produce an artifact, and the workflow can record a trace.

That is the bridge from "what is an LLM?" to "why do we need orchestration?"

8. Hands-On Lab

In this first lab, you will run the simplest possible workflow: one simulated LLM node that produces one artifact.

Run this from the repository root:

python3 -m src.mini_meshflow compile examples/01_basic_llm.json

Expected idea:

  • The workflow is valid.
  • It has one node.
  • It produces one artifact called llm_explanation.

Now run it:

python3 -m src.mini_meshflow run examples/01_basic_llm.json

You should see a trace with one completed node.

Open the workflow:

examples/01_basic_llm.json

Look at these fields:

  • id: the node name.
  • type: what kind of node it is.
  • input: the prompt text.
  • produces: the artifact name.

Even this tiny workflow has a shape:

prompt node -> artifact

That shape is the beginning of orchestration.

9. Exercise: Modify The First Prompt

Open examples/01_basic_llm.json.

Change:

"input": "Explain an LLM in one beginner-friendly paragraph."

to:

"input": "Explain generative AI in one beginner-friendly paragraph."

Run:

python3 -m src.mini_meshflow run examples/01_basic_llm.json

Observe what changed.

This exercise is small on purpose. You are learning that a workflow node has an input and produces a named output. Later, the input will include memory, tool results, retrieved documents, and previous artifacts.

10. Knowledge Check

Answer these before moving to Lesson 02:

  1. What is the difference between AI and generative AI?
  2. What is an LLM?
  3. Why can an LLM sound correct even when it is wrong?
  4. What does an LLM not automatically know?
  5. Why is a single LLM call not enough for a governed workflow?
  6. What artifact did the first example produce?
  7. Why might a workflow trace matter?

11. Plain-English Summary

AI is the broad field of software that performs intelligent-seeming tasks. Generative AI creates new content. LLMs are generative AI models that work with text. An LLM is powerful, but it is not automatically an agent, memory system, tool user, verifier, or workflow engine.

MeshFlow-style orchestration exists because useful AI systems need structure around the model: steps, dependencies, artifacts, gates, and traces.

12. Ready To Continue

You are ready for Lesson 02 when you can say:

An LLM generates text from context. A real AI application adds memory, tools,
checks, and workflow control around the model.

Next lesson:

Lesson 02: Context, Memory, And Tools


Exercises

Exercises

Exercise 1: Compile The First Workflow

Run:

python3 -m src.mini_meshflow compile examples/01_basic_llm.json

Write down:

  • Workflow name.
  • Number of nodes.
  • Artifact name.

Exercise 2: Run The First Workflow

Run:

python3 -m src.mini_meshflow run examples/01_basic_llm.json

Find:

  • The node id.
  • The node type.
  • The produced artifact.
  • The trace status.

Exercise 3: Modify The Prompt

Open ../../examples/01_basic_llm.json.

Change the input value to:

"Explain generative AI in one beginner-friendly paragraph."

Run the workflow again and compare the output.

Exercise 4: Explain The Boundary

Write two sentences:

  1. What an LLM does.
  2. What an application must add around an LLM.