Noureddine RAMDI / hf-agents: a shell CLI extension for hardware-aware local coding agents with llama.cpp

Created Mon, 04 May 2026 10:23:02 +0000 Modified Sat, 23 May 2026 20:41:27 +0000

huggingface/hf-agents

The process of getting a local coding agent up and running can be surprisingly complex, especially when hardware compatibility and model selection come into play. hf-agents tackles this by chaining hardware profiling, model selection, server management, and agent launch into a streamlined shell CLI extension. It’s a practical, no-frills approach to bootstrapping a local AI coding assistant.

what hf-agents does and how it works

hf-agents is a HuggingFace CLI extension written in Shell that automates the pipeline from detecting your hardware through deploying a local coding agent. It combines multiple tools into a single command flow that profiles your system’s capabilities, recommends compatible language model and quantization options, bootstraps a llama.cpp server with the selected model, and finally launches Pi, the coding agent.

Under the hood, it leverages llmfit to probe your system’s hardware and generate tailored model recommendations based on your CPU/GPU capabilities and memory. This step is crucial — picking a model that matches your hardware avoids runtime failures and poor performance.

Next, it uses fzf, a fuzzy finder CLI tool, to let you interactively select a model/quantization combination or accept a default non-interactive execution path by passing arguments. Once the model choice is made, the tool manages the lifecycle of a llama.cpp server — if a server is already running on the target port, it smartly reuses that instance instead of starting a new one, cutting down startup overhead.

Finally, hf-agents launches Pi, a local coding agent designed to interact with the user and the model server.

The entire flow is orchestrated in a shell script, relying on runtime dependencies jq (for JSON processing), fzf (interactive UI), and curl (networking). It integrates neatly as an extension to the hf CLI ecosystem, meaning if you’re already using HuggingFace tools, this fits right in.

technical highlights and tradeoffs

What stands out technically is how hf-agents chains distinct components — hardware profiling, model selection, server management, and agent orchestration — into a cohesive CLI experience with minimal dependencies.

The hardware-aware model recommendation via llmfit is a practical touch that many local LLM projects overlook, leading users to try incompatible models. This preflight profiling improves reliability.

The use of fzf for model selection provides a user-friendly interactive experience in the terminal without adding heavy UI dependencies.

Managing the llama.cpp server lifecycle intelligently is another smart engineering detail. By checking if a server instance is already running on the desired port and reusing it, hf-agents avoids redundant startup delays and resource waste.

Since it’s written in shell, the code is concise and easy to follow for experienced CLI developers. However, this choice also means the script is less suited for complex error handling, extensibility, or cross-platform compatibility beyond Unix-like systems.

The runtime dependencies (jq, fzf, curl) are common and lightweight but still require users to install them separately.

Overall, hf-agents trades the flexibility and robustness of a full programming language implementation for a highly composable, minimal script that glues existing tools effectively.

quick start

To install hf-agents, you can run the following commands exactly:

curl -LsSf https://hf.co/cli/install.sh | bash
hf extensions install hf-agents

This installs the hf CLI if you don’t have it already, and then adds hf-agents as an extension.

From there, running the hf-agents command will launch the full hardware detection to coding agent pipeline. You can interactively select models or pass arguments to skip the prompt.

Make sure you have jq, fzf, and curl installed as these are required for the extension to function.

verdict

hf-agents is a pragmatic tool for developers wanting a quick local coding agent setup that respects their hardware constraints. The hardware profiling step and server reuse are practical touches that improve the user experience.

Its main limitation is the reliance on shell scripting, which restricts cross-platform support and advanced error handling. If you need a more robust or extensible solution, a Python or Go-based tool might be preferable.

That said, for Unix-like users already invested in the HuggingFace CLI ecosystem, hf-agents offers a neat, minimal dependency path to local LLM inference and coding assistance. It’s worth understanding for anyone building or deploying local AI agents with hardware-aware model selection.


→ GitHub Repo: huggingface/hf-agents ⭐ 407 · Shell