Conversational AI Agent for learning chess openings (RAG, LangGraph, MCP)
Python, LangGraph, RAG, FastAPI, Milvus, MongoDB, Angular, MCP, Computer Vision, LLM
AI Agent for Learning Chess Openings
Overview
This project implements the design of a conversational AI agent connected to multiple expert knowledge sources, on behalf of the Fédération Française des Échecs. The objective is to guide young talents in learning openings by combining official theory (Lichess), evaluation by a chess engine (Stockfish), vector search on a knowledge base (RAG), and educational video resources, all driven by LangGraph and exposed via an Angular interface with an interactive chessboard.
The project applies best practices for designing orchestrated AI agents and multimodal RAG, covering both the development of a functional POC and the feasibility study for an advanced extension based on an MCP server.
Objectives
- Develop an AI agent capable of suggesting theoretical moves for a chess position and evaluating it if it deviates from standard lines.
- Enrich the agent with a RAG system connected to a vector knowledge base on openings.
- Integrate a search for relevant educational video resources related to the current position.
- Build an interactive user interface (chessboard) connected to the agent.
- Design, without developing it, an advanced video search system by exact position (vision + FEN), supported by an MCP server.
Demonstrated Skills
Backend Architecture and Agent Orchestration
- Setup of a service architecture (FastAPI, Milvus, MongoDB, Angular) orchestrated by Docker Compose, with a healthcheck endpoint from initialization.
- Development of business endpoints (
/api/v1/moves/{fen},/api/v1/evaluate/{fen}) successively querying the Lichess API (theoretical moves) and Stockfish (evaluation in centipawns) depending on the nature of the position. - Encapsulation of external service call logic in dedicated modules, with error and timeout management.
- Orchestration of the agent's workflow (context retrieval, vector search, video recommendation) with LangGraph.
RAG and Vector Search
- Creation of a textual dataset on openings (Wikichess) and generation of embeddings via
sentence-transformers. - Indexing and querying of a Milvus vector database, exposed via a semantic search endpoint (
/vector-search). - Attention paid to chunking quality and network connection between the API and Milvus within the Docker environment.
Integration of External Sources and Multimodal Enrichment
- Integration of the YouTube Data v3 API for searching relevant explanatory videos based on the opening played, with quota management and quality filtering.
- Validation of positions and move legality via the
python-chesslibrary. - Design of an intelligent query combining opening name and educational keywords to refine the relevance of results.
Interactive User Interface
- Development of an Angular application with an interactive chessboard (
ngx-chessboard) and a recommendations panel (moves, context, videos). - Setup of Angular services for communication with the backend API, with management of loading states and network errors.
- Synchronization of the chessboard state with the AI agent's responses.
Industrialization and Demonstration
- Full containerization of the system (
docker-compose.yml) orchestrating FastAPI, Milvus, MongoDB, and Angular. - Verification of Docker volume persistence and end-to-end testing from a fresh installation.
- Writing of installation documentation and preparation of a client demonstration scenario.
Feasibility Study for an Advanced System (Vision + MCP)
- Design (without development) of a chess position recognition system from videos: frame extraction, chessboard detection, conversion to FEN notation via a board-to-FEN vision model.
- Consideration of exposing this system via an MCP (Model Context Protocol) server for easier integration into the existing application.
- Writing of an 8 to 10-page note covering benefits, limitations, technical architecture diagram, and cost study (build + opex), with identification of technical and business risks and proposal of alternatives.
Architecture
Angular Interface
(ngx-chessboard + panel)
│
▼
FastAPI API
│
LangGraph Orchestration
│
┌───────────────┼───────────────┬──────────────┐
▼ ▼ ▼ ▼
Lichess API Stockfish RAG Search YouTube API
(theoretical moves) (evaluation) (Milvus, Wikichess (educational
text) videos)
│ │ │ │
└───────────────┴───────┬───────┴──────────────┘
▼
MongoDB (persistence)
│
▼
── Feasibility Study (not developed) ──
Stored YouTube Videos
│
Frame Extraction (vision)
│
Chessboard Detection → FEN
│
MCP Server (search by position)
Technical Stack
Backend & Agent Orchestration
- FastAPI
- LangGraph
- python-chess, Stockfish
Data & Vector Search
- Milvus, pymilvus
- sentence-transformers
- MongoDB
External Sources
- Lichess API
- YouTube Data v3 API (google-api-python-client)
Frontend
- Angular, ngx-chessboard
Infrastructure
- Docker, Docker Compose
- Git
Prospective Study
- Model Context Protocol (FastMCP)
- Computer Vision (chessboard detection, board-to-FEN)
Applied Best Practices
- Decoupled service architecture, orchestrated by Docker Compose, tested from the first commit (healthcheck)
- Encapsulation of external API call logic in dedicated modules
- Explicit management of errors, timeouts, and API quotas
- Clear separation between POC development and prospective feasibility study
- Realistic cost estimation (build + opex) and explicit identification of technical and business risks
- Installation documentation allowing for a reproducible demonstration from a fresh installation
Results
Upon completion of this project, the system allows to:
- propose to a user the theoretical moves for a chess position, or its engine evaluation if it deviates from theory;
- enrich each recommendation with relevant textual context via vector search (RAG);
- suggest educational videos adapted to the current opening;
- offer a complete interactive experience via an Angular interface connected to the agent;
- document a credible evolution path (video search by exact position via vision + MCP) supported by a cost study.
Acquired Skills
- Design and orchestration of AI agents (LangGraph)
- Setup of a RAG system (embeddings, Milvus vector database)
- Integration of multiple external APIs within the same agent (Lichess, Stockfish, YouTube)
- Full-stack development (FastAPI + Angular) and containerization (Docker Compose)
- Design of prospective technical architecture (Model Context Protocol)
- Feasibility study and cost estimation for an AI system (build + opex)