AI Hints
Home›Generative AI Tutorial›Tools and Agents
Generative AI · Lesson 40 of 77

Planning, Memory and Safety

Making agents dependable.

⏱ 2 min read▶ Video at 1:32:30🎓 Free
Watch this lesson in the Generative AI courseWatch on YouTube ↗Full Generative AI course

Agents are powerful, and also easy to get wrong. They can wander off course, forget earlier steps, or take actions you did not intend. In this lesson, you will learn how to make agents dependable, with planning, memory, and guardrails.

Planning, Memory and Safety
From the video: Planning, Memory and Safety
  • Wandering off course
  • Forgetting earlier steps
  • Guardrails that keep agents safe

Planning

Good agents plan before acting. They break a big goal into smaller sub goals, and write the plan down. As they work, they tick off steps, and revise the plan, when something unexpected happens. Asking a model, first write a numbered plan, then follow it, step by step, makes its behaviour much easier to follow, and to debug.

Break the goal downsmaller, checkable steps
Write the plana numbered list
Follow and tick offone step at a time
Revise when neededadapt to surprises

Memory

Agents need memory, at two levels. Short term memory is the context window, holding the current task and recent results. Long term memory is stored outside, in a database, or files, so the agent can recall earlier work, and preferences, across sessions. Often, long term memory is simply the retrieval pattern from before, applied to the agent's own notes.

Short-termthe context window: this task
Long-terma database or notes, across sessions
Retrievalfetch the relevant memories
Summariescompress old work to save space

Guardrails for agents

Guardrails keep agents safe. Give the narrowest set of tools, and permissions, that the job needs. Set limits, on steps, time, and spending. Require human approval, before anything irreversible, like paying, deleting, or sending. Log every action, so you can review what happened. And test with harmless pretend data first, before using real accounts.

  1. Least privilegeonly the tools and access needed
  2. Hard limitssteps, time and money caps
  3. Human approvalbefore irreversible actions
  4. Full loggingreview every step taken
  5. Safe testingpretend data before real data

Summary

Good work. Dependable agents plan first, use short and long term memory, and live inside guardrails, least privilege, limits, approval, logging, and safe testing. Next, a standard way to connect agents to tools, and how several agents can work together.

Key takeaways
  • Plan, follow, revise
  • Short-term and long-term memory
  • Least privilege, limits, approval, logs
Next up: MCP and Multi-Agent Systems — connecting tools, teaming up agents