Welcome! In this tutorial you'll install OpenClaw AI, configure your API credentials and run your very first AI agent β€” all in under 10 minutes. No prior experience with AI frameworks is required; basic command-line familiarity is enough.

What you'll build
A simple "research assistant" agent that takes a topic, looks up information, and returns a concise summary. You'll be able to extend it later.

1. Prerequisites

  • Python 3.10 or newer (or Node.js 18+ if you prefer JS)
  • An OpenClaw API key β€” sign up on the official site to obtain one
  • A terminal and your favourite text editor

2. Installation

OpenClaw ships as both a Python and a JavaScript package. Pick whichever fits your stack.

Python (recommended)

pip install openclaw

Node.js

npm install openclaw

Verify the installation:

openclaw --version
# openclaw 1.4.2

3. Configure your API key

OpenClaw reads your API key from the OPENCLAW_API_KEY environment variable. Set it once per shell session (or persist it in your shell profile):

export OPENCLAW_API_KEY="sk-your-key-here"
⚠️ Keep your key secret
Never commit API keys to Git. Use a .env file with .gitignore, or a secrets manager like Vault / Doppler.

4. Your first agent

Create a file hello_claw.py:

from openclaw import Agent

agent = Agent(
    name="research-assistant",
    model="openclaw-1",
    instructions=(
        "You are a research assistant. Given a topic, return a "
        "concise summary in 3 bullet points."
    ),
)

result = agent.run("the history of the World Wide Web")
print(result.text)

Run it:

python hello_claw.py

# β–Ί The World Wide Web was invented by Tim Berners-Lee in 1989…
# β–Ί It was originally proposed as a way for physicists to share data…
# β–Ί The first website went live in 1991 at CERN…

5. What just happened?

Let's break down the four lines of agent code:

  1. Agent(...) β€” instantiates a new agent. name is its identifier; model picks the underlying LLM; instructions is the system prompt.
  2. agent.run(topic) β€” synchronous call: send the prompt, wait for the full response.
  3. result.text β€” the assistant's final message (string).
  4. For streaming, use async for chunk in agent.stream(topic) instead.

6. Next steps

Advertisement Ad slot (in-article / responsive)
πŸŽ‰ You did it!
You've installed OpenClaw, configured credentials and run your first agent. Bookmark this site β€” we publish new tutorials every week.