Skip to main content
Current Version: v0.1.0
The Knowledge Agent (Level 3) is a production-ready RAG (Retrieval-Augmented Generation) starter kit for building knowledge-powered AI agents. It provides complete document ingestion, intelligent chunking, hybrid search, and RAG-enabled query capabilities—everything needed to build agents that answer questions from your organization’s documents and data.
This repository can be used as a base template for creating your own application. Select starter-knowledge-base-agent as the repository_template when provisioning a new repository via Self Service.

GitHub Repository

View source code, releases, and issues

Why RAG for Banking?

Financial institutions manage vast repositories of policies, regulations, product documentation, and customer-facing content. RAG enables agents to provide accurate, source-cited answers from this knowledge—critical for compliance, trust, and customer experience. Common use cases:
  • Policy and compliance Q&A
  • Product information lookup
  • Internal knowledge base assistants
  • Document-grounded customer support

What You’ll Get

This starter provides a complete RAG pipeline with three core capabilities:

Document Ingestion

Load PDFs, text, markdown, and web pages with multiple chunking strategies (character, token, semantic, recursive).

Hybrid Search

Semantic vector search, keyword full-text search, and hybrid search with optional reranking for improved relevance.

RAG Agent

Knowledge-augmented responses with source citations. Answers grounded in your documents.
This documentation explains two implementation approaches:

Starter Kit Implementation

The native implementation included in this repository—custom pipelines using raw SQL, embeddings API, and search logic.

Agno Framework Alternative

Expandable examples throughout each section showing how to achieve similar functionality using Agno’s built-in knowledge base, readers, and search features.

Prerequisites

  • Python 3.11+: Managed via UV
  • UV Package Manager: Modern Python package manager (replaces pip/poetry)
  • PostgreSQL 14+: With pgvector extension for vector storage
  • Docker: For running PostgreSQL locally
Database Required: This starter requires PostgreSQL with the pgvector extension. Unlike other starters, you must set up a database before running the application.

Quick Start

1

Clone and Install UV

2

Setup Environment

3

Configure Credentials

Edit .env with required values:
4

Setup Database and Install Dependencies

Set up PostgreSQL with pgvector. See Database Setup for detailed instructions on provisioning via Azure or running locally with Docker.
5

Run the Server

The server runs at http://localhost:8000. Access the API documentation at /docs.
VPN and Web Proxy: Required for local development. Configure Aviatrix VPN and web proxy settings. See Onboarding Guide for setup instructions.

Database Setup

The starter uses PostgreSQL with pgvector for vector storage and similarity search. You have two options for provisioning the database:
Use Self Service to provision a managed PostgreSQL instance on Azure. This is the recommended approach for production deployments and shared development environments.
See Self Service for instructions on requesting PostgreSQL with pgvector extension and managing infrastructure access.
Once provisioned, configure your .env with the provided credentials:

Initialize Database

After configuring your database connection, run the setup script to create the required tables:
This creates three normalized tables:

Database Management

Agno manages its own schema automatically via PgVector. To use the AI Gateway for embeddings:
See Agno PgVector Documentation for more details on PgVector and other supported vector stores.

Document Ingestion

Add documents to the knowledge base using CLI scripts or the REST API.

Chunking Strategies

Supported File Formats

Agno provides built-in Readers that transform raw content from various sources into structured Document objects. Readers handle parsing, text extraction, and automatic chunking.
Agno supports multiple reader types including PDF, CSV, Markdown, JSON, and web content. See Agno Readers Documentation for the full list of supported readers and configuration options.For chunking strategies, Agno supports document chunking, fixed-size chunking, semantic chunking, and agentic chunking. See Agno Chunking Documentation for details.

Search & Retrieval

Query the knowledge base with multiple search strategies.

Search Strategies

Reranking

Reranking improves search result quality by re-scoring retrieved documents. Two backends are supported:
For production deployments, configure Cohere reranking via COHERE_RERANK_ENDPOINT and COHERE_RERANK_API_KEY environment variables.
Agno provides built-in search capabilities on the knowledge base with support for different search types.
Agno’s PgVector supports multiple search types configured at initialization:
See Agno Search & Retrieval for advanced search configuration and filtering options.

RAG Agent

The starter includes a RAG-enabled agent that searches the knowledge base to answer questions with source citations.
Response with sources:
Agno agents can automatically search the knowledge base when configured with knowledge:
When search_knowledge=True, the agent automatically queries the knowledge base for relevant context before generating a response. You can also configure the number of results to retrieve and filtering options.See Agno Knowledge Getting Started for more details on integrating knowledge bases with agents.

API Reference

Access interactive API documentation at:
  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

Project Structure

Observability

The starter integrates bb-ai-sdk observability—export to Langfuse, Grafana, or an OTLP endpoint depending on your environment variables.
  • Automatic Tracing: Captures full traces for agent runs, search queries, and LLM calls.
  • Embedding Tracking: Monitors embedding generation costs and latency.
  • Search Analytics: Tracks search queries, strategies, and result quality.
  • Configuration: Managed via LANGFUSE_* environment variables.
This starter uses bb-ai-sdk for observability (Langfuse, Grafana, or OTLP) and AI Gateway. See BB AI SDK Observability for configuration and custom tracing.

Development

Run Tests

Build Docker Image

CI/CD

Standard workflows are pre-configured in .github/workflows:
  • PR Checks: Linting, testing, and validation.
  • Build & Publish: Docker image creation on merge.
  • Release: Automated versioning and release notes.
See CI/CD Workflows for pipeline details.

Next Steps