Educational demonstration of how modern LLMs orchestrate specialized agents to answer complex queries
Quick Start โข Features โข Architecture โข Demo Queries
WikidAI is an educational proof-of-concept that demonstrates how Large Language Models can orchestrate multiple specialized agents to answer complex questions. Unlike black-box AI assistants, WikidAI shows you exactly how it thinks - you can watch in real-time as it:
- ๐ง Reasons about which data sources to query
- ๐ง Generates SPARQL queries for Wikidata's knowledge graph
- ๐ Fetches summaries from Wikipedia and OpenStreetMap
- โ Retrieves real-time weather data
- ๐ Chains multiple queries together to answer complex questions
I have built it in a few hours for a short lightning talk for itWikiCon 2025 on November 8, 2025 in Catania. This Proof of Concept showcases the power of transparent AI orchestration with Gemini 2.5 Pro.
Get WikidAI running in under 2 minutes:
- ๐ณ Docker and Docker Compose installed
- ๐ Gemini API key (Get it free from Google AI Studio)
# 1. Clone the repository
git clone https://github.com/gnovelli/wikidai.git
cd wikidai
# 2. Configure your API key
cd backend
cp .env.example .env
# Edit .env and add your GEMINI_API_KEY
# 3. Launch with Docker
cd ..
docker compose upOpen your browser and navigate to:
- ๐ฅ๏ธ Dashboard: http://localhost:8080
- ๐ API: http://localhost:3000
- ๐ Health Check: http://localhost:3000/health
Unlike typical AI assistants that hide their decision-making process, WikidAI provides a real-time window into the AI's thoughts:
User: "Who is the mayor of Rome and what's the weather there?"
AI Reasoning (visible to you):
โโ ๐ค Need to find current mayor โ Query Wikidata with SPARQL
โโ ๐ Got Roberto Gualtieri โ Need location coordinates
โโ ๐บ๏ธ Query Nominatim for Rome coordinates
โโ โ
Query OpenMeteo for current weather
Final Answer: "Roberto Gualtieri is the mayor of Rome.
Current weather: 22ยฐC, partly cloudy..."
| Feature | Description |
|---|---|
| ๐ก๏ธ SPARQL Gauntlet | Multi-layer security validation for generated queries |
| ๐งช Syntax Validation | Uses sparqljs to validate queries before execution |
| ๐ฌ Multi-Turn Conversations | Maintains context across multiple questions |
| โก Function Calling | Native Gemini 2.5 Pro function orchestration |
| ๐จ Educational UI | 3-panel dashboard showing Input โ Reasoning โ Output |
| ๐ณ Docker-First | Zero-config deployment with hot-reload for development |
-
WikidataAgent - Queries the world's largest open knowledge graph
- Generates SPARQL queries from natural language
- Handles entity disambiguation (e.g., "Paris the city" vs "Paris Hilton")
- Validates and sanitizes all queries
-
WikipediaAgent - Fetches concise summaries
- Multi-language support
- Fallback handling for missing articles
-
NominatimAgent - Geocoding and reverse geocoding
- Powered by OpenStreetMap data
- Returns detailed location information
-
OpenMeteoAgent - Real-time weather data
- No API key required
- Current conditions and forecasts
๐ฌ "Who was Albert Einstein?"
โ Fetches Wikipedia summary
๐ฌ "What's the population of Tokyo?"
โ Generates and executes SPARQL query on Wikidata
๐ฌ "Who is the mayor of Rome and what's the weather there today?"
โ Chains: Wikidata โ Nominatim โ OpenMeteo
๐ฌ "Tell me about Marie Curie and the weather in her birthplace"
โ Chains: Wikipedia โ Wikidata โ Nominatim โ OpenMeteo
๐ฌ "List all Italian cities with more than 500,000 inhabitants"
โ Generates complex SPARQL with filters and aggregations
๐ฌ "Who are the Nobel Prize winners born in Germany?"
โ Demonstrates entity disambiguation and property navigation
WikidAI uses a clean, layered architecture designed for educational clarity:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ User Browser โ
โ http://localhost:8080 โ
โโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฑ Frontend (Nginx + Vanilla JS) โ
โ โข 3-Panel Dashboard (Input/Reasoning/Output) โ
โ โข Real-time thought stream visualization โ
โ โข Agent call tracking & metrics โ
โโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ REST API
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฏ Backend (Express + TypeScript) โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ง Gemini Orchestrator โ โ
โ โ (Function Calling + Thinking Mode) โ โ
โ โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโดโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโ โ
โ โผ โผ โผ โผ โ
โ โโโโโโ โโโโโโ โโโโโโ โโโโโโ โ
โ โ ๐ โ โ ๐บ๏ธ โ โ ๐ โ โ โ
โ โ
โ โWikiโ โNom โ โWikiโ โOpenโ โ
โ โdataโ โinatโ โpediโ โMeteโ โ
โ โ โ โim โ โa โ โo โ โ
โ โโโโโโ โโโโโโ โโโโโโ โโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ ๐พ Redis Cache โ
โ (Future: Rate โ
โ Limiting) โ
โโโโโโโโโโโโโโโโโโโโ
External APIs:
โโ Wikidata SPARQL Endpoint (query.wikidata.org)
โโ Wikipedia API (en.wikipedia.org/api)
โโ Nominatim (nominatim.openstreetmap.org)
โโ OpenMeteo (api.open-meteo.com)
โโ Gemini 2.5 Pro (generativelanguage.googleapis.com)
๐จ Why Vanilla JS for Frontend?
- Educational clarity - no framework magic to understand
- Fast iteration during PoC phase
- Easy for contributors to jump in
๐ค Why Gemini 2.5 Pro?
- Native function calling (no custom parsing needed)
- "Thinking mode" for transparent reasoning
- Extended context window (1M tokens)
- Cost-effective for educational projects
๐ณ Why Docker-First?
- Zero dependency conflicts
- Identical dev/prod environments
- Hot-reload for rapid development
wikidai/
โโโ ๐จ frontend/
โ โโโ index.html # 3-panel dashboard UI
โ โโโ nginx.conf # Reverse proxy config
โ โโโ Dockerfile # Nginx container
โ
โโโ โ๏ธ backend/
โ โโโ src/
โ โ โโโ ๐ค agents/
โ โ โ โโโ wikidata-agent.ts # SPARQL generation & validation
โ โ โ โโโ wikipedia-agent.ts # Wikipedia API wrapper
โ โ โ โโโ nominatim-agent.ts # Geocoding service
โ โ โ โโโ openmeteo-agent.ts # Weather data
โ โ โ
โ โ โโโ ๐ prompts/
โ โ โ โโโ system-instructions.ts # Balanced mode
โ โ โ โโโ wikidata-focused-instructions.ts # SPARQL-first mode
โ โ โ
โ โ โโโ orchestrator.ts # Gemini function calling logic
โ โ โโโ conversation-manager.ts # Multi-turn state management
โ โ โโโ reflexive-mode.ts # Advanced reasoning loops
โ โ โโโ config.ts # Environment configuration
โ โ โโโ types.ts # TypeScript interfaces
โ โ โโโ index.ts # Express server
โ โ
โ โโโ Dockerfile # Multi-stage Node.js build
โ โโโ package.json
โ โโโ tsconfig.json
โ
โโโ ๐ณ docker-compose.yml # Full stack orchestration
โโโ ๐ README.md #
# Inside Docker container
docker compose exec backend npm test
# Or locally (requires Node.js 20+)
cd backend
npm install
npm test# Start all services with hot-reload
docker compose up
# Rebuild after Dockerfile changes
docker compose up --build
# View logs in real-time
docker compose logs -f backend
# Stop all services
docker compose down
# Stop and remove volumes (clean slate)
docker compose down -v
# Run a specific agent test
docker compose exec backend npm run test:wikidataCreate backend/.env with:
# Required
GEMINI_API_KEY=your_api_key_here
# Optional
NODE_ENV=development
PORT=3000
REDIS_URL=redis://redis:6379
LOG_LEVEL=debug| Feature | Status | Details |
|---|---|---|
| Docker Setup | โ Complete | Multi-stage builds, hot-reload, health checks |
| Gemini Integration | โ Complete | Function calling, thinking mode, history |
| Wikidata Agent | โ Complete | SPARQL generation, validation, gauntlet |
| Wikipedia Agent | โ Complete | Summary fetching, error handling |
| Nominatim Agent | โ Complete | Geocoding and reverse geocoding |
| OpenMeteo Agent | โ Complete | Real-time weather data |
| Educational UI | โ Complete | 3-panel dashboard with reasoning display |
| Multi-Turn Conversations | โ Complete | Context preservation across queries |
PoC Success Metrics:
- โ All demo queries working (100% success rate)
- โ SPARQL validation operational (prevents injection)
- โ Thought visualization functional
- โ Multi-agent orchestration working
- Rate limiting with BullMQ
- DuckDuckGo web search agent
- Production frontend (SolidJS rewrite)
- Advanced error handling
- Performance metrics dashboard
- API documentation (OpenAPI/Swagger)
- Cloud deployment (Google Cloud Run)
- Authentication & user management
- Query caching & optimization
- Monitoring & observability (Prometheus/Grafana)
- Multi-language support
- Advanced SPARQL optimization
WikidAI is an educational project - contributions are welcome!
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and test thoroughly
- Commit with clear messages:
git commit -m 'Add amazing feature' - Push to your fork:
git push origin feature/amazing-feature - Open a Pull Request
- Follow the existing TypeScript style (we use ESLint)
- Add tests for new agents or features
- Update documentation for significant changes
- Keep the educational focus - clarity over cleverness
- ๐ New agents (e.g., DBpedia, Europeana, arXiv)
- ๐จ UI improvements (dark mode, mobile responsiveness)
- ๐ Better visualization of SPARQL queries
- ๐งช More comprehensive test coverage
- ๐ Documentation improvements or translations
- ๐ง Performance optimizations
- Gemini API Documentation
- Wikidata Query Service
- SPARQL Tutorial
- OpenStreetMap Nominatim
- Open-Meteo API
WikidAI was created by Giovanni Novelli Ph.D. for itWikiCon 2025 in Catania, Italy.
Special thanks to:
- The Wikimedia community for Wikidata and Wikipedia
- Google for the Gemini API
- OpenStreetMap contributors
- The open-source community
Author: Giovanni Novelli Ph.D.
- ๐ Website: novelli.me
- ๐ผ GitHub: @gnovelli
- ๐ง Email: [email protected]
- ๐ Project: novelli.me/wikidai
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright ยฉ 2025 Giovanni Novelli Ph.D.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software.
- Issues: GitHub Issues
- Discussions: GitHub Discussions