Setting up for Intro to AI Agents
Building an agent takes surprisingly little setup. You need somewhere to send a request, permission to send it, and a model on the other end that can call tools.
That's three values. The rest of this guide is about getting them right the first time, so that nothing in the course fails for a reason that has nothing to do with agents.
These pages accompany Scrimba's Intro to AI Agents course, and they stand on their own. If you're working through the course in the browser, you only need the first three pages. If you'd rather have the code on your own machine, the last page covers that too.
The course code is JavaScript, and the JavaScript handbook is there if you want to shore that up first.
What you'll set up
Three environment variables carry everything the course code needs to reach a model:
| Variable | What it holds |
|---|---|
AI_URL | The provider's API base URL, which is where requests get sent |
AI_KEY | Your API key, which is what authorizes those requests |
AI_MODEL | The ID of the specific model you want to talk to |
They have to agree with each other. A valid key pointed at the wrong provider's URL fails, and a correct provider with a model ID that provider doesn't serve fails too. Whenever you switch providers, change all three together.
Coming from Intro to AI Engineering?
These are the same three variables that course used. If you already have them saved in Scrimba, you may be able to skip straight to recommended models and confirm your model supports tool calling.
AI_URL, AI_KEY and AI_MODEL are one setting in three parts. The URL says which company you're talking to, the key proves you're allowed to, and the model says which brain answers. They only work as a matched set, so change all three together whenever you switch. Mixing one provider's key with another's URL is the mistake nearly everyone makes once!
The pages in order
Provider setup walks through creating an account with OpenAI or OpenRouter, generating an API key, and storing all three values.
Recommended models covers the one hard requirement, tool calling, and gives a tested shortlist so you don't have to guess.
Chat Completions and Responses explains the two OpenAI APIs you'll see in the wild, how their request and reply shapes differ, and why this course uses Responses.
Running the code locally is for when you want the project off Scrimba and onto your own machine, covering the download, the .env file, installing dependencies, and the port collisions that catch people out.
One thing to decide up front
Almost everything in this course works with any provider that speaks the OpenAI API shape. What doesn't vary is the requirement that your model can call tools.
An agent is a model that decides to use a tool, so a model without tool calling can't be made into one however the rest of the code is written. Keep that in mind if you go exploring beyond the recommended list, because a model limitation and a bug in your code look identical from the console.
An agent is a model that asks your code to run something, so a model that can't make that request can't be an agent at all. The shortlist on the models page has this checked already, so you don't have to work it out yourself.
Other Scrimba AI courses
Every other AI course and project has its own local setup guide. Run an AI course project locally is the index for those, covering the AI Engineer Path, Chef Claude, and Intro to Mistral AI.
Take the AI Engineer Path on ScrimbaScrimba's AI Engineer Path takes you from your first LLM call to agents, RAG and MCP across nine interactive modules.
