Understanding what sits
behind an AI agent.
Cloud AI assistants are handy, but you can't send them just anything: production logs, configurations or client data must not leave the company. I wanted to see what can be done with a model that runs entirely locally.
The other goal was to understand how an agent works end to end: a model on its own only produces text. The harness, the program around the model, gives it tools, runs what it asks for and sends the results back.
Four layers,
one machine.
The diagram at the top of the page reads from left to right. Each layer has a clear role:
- OpenCode (the harness): receives my request, keeps track of the conversation, describes its tools to the model and runs the ones the model asks for.
- Ollama (the model server): loads the model onto the graphics card and exposes a local OpenAI-compatible API, which OpenCode uses.
- Qwen3 (the model): reads the context and answers either with text or with a structured tool call.
- The RTX 4060 Ti: does the computation through CUDA. Its video memory (VRAM) decides which models I can run.
How a request flows
- I describe the taskFor example: “analyse this log file and summarise the errors”.
- OpenCode builds the requestIt sends Ollama my request, the history and the list of available tools.
- Qwen3 decidesIt answers directly, or asks for a tool: read a file, run a command, search a folder.
- OpenCode runs the toolOn the files in the working folder; it can ask for my confirmation before a command.
- The result goes back to the modelThe loop continues until the model has enough to give its final answer.
No web interface: everything happens in the terminal. No extra service is exposed on the network.
Simple,
open-source building blocks.
- Ollamamodel server
- Simple setup, automatic GPU handling, models pulled with one command and an OpenAI-compatible API that most tools can connect to.
- Qwen3model
- Open-source model that handles tool calling well, which an agent needs. The 8B and 14B sizes fit on a consumer graphics card once quantized.
- 8B or 14Btrade-off
- The 8B answers faster and leaves more memory for context; the 14B reasons better on multi-step tasks. I pick one depending on the task.
- OpenCodeagent harness
- Open-source terminal agent that connects to any OpenAI-compatible API, including Ollama. It provides the tools (files, shell, search) and the agent loop.
What I took away.
- A local model is more limited than a large cloud model: on long tasks it loses track sooner and its tool calls are sometimes malformed. I always review what it proposes.
- Video memory is the real constraint: it limits both model size and context length.
- The harness matters as much as the model: it is what makes the model useful, by giving it tools and limiting what it can do.
Next steps
- Connect the agent to my homelab logs to help with troubleshooting.
- Compare other open-source models on the same admin tasks.
Skills used
- Ollama
- Qwen3
- OpenCode
- CUDA
- LLMs & quantization
- Agents & tool calling