# Self-Hosting an AI Agent: What You Take On

> Canonical: https://skillalmanac.com/learn/self-hosted-ai-agent-considerations | Updated: 2026-11-21 | Index status: not offered to search engines

What you own when an AI agent runs on your machine: model memory, network exposure, file access and vetting skills. Checklist and decision points.

## Facts

- 2026-11-21: Ollama's README gives its local REST chat endpoint as localhost port 11434, path /api/chat (https://github.com/ollama/ollama)
- 2026-11-21: Ollama's README states no hardware or memory requirements, so model fit must be checked separately (https://github.com/ollama/ollama)
- 2026-11-21: The llama.cpp README describes its goal as LLM inference with minimal setup across a wide range of hardware, with Docker and source builds among the install options (https://github.com/ggml-org/llama.cpp)
- 2026-11-21: Claude Code's security page says that in Manual mode an approved Bash command can still write anywhere your user account can, because the folder boundary is a permission prompt (https://code.claude.com/docs/en/security)
- 2026-11-21: Claude Code's security page says Remote Control keeps code execution and file access on the local machine, while the session transcript is stored on Anthropic servers while connected (https://code.claude.com/docs/en/security)
- 2026-11-21: Claude Code's security page recommends the sandbox runtime or a dev container for extra isolation when running the local process (https://code.claude.com/docs/en/security)

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.json` does not show every server a session can load.

## Pitfalls

1. **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.
2. **Assuming local means private.** Check where the transcript, logs and any telemetry go, not just where the weights run.
3. **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.
4. **The model server listens on all interfaces.** Check the bound address after setup. Restrict it to localhost if no other device needs access.
5. **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](/skills/skill-almanac/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](/skills/skill-almanac/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

- [local-model-sizing](https://skillalmanac.com/skills/skill-almanac/local-model-sizing.md): Platform Score 57/100 (provisional)
- [skill-safety-audit](https://skillalmanac.com/skills/skill-almanac/skill-safety-audit.md): Platform Score 57/100 (provisional)

## Related guides

- [Open-source AI agents: criteria for comparing them](https://skillalmanac.com/learn/open-source-ai-agents-what-to-compare.md)
- [What Is Claude Superpowers and What to Check Before Use](https://skillalmanac.com/learn/what-is-claude-superpowers.md)
- [What Is everything-claude-code (ECC)? Contents and Install](https://skillalmanac.com/learn/what-is-everything-claude-code.md)
- [AI Hallucination: What to Check in Agent Output](https://skillalmanac.com/learn/ai-hallucination-what-to-check.md)

## Sources

- https://github.com/ollama/ollama
- https://github.com/ggml-org/llama.cpp
- https://code.claude.com/docs/en/security

Platform Scores report our assessment under a published method. They are not a safety guarantee.
