Welcome to the OpenClaw.NET User Guide! This document will walk you through the core concepts, configuring your preferred AI provider via API keys, and deploying your first agent.
OpenClaw is split into three main logical layers:
- The Gateway: Handles WebSocket, HTTP, and Webhook connectivity (e.g. Telegram/Twilio). It performs authentication and passes messages.
- The Agent Runtime: The cognitive loop of the framework. It handles the "ReAct" (Reasoning and Acting) loop, executing tools like Shell, Browser, or File I/O until the goal is completed.
- The Tools: A set of native capabilities (15 included by default) that the Agent can invoke to interact with the world, such as Web Fetching, File Writing, or Git Operations.
OpenClaw.NET relies on Microsoft.Extensions.AI to abstract away provider complexity. You can configure which provider to use via appsettings.json or environment variables.
You can point the Gateway at an additional JSON config file (merged on top of defaults):
--config /path/to/openclaw.json- or
OPENCLAW_CONFIG_PATH=/path/to/openclaw.json
This is useful when you want to keep configuration under your OS app-data folder rather than editing appsettings.json in the install directory.
For the quickest start, set your API key as an environment variable before running the gateway.
Bash / Zsh (Linux/macOS):
export MODEL_PROVIDER_KEY="sk-..."PowerShell (Windows/macOS/Linux):
$env:MODEL_PROVIDER_KEY = "sk-..."If you need to change the endpoint (e.g., for Azure or local models), set MODEL_PROVIDER_ENDPOINT similarly.
To explicitly define your LLM configuration, edit src/OpenClaw.Gateway/appsettings.json under the Llm block:
{
"OpenClaw": {
"Llm": {
"Provider": "openai",
"Model": "gpt-4o",
"ApiKey": "env:MODEL_PROVIDER_KEY",
"Temperature": 0.7,
"MaxTokens": 4096
}
}
}Note on Resilience & Streaming: Configured properties like
FallbackModelsand agent constraints like theSessionTokenBudgetare enforced uniformly across both standard HTTP API requests and real-time WebSocket streaming sessions (RunStreamingAsync). If a primary provider drops mid-stream, the gateway will flawlessly failover and resume generation using your fallback model.
OpenClaw supports native routing for several providers out-of-the-box. Change the Provider field in your config to utilize them:
- Provider:
"openai" - Required:
ApiKey - Optional:
Endpoint(if routing through a proxy).
- Provider:
"azure-openai" - Required:
ApiKeyandEndpoint - Notes: The
Endpointmust be your Azure resource URL (e.g.https://myresource.openai.azure.com/).
- Provider:
"ollama" - Required:
Model(e.g.,"llama3"or"mistral") - Default Endpoint:
http://localhost:11434/v1 - Notes: OpenClaw connects to Ollama's OpenAI-compatible endpoint automatically.
- Provider:
"anthropic"or"claude" - Required:
ApiKeyandModel - Optional:
Endpoint - Notes: This uses the native Anthropic client. You only need
Endpointwhen routing through a proxy or compatible gateway.
- Provider:
"gemini"or"google" - Required:
ApiKeyandModel - Optional:
Endpoint - Notes: This uses the native Gemini client for chat and embeddings. You only need
Endpointwhen routing through a proxy or compatible gateway.
- Provider:
"groq","together","lmstudio", or"openai-compatible" - Required:
ApiKey,Model, and usuallyEndpoint - Notes: These providers are accessed via the OpenAI-compatible REST abstractions. Ensure that you provide the proper base API URL as the
Endpointwhen required by the target service.
OpenClaw gives the AI extreme power. By default, it can run bash commands (ShellTool), navigate dynamic websites (BrowserTool), and read/write to your local machine.
You can lock down the agent via the Tooling config block:
{
"OpenClaw": {
"Tooling": {
"AllowShell": false,
"AllowedReadRoots": ["/Users/telli/safe-dir"],
"AllowedWriteRoots": ["/Users/telli/safe-dir"],
"RequireToolApproval": true,
"ApprovalRequiredTools": ["shell", "write_file"],
"EnableBrowserTool": true
}
}
}If you expose OpenClaw to the internet (a non-loopback bind address like 0.0.0.0), the Gateway will refuse to start unless you explicitly harden these settings or opt-out of the safety checks.
For a complete list of all available tools and their configuration details, see the Tool Guide.
OpenClaw.NET supports “skills” — reusable instruction packs loaded from SKILL.md files and injected into the system prompt.
Skill locations (precedence order):
- Workspace:
$OPENCLAW_WORKSPACE/skills/<skill>/SKILL.md - Managed:
~/.openclaw/skills/<skill>/SKILL.md - Bundled:
skills/<skill>/SKILL.md(shipped with the gateway) - Extra dirs:
OpenClaw:Skills:Load:ExtraDirs
OpenClaw.NET skill folders are compatible with the upstream OpenClaw skill format (a folder containing SKILL.md).
Prerequisite: install the ClawHub CLI:
npm i -g clawhub(orpnpm add -g clawhub)
Install into your workspace skills (recommended):
- Ensure
OPENCLAW_WORKSPACEis set openclaw clawhub install <skill-slug>
Install into managed skills (shared across workspaces):
openclaw clawhub --managed install <skill-slug>
Note: start a new Gateway session (or restart the Gateway) to pick up newly installed skills.
This repo ships a bundled set of powerful personas and capabilities out-of-the-box (Software Developer, Deep Researcher, Data Analyst, daily news digest, email triage, Home Assistant + MQTT operations). You can disable any skill via:
{
"OpenClaw": {
"Skills": {
"Entries": {
"daily-news-digest": { "Enabled": false }
}
}
}
}The easiest way to interact with OpenClaw locally is via the embedded frontend:
- Start the Gateway:
dotnet run --project src/OpenClaw.Gateway - Open your browser to
http://127.0.0.1:18789/chat - Enter your
OPENCLAW_AUTH_TOKENvalue into the Auth Token field at the top of the page.
WebChat token details:
- The browser client authenticates WebSocket using
?token=<value>on the/wsURL. - For non-loopback/public binds, enable
OpenClaw:Security:AllowQueryStringToken=trueif you use the built-in WebChat. - Tokens are stored in
sessionStorageby default. - Enable the Remember checkbox to also store
openclaw_tokeninlocalStorage. WebChat includes a Doctor button which fetchesGET /doctor/textand prints a diagnostics report (helpful for onboarding and debugging).
For operator workflows outside the chat UI, the gateway also exposes:
GET /admin/posturePOST /admin/approvals/simulateGET /admin/incident/export
CLI mirrors:
openclaw admin postureopenclaw admin approvals simulateopenclaw admin incident export
These are useful for validating public-bind posture, approval-policy behavior, and exporting a redacted incident bundle during support/debugging.
Retention is opt-in and targets persisted sessions/branches only (not notes).
Key defaults:
OpenClaw:Memory:Retention:Enabled=falseSessionTtlDays=30BranchTtlDays=14ArchiveEnabled=truewith archive-before-deleteArchiveRetentionDays=30
Recommended enablement flow:
- Configure retention in
appsettings.jsonunderOpenClaw:Memory:Retention. - Run a dry-run first:
POST /memory/retention/sweep?dryRun=true - Inspect status:
GET /memory/retention/status - Validate
/doctor/textwarnings and retained-count trends after enabling.
The runtime also performs proactive in-memory active-session expiry sweeps, so expired sessions are evicted over time even without max-capacity pressure.
You can also interact via the C# desktop interface:
- Start the Gateway:
dotnet run --project src/OpenClaw.Gateway - Start the UI:
dotnet run --project src/OpenClaw.CompanionThe app will connect tows://127.0.0.1:18789/wsautomatically.
The gateway also exposes two typed automation surfaces alongside the browser UI, WebSocket endpoint, and OpenAI-compatible routes:
/api/integration/*for typed operational reads and inbound message enqueueing/mcpfor a gateway-hosted MCP JSON-RPC facade over the same runtime/integration data
Current integration API coverage includes:
- status and dashboard snapshots
- pending approvals and approval history
- provider and plugin health snapshots
- operator audit events
- session lists, session detail, and session timelines
- runtime event queries
- message enqueueing
Current MCP coverage includes:
initializetools/listandtools/callresources/list,resources/templates/list, andresources/readprompts/listandprompts/get
If you are building a .NET client, use OpenClaw.Client for typed access to both /api/integration/* and /mcp.
Example:
using System.Text.Json;
using OpenClaw.Client;
using OpenClaw.Core.Models;
using var client = new OpenClawHttpClient("http://127.0.0.1:18789", authToken: null);
var sessions = await client.ListSessionsAsync(page: 1, pageSize: 25, query: null, CancellationToken.None);
var mcp = await client.InitializeMcpAsync(new McpInitializeRequest { ProtocolVersion = "2025-03-26" }, CancellationToken.None);
using var emptyArguments = JsonDocument.Parse("{}");
var status = await client.CallMcpToolAsync("openclaw.get_status", emptyArguments.RootElement.Clone(), CancellationToken.None);On non-loopback/public binds, authenticate these surfaces with Authorization: Bearer <token>.
You can configure OpenClaw to listen to messages in the background natively.
Enable them under the Channels block in your config.
- Telegram: Basic bot API support.
- Twilio SMS: SMS support via Twilio.
- WhatsApp: Official Cloud API or custom bridge support.
- Setup walkthroughs:
../README.md#telegram-webhook-channeland../README.md#twilio-sms-channel.
Scheduled jobs (Cron) and outbound delivery require a RecipientId that is specific to each channel:
- Email (
ChannelId="email"): the destination email address (e.g.you@example.com) - SMS (
ChannelId="sms"): an E.164 number (e.g.+15551234567) - Telegram (
ChannelId="telegram"): a numeric Telegramchat.id(notfrom.id)
To discover a Telegram chat.id:
- Enable the Telegram channel and temporarily set
DmPolicy="open"(or approve the pairing). - Temporarily allow inbound messages:
- If
OpenClaw:Channels:AllowlistSemantics="legacy": you can leaveAllowedFromUserIdsempty. - If
OpenClaw:Channels:AllowlistSemantics="strict"(recommended): setAllowedFromUserIds=["*"](or usePOST /allowlists/telegram/add_latestafter you send a test message).
- If
- Send your bot a message from Telegram so a session is created.
- In the WebChat UI, ask: “Use the
sessionstool to list active sessions.” - Find the
telegram:<chatId>session and use that numeric<chatId>inAllowedFromUserIdsand CronRecipientId.
If you keep DmPolicy="pairing" (recommended for internet-facing deployments), new senders will receive a 6-digit code and their messages will be ignored until approved. Approve via the gateway API:
curl -X POST "http://127.0.0.1:18789/pairing/approve?channelId=telegram&senderId=<chatId>&code=<code>"If your gateway is bound to a non-loopback address and OpenClaw:AuthToken is set, include -H "Authorization: Bearer $OPENCLAW_AUTH_TOKEN".
Once you’ve verified the right senders, you can tighten allowlists:
POST /allowlists/{channelId}/tighten(replaces wildcard with paired senders for that channel)
If OpenClaw:Tooling:AutonomyMode="supervised", the gateway will request approval before running write-capable tools (shell, write_file, etc.).
- WebChat prompts via a confirmation dialog.
- On non-loopback/public binds, requester-bound HTTP approval depends on
OpenClaw:Security:RequireRequesterMatchForHttpToolApproval.true: the approver must match the original requester.false: any authenticated admin/operator can approve the pending request by id.
- Fallbacks:
- Reply:
/approve <approvalId> yes|no - Admin API:
POST /tools/approve?approvalId=...&approved=true|false
- Reply:
Use POST /admin/approvals/simulate or openclaw admin approvals simulate to inspect the effective result for a tool/action without mutating the live approval queue.
Webhook request size controls:
OpenClaw:Channels:Sms:Twilio:MaxRequestBytes(default65536)OpenClaw:Channels:Telegram:MaxRequestBytes(default65536)OpenClaw:Channels:WhatsApp:MaxRequestBytes(default65536)OpenClaw:Webhooks:Endpoints:<name>:MaxRequestBytes(default131072)
For custom /webhooks/{name} routes, MaxBodyLength still controls prompt truncation after size validation.
If ValidateHmac=true, Secret is mandatory and validated at startup.
Compaction note:
- History compaction remains off by default.
- If you enable
OpenClaw:Memory:EnableCompaction=true,CompactionThresholdmust be greater thanMaxHistoryTurns.
OpenClaw can optionally reject a turn before the provider call when the next turn estimate would already exceed the session budget.
Config:
{
"OpenClaw": {
"EnableEstimatedTokenAdmissionControl": true
}
}This is off by default for compatibility with the existing post-admission budget behavior.
OpenClaw.NET supports WhatsApp via two methods: the Official Meta Cloud API and a Bridge (for whatsmeow or similar proxies).
- Create a Meta Developer App and set up "WhatsApp Business API".
- Get your Phone Number ID and Cloud API Access Token.
- Set your Webhook URL to
https://your-public-url.com/whatsapp/inbound. - Set the Verify Token (default:
openclaw-verify).
"WhatsApp": {
"Enabled": true,
"Type": "official",
"ValidateSignature": true,
"WebhookAppSecretRef": "env:WHATSAPP_APP_SECRET",
"PhoneNumberId": "YOUR_PHONE_ID",
"CloudApiTokenRef": "env:WHATSAPP_CLOUD_API_TOKEN"
}For non-loopback/public binds, official mode requires ValidateSignature=true and a valid app secret.
If you are using a proxy that handles the WhatsApp protocol (like a whatsmeow wrapper), use the bridge mode.
"WhatsApp": {
"Enabled": true,
"Type": "bridge",
"BridgeUrl": "http://your-bridge:3000/send",
"BridgeTokenRef": "env:WHATSAPP_BRIDGE_TOKEN"
}Bridge mode validates inbound webhook auth using Authorization: Bearer <BridgeToken> or X-Bridge-Token.
For non-loopback/public binds, BridgeTokenRef/BridgeToken is required.
OpenClaw.NET includes a built-in Email Tool that allows your agent to interact with the world via email. Unlike Telegram or SMS which act as "Channels" to talking to the agent, the Email Tool is a capability the agent uses to perform tasks like sending reports or reading your inbox.
To enable the email tool, update the OpenClaw:Plugins:Native section in your appsettings.json or use environment variables.
{
"OpenClaw": {
"Plugins": {
"Native": {
"Email": {
"Enabled": true,
"SmtpHost": "smtp.gmail.com",
"SmtpPort": 587,
"SmtpUseTls": true,
"ImapHost": "imap.gmail.com",
"ImapPort": 993,
"Username": "your-email@gmail.com",
"PasswordRef": "env:EMAIL_PASSWORD",
"FromAddress": "your-email@gmail.com",
"MaxResults": 10
}
}
}
}
}We strongly recommend using env:VARIABLE_NAME for the PasswordRef field.
For PowerShell:
$env:EMAIL_PASSWORD = "your-app-password"For Bash/Zsh:
export EMAIL_PASSWORD="your-app-password"Tip
If using Gmail, you must use an "App Password" rather than your primary password if Two-Factor Authentication is enabled.
Once enabled, you can naturally ask the agent to handle emails:
- "Send an email to boss@example.com with the subject 'Weekly Report' and a summary of my recent work."
- "Check my inbox for any emails from 'Support' in the last hour and summarize them."
- "Search my email for a receipt from Amazon and tell me the total amount."
If OpenClaw:Plugins:Native:Email:Enabled=true, the gateway also enables an email channel adapter for scheduled jobs. This is separate from the email tool:
- Email tool: the agent decides when to send/read email as part of a conversation.
- Email channel: cron jobs can deliver their final response directly via SMTP, using
ChannelId="email"andRecipientId="<address>".
OpenClaw.NET supports scheduled prompts via OpenClaw:Cron. Each cron job enqueues an internal system message; the agent runs it and sends the response back through the specified channel.
Recommended fields per job:
SessionId: stable session for that job (e.g.cron:daily-news)ChannelId:email,telegram,sms, etc.RecipientId: channel recipient (email address, Telegram chat id, E.164 number)Subject: used by theemailchannel (optional)
- Cron expressions are currently evaluated in UTC.
- Supported cron format is 5 fields: minute hour day-of-month month day-of-week.
- Supported forms per field:
*,*/n,a,b,c,a-b, or a single integer.
Daily news (delivered to email)
- Use the example job in
src/OpenClaw.Gateway/appsettings.jsonas a starting point. - Prompt idea: “Summarize today’s top AI + security news. Include links and 5 bullet takeaways.”
Inbox triage (daily digest)
- Enable
OpenClaw:Plugins:Native:EmailandOpenClaw:Plugins:Native:InboxZero. - Cron prompt idea: “Run inbox triage on the last 50 emails (dry-run). Summarize what you would archive, what needs replies, and any urgent items. Then email me the report.”
Home status report
- Enable
OpenClaw:Plugins:Native:HomeAssistant. - Cron prompt idea: “Check if any doors/windows are open, list any lights left on, and summarize any energy-usage sensors. Email me the results.”
OpenClaw.NET supports native (C#) smart-home control via:
- Home Assistant tools:
home_assistant(read) andhome_assistant_write(write) - MQTT tools:
mqtt(read) andmqtt_publish(write)
Matter support:
- OpenClaw.NET does not commission Matter devices directly; the recommended approach is to commission devices into Home Assistant and control them through Home Assistant’s entity/service model.
Safety model:
- Keep writes gated via tool approval by adding
home_assistant_writeandmqtt_publishtoOpenClaw:Tooling:ApprovalRequiredTools. - Use allow/deny policies (
Policy.Allow*Globs/Policy.Deny*Globs) to restrict entities, services, and MQTT topics.
OpenClaw.NET supports an optional native Notion integration for shared scratchpads and note databases:
notion: read/search/list operationsnotion_write: append/create/update operations
Recommended use:
- shared project scratchpads
- operator-visible runbooks
- handoff notes across sessions or team members
Design constraints:
- Notion is not used for session memory, branch storage, or core retention.
- Access is bounded by
AllowedPageIds/AllowedDatabaseIdsplus any configured defaults. DefaultPageIdis used for scratchpad-style reads/appends.DefaultDatabaseIdis used for list/search/create workflows.
Recommended safety posture:
- Keep
RequireApprovalForWrites=trueunless you intentionally want autonomous writes. - Set
ReadOnly=trueif the agent should only search/read Notion. - Share only the specific pages/databases the integration needs. The token may have broader workspace reach than the local allowlist, so the allowlist is part of the tool boundary.
Minimal config example:
"OpenClaw": {
"Plugins": {
"Native": {
"Notion": {
"Enabled": true,
"ApiKeyRef": "env:NOTION_API_KEY",
"DefaultPageId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"DefaultDatabaseId": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
"AllowedPageIds": [
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
],
"AllowedDatabaseIds": [
"yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"
],
"ReadOnly": false,
"RequireApprovalForWrites": true
}
}
}
}OpenClaw.NET is designed to be compatible with the original OpenClaw TypeScript/JavaScript plugin ecosystem. This allows you to leverage hundreds of community plugins without rewriting them.
For a detailed breakdown of supported features and implementation details, see the Plugin Compatibility Guide.
When you enable the plugin system, OpenClaw.NET spawns a optimized Node.js "Bridge" process for each plugin. This bridge loads the TypeScript or JavaScript files, registers the exported tools, and communicates with the .NET Gateway via a high-performance JSON-RPC protocol over local pipes.
- Node.js 18+: The bridge requires a modern Node.js runtime.
- Enabled Config: Set
OpenClaw:Plugins:Enabled=trueinappsettings.json.
| Feature | Support | Note |
|---|---|---|
| Tools | ✅ Full | Bridged tools appear natively to the AI. |
| Background Services | ✅ Full | Lifecycle methods start() and stop() are supported. |
| Logging | ✅ Full | Plugin console output is captured and routed to .NET logs. |
| Channels | Registered but not yet active in the .NET gateway. | |
| Model Providers | ❌ No | Auth flows for third-party providers must be native. |
You can install plugins by placing them in:
- Your workspace:
.openclaw/extensions/ - Your home directory:
~/.openclaw/extensions/ - Custom paths: configure them in
Plugins:Load:Paths.
The agent will automatically choose the email tool and perform the requested actions!