Skip to main content

Agent Finder registry adapter for Hugging Face Spaces

Project description

hf-agentfinder

A small Agent Finder registry adapter for Hugging Face Spaces.

It exposes Hugging Face Spaces semantic search as:

  • a CLI: agentfinder spaces search "remove background from image"
  • an Agent Finder-ish REST API: POST /search
  • generated skill artifacts for Spaces via GET /skills/huggingface/{owner}/{space}/SKILL.md

Search results default to application/ai-skill entries. Each result points to a generated SKILL.md route that wraps the Space's agents.md instructions.

Features

Space Search and Skill Generation

agentfinder uses Hugging Face Spaces semantic search as a registry backend. Search requests use the Hub's agent-oriented semantic search (agents=true) and return matching Spaces as Agent Finder catalog entries. By default, results can include generated application/ai-skill artifacts, plus application/mcp-server+json entries for matching Spaces tagged mcp-server.

Search responses strictly include only Spaces whose runtime stage is RUNNING, so returned entries are limited to Spaces that are currently ready to serve traffic. The runtime stage is also surfaced in result metadata as runtimeStage.

The generated skill wraps the Space's agents.md instructions with the required skill frontmatter (name and description) plus source metadata such as the Space ID, Hub URL, app URL, and original agents.md URL. This lets clients discover a relevant Space, fetch the generated skill, and install or load it using their normal skill flow.

For clients that want raw Space descriptors instead of skills, the same search endpoint can return application/vnd.huggingface.space+json entries with inline JSON metadata.

Requests for application/mcp-server+json add filter=mcp-server to the downstream Hub search and return MCP server catalog entries that point at the Space's Gradio MCP endpoint using HTTP transport. When Hub runtime metadata includes a Space domain, that domain is used for app and MCP URLs; otherwise the adapter falls back to the standard .hf.space slug convention.

Release Automation

Releases are built through the same quality gates as CI: locked dependency sync, Ruff format/lint checks, ty type checking, and pytest. The release check script then builds both source and wheel distributions, inspects the artifacts, and smoke-installs the wheel in a clean Python 3.14 virtual environment.

Run the release check with:

./scripts/check-release.sh

Optionally assert the expected project version:

./scripts/check-release.sh 0.1.0

Release Please watches conventional commits on main, opens a release PR, bumps pyproject.toml, and maintains CHANGELOG.md. Merging that release PR creates a v* tag. The tag-based release workflow then builds artifacts, publishes them to PyPI with the UV_PUBLISH_TOKEN GitHub secret, attaches the artifacts to the GitHub Release, and restarts the Hugging Face Space when the HF_TOKEN secret is configured.

Release Please needs permission to create pull requests. Enable GitHub Actions read/write workflow permissions and "Allow GitHub Actions to create and approve pull requests" in the repository settings, or configure a RELEASE_PLEASE_TOKEN secret containing a fine-grained GitHub token with repository contents, pull request, and issue write permissions. Using RELEASE_PLEASE_TOKEN is recommended because release PRs and release tags created with the built-in GITHUB_TOKEN do not trigger subsequent GitHub Actions workflows.

Hugging Face Space Deployment

The project includes a reproducible Docker Space definition in deploy/huggingface-space/. It uses the official uv Python image and runs the latest published hf-agentfinder package with uvx --refresh, so restarting or rebuilding the Space resolves the newest PyPI release without committing generated application code to the Space repository.

Usage

uv run agentfinder spaces search "generate image" --limit 5
uv run agentfinder spaces search "generate image" --kind skill --json
uv run agentfinder spaces search "generate image" --kind mcp --json
uv run agentfinder spaces search "generate image" --json
uv run agentfinder serve --port 8080
curl -X POST http://localhost:8080/search \
  -H 'content-type: application/json' \
  -d '{"query":{"text":"remove background from image","mediaType":"application/ai-skill"},"pageSize":5}'

Fetch a generated skill:

curl http://localhost:8080/skills/huggingface/mcp-tools/FLUX.1-Kontext-Dev/SKILL.md

To get generic Hugging Face Space descriptors instead of skill wrappers, request:

{"query":{"text":"remove background from image","mediaType":"application/vnd.huggingface.space+json"},"pageSize":5}

HF_TOKEN handling

HTTP search requests can forward a request-scoped Hugging Face token for the downstream Spaces search call. The server checks X-HF-Authorization: Bearer ..., then Authorization: Bearer ..., then HF_TOKEN: ...; a header token overrides any token configured when the server starts and is not stored beyond the request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hf_agentfinder-0.1.2.tar.gz (46.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hf_agentfinder-0.1.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file hf_agentfinder-0.1.2.tar.gz.

File metadata

  • Download URL: hf_agentfinder-0.1.2.tar.gz
  • Upload date:
  • Size: 46.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hf_agentfinder-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3a1d08fb30560f25b88b80ba23cef2faa9dd7cb5b5e8087ccbcfe7b40e74b91d
MD5 3150caa875ab07c49c54d11402e1137c
BLAKE2b-256 199f96a476a11b54a9f45fbea81cfea5a3aa281763f3bf4f21d0d114c39926f8

See more details on using hashes here.

File details

Details for the file hf_agentfinder-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: hf_agentfinder-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hf_agentfinder-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e61d9ef8e029f6aff11688031841b893ccba55cd59871dedb960c4036de24394
MD5 7d01b649977e68d08718265c09165f88
BLAKE2b-256 3348c09c3b3f099b47caeb9c05c0b84940bee62098822b6f86c6c0b7f4e51202

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page