Build a Local AI Assistant on Your Laptop or Homelab: Setup, Tools, and When to Go Agentic
Running AI models locally sounds intimidating until you actually do it. Fifteen minutes and a couple of terminal commands later, you've got a capable language model running entirely on your own hardware, no API key, no usage limits, no data leaving your machine. That last part matters more than people give it credit for.
This guide walks through the practical steps: picking a model, getting it running, choosing a front-end that won't make you miserable, and then deciding whether a basic chat setup is enough or whether you want to wire something more agentic together.
Why Run a Model Locally at All
Cloud APIs are convenient, but they come with tradeoffs. You're paying per token, your queries are logged somewhere, and you're dependent on someone else's uptime. For personal projects, coding workflows, or anything involving sensitive documents, local models sidestep all of that.
The quality gap has also closed considerably. Models like Llama 3.1 8B and Mistral 7B punch well above their weight on coding tasks and general Q&A, especially when you quantize them to run efficiently on consumer hardware. You don't need a beefy GPU to get started. An M-series Mac or a machine with 16GB of RAM and a modern CPU will handle 7B parameter models without breaking a sweat.
Step 1: Install Ollama
Ollama is the easiest way to pull and run open-weight models locally. It handles downloading, quantization, and serving the model through a local HTTP API. Think of it as Docker, but specifically for LLMs.
Install it on macOS or Linux:
curl -fsSL https://ollama.com/install.sh | sh
On Windows, grab the installer from the Ollama site directly. Once installed, pull a model:
ollama pull llama3.1
This downloads the 8B parameter version by default, quantized to 4-bit, which comes in around 4.7GB. You can also grab mistral, phi3, gemma2, or codellama depending on what you need. For general use, llama3.1 or mistral are reasonable starting points. For code specifically, codellama or deepseek-coder tend to perform better on language-specific tasks.
Once the model is downloaded, test it in the terminal:
ollama run llama3.1
You'll get a prompt where you can type directly. It works, but it's not something you'd want to use as a daily driver.
Step 2: Pick a Front-End
For most people, the terminal interface gets old fast. The good news is that Ollama's local API (it runs on http://localhost:11434 by default) is compatible with a bunch of front-ends.
The most beginner-friendly options:
- Open WebUI is a full-featured web interface that looks and feels like ChatGPT. It supports conversation history, multiple models, file uploads for document Q&A, and system prompt customization. You can run it with Docker in about two commands. If you want one thing that just works, this is it.
- Msty is a desktop app with a clean UI that connects directly to your local Ollama instance. Good if you'd rather avoid Docker.
- Continue is a VS Code extension that connects to Ollama and gives you an in-editor assistant for code completions and chat. For development workflows, this is probably the most useful option.
For this walkthrough, assume you've got Docker installed and want to spin up Open WebUI:
docker run -d -p 3000:8080 \
--add-host=host.docker.internal:host-gateway \
-v open-webui:/app/backend/data \
--name open-webui \
--restart always \
ghcr.io/open-webui/open-webui:main
Open http://localhost:3000, create a local account (it's just for your own instance), and you'll see your Ollama models listed and ready to use. The whole setup takes maybe five minutes.
Step 3: Test It for Real Work
Rather than asking it to write a poem, try things that actually reflect how you'd use it:
Coding help: Paste a Python function and ask it to write tests, explain what it does, or suggest a refactor. Llama 3.1 and Mistral handle this reasonably well for mid-complexity tasks. They'll occasionally hallucinate library methods, so treat output the same way you'd treat anything from a junior dev: review it, don't ship it blind.
Document Q&A: Open WebUI supports file uploads. Upload a PDF, a long README, or a dense technical doc, then ask questions about it. This is useful for internal documentation, research papers, or vendor contracts you don't want running through a third-party API.
Explaining errors: Drop in a stack trace and ask what's going wrong. Models are generally decent at this, and for common errors in Python, Django, or JavaScript, you'll often get a usable answer faster than scrolling Stack Overflow.
Drafting: Local models are good enough for drafting emails, writing commit messages, or summarizing meeting notes. Not perfect, but plenty usable.
Simple Setup vs. Agentic Workflow
What's described above is a basic local assistant: you prompt it, it responds, you copy what you need. That's useful and probably covers 80% of what most developers want from an AI assistant day-to-day.
An agentic workflow means the model can take actions, not just respond. It can browse the web, run code, read files, call external APIs, or chain multiple steps together to complete a longer task. The most common way to build this locally is with tools like LangChain, CrewAI, or AutoGen.
Here's a minimal example using LangChain with a local Ollama model to run a ReAct agent that can answer questions using a tool:
from langchain_ollama import OllamaLLM
from langchain.agents import AgentType, initialize_agent
from langchain.tools import Tool
def word_count(text: str) -> str:
count = len(text.split())
return f"{count} words"
llm = OllamaLLM(model="llama3.1")
tools = [
Tool(
name="WordCounter",
func=word_count,
description="Counts the number of words in a given text string."
)
]
agent = initialize_agent(
tools=tools,
llm=llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True
)
result = agent.run("How many words are in this sentence: The quick brown fox?")
print(result)
The agent will reason through the task, decide to use the WordCounter tool, and return an answer. Replace the toy tool with something real, like a function that reads from your database or searches a vector store of your documents, and you've got something genuinely useful.
The honest caveat: smaller local models (7B to 13B parameters) struggle with complex multi-step agent tasks. They lose track of the plan, use tools incorrectly, or get stuck in loops. If you want agentic workflows to be reliable, you either need a larger model (Llama 3.1 70B with sufficient VRAM, or a homelab with multiple GPUs), or you accept that the simpler prompt-and-respond workflow is more dependable for daily use.
Hardware Notes
For anyone wondering if their machine is up to it: an M2 MacBook Pro with 16GB RAM runs Llama 3.1 8B at about 25-40 tokens per second, which is fast enough to feel responsive. An older Intel machine with no GPU will work but will be noticeably slower, around 5-10 tokens per second depending on the CPU. Usable for Q&A, frustrating for anything interactive.
If you're running a homelab, a machine with a consumer NVIDIA GPU (RTX 3060 or better with at least 12GB VRAM) will accelerate inference significantly. Ollama automatically uses CUDA if it's available, so no extra configuration needed.
What to Actually Do Next
If you haven't tried this before, start with Ollama and Open WebUI. Get the basic setup running, use it for a week on real tasks, and see what feels limiting. That'll tell you whether you want to stay simple or start wiring up something more complex. The simple setup is more useful than it sounds, and the agentic path is more work than it looks. Starting with the boring version and building toward complexity is usually the right order.