AI / Learning

From Prompts to Agents: Understanding How Modern AI Actually Works

If you have ever heard terms like prompt engineering, LLMs, agents, ChatML, or distillation and thought, “Why is everyone assuming I already know this?”, this article is for you.

When I started learning AI, I realized something important: most resources explain what these terms are, but very few explain how they connect.

So instead of memorizing definitions, I tried to build a simple mental model.

This article is that mental model.

Visual overview of prompts, applications, agents, and LLMs

Let’s Start With a Simple Question

Imagine you open ChatGPT and type:

What is Artificial Intelligence?

A few seconds later, you get a polished answer.

But what actually happened behind the scenes?

Step 1: What Is a Prompt?

A prompt is simply the instruction you give to an AI model.

Examples include:

Explain React Hooks.
Summarize this article.

That is all a prompt is: a request to a very knowledgeable system.

Different Ways of Writing Prompts

1. One Prompt

Explain JavaScript Promises.

One prompt, one answer.

2. Guided Prompt

Explain JavaScript Promises.

First explain callbacks.
Then explain promises.
Finally explain async/await.
Give one real-world example after each section.

This gives the AI a clearer path to follow.

3. Step-by-Step Problem Solving

Solve this problem step by step.
Explain your approach clearly before giving the final solution.

This works especially well for coding, planning, and debugging.

What Is an LLM?

A Large Language Model, or LLM, is the core intelligence behind the AI experience.

It has learned patterns from massive amounts of text and can generate answers when prompted.

Question
   ↓
 Model
   ↓
Answer

Popular examples include GPT, Gemini, Claude, and Llama.

But a model by itself has limits. It cannot open your files, run terminal commands, or call APIs unless it is paired with a system that gives it those capabilities.

Then What Is an Agent?

Think of the model as the brain.

An agent is software built around that brain so it can take actions.

It gives the model access to tools like:

  • Search the internet
  • Read files
  • Run commands
  • Call APIs
  • Work with databases

So the model provides intelligence, while the agent provides capability.

Model vs Agent

The easiest way to remember it is:

Model = Brain
Agent = Brain + Hands

How an Agent Works

Suppose you ask:

Count all JavaScript files in my project.

The agent receives your request, decides what needs to happen, uses a tool to gather the answer, and then replies with the result.

The model does not directly execute the command. The agent does.

What Are Prompt Formats?

Different models expect different prompt formats.

For example, ChatGPT may use a conversation-style format, while Llama may use a different wrapper.

These are not different meanings; they are different packaging methods.

Modern SDKs usually handle this automatically, so you do not need to manually construct the format yourself.

Foundation Models vs Applications

Many people mistakenly think ChatGPT is the model itself.

In reality, ChatGPT is an application built on top of a model.

Applications such as ChatGPT, Cursor, GitHub Copilot, and Perplexity sit above the actual foundation models and provide an interface for users.

What Is Distillation?

Distillation is the process of taking knowledge from a large model and transferring it to a smaller, faster one.

It is a very common machine learning technique.

A distillation attack happens when someone uses another company’s model outputs to train a new model without permission.

Putting Everything Together

Once all these pieces connect, the whole picture becomes much simpler.

User
  ↓
Prompt
  ↓
Application
  ↓
Agent
  ↓
Prompt Format
  ↓
Model (LLM)
  ↓
Tool or Action
  ↓
Final Answer

Each layer has a clear job.

  • The prompt tells the AI what you want.
  • The application provides the interface.
  • The agent coordinates tools and actions.
  • The prompt format packages the request for a specific model.
  • The model provides the intelligence.

Final Thought

If you are just starting your AI journey, do not try to memorize every buzzword.

Instead, focus on understanding how the pieces fit together.

Once the architecture clicks, the terms stop feeling intimidating and start making sense.

← Back to all articles