How to run an Agent Locally with Ollama with an AI agent
Install Ollama, pull a model that supports tool calling, then run ollama launch claude or ollama launch codex. Ollama points the agent at the local model for you. Smaller local models handle simple edits well but struggle with long multi-step tasks, so start small and check its work.
Checked against official docs on Oct 26, 2026.
Get the free starter kit. One short email a day when our setups change.
Free starter kit on signup: 2 Claude Code skills and 1 agent persona from our paid packs. By subscribing you agree to get The AI Loadout Daily, one email each morning. No spam, we never sell your email, and every email has a one-click unsubscribe link.
Claude Code
Install Ollama from ollama.com and pull a tool-capable modelollama launch claudeOr set it up by hand: export ANTHROPIC_BASE_URL to your Ollama server, ANTHROPIC_AUTH_TOKEN=ollama and ANTHROPIC_API_KEY="", then run claude --model <model>Run /status inside Claude Code to check the connection
Codex
ollama launch codexType /model inside Codex to switch between installed tool-capable modelsollama launch codex --config to change settings
Cursor
We did not find official Cursor docs for running its agent on a local Ollama model as of Oct 26, 2026For a fully local setup, use Claude Code or Codex through ollama launch
Grok Bot
Grok Bot runs on its own cloud computer, so it is not a local optionUse it for tasks that need your connected apps, and a local agent for private code
Gotchas
- The model must support tool calling or the agent cannot edit files.
- Claude settings files can override the environment variables. Check them if the connection fails.
- Local models need a lot of RAM or VRAM. Check the model size before pulling it.
The loadout for this job
- Tools: Cursor, Claude
- Repo: Ollama
- Model: Qwen 3.8 27B (local)
- Bot: Grok Bot
- Full setup: How to run AI locally
FAQ
Can Claude Code run on a local model?
Yes. Ollama documents ollama launch claude, which points Claude Code at a model Ollama serves.
Ollama or LM Studio for agents?
Both can serve local models. Ollama has documented one-command launch for Claude Code and Codex.
Related how-tos
Sources
Commands change. Check the linked docs before you run anything. All how-to guides