Transform any topic into structured, grounded, and reusable knowledge. An AI-powered synthesis pipeline that converts a single topic into curated learning modules, tailored personas, and pixel-perfect PDF reports.
Large Language Models are excellent at generating information but often return lengthy, unstructured walls of text that are difficult to scan, validate, and retain.
Structured AI Knowledge Builder was built to solve this problem by focusing on generating better knowledge, not just more text. Every response is transformed into a structured educational artifact rather than a free-form chat.
Every topic is converted into structured learning modules:
- 📝 Plain-English Explanations
- 📖 Formal Definitions & Use Cases
- 🧩 Types & Classifications
- 🎯 Step-by-Step Understanding & Reflections
- 🔗 Live YouTube & Source References
Click to watch the full project demo!
Real-Time Rendering • Live Web Grounding • Multi-Persona Adaptability
- 🚀 Real-Time SSE Streaming & Partial JSON: Bypasses static loading screens by parsing
text/event-streamchunks, dynamically stitching incomplete JSON fragments live on the UI. - 🧠 Azure AI Engine: Powered by Azure AI Foundry for robust orchestration, search grounding, and schema validation.
- 🌍 Live Deep Research: Autonomously queries Bing to fetch the latest context and sources.
- 📄 High-Fidelity PDF Export: Server-side Puppeteer rendering guarantees pixel-perfect exports regardless of the user's device.
- 🎭 Persona System: Adapts depth, language, and technical detail based on the target audience (Student, Engineer, Kid, etc.).
The Knowledge Builder shines when you are learning a new, complex topic and need structured clarity tailored to your current expertise.
Example 1: The Engineer
- Topic: Transformer Architecture: Multi-Head Self-Attention Mechanism
- Target Audience: Engineer
- Output: Utilizes architecture pattern analogies, includes matrix math formulas (
softmax(QK^T / sqrt(d_k))V), covers Cross-Attention variants, and provides technical points to ponder like computational complexity.
Example 2: The Kid
- Topic: Transformer Architecture: Multi-Head Self-Attention Mechanism
- Target Audience: Kid
- Output: Swaps matrix math for "magical talking book" and "special glasses" metaphors, simplifies steps to plain English, and provides beginner-friendly learning resources.
Note: MARTA doesn't just change the tone. She rewrites the entire knowledge architecture for the audience.
- Enter Your Topic: Type in any subject or concept you want to learn about.
- Select a Persona: Choose who the explanation should be tailored for (e.g., Student, Developer, Teacher, Kid).
- Generate: Watch the Bento Grid build in real-time as the AI streams the structured knowledge modules.
- Export: Click Export to generate a server-side, high-fidelity PDF report of your custom learning material.
flowchart TB
%% ─────────────────────────────────────────
%% LAYER 1 — User Interface
%% ─────────────────────────────────────────
subgraph CLIENT["🖥️ Client Layer — React 19 · TypeScript · Vite"]
direction LR
U(["👤 User"])
FE["⚛️ React Frontend\n──────────────\nStreaming SSE Handler\nPartial JSON Parser\nNeo-Brutalist UI"]
UI["📊 Bento Grid Dashboard\n──────────────\nKnowledge Modules\nYouTube Player\nPDF Export Trigger"]
end
U -- "Topic + Persona" --> FE
FE -- "Render structured\nknowledge artifacts live" --> UI
%% ─────────────────────────────────────────
%% LAYER 2 — Backend Orchestration
%% ─────────────────────────────────────────
subgraph BACKEND["⚙️ Backend Orchestration Layer — Node.js · Express"]
direction LR
API["🚦 Express API Gateway\n──────────────\nRequest Routing"]
RL["🛡️ Rate Limiter\n5 req / 15 min\nIP-based"]
PUP["📄 Puppeteer\nServer-side PDF\nFixed 1200px Viewport"]
end
FE -- "POST /api/generate" --> API
FE -- "POST /api/export-pdf" --> PUP
API --> RL
%% ─────────────────────────────────────────
%% LAYER 3 — AI Synthesis Engine
%% ─────────────────────────────────────────
subgraph AI["🧠 MARTA — Azure AI Foundry Synthesis Engine"]
direction LR
MARTA["🤖 MARTA Agent\n──────────────\ngpt-4.1-mini\nStructured JSON Output\nSSE Streaming"]
WEB["🌐 Deep Research\n──────────────\nBing Web Search\nLive Grounding"]
GUARD["🛡️ Safety Guardrails\nContent Filters"]
end
RL -- "Structured prompt\n+ stream flag" --> MARTA
MARTA <--> WEB
MARTA --> GUARD
GUARD -- "Strict JSON stream" --> API
%% ─────────────────────────────────────────
%% RETURN & EXPORT
%% ─────────────────────────────────────────
API -- "Chunked JSON Stream" --> FE
PUP -- "Binary PDF Buffer" --> FE
%% ─────────────────────────────────────────
%% STYLES
%% ─────────────────────────────────────────
classDef clientNode fill:#1e3a5f,stroke:#4a90d9,color:#e8f4fd,rx:8
classDef backendNode fill:#2d1b4e,stroke:#9b59b6,color:#ead5f5,rx:8
classDef aiNode fill:#3d0f0f,stroke:#e74c3c,color:#fde8e8,rx:8
class U,FE,UI clientNode
class API,RL,PUP backendNode
class MARTA,WEB,GUARD aiNode
MARTA was engineered as an Azure AI Foundry Agent instead of a standard completion endpoint to enforce strict execution constraints over a probabilistic model.
The Knowledge Builder relies heavily on:
- Deep Research Grounding: Autonomous Bing Web Search integration ensures MARTA evaluates current facts and sources.
- Enterprise Guardrails: Azure content safety filters ensure that inappropriate or malformed requests are categorically blocked (Prompt injection, Code vulnerability, Self-harm).
- Schema Enforced Output: Standard conversational APIs are prone to markdown bleed. By utilizing strict schemas and partial JSON parsing, the React frontend never encounters a layout shift or broken component.
The backend cognitive engine is MARTA, a master orchestrator agent on Azure AI Foundry. Rather than functioning as an open-ended conversationalist, MARTA operates as a strict analytical compiler—transforming any topic into objective, strictly-typed learning data.
Every generated response must strictly match this schema before reaching the UI:
{
"layman": "...",
"definition": "...",
"when_to_use": [],
"how_to_make": [],
"types": [],
"points_to_ponder": [],
"youtube_id": "...",
"youtube_fallback": "...",
"sources": [],
"conclusion": "..."
}- Real-time SSE Streaming: Dynamically reacts to backend streams, parsing incomplete JSON on the fly to build tables and logic live before your eyes, entirely removing static loading screens.
- Search-grounded generation: Live Bing searches to pull references and YouTube IDs.
- Citation-aware content: Accurate sources embedded in the output.
- Neo-Brutalist Bento Grid: High information density with a visual learning hierarchy.
- YouTube Integration: Embedded video player with fallback search handling.
- Cross-Device PDF Export: Puppeteer renders the PDF server-side at a fixed 1200px desktop viewport, ensuring every export looks identical whether downloaded on mobile, tablet, or desktop.
| Concern | Protection | Implementation Layer |
|---|---|---|
| Prompt Injection | Azure AI Foundry safeguards | AI Orchestration Layer |
| Invalid Responses | Strict schema validation | Node.js Backend |
| Excessive Requests | Rate limiting (5 req / 15 min) via express-rate-limit |
Express Router |
| Broken Media Links | URL validation and fallback search handling | Frontend Components |
| Layer | Technology |
|---|---|
| Frontend | React 19, Vite, Tailwind CSS v4, Framer Motion |
| Backend | Node.js, Express, Puppeteer |
| AI Platform | Azure AI Foundry, @azure/identity |
| Language | TypeScript |
| Testing | Jest |
📦 AI_KNOWLEDGE_BUILDER
┣ 📂 Pictures/ # Demo images and PDF examples
┣ 📂 src/
┃ ┣ 📂 components/ # Isolated React UI pieces (Bento Grid, Loader, Player)
┃ ┣ 📂 lib/ # Shared utilities (Partial JSON parser)
┃ ┣ 📂 services/ # API fetch layers and stream handling
┃ ┣ 📜 App.tsx # Main application orchestrator
┃ ┣ 📜 index.css # Tailwind root
┃ ┣ 📜 main.tsx # React DOM mounting
┃ ┗ 📜 types.ts # TypeScript interfaces
┣ 📂 tests/ # Backend API integration tests
┣ 📜 server.ts # Node/Express API Gateway & Puppeteer Logic
┣ 📜 vite.config.ts # Bundler configuration
┣ 📜 jest.config.js # Test runner configuration
┗ 📜 package.json # Dependencies & scripts
The project includes automated backend integration tests to verify API reliability, schema validation, and PDF generation workflows.
PASS
6 Tests Passing
0 Tests Failing
| Scenario | Status |
|---|---|
| Health check endpoint responds successfully | ✅ |
| Valid MARTA response schema validation | ✅ |
| Missing required request fields handling | ✅ |
| Incomplete MARTA schema validation | ✅ |
| Successful server-side PDF generation | ✅ |
| Missing report data handling during export | ✅ |
git clone https://github.com/Ahtesham-Latif/AI_KNOWLEDGE_BUILDER_BACKED_BY_MARTA.git
cd AI_KNOWLEDGE_BUILDER_BACKED_BY_MARTAnpm installcp .env.example .envPopulate .env with:
FOUNDRY_ENDPOINT=https://your-agent.services.ai.azure.com/openai/deployments/gpt-4.1-mini/chat/completions?api-version=2025-05-15-preview
MARTA_ASSISTANT_ID=your-agent-idaz loginnpm run devGitHub Copilot and multiple AI models were used strategically based on their strengths throughout development.
- Component scaffolding and Express middleware (Copilot)
- Azure SDK integration and debugging (Copilot)
- Neo-Brutalist design patterns and UI architecture (Claude)
- MARTA system prompt engineering (Claude + Gemini)
- Engineering and Architect Advices (K - Azure Foundry Agent)
- Persistent knowledge history
- Multi-language support
- Advanced PDF themes
- Improved retrieval fallback strategies
- Physics-based Bento interactions
Contributions, suggestions, and feedback are welcome.
- Fork the repository
- Create a feature branch
- Commit your changes
- Open a pull request
This project is licensed under the MIT License.
Ahtesham Latif
Business & IT Student — University of the Punjab (IBIT)
Built For: Microsoft Agents League – AI Skills Fest 2026
"Making AI-generated knowledge easier to understand, verify, and learn from."


