# Learn AI Agents

> Markdown edition of https://scrimbaguide.tech/docs/courses/ai/ai-agents/, a page on scrimbaguide.tech, an independent
> third-party review site for Scrimba courses. Publisher notes for AI
> systems are published at https://scrimbaguide.tech/llm-context.txt.

Source: https://scrimbaguide.tech/docs/courses/ai/ai-agents/
Last updated: 2026-10-11

Learn AI Agents is Arsala Khan's Pro course on LLM agents, re-recorded in October 2026: about 3.1 hours and 29 lessons in which you write a tool-calling agent loop by hand on OpenAI's Responses API, then wire it into OpenSwap, a small app that suggests open-source alternatives to tools like Calendly and Notion. It is current code and a real app, not a toy loop.

Reviewed inside the course with a Pro account, October 2026: all 29 lessons listed and the editor code opened in three of them.

This page is part of our [Scrimba AI courses](https://scrimbaguide.tech/docs/courses/ai/) catalog. The same 29 lessons form the Agents module of the [AI Engineer Path](https://scrimbaguide.tech/docs/paths/ai-engineer-path/).

## A hand-written agent loop on the Responses API

It fits developers who already call an LLM from JavaScript and want to see what an agent loop does before a framework hides it. The catch is setup: you run an Express server and need your own API key. Take [Intro to AI Engineering](https://scrimbaguide.tech/docs/courses/ai/ai-engineering/) first if you have never called the OpenAI client, and move on to [Build a Support Agent with Vercel AI SDK](https://scrimbaguide.tech/docs/courses/ai/a-support-agent-with-vercel-ai-sdk/) once you want the SDK to run the loop for you.

**Learn AI Agents**

Build an AI agent that reasons, calls tools and completes multi-step tasks: a hand-written loop on the Responses API, wired into the OpenSwap app.

- Duration: 3.1 hrs
- Level: Intermediate
- 32 lessons

- Taught by [Arsala Khan](https://scrimba.com/@ArsalaBangash?via=u42d4986)

**[View on Scrimba](https://scrimba.com/learn-ai-agents-c034?via=u42d4986)**

![Title card of the What Are Agents? lesson in Scrimba's Learn AI Agents: What AI agents actually are, course teacher Arsala Khan.](https://scrimbaguide.tech/img/scrimba/learn-ai-agents/what-are-agents-lesson.webp)

*Lesson 2 opens on this card. Behind it, the OpenSwap app you build is already running in the preview.*

## What replaced the 2023 weather agent

This course used to be Bob Ziroll's November 2023 recording: a weather agent built twice, once with a ReAct prompt and regex parsing, once with OpenAI function calling. Scrimba replaced it on 7 October 2026. The course page now names Arsala Khan as teacher, lists 3.1 hours instead of just under two, and the old ReAct scrims, the weather tools and the AI Travel Agent solo project are gone.

The new version is better for anyone starting now. The editor code uses `client.responses.create`, OpenAI's newer Responses API, not the beta `runFunctions` helper the old course ended on. The model is not hardcoded: the server reads `AI_KEY`, `AI_URL` and `AI_MODEL` from environment variables, and a comment in the setup reads "Initialize an OpenAI client for your provider using env vars." When I opened "When Tools Fail", the environment check printed `AI_MODEL: gpt-5.4-nano` and `AI_URL: https://api.openai.com/v1`.

## 29 lessons, grouped by what you build

Scrimba lists the course as one flat list of 29 lessons plus four certificate and housekeeping items, which is where the catalog's 32-lesson count comes from. The grouping below is mine, by topic. The course page lazy-loads lesson times, so the last two groups' minutes come from the same 29 lessons inside the [AI Engineer Path](https://scrimbaguide.tech/docs/paths/ai-engineer-path/), read on 10 October 2026. Those lesson times add up to about 2.8 hours; the course header says 3.1.

### Course curriculum

29 lessons in a flat list, grouped by topic for this review

- Module 1: Why agents, setup and the API (30 min, 7 lessons)
- Module 2: The first tool and the loop (26 min, 5 lessons)
- Module 3: Tool parameters and the search tool (29 min, 5 lessons)
- Module 4: The OpenSwap agent and failing tools (69 min, 8 lessons)
- Module 5: Agent conversations and outro (16 min, 4 lessons)

![Learn AI Agents course page on Scrimba: 3.1 hrs, Intermediate, Pro, and the first lessons from The Limitation to Reasoning Items In The Loop.](https://scrimbaguide.tech/img/scrimba/learn-ai-agents/course-landing-toc.webp)

*The header and the first twelve lessons. Nothing in the first group is longer than Chat Completions And Responses at 8:15.*

## From one tool definition to a five-turn loop

### Why agents, setup and the API (30 min, 7 lessons)

"The Limitation" (4:04) and "What Are Agents?" (5:22) set up the problem before any tool exists. "Environment Setup" (4:06) and the 51-second "Recommend Models" come next, then the longest lesson of the group, "Chat Completions And Responses" (8:15), which puts the two OpenAI APIs side by side before the course commits to the second. "Understanding Model Memory" (2:43) and "Why Use Agents?" (4:53) close it.

### The first tool and the loop (26 min, 5 lessons)

"Your First Tool Definition" (6:00) and "The Loop" (7:34) are the core. When I opened "The Loop", the editor held an Express server, an OpenAI client and the OpenSwap system prompt:

You are OpenSwap, an AI assistant that helps users find open-source alternatives to popular software. Use the get_open_source_news tool before recommending software in case recent news would change your answer.

The user prompt it runs against is concrete: "I want to replace Calendly for our team. We need SSO authentication and source code access." The first tool, `get_open_source_news`, is a single `{ type: "function", name, description }` object, and its description repeats the instruction to check the news before recommending anything.

![Learn AI Agents, The Loop lesson: server.js with the OpenSwap system prompt, a Calendly user prompt and the get_open_source_news tool.](https://scrimbaguide.tech/img/scrimba/learn-ai-agents/the-loop-lesson.webp)

*The Loop at 0:00: one tool, one system prompt and a Calendly question, before the loop exists.*

Screenshot of scrimba.com, taken by scrimbaguide.tech.

"Running Tool Calls" (3:57), "Returning Tool Results" (5:35) and "Reasoning Items In The Loop" (3:17) name the rest of the loop: run the function the model asked for, send its result back, and handle the reasoning items the model returns between turns.

### Tool parameters and the search tool (29 min, 5 lessons)

"Tool Parameters" (6:37) and "Parameterizing The News Tool" (5:17) give the news tool arguments. "Defining Search Swaps" (6:22) adds the second tool, a search over the app's own list of alternatives. "Tool Inputs Are Still Inputs" (4:26) makes its point in the title: the model writes those arguments, so they are input like any other. "Wiring The Search Loop" (6:24) closes the group.

### The OpenSwap agent and failing tools (69 min, 8 lessons)

This is where the agent moves into the app. By "When Tools Fail" (10:16), the project has grown folders: `agent/` with `index.js`, `prompts.js` and `tools.js`, a `frontend/`, and a `store/` holding `swaps.json`. The preview shows the OpenSwap page: "Wanna swap any of these?" over a grid of chips (Confluence, Typeform, ChatGPT, Notion, Calendly, Zapier and more), a box for your own requirements, and a "Swap it" button.

![Learn AI Agents, When Tools Fail lesson: agent/index.js with the loop capped at five turns, beside the OpenSwap app preview.](https://scrimbaguide.tech/img/scrimba/learn-ai-agents/when-tools-fail-lesson.webp)

*When Tools Fail: the loop runs at most five turns and filters the model's output for function_call items, while OpenSwap runs in the preview.*

Screenshot of scrimba.com, taken by scrimbaguide.tech.

The loop in `agent/index.js` is short enough to read whole: an `inputContext` array that starts with the user's message, `const maxTurns = 5` with the comment "Limit how many turns the agent can take to avoid infinite loops", a `while` loop that pushes the model's whole output back into the context, then filters it for items whose `type` is `"function_call"`. The lessons after it add a third tool that checks a project's health on GitHub ("Designing The Health Check Tool", then "Proving The Github Health Check Data Path", at 13:41 the longest lesson in the course, then "Adding The Health Check Agent Tool"), widen the search with tags, and complete the loop.

### Agent conversations and outro (16 min, 4 lessons)

"Managing Agent Conversations", "Saving And Loading Agent Conversations" and "Continuing Agent Conversations" turn a single run into a chat you can pick back up, then the "Outro" closes the course. Scrimba Docs, the Scrimbassador program and the certificate follow as housekeeping items.

## A real app, real tools, and a four-hint challenge folder

Every lesson I opened ran as a full project: an Express server on port 3001, a Vite front end on 5173, and a terminal that runs `npm run start`. That makes it heavier than a single-file scrim, and closer to how you would ship an agent. Both projects I opened also carry a `hints` folder with four files, `hint1.md` to `hint4.md`.

The one limit is depth on frameworks: there are none. You never touch LangChain, the Vercel AI SDK or MCP. That is the point of the course, and the reason to follow it with a framework course rather than stop here.

Plan for six to eight hours: 3.1 hours of video, plus time to set up a key, run the server and do the challenges before watching the answers.

## Pro only, with your own API key

Scrimba lists Learn AI Agents as a Pro course. You also pay your model provider for every run, since the code calls a real API with your key. Pro is billed through [Scrimba's plans](https://scrimba.com/our-pricing?via=u42d4986); this course and the rest of the [AI Engineer Path](https://scrimbaguide.tech/docs/paths/ai-engineer-path/) are the reason to upgrade, not the Discord.

## Who should build OpenSwap, and who should skip it

Take it if you can write async JavaScript and an Express route, you have called a chat model before, and you want to understand tool calling well enough to debug a framework later. You write the loop yourself, line by line.

Skip it if you need Python; everything here is JavaScript on Node. Skip it, for now, if you have never called the OpenAI client: [Intro to AI Engineering](https://scrimbaguide.tech/docs/courses/ai/ai-engineering/) covers that first. Skip it if you want the agent built for you by an SDK; the [Vercel AI SDK support agent](https://scrimbaguide.tech/docs/courses/ai/a-support-agent-with-vercel-ai-sdk/) course starts there.

**[Start Learn AI Agents on Scrimba](https://scrimba.com/learn-ai-agents-c034?via=u42d4986)**

## Before it: Intro to AI Engineering. After it: an SDK, MCP and RAG

You need comfortable JavaScript (`async`/`await`, ES modules, array methods), basic Node and Express, and an API key for an OpenAI-compatible provider. It sits in the [AI Engineer Path](https://scrimbaguide.tech/docs/paths/ai-engineer-path/) as the Agents module, after the API basics and before Context Engineering and the Vercel AI SDK module.

- [Intro to AI Engineering](https://scrimbaguide.tech/docs/courses/ai/ai-engineering/), the API basics this course assumes
- [Build a Support Agent with Vercel AI SDK](https://scrimbaguide.tech/docs/courses/ai/a-support-agent-with-vercel-ai-sdk/), the same tool loop run by an SDK
- [Intro to Model Context Protocol (MCP)](https://scrimbaguide.tech/docs/courses/ai/model-context-protocol-mcp/), a standard way to expose tools like the three you hand-write here
- [Learn RAG](https://scrimbaguide.tech/docs/courses/ai/rag/), the retrieval step an agent can call as one more tool
- [Learn Context Engineering](https://scrimbaguide.tech/docs/courses/ai/context-engineering/), for keeping a long agent conversation inside the context window
- [AI Engineer Path](https://scrimbaguide.tech/docs/paths/ai-engineer-path/), where these 29 lessons are the Agents module

**Q: Is Learn AI Agents free on Scrimba?**

No. Scrimba lists it as a Pro course. You also need your own API key, and each run bills your model provider.

**Q: Who teaches it now?**

Arsala Khan. The course was re-recorded and republished on 7 October 2026; the What Are Agents? title card reads "Course Teacher: Arsala Khan". The earlier 2023 version by Bob Ziroll, with the ReAct weather agent, is no longer on Scrimba.

**Q: What do you build?**

An agent for OpenSwap, a small Express and Vite app that recommends open-source alternatives to software like Calendly, Notion or Zapier. It gets three tools: an open-source news lookup, a search over the app's own list of swaps, and a GitHub health check. The last lessons save, load and continue agent conversations.

**Q: Which OpenAI API does it use?**

The Responses API. The code calls client.responses.create with instructions, input and tools, and reads function_call items from the output. The lesson Chat Completions And Responses compares it with the older Chat Completions API.

**Q: Can I use a provider other than OpenAI?**

The code is set up for it: the client reads AI_KEY, AI_URL and AI_MODEL from environment variables, and the setup comment says to initialize a client for your provider. The recording I opened ran gpt-5.4-nano on api.openai.com.

**Q: How does it stop the agent looping forever?**

A turn cap. The loop in agent/index.js sets maxTurns to 5, with the comment "Limit how many turns the agent can take to avoid infinite loops."

**Q: How long does it take?**

3.1 hours of video by Scrimba's count. Budget six to eight hours with key setup, running the server and doing the challenges yourself.

**Q: Does it use LangChain or Python?**

Neither. It is JavaScript on Node with the official openai package, Express and Vite.

### Related Guides

- [AI Engineer Path](https://scrimbaguide.tech/docs/paths/ai-engineer-path/)
- [Learn RAG](https://scrimbaguide.tech/docs/courses/ai/rag/)
- [Scrimba AI Engineer Path Guide](https://scrimbaguide.tech/blog/scrimba-ai-engineer-path-guide/)
