📚Academy
likeone
online

Install & First Query

From npm install to your first working agent in under five minutes

Setting Up Your Environment

Before you write a single line of agent code, you need three things: Node.js, an Anthropic API key, and the SDK package. If you have ever set up a JavaScript project, this will feel familiar. If you have not, follow every step — we will not skip anything.

Real-world analogy: Setting up the SDK is like setting up a workshop. Node.js is the workbench. The API key is your badge that gets you into the building. The SDK package is the toolbox. You need all three before you can build anything.

Step 1: Install Node.js

The Agent SDK runs on Node.js 18 or later. Check if you already have it:

Terminal — check your Node.js version
# Check if Node.js is installed and what version
node --version
# You need v18.0.0 or higher
# If you see "command not found" or a version below 18,
# install from https://nodejs.org (use the LTS version)

Step 2: Get Your API Key

You need an Anthropic API key. If you already have one from using the Claude API, it works with the SDK too — same key, same account.

1
Go to console.anthropic.com and sign in (or create an account)
2
Navigate to Settings > API Keys and click "Create Key"
3
Set it as an environment variable so the SDK can find it automatically
Terminal — set your API key
# Add to your shell profile (~/.zshrc or ~/.bashrc)
export ANTHROPIC_API_KEY="sk-ant-api03-your-key-here"

# Reload your shell
source ~/.zshrc
Security: Never put your API key directly in source code. Never commit it to Git. Use environment variables or a .env file (and add .env to your .gitignore). If you accidentally expose a key, rotate it immediately in the Console.

Step 3: Install the SDK

Create a new project and install the Claude Agent SDK:

Terminal — create project and install
# Create a new directory for your agent project
mkdir my-first-agent && cd my-first-agent

# Initialize a new Node.js project
npm init -y

# Install the Claude Agent SDK
npm install @anthropic-ai/claude-agent

# If you are using TypeScript (recommended):
npm install typescript tsx --save-dev
🔒

This lesson is for Pro members

Unlock all 355+ lessons across 36 courses with Academy Pro. Founding members get 90% off — forever.

Already a member? Sign in to access your lessons.

Academy
Built with soul — likeone.ai