Open-source AI Financial Advisor: Manage Investments and Debt Without Sending Data to the Cloud

I’m Denis Shokhirev, Agentic AI Systems Architect in Freiburg, Germany. I ship production AI systems for DACH B2B clients using Claude, Supabase, n8n, Doppler, and self-hosted Postgres. One recurring production blocker: finance teams need AI-driven investment and debt insights, but can’t risk sending sensitive data to the cloud. Here’s how I solve that, in code and contracts.

Why Cloudless AI for Finance Isn’t Optional

Most German and Swiss B2B clients operate under strict GDPR and NIS2 mandates. Handing off raw bank data to SaaS is a non-starter. On three recent deployments, compliance officers flagged even encrypted API calls as unacceptable risk. The only viable path: open-source, fully self-hosted AI pipelines, with no data leaving on-prem infrastructure.

System Architecture: Open-source, End-to-End

SaaS? Not an Option

Tools like Plaid or Tink require uploading financial records to third-party servers. For regulated sectors, this is a showstopper. In all my DACH projects, the mandate is absolute: “No cloud, no external LLM calls.”

Core Stack for Self-hosted AI Advisor

ComponentOpen-source AlternativePurpose
LLM BackendOllama (hosting Llama 3, Mistral), LM StudioAdvice generation, transaction classification
Orchestrationn8nWorkflow automation, data pipelines
DatabasePostgres (self-hosted)Transaction storage, user configs
CI/CDGitHub Actions + SemgrepAutomated security checks on code pushes
APIFastAPI / SupabaseInternal API for web/mobile UI

What a Production Pipeline Looks Like

1. Bank Statement Ingestion

Inputs come as local CSV/XML files or directly via bank APIs with 2FA. Here’s an n8n workflow for ingesting and storing a statement:


{
  nodes: [
    {
      type: "n8n-nodes-base.readBinaryFile",
      parameters: { filePath: "/data/inbox/bank.csv" }
    },
    {
      type: "n8n-nodes-base.csvParse",
      parameters: { delimiter: ";" }
    },
    {
      type: "n8n-nodes-base.postgres",
      parameters: {
        query: "INSERT INTO transactions (date, amount, description) VALUES ({{date}}, {{amount}}, {{description}})"
      }
    }
  ]
}

All data stays on-prem. For high-risk clients, I encrypt at-rest using pgcrypto.

2. Transaction Analysis via Local LLM

LLMs run locally—no external API calls. I deploy Llama 3 or Mistral models with Ollama. Example workflow:


import ollama
from supabase import create_client

db = create_client("http://localhost:54321", "service_key")
transactions = db.table("transactions").select("*").execute()

for tx in transactions.data:
    prompt = f"Categorize: {tx['description']}, amount: {tx['amount']}"
    result = ollama.chat(model="llama3", prompt=prompt)
    db.table("transactions").update({"category": result}).eq("id", tx["id"]).execute()

The LLM sees only local records, never raw bank data from outside the firewall.

3. Generating Investment and Debt Advice

I use RAG (Retrieval-Augmented Generation): vectorize transaction history (with SentenceTransformers), store embeddings in pgvector, then prompt the local LLM to suggest actions based on similar past cases.


from sentence_transformers import SentenceTransformer
import psycopg2
model = SentenceTransformer('all-MiniLM-L6-v2')
conn = psycopg2.connect(...)
cur = conn.cursor()
cur.execute("SELECT id, description FROM transactions")
embeddings = []
for row in cur.fetchall():
    emb = model.encode(row[1])
    cur.execute("UPDATE transactions SET embedding=%s WHERE id=%s", (emb.tobytes(), row[0]))
conn.commit()

Debt risk is flagged by analyzing payment delinquencies and credit exposure trends, with automatic warnings in the dashboard.

Security and Compliance: What Actually Works

Static Security Audits on LLM Integration

On three of my recent agent deployments I caught the same SQL-injection pattern in LLM-generated DB code. CI/CD pipelines with Semgrep and Bandit are non-negotiable. Example GitHub Actions workflow:


name: CI
on: [push]
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Run Semgrep
        run: semgrep --config=python .
      - name: Run Bandit
        run: bandit -r .

About 20% of LLM-generated DB code needs manual review after static analysis (my own metric across 3 production projects).

GDPR: Auditable, Local, Logged

DACH clients require full audit logs and (often) third-party review of the pipelines—gitleaks is a solid baseline for token/secret leak checks. All processing happens on their own servers, with no data leaving the perimeter.

FAQ

Which open-source LLMs are safe for self-hosted finance workflows?

Llama 3, Mistral, Falcon—all can be run on-prem with proper resource allocation and monitoring.

Can I connect a mobile app to this setup?

Yes, via Supabase or FastAPI, but restrict to VPN or corporate network access only.

How do you validate the AI’s advice before showing it to users?

Multi-stage: static analysis, human review, and test pipelines with synthetic data before production rollout.

How long does a typical deployment take?

3–6 weeks if the client has existing infra. Most of the time is spent on secure integration and audit.

How do you handle changing compliance requirements?

CI/CD with Semgrep and Bandit lets me update security patterns as new risks emerge.

In your production pipeline, which part causes the most headaches—data integration, LLM inference, or advice validation? I’m curious about your real-world pain points. I run a free 30-min stack audit for DACH founders building AI in regulated markets. DM me on LinkedIn or write to @ger_dennis_ai.

Read more

Computer-Use-Agenten scheitern an Pixeln: wie Sie auf stabile UI-Referenzen über Accessibility Trees umstellen und fehleranfällige Desktop-Automatisierung nicht mehr ständig reparieren

von Denis Shokhirev, Enterprise AI Architect aus Freiburg im Breisgau Ich bin Denis Shokhirev, Agentic AI Systems Architect in Freiburg im Breisgau, Germany, und bei DennisCraft AI Studio setze ich produktive KI-Systeme für DACH-B2B-Kunden auf Basis von Claude, Supabase, n8n, Doppler und selbst betriebenem Postgres um. Die teuersten Fehler in

By Denis Shokhirev

Компьютерные агенты ломаются на пикселях: как перейти на stable UI refs через accessibility tree и перестать чинить flaky desktop automation

Я Denis Shokhirev, Agentic AI Systems Architect из Freiburg im Breisgau, Germany, и в DennisCraft AI Studio я собираю production AI-системы для DACH B2B на Claude, Supabase, n8n, Doppler и self-hosted Postgres. Самая дорогая поломка в desktop automation, которую я вижу у клиентов, почти никогда не связана с моделью: агент

By Denis Shokhirev