← Back to Field Notes
How to Create Your OpenClaw AI Agent in 2026: Full Tutorial
Field Notes #53
OpenClaw Tech ExplainedPlaybook
By Amplify Team·
Jul 21, 2026
13 min read

How to Create Your OpenClaw AI Agent in 2026: Full Tutorial

Step-by-step OpenClaw tutorial for 2026: VPS, install, channels, tools, memory. Working agent by the end. Amplify as the managed alternative.

This is the hands-on version. If you've already decided you want to self-host and you're comfortable with a terminal, this walk-through gets you from an empty VPS to a working OpenClaw agent responding in your Telegram, with memory, web search, and Google Workspace wired up. Real commands, real config, real order of operations. No toy example at the end, an actual agent you can use.

Time budget: four to six hours end to end the first time you do this, including waiting for DNS to propagate and Google's OAuth consent screen. If you've done it before, closer to 60-90 minutes.

One thing to keep in mind while you read: OpenClaw is on a calendar release cadence, and the commands and plugin names occasionally shift with new pins. Every command here reflects the runtime as of publish date. When you actually run this, cross-check against docs.openclaw.ai for anything that looks off. The shape of the setup is stable, but individual verbs and JSON keys move.

If you're still comparing whether to self-host at all, read the three-tracks guide first and come back once you're sure Track 1 is where you want to be.

What OpenClaw is (one paragraph)

OpenClaw is an open-source runtime for building AI agents that live inside your messengers and take actions on your behalf. It ships the pieces you'd otherwise stitch together yourself: the agent loop, tool invocation, memory adapters, channel plugins for Telegram, Discord, Slack, WhatsApp, and a sandboxed exec plugin for running code. You bring the LLM key, the channel credentials, and a VPS to host it on. Docs live at docs.openclaw.ai and are worth bookmarking before you start.

Prerequisites checklist

Verify each of these before you type a single command. Nothing burns setup time faster than realizing halfway in that you need to go set up an OAuth consent screen.

A VPS with at least 4GB RAM, 8GB recommended. Realistic options: DigitalOcean droplet at $12/month, Hetzner CX22 at €4.51/month, Contabo VPS S at $5.50/month. Pick a region close to you for latency.
A domain you control with DNS access. You'll point a subdomain at your VPS for HTTPS. Cloudflare-fronted works fine.
An LLM API key. OpenRouter is the pragmatic default because one key routes to Anthropic, OpenAI, xAI, Mistral, and DeepSeek. Top up $10 to start, which lasts weeks of light personal use. Direct provider keys work too if you know you want a specific model.
A Telegram account. This tutorial uses Telegram as the walking-example channel because it's the easiest to wire up. Discord and Slack work the same way with slightly different token flows.
Recommended optional extras: a Google Workspace account (Gmail, Calendar, Drive), a Tavily key for web search (there's a free 1000-credits-per-month tier), and a Mem0 account (free personal tier).

Realistic first-month budget: $6-15 VPS + $12/year domain + $5-40 LLM usage + optional $30 Tavily. Call it $40-70 for month one, less after you've settled into a usage pattern.

Step 1: VPS setup and base install

Assume Ubuntu 24.04 LTS. If you're on a different distro, translate the apt commands to your package manager.

Create the VPS through your provider's dashboard. When it's up, SSH in as root. First priority: create a deploy user and disable password login.

Copy your SSH public key to /home/deployer/.ssh/authorized_keys, then log out and log back in as deployer. Edit /etc/ssh/sshd_config to set PasswordAuthentication no and PermitRootLogin no, then sudo systemctl restart ssh. Don't skip this. VPSes with root+password login open on the internet get compromised in under a day.

Install Docker, Node 20, git, and jq:

Log out and back in so the docker group membership takes effect. Verify:

Both should return without errors. If docker complains about permissions, you skipped the re-login step.

Now point a subdomain at your VPS. In your DNS provider, create an A record agent.yourdomain.tld pointing at the VPS's public IP. DNS propagation usually takes 2-10 minutes. Check with dig agent.yourdomain.tld +short.

Install Caddy for HTTPS. Caddy auto-provisions Let's Encrypt certs, which saves you a manual dance.

Write a minimal /etc/caddy/Caddyfile that reverse-proxies to the OpenClaw gateway port (8080 by default):

Reload Caddy with sudo systemctl reload caddy. Time so far: 30-45 minutes if DNS cooperated.

Step 2: Install OpenClaw

Follow the current install command at docs.openclaw.ai/install. The docs are the source of truth here because the exact npm package and CLI verb change with the calendar pin. As of this article, the runtime installs into ~/.openclaw/, drops an openclaw CLI on your PATH, and creates a default gateway config at ~/.openclaw/gateway.json.

Open the gateway config in your editor. The core sections you'll edit:

`agents`: which LLM handles which agent. You'll set a primary and a fallback.
`channels`: entries for each messenger you're wiring up. Empty at first.
`plugins`: tools available to the agent. Memory (openclaw-mem0), web search (openclaw-tavily-search), Google Workspace (gog), sandboxed code exec.
`tools`: capabilities. Look for tools.elevated.enabled and make sure it's false. If it's true, the sandboxed exec plugin can escape to the host. This is not paranoia, it's the default that keeps you safe when the agent misinterprets an instruction.

Start the runtime as a user-level systemd service:

The last command tails the log so you can watch the runtime come up. You want to see "listening on :8080" (or whatever port you configured). If you see errors about missing plugin config, that's expected right now, you haven't filled them in yet.

Step 3: Wire up the LLM (OpenRouter)

Sign up at openrouter.ai if you haven't. Top up $10. From the dashboard, generate an API key.

Edit ~/.openclaw/gateway.json. Find the agents.defaults.model.primary block. Set:

(Verify the exact current model ID against OpenRouter's dashboard, model naming shifts.)

Add the key to the runtime's environment. Either edit ~/.openclaw/env or set it in the systemd user unit override. The variable name is OPENROUTER_API_KEY.

Restart:

Sanity check from the shell:

You should get a reply from the model within a few seconds. If not, tail the log again and look for auth errors, they'll be verbose.

Step 4: Add memory (Mem0)

Without memory, your agent forgets you between sessions. Every conversation starts blank. That's not what you want.

Two options: hosted Mem0 (simpler, free personal tier at mem0.ai) or self-hosted Mem0 in Docker. This tutorial covers the hosted route because the self-hosted setup is a separate 30-minute detour.

Sign up at mem0.ai, grab an API key from the dashboard.

Open ~/.openclaw/gateway.json and find plugins.entries['openclaw-mem0'].config (create the entry if it doesn't exist based on the plugin's docs). Add:

Restart the gateway. Test it end to end. Open a chat with your agent (via the CLI for now, we'll wire up Telegram in the next step). Say: "I'm building a mobile app called BlueSky and I care most about onboarding conversion." Then start a fresh chat session (Ctrl+C, run openclaw chat again) and ask: "what's the name of the app I'm building?" It should recall BlueSky. If it doesn't, memory isn't wired correctly, tail the log and look for Mem0 API errors.

Step 5: Connect Telegram

The most fun part. Once this works, you've got a real agent in a real messenger.

Open Telegram on your phone. Message @BotFather. Send /newbot. Pick a display name for your bot ("Sam's Agent"). Pick a username ending in bot ("samsagent_bot"). BotFather replies with a bot token. Copy it.

Now find your own numeric Telegram user ID. Message @userinfobot in Telegram, it'll reply with your ID. You need the numeric ID, not your @username.

Open ~/.openclaw/gateway.json. Add a Telegram channel entry:

If you're going to use commands or slash-triggered actions, also add:

Both prefixed and bare forms are required because the runtime's owner-check normalizes them differently across code paths.

Restart the gateway. Open a DM with your bot in Telegram. Send "hello". You should get a reply in three to five seconds.

If nothing happens, three most likely causes in order:

1.Bot token has a typo. Copy-paste it fresh from BotFather.
2.Owner allowlist is missing your numeric ID, or you put in your @username instead.
3.The gateway didn't actually restart. systemctl --user status openclaw-gateway will confirm.

Step 6: Add tools

Now the agent can talk. Time to give it hands.

Tavily web search

Sign up at tavily.com, grab an API key. The free tier gives 1000 searches per month, which is plenty for personal use.

Add to ~/.openclaw/gateway.json:

Restart. In Telegram, ask: "search for OpenAI's most recent model release and summarize it in three bullet points." You should get real search results with a real summary, not a generic model answer.

Google Workspace

This one is a wizard on its own but worth doing once. It unlocks Gmail, Calendar, Drive, Contacts, Sheets, Docs.

1.Open Google Cloud Console. Create a new project ("SamAgent" or similar).
2.Enable the following APIs from the API Library: Gmail, Google Calendar, Google Drive, Google People (Contacts), Google Sheets, Google Docs.
3.Configure the OAuth consent screen. User type: External. Fill in the required fields (app name, user support email, developer contact). Add yourself as a test user under "Test users." Do not submit for verification, testing mode is fine forever for personal use as long as you stay under 100 users.
4.Create OAuth 2.0 credentials of type "Desktop app" (or "Web application" depending on how OpenClaw's gog plugin expects them, check the plugin's README). Download the client ID JSON.
5.Add the credentials path to the gog plugin's config in the gateway JSON.

Restart. In Telegram, ask: "summarize my inbox from the last 24 hours." The first time you'll get an OAuth link, click it, sign in, grant access. Every subsequent request works without prompts.

If Google shows an "unverified app" warning during OAuth, that's expected for testing mode. Click "Advanced" and proceed. This warning goes away only after you submit the app for Google's verification, which is a separate multi-week process not worth doing for personal use.

Code execution

OpenClaw's sandboxed exec plugin ships enabled by default. It runs code in a locked-down Docker container isolated from the host. You don't need to configure anything beyond confirming tools.elevated.enabled: false in the gateway JSON (from Step 2). That flag is the hinge between "safe sandbox" and "agent can read your VPS's environment." Leave it off.

Step 7: Test the full agent

Three prompts that stress every piece you just wired up. Try each in Telegram:

1."What's on my calendar tomorrow, and are there any emails I should reply to first?" This tests Google Workspace access plus the agent's ability to reason across two data sources and produce a prioritized answer.
2."Research the top 5 open-source AI runtimes released in 2026 and post a comparison in this chat, with links." This tests web search, long-form generation, and formatting.
3."Remember that I prefer bullet-point summaries over prose. Then summarize my last five emails." This tests memory persistence plus Gmail access plus formatting-preference adherence.

If all three work, the agent is real. Take a screenshot, log off, celebrate.

Common problems and their causes

Real ones, from the OpenClaw community and from dogfooding the same runtime at Amplify:

The agent doesn't reply on Telegram after setup. Nine times out of ten it's the owner allowlist missing your numeric ID, or @username in place of the numeric.
"tool_use error" appears in the log when the agent tries to call a tool. Schema mismatch between the LLM's output and the plugin's expected input. Usually a runtime or plugin restart resolves it (the schema gets re-registered on boot).
Memory doesn't stick between sessions. Mem0 key missing, or the plugin's config block landed under the wrong key name in the gateway JSON. Triple-check the plugin's docs against your entry.
OAuth flow fails on Google. The OAuth consent screen isn't published, your account isn't in the test users list, or the redirect URI in the credentials doesn't match what the plugin expects.
Runtime crashes with "Too many open files." Docker's default nofile ulimit is too low for a busy agent. Set default-ulimits.nofile = 65536 in /etc/docker/daemon.json and restart Docker.
Streaming replies stop mid-answer. LLM provider is rate-limiting you. Check your OpenRouter dashboard, top up if you're low.

What to add next

Once the base is running, expanding is cheap:

A second channel. Discord takes about ten minutes, same shape as Telegram: create a bot in the developer portal, grab a token, paste it into the gateway config's channels.discord block, restart.
A scheduled cron. OpenClaw ships a cron plugin. Wire it up to fire a prompt at 7am every weekday: "brief me on today's calendar and any overnight emails I should reply to first."
Notion for notes. The Notion plugin takes an integration token you generate in Notion's developer settings. Once wired up, your agent can search, read, and edit your workspace.
WhatsApp. Requires a QR pair with your phone. The Baileys-based plugin does the work; you scan a QR from a linked device screen and your agent lives on that WhatsApp session. Note: WhatsApp officially considers Baileys-style connections a ToS gray area, and there's a nonzero risk to the phone number you connect. Read the plugin's README before doing this.

Each of these takes about 30 minutes once the base is running.

Lifehack – When to stop DIYing and switch to hosted

Being honest about when this stops being fun.

"I've spent more time patching the runtime than using the agent." Common after month three when a runtime bump breaks a plugin you depended on.
"My VPS got compromised because I forgot to apt upgrade for two months." Also common. Also avoidable, but only if security patching is part of your routine.
"I want media generation and setting up the fal.ai integration plus billing plumbing looks like a whole project." Fair.
"I want observability dashboards and I don't want to run Langfuse myself."
"I'd rather pay one predictable subscription than track VPS + LLM + Mem0 + Tavily bills separately."

Amplify handles all of the above. It's the same OpenClaw runtime, but the provider runs it, patches it, and consolidates billing. Pricing: $9.99 subscription plus a wallet for provider usage (minimum $3 deposit, no expiry). Provider costs get debited at cost plus a 7.5% service fee. Details at getamplify.team.

Frame it as: Amplify is OpenClaw hosted, for people who'd rather not be DevOps. It's not a competitor, it's the offramp when the tutorial gets tiring.

TL;DR

OpenClaw is an open-source agent runtime you self-host. This tutorial walks you from empty VPS to a working agent in your Telegram with memory, web search, and Google Workspace, in four to six hours the first time. The realistic ongoing cost is $25-80 per month depending on how much you use it. You get full control and full responsibility. If either of those becomes a source of stress, the same runtime runs hosted at Amplify with the pricing above. Pick the option that matches how much of your time you want to spend on infrastructure versus on what the agent actually does for you.

OpenClaw Tech Explained
Enjoyed this Field Note?

Read more

How to Create Your OpenClaw AI Agent in 2026: Full Tutorial — Field Notes — Amplify