README.md

January 30, 2026 Β· View on GitHub

Knowsee Banner

A fullstack reference implementation for building AI assistants with Google ADK and CopilotKit using AGUI, A2A and GenerativeUI

License Try Demo


Knowsee demonstrates how to build a multi-agent conversational AI using Google Agent Development Kit (ADK) for the backend and CopilotKit for the frontend, connected via the AG-UI protocol.

Knowsee Chat

Sessions and Tools

Contents

Features

πŸ€– Agentic Architecture

  • Multi-Agent Orchestration β€” Hierarchical delegation via AgentTool with isolated contexts
  • A2A Composition β€” Agent-to-agent patterns without namespace contamination
  • Extended Thinking β€” Gemini 2.5 Pro with dedicated reasoning budget
  • AG-UI Protocol β€” Bidirectional streaming between frontend and backend
  • Generative UI β€” Tool calls, reasoning, and sources as interactive components
  • Data Analyst Agent β€” Natural language to SQL with BigQuery, query tracking, chart widgets
  • SSE Event Bus β€” Live updates without polling

πŸ” Retrieval & Grounding

  • Vertex AI RAG Engine β€” Semantic search with team-scoped corpus access
  • Web Search Grounding β€” Google Search with inline citations
  • Multi-Source Synthesis β€” RAG + web + uploads unified in responses
  • Google Drive Picker β€” Import files directly from Drive with OAuth
  • Wide Format Support β€” png, jpeg, gif, webp, pdf, txt, csv, md, html, docx, doc, xlsx, xls, pptx, ppt, odt, ods, odp, rtf, Google Docs/Sheets/Slides

πŸ—οΈ Production-Ready

  • Better Auth β€” Email/password, OTP verification, TOTP 2FA
  • Pluggable Identity β€” Supports Google Groups, Azure AD, custom providers
  • Permission-Scoped RAG β€” Users only access corpora their teams own
  • Terraform IaC β€” Cloud Run, Cloud SQL, Vertex AI, KMS
  • SOPS Secrets β€” Encrypted configuration management
  • Scheduled Sync β€” Automated RAG corpus updates from GDrive/OneDrive

Prerequisites

ToolVersionPurpose
Node.js20+Frontend runtime
Python3.11+Backend runtime
uvLatestPython package manager
DockerLatestLocal Postgres
gcloud CLILatestGCP authentication

For deployment only: | Terraform | 1.5+ | Infrastructure as Code | | SOPS | Latest | Secrets encryption |

Quick Start

1. Clone and Install

git clone https://github.com/saahil-mehta/knowsee-public.git
cd knowsee-public
make install

2. Configure Environment

cp sagent/.env.example sagent/.env.development
cp web/.env.example web/.env.development

Edit both files with your values:

VariableWhereNotes
GOOGLE_CLOUD_PROJECTsagentGCP Free Tier includes Vertex AI credits
NEXT_PUBLIC_COPILOTKIT_PUBLIC_KEYwebFree for personal use
BETTER_AUTH_SECRETwebGenerate: openssl rand -base64 32
MAILGUN_*webFree tier β€” required for email OTP

Important

Mailgun is required. Email verification is enforced β€” users cannot access the app without verifying their email via OTP. To disable this, remove the verification check in web/src/proxy.ts (lines 54-62).

3. Authenticate with GCP

Required for Vertex AI (Gemini models, RAG engine):

make gcp-login

4. Start Development

Ensure Docker Desktop is running, then:

make dev

This automatically:

Note

Database: make dev spins up a Postgres container with default credentials (knowsee/localdev) β€” no manual setup required. Data persists in a Docker volume.

5. Create an Account

Open http://localhost:3000 and sign up. You'll receive an OTP via email (or check Mailgun logs in sandbox mode).

Configuration

Backend (sagent/.env.development)

VariableRequiredDescription
GOOGLE_CLOUD_PROJECTYesGCP project ID for Vertex AI
GOOGLE_CLOUD_LOCATIONYesGCP region (default: europe-west1)
GOOGLE_GENAI_USE_VERTEXAIYesTRUE for Vertex AI (recommended) or use API key

Note

This project uses Vertex AI for production parity β€” RAG Engine, Cloud SQL, and other GCP services require it. Switching to a Gemini API key requires code changes (not implemented out of the box).

VariableRequiredDescription
DATABASE_URLYesPostgres connection string
ENVIRONMENTNodevelopment (default) or production
RAG_SIMILARITY_TOP_KNoRAG retrieval count (default: 10)
TEAM_MEMBERSHIP_PROVIDERNobetter_auth, google_groups, or azure_ad

Frontend (web/.env.development)

VariableRequiredDescription
AGENT_URLYesBackend URL (default: http://localhost:8000)
NEXT_PUBLIC_COPILOTKIT_PUBLIC_KEYYesCopilotKit public key
BETTER_AUTH_URLYesAuth callback URL (default: http://localhost:3000)
BETTER_AUTH_SECRETYesSession encryption key
DATABASE_URLYesPostgres connection string
MAILGUN_API_KEYNoMailgun API key (optional)
MAILGUN_DOMAINNoMailgun sending domain
MAILGUN_FROMNoFrom address for emails

Tip

See sagent/.env.example and web/.env.example for full documentation with comments.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              User Browser                                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Frontend (Next.js + CopilotKit)                                            β”‚
β”‚  β”œβ”€β”€ Chat UI with streaming responses                                       β”‚
β”‚  β”œβ”€β”€ Better Auth (sessions, teams)                                          β”‚
β”‚  └── /api/copilotkit β†’ AG-UI bridge                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚ AG-UI Protocol
                                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Backend (FastAPI + ADK)                                                    β”‚
β”‚  β”œβ”€β”€ Root Agent (Gemini 2.5 Pro + extended thinking)                        β”‚
β”‚  β”‚   β”œβ”€β”€ Team Knowledge Agent β†’ Vertex AI RAG                               β”‚
β”‚  β”‚   β”œβ”€β”€ Web Search Agent β†’ Google Search                                   β”‚
β”‚  β”‚   β”œβ”€β”€ Data Analyst Agent β†’ BigQuery SQL execution                        β”‚
β”‚  β”‚   └── File Tools β†’ Artifact storage                                      β”‚
β”‚  └── Callbacks: user context, artifacts, widgets                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β–Ό            β–Ό         β–Ό            β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚ Postgres β”‚ β”‚ Vertex   β”‚ β”‚ BigQuery β”‚ β”‚   GCS    β”‚
              β”‚ Sessions β”‚ β”‚ AI RAG   β”‚ β”‚ Analyticsβ”‚ β”‚ Artifactsβ”‚
              β”‚ Auth     β”‚ β”‚ Engine   β”‚ β”‚          β”‚ β”‚          β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow

  1. User sends message β†’ CopilotKit streams to /api/copilotkit with x-user-id header
  2. AG-UI bridge β†’ Forwards to ADK backend via HttpAgent
  3. Context injection β†’ User's teams and accessible RAG corpora loaded into state
  4. Agent execution β†’ Root agent delegates to sub-agents (RAG, web search, files)
  5. Response synthesis β†’ Gemini combines sources with inline citations
  6. Streaming response β†’ Flows back through AG-UI to CopilotKit UI

Project Structure

sagent/                          # Backend (ADK + FastAPI)
β”œβ”€β”€ agents/
β”‚   β”œβ”€β”€ root.py                 # Main orchestrator
β”‚   β”œβ”€β”€ search.py               # Web search sub-agent
β”‚   β”œβ”€β”€ data_analyst/           # BigQuery SQL agent
β”‚   └── rag/agent.py            # Team knowledge sub-agent
β”œβ”€β”€ callbacks/                  # Before/after LLM hooks
β”œβ”€β”€ services/rag/               # RAG sync and config
└── main.py                     # FastAPI server

web/                             # Frontend (Next.js + CopilotKit)
β”œβ”€β”€ src/app/
β”‚   β”œβ”€β”€ api/copilotkit/         # AG-UI bridge
β”‚   β”œβ”€β”€ api/sessions/           # Session management
β”‚   └── chat/                   # Chat pages
└── src/components/
    β”œβ”€β”€ charts/                 # Recharts visualisations
    β”œβ”€β”€ chat/tool-call/         # Modular tool renderers
    └── copilotkit-provider.tsx # Auth header injection

Demo

1. Create an Account

Sign up with email and password.

Create Account

2. Verify Your Email

An OTP is sent to your inbox.

Email Verification

Enter OTP

3. Welcome to Knowsee

After verification, you're in.

Verified

4. Chat with Personality

Ask anything β€” get up-to-date answers with a touch of humour.

Chat Personality

5. Light Mode

For the light-mode lovers.

Light Mode

6. Sign In & Out

Seamless authentication flow.

Auth Flow

7. Google Drive Import

Import files directly from your Google Drive into conversations.

Demo coming soon

Try Live Demo

Note

Demo instance may be rate-limited or taken offline.

β†’ Try Knowsee Live

License

Apache 2.0