← Back to Garden

Local Autonomous Agents Architecture

#AI#Ollama#Python#LXC

INIT_AGENT_PROTOCOL

Relying on OpenAI’s API (GPT-4) to develop autonomous agents is fast, but it has two fatal flaws for enterprise deployments: data privacy and exponential inference costs.

In this note, I detail my On-Premise AI stack, designed to run agents like Hermes or OpenClaw directly in the homelab.

The Tech Stack

The Engine (Ollama): Running in an LXC container on Proxmox with GPU passthrough. Ollama manages model weights (e.g., Llama 3, Mistral) and exposes them via API.

The Translator (LiteLLM): Many agent frameworks are hardcoded for the OpenAI API. LiteLLM acts as a reverse proxy; it receives OpenAI-formatted requests and translates them to Ollama format.

The Brain (Framework): Pure Python running Reasoning and Action (ReAct) cycles.

Proxy Configuration (LiteLLM)

Spinning up the proxy takes just one Docker command:

docker run -d -p 4000:4000
-e OLLAMA_API_BASE=“http://10.0.0.50:11434
litellm/litellm
—model ollama/llama3

Now, your Python script thinks it’s talking to OpenAI:

import openai

client = openai.OpenAI( api_key=“sk-nada”, # No real key required base_url=“http://localhost:4000” )

response = client.chat.completions.create( model=“ollama/llama3”, messages=[{“role”: “user”, “content”: “Analyze this server log…”}] )

In future posts, we will cover context injection (RAG) using local vector databases.

TUXBOT@SYSTEM:~$ ./chat
> SYSTEM INITIALIZED. FLEET STATUS: ACTIVE.
🐧🤖 [Tuxbot]: Hello, I am Tuxbot. Your Ghost in the Shell for dragont.ec. What do you want to query today?
>