
An AI Agent That Searches Homebrew and Hugging Face for You
Building a chat agent that searches Homebrew and Hugging Face in plain language and installs what you approve, with Amazon Bedrock AgentCore and AWS IoT Core.
Series: AWS IoT Core (2 articles)
- 1An AI Agent That Searches Homebrew and Hugging Face for You This article
Homebrew is the package manager most Mac users reach for to install command-line tools. Hugging Face is the hub where the machine learning community publishes models and datasets. If you use a Mac, you've probably typed
brew install something at some point. If you've touched machine learning, you've probably browsed Hugging Face looking for a model.Both are great, but both share the same small annoyance: you need to already know roughly what you're looking for.
brew install needs the exact package name. Hugging Face search works, but with hundreds of similar models it's easy to pick the wrong one.I wanted something simpler: tell an agent what you want in a normal sentence, let it search both places, and only install something once you say yes. So I built it.
What it does
You type something like "I want a lightweight image viewer" or "a small Japanese summarization model" into a chat window. The agent searches Homebrew and Hugging Face at the same time, shows you a few candidates, and waits. Nothing gets installed until you explicitly confirm. Once you do, the actual Homebrew install, or the Hugging Face model download, runs on your own Mac.
It also speaks nine languages: Japanese, English, Chinese, French, German, Spanish, Portuguese, Arabic, and Thai. More on that later.
The parts, and what each one is actually for
The agent itself runs on Strands Agents, hosted on Amazon Bedrock AgentCore Runtime. That's the part that reads your sentence and decides what to do next.
The agent can't search anything on its own, so the actual searching is done by a single AWS Lambda function that handles both Homebrew's public formula list and the Hugging Face Hub API, dispatching to one or the other based on which tool the agent called. Amazon Bedrock AgentCore Gateway sits between the agent and this Lambda function, exposing it as tools the agent is allowed to call.
That covers search. Installing is a different problem, because the thing that has to run
brew install is your Mac, not a server in AWS.The part I didn't expect to use: AWS IoT Core
AWS can't reach into your laptop and run a command. So there needed to be a bridge: AWS says "please install this," and something running on your Mac picks that up and actually does it.
I used AWS IoT Core for that bridge. IoT Core is normally built for connecting physical devices, light bulbs, sensors, that kind of thing, to the cloud. I registered my own Mac as one such "device," and used a feature called Device Shadow, which keeps a small shared document describing what a device is asked to do (
desired) and what it has actually done (reported). AWS writes the install request into that document. A small background process on my Mac watches for changes, runs the install, and writes the result back.The nice side effect: my Mac doesn't need to be online when the request comes in. It picks up whatever's pending the next time it connects. Using a service meant for smart lightbulbs to message a laptop was the part of this project I found genuinely fun.
Here's the Lambda that writes to the shadow. It doesn't run the install itself, it just writes the request and returns immediately:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
shadow_update = {
"state": {
"desired": {
"requestId": request_id,
"source": source,
"id": package_id,
},
},
}
_get_iot_data_client().update_thing_shadow(
thingName=thing_name,
payload=json.dumps(shadow_update).encode("utf-8"),
)
return {
"status": "accepted",
"request_id": request_id,
}A small background process on my Mac subscribes to shadow updates, sees the new
desired state, runs brew install or downloads the Hugging Face model, and writes the result back to reported.Scaffolding with nx-plugin-for-aws
There was a fair amount to build (the agent, the search backend, a web UI), so I used AWS Labs' nx-plugin-for-aws to scaffold most of it. It generates working project skeletons for an agent, a website, Cognito auth, and more, in a single command.
It got me most of the way there quickly, but not all the way. The generated website, for instance, comes with the wiring to talk to the agent but not an actual chat screen, that I had to build myself. A useful reminder that scaffolding tools save time on the boilerplate, not on the part that makes your app actually yours.


Making it work in nine languages
Getting the agent to answer in the user's language turned out to be one line of logic: attach the selected language to every request, with an instruction to respond in that language, package names excluded so they don't get mistranslated.
The one thing that tripped me up: the agent instance is cached per conversation session. If I'd baked the language into the agent's fixed system prompt, it would have locked to whatever language the conversation started in. Instead, I inject the "please respond in this language" instruction into each individual request, so switching languages mid-conversation just works:
1
2
3
4
5
6
7
8
9
10
11
12
13
def _build_prompt(input: InvokeInput) -> str:
"""Prepend a per-request language instruction without touching the Agent's system_prompt.
The Agent instance is cached per session, so baking the language into system_prompt
would lock it to whatever language was used on the session's first turn. Instead, the
instruction is injected into the prompt on every call.
"""
language_name = LANGUAGE_NAMES.get(input.language or "en", LANGUAGE_NAMES["en"])
return (
f"[System note: Respond to the user in {language_name}. Package names/IDs from search "
f"results must not be translated; only your descriptions/confirmations should be in "
f"{language_name}.]\n\n{input.prompt}"
)Arabic reads right-to-left, so the UI also needed real RTL support, not just translated strings. A few components didn't flip automatically and needed explicit fixes.
Seeing it work
A short demo is linked below, showing the actual flow from typing a request to the install completing on my machine.
Series: AWS IoT Core (2 articles)
- 1An AI Agent That Searches Homebrew and Hugging Face for You This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article