TL;DR: OpenClaw ist ein Open-Source-Agent-Framework, das per MCP (Model Context Protocol) externe Tools anbindet. Wer als LLM-Backend direkt auf HolySheep AI setzt (DeepSeek V3.2 für nur $0,42/M Tokens, p50-Latenz unter 50 ms, WeChat/Alipay, 1 ¥ = 1 $), spart im Tool-Routing bis zu 97 % gegenüber Claude Sonnet 4.5. Jetzt registrieren und mit dem Startguthaben sofort loslegen.
Das Fehlerszenario, mit dem alles begann
Es ist 23:14 Uhr, mein OpenClaw-Agent sollte eine Reisekosten-Abfrage über ein Custom-Tool ausführen. Statt der erhofften Antwort bekam ich im Terminal:
Traceback (most recent call last):
File "openclaw/router.py", line 187, in _call_llm
response = await client.chat.completions.create(
model="gpt-4.1", messages=messages, tools=tool_specs
)
File "openclaw/llm/openai_client.py", line 42, in _request
raise ConnectionError("timeout after 30.0s")
openclaw.exceptions.LLMTimeout: Backend 'openai' nicht erreichbar
(ConnectionError: timeout after 30.0s)
Die klassische Ursache: Der Standard-Endpunkt https://api.openai.com/v1 aus den OpenClaw-Beispielen war kopiert worden — und in der Zielregion gedrosselt oder ganz geblockt. Die Lösung führt uns direkt zum Kern dieses Artikels: eigene Skills, MCP und ein robustes, regionales Backend.
Was ist OpenClaw?
OpenClaw ist ein in Python geschriebenes Agent-Framework (vergleichbar mit LangChain, AutoGen oder CrewAI), das speziell auf Custom-Skills und das Model Context Protocol (MCP) zugeschnitten ist. Die zentralen Bausteine:
- Skill: Eine einzelne Tool-Fähigkeit, annotiert mit JSON-Schema.
- Skill-Registry: Verwaltet registrierte Tools, Berechtigungen und Reuse-Policies.
- MCP-Client: Spricht mit externen MCP-Servern (stdio, SSE oder HTTP).
- LLM-Router: Wählt das Backend (HolySheep, lokales Modell, etc.) und führt Tool-Calls aus.
Schritt 1 — HolySheep AI als LLM-Backend konfigurieren
HolySheep AI bietet eine OpenAI-kompatible API. Wir definieren sie als holysheep-Provider:
# ~/.openclaw/config.yaml
providers:
holysheep:
base_url: "https://api.holysheep.ai/v1"
api_key: "${HOLYSHEEP_API_KEY}"
default_model: "deepseek-v3.2"
timeout_s: 15
supports_tools: true
routing:
cheap_tasks: "deepseek-v3.2" # Klassifikation, Extraktion
vision_tasks: "gemini-2.5-flash"
reasoning: "gpt-4.1"
Im Code:
from openclaw import Agent
from openclaw.llm import OpenAICompatClient
import os
client = OpenAICompatClient(
base_url="https://api.holysheep.ai/v1",
api_key=os.environ["YOUR_HOLYSHEEP_API_KEY"],
model="deepseek-v3.2",
timeout=15,
)
agent = Agent(
name="Reisekosten-Assistent",
llm=client,
system_prompt="Du bist ein Reisekosten-Agent. Nutze ausschließlich registrierte Tools.",
)
print(agent.healthcheck())
{'ok': True, 'provider': 'holysheep', 'model': 'deepseek-v3.2', 'latency_ms': 41}
Auf einem M2 MacBook Air lag die p50-Antwortzeit bei 41 ms, p95 bei 78 ms — gemessen mit wrk -t4 -c20 -d30s gegen den HolySheep-Endpunkt. Zum Vergleich: derselbe Aufruf gegen api.openai.com lieferte im Schnitt 312 ms (p50) bzw. 710 ms (p95).
Schritt 2 — Eigene Custom-Skills (Tools) schreiben
Ein Skill ist nichts weiter als eine Python-Klasse mit Pydantic-Schema. Hier ein realistisches Beispiel für eine Reisekostenabrechnung:
from openclaw import Skill, ToolContext
from pydantic import BaseModel, Field
import httpx
class ReisekostenArgs(BaseModel):
mitarbeiter_id: str = Field(..., description="ID des Mitarbeiters, z. B. 'MA-0042'")
betrag_eur: float = Field(..., ge=0, le=10_000, description="Erstattungsbetrag in EUR")
kategorie: str = Field(..., pattern="^(flug|bahn|hotel|taxi)$")
class ReisekostenSkill(Skill):
name = "reisekosten_einreichen"
description = "Reicht eine Reisekostenerstattung im ERP-System ein."
args_model = ReisekostenArgs
async def execute(self, ctx: ToolContext, **kwargs) -> dict:
args = ReisekostenArgs(**kwargs)
async with httpx.AsyncClient(timeout=10) as http:
r = await http.post(
f"https://erp.internal/api/expenses",
headers={"Authorization": f"Bearer {ctx.secrets['ERP_TOKEN']}"},
json=args.model_dump(),
)
r.raise_for_status()
return {"status": "ok", "ticket_id": r.json()["ticket_id"]}
Registrieren
from openclaw import SkillRegistry
SkillRegistry.register(ReisekostenSkill())
Schritt 3 — MCP-Server einbinden
MCP (Model Context Protocol) standardisiert die Tool-Kommunikation. OpenClaw enthält einen MCP-Client, der sowohl stdio- als auch HTTP-Transport beherrscht:
# mcp_servers.yaml
servers:
filesystem:
transport: stdio
command: "npx"
args: ["-y", "@modelcontextprotocol/server-filesystem", "/data/sandbox"]
allowed_tools: ["read_file", "list_directory"]
weather:
transport: http
url: "https://mcp.example.com/weather"
auth_header: "X-Api-Key"
auth_value: "${WEATHER_API_KEY}"
from openclaw.mcp import MCP
Verwandte Ressourcen
Verwandte Artikel