Self-Hosting an AI Agent: What You Take On
What you own when an AI agent runs on your machine: model memory, network exposure, file access and vetting skills. Checklist and decision points.
Updated · Markdown version
Running an AI agent yourself means you own the model server, the memory it needs, the network it can reach, and every skill or tool it can load. The work comes down to matching the model to your hardware, deciding what the agent can touch on disk and over the network, and vetting what you install before it runs.
What a self-hosted agent is
A self-hosted agent has two parts on your side: a model server that holds the weights and answers requests, and an agent client that plans steps and calls the model. Ollama is one example of a model server. Its README shows a local chat request sent to http://localhost:11434/api/chat, so the model runs on the same machine and the client talks to it over loopback.
A worked example: a laptop runs the model server and an agent client on the same account. The model server answers on port 11434, and the agent can read and write any folder that account can reach. Every decision in this guide follows from those two facts. Your model choice determines memory use, and the agent's permissions determine what it can change.
Self-hosting does not automatically make the setup private or contained. Ollama's README describes local runs as offering "complete privacy," which is a vendor statement about the model server, not a statement about the agent client, its logs, or its network calls. Check each component separately.
What you take on
- Model fit. Weights, the context cache and runtime overhead all compete for memory. The llama.cpp README describes its goal as inference with minimal setup on a wide range of hardware, but it does not give you a memory budget for your machine. Work the numbers before you download a large model.
- Network exposure. A model server listening on a non-loopback address can be reached by other devices on your network. Keep it bound to localhost unless you have a reason to share it.
- File and command reach. Agent clients differ. Claude Code's Manual mode asks before its file tools leave the starting folder, but an approved Bash command can still write anywhere your account can. Its sandbox restricts Bash at the operating system level, which is a separate control.
- Data flow. Some modes keep execution local and still store the transcript on a vendor server. Read the data-flow description for the exact mode you use.
- Skills and tools. Each skill, plugin or server adds code and instructions the agent will follow. Claude Code's security page notes that reviewing a project's
.mcp.jsondoes not show every server a session can load.
Pitfalls
- The model loads but runs slowly or fails mid-task. This usually means the memory budget was too tight. Notice swapping or repeated load failures, then pick a smaller model or a more compact quantization and re-check the fit.
- Assuming local means private. Check where the transcript, logs and any telemetry go, not just where the weights run.
- An approved command writes outside the project. Permission prompts are not a filesystem boundary. Use the sandbox, narrow allow rules, or a dev container for work with sensitive folders.
- The model server listens on all interfaces. Check the bound address after setup. Restrict it to localhost if no other device needs access.
- Unreviewed skills with broad permissions. Read each skill's files and the commands it asks for before you install it, and remove anything you do not use.
When to use a skill instead
Ad-hoc prompting does not answer the fit question or the install question with evidence. local-model-sizing estimates whether an open-weight model will fit a given GPU, Mac or PC, with memory figures for each quantization level, so you can compare options before downloading. skill-safety-audit scans a skill folder before installation and returns a risk table with file and line evidence, followed by a triage decision. Use them together: size the model first, then vet every skill you plan to add. Neither replaces your own review of what the agent is allowed to do.
FAQ
Which port does a local Ollama server use? Ollama's README gives port 11434 for its local REST API, with the chat endpoint at /api/chat on localhost. Check the Ollama documentation for other endpoints and the current configuration options.
Does running an agent locally keep my code on my machine? Not by itself. Claude Code's Remote Control mode keeps code execution and file access local, but the session transcript is stored on Anthropic servers while connected. Confirm the data flow for the mode and client you use.
Is a sandbox the same as a permission prompt? No. Claude Code's security page says the folder boundary is enforced by a prompt, so an approved Bash command can still write anywhere your account can. Sandboxing restricts Bash commands at the operating system level, which is a different control.
Related skills in this catalog
Platform Score is our assessment under a published method. It is not a safety guarantee.
Related guides
Terms this guide uses
This item is a worked example in the AI glossary for:
- AI PC
- AnythingLLM
- AUTOMATIC1111 (Stable Diffusion web UI)
- AWQ quantization
- Azure OpenAI Service
- Cerebras
- ComfyUI
- ControlNet
- CUDA
- DeepSeek
- Dify
- Federated learning
- FlashAttention
- Flowise
- Gemma
- GGUF
- GLM (Zhipu)
- GPT4All
- GPTQ
- GPU for AI
- Hunyuan (Tencent)
- IBM watsonx
- Jan (local AI app)
- Keras
- KoboldCpp
- KV cache
- Llama (Meta)
- llama.cpp
- llamafile
- LM Studio
- LocalAI
- Mistral (models)
- Mixed-precision training
- Mixture of experts (MoE)
- MLX (Apple)
- Nemotron
- Neural processing unit (NPU)
- Neuromorphic computing
- Ollama
- On-device AI
- Open WebUI
- OpenRouter
- Phi (Microsoft)
- PyTorch
- Quantization
- Qwen
- RunPod
- Safetensors
- SambaNova
- SDXL
- Serverless GPU
- SGLang
- Sovereign AI
- Speculative decoding
- Spiking neural network (SNN)
- TensorRT
- Text generation web UI
- Together AI
- Triton Inference Server
- Variational autoencoder (VAE)
- Vertex AI
- vLLM
Sources
- https://github.com/ollama/ollama (accessed 2026-11-21)
- https://github.com/ggml-org/llama.cpp (accessed 2026-11-21)
- https://code.claude.com/docs/en/security (accessed 2026-11-21)
This page is not offered to search engines yet: The content file does not mark this page indexable yet.