README.md
January 30, 2026 Β· View on GitHub
A fullstack reference implementation for building AI assistants with Google ADK and CopilotKit using AGUI, A2A and GenerativeUI
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.
Contents
Features
π€ Agentic Architecture
- Multi-Agent Orchestration β Hierarchical delegation via
AgentToolwith 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
| Tool | Version | Purpose |
|---|---|---|
| Node.js | 20+ | Frontend runtime |
| Python | 3.11+ | Backend runtime |
| uv | Latest | Python package manager |
| Docker | Latest | Local Postgres |
| gcloud CLI | Latest | GCP 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:
| Variable | Where | Notes |
|---|---|---|
GOOGLE_CLOUD_PROJECT | sagent | GCP Free Tier includes Vertex AI credits |
NEXT_PUBLIC_COPILOTKIT_PUBLIC_KEY | web | Free for personal use |
BETTER_AUTH_SECRET | web | Generate: openssl rand -base64 32 |
MAILGUN_* | web | Free 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:
- Starts local Postgres via Docker
- Runs database migrations
- Launches ADK backend β http://localhost:8000
- Launches Next.js frontend β http://localhost:3000
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)
| Variable | Required | Description |
|---|---|---|
GOOGLE_CLOUD_PROJECT | Yes | GCP project ID for Vertex AI |
GOOGLE_CLOUD_LOCATION | Yes | GCP region (default: europe-west1) |
GOOGLE_GENAI_USE_VERTEXAI | Yes | TRUE 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).
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | Postgres connection string |
ENVIRONMENT | No | development (default) or production |
RAG_SIMILARITY_TOP_K | No | RAG retrieval count (default: 10) |
TEAM_MEMBERSHIP_PROVIDER | No | better_auth, google_groups, or azure_ad |
Frontend (web/.env.development)
| Variable | Required | Description |
|---|---|---|
AGENT_URL | Yes | Backend URL (default: http://localhost:8000) |
NEXT_PUBLIC_COPILOTKIT_PUBLIC_KEY | Yes | CopilotKit public key |
BETTER_AUTH_URL | Yes | Auth callback URL (default: http://localhost:3000) |
BETTER_AUTH_SECRET | Yes | Session encryption key |
DATABASE_URL | Yes | Postgres connection string |
MAILGUN_API_KEY | No | Mailgun API key (optional) |
MAILGUN_DOMAIN | No | Mailgun sending domain |
MAILGUN_FROM | No | From 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
- User sends message β CopilotKit streams to
/api/copilotkitwithx-user-idheader - AG-UI bridge β Forwards to ADK backend via
HttpAgent - Context injection β User's teams and accessible RAG corpora loaded into state
- Agent execution β Root agent delegates to sub-agents (RAG, web search, files)
- Response synthesis β Gemini combines sources with inline citations
- 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.
2. Verify Your Email
An OTP is sent to your inbox.
3. Welcome to Knowsee
After verification, you're in.
4. Chat with Personality
Ask anything β get up-to-date answers with a touch of humour.
5. Light Mode
For the light-mode lovers.
6. Sign In & Out
Seamless authentication 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.