Open Source · Blueprint + Reference Implementation
Natural Language to SQL, Streaming Code, and the Blueprint to Rebuild It
Octofy AI Agent is the backend service behind Octofy Professional: it turns natural-language questions into validated T-SQL (and Python, R or SAS) using retrieval-augmented generation, semantic search, and an iterative attempt loop. Discovery runs knowledge-base first, then fuses schema vectors, value-index hits and business data groups with reciprocal rank fusion before hydrating the evidence into the prompt under a token budget. A deterministic front half—preprocessing, PII masking, history folding, coreference rewriting, scenario routing and fast paths—runs before any model call, and what follows is validation-bound: up to five attempts in 120 seconds with a safety interceptor, structural-hash hallucination detection, an advisory LLM critic, and authoritative database parse validation. For governed metrics the model emits a structured SMQ request that a deterministic compiler turns into physical SQL, so business definitions live in the semantic model rather than in the prompt. The model layer is provider-agnostic through LiteLLM (OpenAI, Azure, Anthropic, Google, DeepSeek, Ollama or a local server), and every store read and write is partitioned by source_id so one deployment can host many warehouses without cross-leakage. Around the pipeline sit Server-Sent Event streaming, an execution endpoint with auto-retry, profiling, insights and chart hints, per-user API keys with admin and user roles, conversation history, and admin governance over schema sync, few-shots, value indexes and vector-store backup. The whole project is open source under the MIT licence and ships with the blueprint that makes it reproducible.
Open source under the MIT licence. The whole project is published on GitHub, where it doubles as a build blueprint. docs/SQL_GENERATION_BACKEND_BLUEPRINT.md is a code-derived specification—exact constants, frozen orderings, verbatim prompts, data contracts and an acceptance matrix—that an AI coding agent can execute to build an equivalent agent from an empty repository, so nobody has to reverse-engineer one. The vibe-coding guide covers the standing instructions, the eight build phases, and the tests to require at each step.
Octofy Pro can talk to any backend that implements the same HTTP contract. The Octofy AI Agent backend API in the Documentation Center lists base URL, authentication, SSE generation, execution, conversations, and admin endpoints.