---
title: "Sigrun Multi-Agent RAG Platform"
description: "Production RAG platform for Mexican SMBs: graph-aware retrieval over Obsidian knowledge bases, domain-specialized agents, budget-aware LLM routing, and human-in-the-loop actions."
canonical_url: "https://cesasol.dev/work/sigrun-multi-agent-rag-platform"
---

> Index of every page on this site: [llms.txt](https://cesasol.dev/llms.txt)

## Challenge

Small and mid-size businesses hold valuable operational knowledge scattered across documents, CRM notes, internal processes, chat history, spreadsheets, and the heads of a few key people. Generic chatbot wrappers don't solve that: they lack retrieval quality, domain awareness, cost control, and clear boundaries on what the system is allowed to do on its own.

Sigrun was built to close that gap — a platform that connects business knowledge to useful, grounded answers and carefully bounded actions, built to run in production rather than in a demo.

## Solution

I designed Sigrun as a multi-agent RAG platform for ValkymIA client work: a Python/FastAPI async backend (LangGraph orchestration, PostgreSQL + pgvector) fronted by a chat-first Nuxt app on Cloudflare Workers. The focus is knowledge retrieval, cost-aware LLM orchestration, and bounded automation — not one-off prompts.

![System architecture: a Nuxt chat frontend on Cloudflare Workers calling a FastAPI/LangGraph backend, with pgvector retrieval and a budget-aware gateway routing between local Ollama and hosted OpenRouter models.](https://cesasol.dev/images/work/sigrun/architecture.png)

*System architecture — frontend on Cloudflare Workers, FastAPI/LangGraph backend, pgvector retrieval, and budget-aware routing between local and hosted models.*

Key capabilities:

- **Graph-aware retrieval**: Ingests Obsidian-based knowledge bases, chunks on document structure, and embeds locally with BGE-M3. Retrieval runs in two stages — vector similarity followed by wikilink graph expansion — so answers pull in linked context that a flat vector search would miss. Responses are grounded with structured citations.
- **Domain-specialized agents**: Five agent personas (sales, marketing, admin, operations, strategy), each with its own scope, retrieval filters, and plan gating, running over a shared LangGraph workflow. The caller selects the agent; over WhatsApp, users switch with slash commands.
- **Budget-aware model routing**: Every paid inference passes through an inference gateway that estimates worst-case cost, checks per-tenant and per-workflow budget policies, and routes to a hosted model (OpenRouter), a local model (Ollama), or refuses — with kill switches and admin overrides. Local models handle embeddings and light work; hosted models are reserved for where quality justifies the spend.
- **Human-in-the-loop actions**: External side effects (e.g. drafting a social post) run through a separate checkpointed graph that drafts, pauses for explicit approval, then executes or rejects. No autonomous actions by default.
- **Multi-tenant and observable**: Row-level org isolation across the vector store and knowledge base, Prometheus metrics for retrieval quality, latency, token cost, budget state, and knowledge gaps, plus a database audit trail of every answer and action.

![Sigrun chat interface returning a grounded answer with knowledge-base source citations.](https://cesasol.dev/images/work/sigrun/chat-citations.png)

*Grounded answer with citations — placeholder screenshot.*

![Two-stage retrieval: vector-similarity results expanded along Obsidian wikilinks to pull in linked context.](https://cesasol.dev/images/work/sigrun/graph-retrieval.png)

*Graph-aware retrieval — Stage 1 vector similarity, then Stage 2 wikilink graph expansion, assembled with per-domain grounding into a cited answer.*

![Human-in-the-loop approval: Sigrun drafts an action and pauses for explicit approval before executing.](https://cesasol.dev/images/work/sigrun/approval-loop.png)

*Human-in-the-loop approval — placeholder screenshot.*

Integrations are deliberately narrow and honest about their boundaries: WhatsApp (via Twilio) as a read channel, approval-gated social drafting (draft-only by default), and transactional email. General LLM tool-calling is scaffolded for a later phase rather than claimed as done.

## Impact

- **Moves AI beyond chat** by connecting retrieval, domain reasoning, and bounded actions into one workflow layer
- **Improves knowledge access** for teams whose operational knowledge lives in fragmented documents and a few people's heads
- **Keeps AI delivery cost-aware** through budget-checked routing between local and hosted models, with hard spend boundaries per tenant
- **Provides a reusable architecture** for ValkymIA client systems built on RAG, agents, and integrations — multi-tenant from day one

![Observability dashboard: token cost, per-tenant budget state, retrieval quality, and knowledge-gap metrics.](https://cesasol.dev/images/work/sigrun/observability.png)

*Cost and retrieval observability — placeholder; optional.*

## Why It Matters

Sigrun is the core of my current AI engineering work: turning RAG and agentic patterns into a system that holds up in real business environments. The architecture is deliberately pragmatic — retrieval quality, cost governance, human review, tenant isolation, and observability over impressive-looking demos that can't be trusted in production.

## Links

- [Visit Sigrun](https://sigrun.valkymia.mx)
- [ValkymIA](https://valkymia.mx)

## Sitemap

See the full [sitemap](https://cesasol.dev/sitemap.md) for all pages.
