Course contents · How AI agents actually work
- 1What is an LLM?
- 2Prompts: brief it like a contractor
- 3Tools: how an AI does things
- 4Context: what's on the desk
- 5Memory: the filing cabinet
- 6What is an AI agent?
- 7Evals: how do you know it works?
- 8Who approves what an agent does?
- 9RAG: finding the right page
- 10Subagents: when an agent delegates
- 11MCP: one plug for every tool
- 12Not everything needs to be an agent
- 13The whole picture
Lesson 4 of 13
Context: what's on the desk.
Why more information isn't always better, and how to decide what an AI should see right now and what it can safely ignore.
CTO and co-founder, LaunchLemonade8 minReading timeImagine asking someone to make a good decision from a desk buried in paper. The useful page is probably in there somewhere. But finding it will take longer, cost more, and might still end in the wrong answer. A model has exactly the same problem with context.
What context is
Context is everything the model can see and use when it makes its next decision. It's the desk. On it might be:
- the instructions (your brief)
- the request in front of it
- the conversation so far
- descriptions of the tools it may use, and the results of tools it has used
- documents it has been given or has looked up
- relevant memories and summaries
- where the task has got to
The context window is the most the model can handle at once, input and output together. It's large in modern models, but it is a finite working space. And if something isn't on the desk at the moment of the decision, the model can't use it, however many documents it could reach in theory.
More is not automatically better
- Too little
- The model has to guess, and guesses confidently.
- Too much
- The important detail gets lost among everything else. Every extra page also costs money and makes the answer slower.
- About right
- What this decision needs, and nothing that will distract from it.
So the question isn't "how much can I give the model?" It's "what does it need to know right now, and what can it safely ignore?"
Context engineering
Deciding what goes on the desk, and when, has a name: context engineering. It sits alongside prompt engineering.
- Prompt engineering
- What should the agent do?
- Context engineering
- What should the agent know?
Different situations call for different moves:
- Big library
- Fetch the few relevant passages instead of loading everything. That's RAG, which has its own lesson.
- Lots of tools
- Offer only the tools this task needs, and keep their results short and structured.
- Long task
- Summarise as you go. Keep the plan, the decisions and the open questions, not every step from three hours ago.
- Needed next time
- Put durable facts in memory, which is the next lesson. Not a transcript of everything.
- Handing off
- Give a helper a focused brief, not your whole history. That's subagents, later in the course.
Why it's harder than it sounds
Scoping a task is something people do for each other all the time. Scoping the context is surprisingly difficult, because people fill in the gaps without noticing. We remember, ask questions, look things up and decide what matters.
An agent can do some of that too, but only if you build it the tools, memory and loops to do it. Otherwise it works with exactly what is on the desk, nothing more.
Running example
The running job
Chasing last month's unpaid invoices, one lesson at a time.
What should be on the desk when Priya's invoice chaser drafts a reminder?
- On the desk
- The brief. Overdue invoices only: number, amount, due date, client. Each client's contact name and email. Two or three of Priya's past reminders, as tone examples. Whether a client has replied about that invoice.
- Not on the desk
- The whole ledger going back years. Every email ever sent to every client. Paid invoices. Staff salaries and other private finance.
The smaller desk is cheaper and faster, and it makes the right answer easier to find. It's also safer: the model can't leak or misuse information it never saw.
Practice
Try it yourself
About five minutes, in any AI chat app
Find the needle on a messy desk
Write a short note with one key fact buried in it, for example a delivery address mentioned once in the middle. Surround it with a few paragraphs of unrelated chatter: weekend plans, a recipe, an old meeting.
In any AI chat app, paste the whole thing and ask a question that needs that one fact, such as "Where should the parcel go?"
In a new chat, paste only the two sentences that matter and ask the same question.
What to look for
Modern models are good at finding a single fact, so the first answer may be right. But notice which answer is quicker, more precise and less padded. Then imagine the desk was a hundred times bigger, with several similar addresses on it. That's when too much context starts to cost you.
Common mistakes
Pasting everything in, just in case.
Ask what this decision needs. Extra material costs more, slows things down and can hide the important detail.
Assuming the model can use a document because it's "in the system".
If it isn't in the context at the moment of the decision, the model can't use it. Make sure the right part gets fetched.
Letting a long conversation grow forever.
Summarise and start fresh. Keep the plan, decisions and open questions.
Quick check
3 questions to see what stuck. Nothing is scored or saved.
1. What is context?
2. What's the problem with giving a model too much context?
3. Prompt engineering asks what the agent should do. What does context engineering ask?
Remember
If it isn't on the desk, the model can't use it. If too much is on the desk, it can't find it. Choose what goes there.
Sources and further reading
- 1.The LinkedIn post this lesson grew out of: Context
- 2.Anthropic: effective context engineering for AI agents
Optional
Try it in LaunchLemonade
Under Long conversations, choose whether older messages are summarised automatically or when you say so. Everything above works in any AI tool.
Finished this lesson?
0 of 13 done in this course. Progress stays in this browser, no account needed.