AI Agents and Automation: Building Reliable Agents

AI Agents and Automation is an advanced-level course of 5 lessons (about 1 h 40 min), with 15 exercises and 15 quiz questions. Prerequisites: Integrating an LLM into an Application. Exercises run in the browser, with nothing to install.

  • Generative AI
  • Advanced
  • 5 lessons
  • 1 h 40 min
  • 15 exercises
  • Exercises run in the browser

The course in brief

This course shows how to go from a simple model call to an agent that uses tools, plans, and acts, without losing control. You write in Python the agent-tool loop, memory management, an authorization policy with human approval, idempotent workflows, and recovery mechanisms. All exercises use a locally simulated model: they are deterministic and require no API key.

What you will be able to do

  • Write a bounded agent-tool loop that validates each tool call
  • Manage working memory within a context budget and make use of long-term memory
  • Validate and order a plan produced by a model
  • Apply code-level guardrails and traceable human approval
  • Choose between workflow, routing, and agent, and make actions idempotent
  • Handle failures: retries with exponential backoff, checkpoints, and fallback

Syllabus: 5 lessons

  1. 01

    The Agent-Tool Loop

    20 minFree preview
    • Explain what distinguishes an agent from a simple model call
    • Write a loop that alternates model decisions and tool execution
    • Bound the loop and handle invalid tool calls

    Agent-tool loopTools and schemasStop conditions

  2. 02

    Planning and Memory

    20 min
    • Distinguish working memory (history) from long-term memory (notes, knowledge base)
    • Keep the history within a context budget without losing the instructions
    • Have a plan produced and then execute it in an order that respects dependencies

    Working memory and long-term memoryContext budgetPlanning

  3. 03

    Guardrails and Human Approval

    20 min
    • Classify tools by risk (read, write, irreversible)
    • Write a policy that allows, requires approval for, or denies an action
    • Set up a traceable human approval queue

    GuardrailsHuman approvalIndirect prompt injection

  4. 04

    Task Orchestration

    20 min
    • Choose between a deterministic workflow, routing, and an autonomous agent
    • Chain steps with a shared state and an execution trace
    • Make an action idempotent to avoid duplicates

    WorkflowsRoutingIdempotency

  5. 05

    Failures and Recovery

    20 min
    • Distinguish transient errors from permanent errors
    • Implement retries with exponential backoff
    • Resume a long process from a checkpoint

    Retries and exponential backoffCheckpointsInvalid model outputs

Final project

Customer Service Agent with Guardrails and Human Approval

Build in Python a customer service agent for a fictional store. It has read tools (look up an order, read the return policy) and write tools (refund, send an email). The model is simulated by a local function that covers at least five scenarios, including a model that loops, an unknown tool, and a prompt injection attempt in a customer message. The agent applies an authorization policy with thresholds, a human approval queue, idempotency keys, and recovery from transient errors.

Deliverables

  • The agent's code: bounded loop, call validation, authorization policy
  • The human approval queue with a decision log (author, date, reason)
  • The simulated model and a test suite covering the five scenarios
  • An execution log of a complete scenario (proposed calls, decisions, results)
  • A one-page note justifying the thresholds and architecture choices

Assessment criteria

  • No write action is executed outside the policy, even in the injection scenario
  • The loop is bounded and tool errors are sent back to the model
  • Approved actions are executed only once, including after a rerun
  • Only transient errors are retried, with exponential backoff and a final fallback
  • The tests are deterministic and pass without network access

Frequently asked questions

Do you need an API key to follow this course?

No. The exercises use a model simulated by a Python function: they are deterministic and run without a network. The course explains how to plug a real model into the same loop afterward.

What is the difference between an agent and a workflow?

In a workflow, the steps are written in the code and the model intervenes at specific steps. In an agent, the model itself chooses the actions and how many there are. The course helps you choose the simplest solution that meets the need.

Does the course use an agent framework?

No, the loop is written in standard Python so you understand every mechanism. These notions (tools, memory, guardrails, recovery) are found in the frameworks on the market.

What prerequisites do you need?

Knowing how to integrate a language model into an application (course AI2) and being comfortable with functions, dictionaries, and classes in Python.

This course, told for your job

Say what you want to be able to do: “AI Agents and Automation” takes its place in your path, with examples from your field. The concepts stay those of the course.

The preview is free, and you can take the courses one at a time without paying. The path only contains lessons from the catalogue.