Hugging Face Agent Skill for Openclaw

An AI agent skill enabling cost-effective, secure discovery and multi-provider inference of open-source models and datasets on Hugging Face.

simonpierreboucher02
v1.0.0
Jun 1, 2026
0
599
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install hugging-face-api

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install hugging-face-api using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Hugging Face Agent Skill?

The Hugging Face Agent Skill provides your AI agents with a comprehensive playbook and seven Model Context Protocol (MCP) tools to interact directly with the Hugging Face Hub. This skill empowers developers to search for open-source models (such as Llama, Qwen, or Mistral) and datasets, inspect technical specifications, and execute chat completions or text embeddings across various providers using a unified, OpenAI-compatible interface.

By implementing this skill, agents can intelligently navigate the Hugging Face ecosystem. It balances performance and cost by guiding agents to perform free search and validation operations first, and only call billed inference tools after confirming model support. This workflow maximizes the capability of Openclaw Skills by offering robust, secure, and production-ready open-source model integration.

Hugging Face Agent Skill Use Cases

  • RAG Systems and Semantic Search: Finding optimal text embedding models and generating embeddings in batches for database indexing.
  • Automated Open-Source Evaluation: Searching and filtering models based on tasks, popularity, and licensing requirements before automated deployments.
  • Multi-Provider LLM Inference: Using a standardized interface to execute chat completions across diverse, hosted open-source models.
  • Dataset Discovery: Querying and retrieving datasets from the Hugging Face Hub to feed continuous training, validation, or analytical pipelines.

How Hugging Face Agent Skill Works

  1. Model & Dataset Discovery (Free): The agent searches the Hugging Face Hub for candidate models or datasets using hf_search_models or hf_search_datasets based on current task criteria.
  2. Information & License Inspection (Free): The agent checks technical metadata, pipeline tags, and license compliance using hf_model_info.
  3. Inference Support Verification (Free): Before running billed inference, the agent queries hf_list_inference_models to confirm that the selected model is hosted and runnable by the router.
  4. Execution (Billed): The agent executes hf_chat with predefined max_tokens constraints for text generation, or hf_embeddings with batched inputs for semantic vectors.
  5. Monitoring & Reporting: The agent logs the exact model ID and returned usage metrics to track downstream resource consumption and enforce cost control.

Hugging Face Agent Skill Setup

To use this skill within Openclaw Skills, you must configure your environment with your Hugging Face API token. Create a read-only or read-write token on your Hugging Face settings page and add it to your environment configurations.

# Export the required token in your terminal environment
export HF_TOKEN="your_hf_token_here"

# Optional configurations to customize behavior
export HF_HUB_BASE_URL="https://huggingface.co"
export HF_ROUTER_BASE_URL="https://api-inference.huggingface.co"
export HF_TIMEOUT_MS=30000
export HF_MAX_RETRIES=3
export LOG_LEVEL="info"

Hugging Face Agent Skill Data Schema & Taxonomy

The Hugging Face agent skill organizes its operations around 7 core Model Context Protocol (MCP) tools, categorizing them by discovery (free) and inference (billed) actions:

Tool Primary Parameters Output Description Cost Category
hf_search_models query (string), filter (string) Array of matching model objects with Hub metadata Free
hf_model_info model_id (string) Comprehensive model card metadata, pipelines, and license Free
hf_search_datasets query (string) Dataset catalog listings matching search terms Free
hf_list_inference_models None Active list of models supported by the inference router Free
hf_chat model (string), messages (array), max_tokens (number) OpenAI-compatible chat response and token usage details Billed
hf_embeddings inputs (array of strings), model (string) Multi-dimensional floating-point vectors for text inputs Billed
hf_request endpoint (string), params (object) Custom raw HTTP payload response from arbitrary endpoints Varied

All tools enforce clean JSON boundaries and ensure that the sensitive HF_TOKEN is never leaked in debug outputs or agent logs.

Hugging Face Agent Skill Advanced Features

  • Optimized Embedding Batching: Built-in capability to batch embedding requests (using arrays in inputs) instead of single-item queries, minimizing API roundtrips.
  • Dynamic Router Failover: Allows agents to programmatically query hf_list_inference_models and fall back to alternative models when encountering unsupported model errors.
  • Proactive License Inspection: Automates pre-flight compliance checks on model licenses (e.g., commercial usage restrictions) prior to deployment.
  • Arbitrary Endpoint Interoperability: Employs the hf_request tool as a flexible developer escape hatch to access custom, fine-tuned, or private Hugging Face endpoints.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*