β‘ Multi-Agent AI that turns any podcast, video or transcript into summaries, highlights, social content & direct answers
π Try the App Here
π https://mediamind-ai.onrender.com/
MediaMind is a production-grade Autonomous Media Intelligence Platform powered by a multi-agent AI pipeline.
Instead of a single LLM call, it routes every user request through a Supervisor β Specialist agent system β intelligently deciding whether to summarize, extract highlights, generate social content, or answer a direct question.
It combines Groq's ultra-fast inference with Hybrid RAG (ChromaDB + BM25), MCP-style tool calling, Langfuse v4 observability, RAGAS auto-evaluation, and real-time YouTube transcript ingestion β all behind a clean, session-aware Streamlit chat UI.
| Feature | Description |
|---|---|
| β‘ Ultra-Fast Inference | Groq LPU running Llama 3.3 70B β sub-2s responses |
| π§ Multi-Agent Pipeline | Supervisor routes to Summarize / Highlight / Social / Q&A agent |
| πΊ YouTube Ingestion | Paste any YouTube URL β transcript fetched, indexed, answered |
| π Hybrid RAG | ChromaDB vector search (60%) + BM25 keyword search (40%) merged |
| π§ MCP Tool Registry | Wikipedia, DuckDuckGo, YouTube Transcript, File Reader β per-agent access control |
| π¬ Multi-Session Chat | Full session history, auto-titles, session switching, export to markdown |
| π¬ Direct Q&A Mode | Ask any question β Q&A Agent answers in 2β5 sentences, grounded in context |
| π‘οΈ Production Guardrails | Input validation, content moderation, output sanitization (Pydantic v2) |
| π RAGAS Auto-Evaluation | Faithfulness, Answer Relevancy, Context Precision + Hallucination detection |
| π Langfuse Observability | Every trace, span, LLM call and RAGAS score logged to Langfuse dashboard |
| π Deployed on Render | Persistent ChromaDB storage β data survives server restarts |
| Technology | Purpose |
|---|---|
| π Python 3.11+ | Core programming |
| β‘ Groq API | Fast LLM inference (Llama 3.3 70B) |
| π§ LangGraph | Agent orchestration (StateGraph) |
| π LangChain | LLM integration + tool binding |
| π¨ Streamlit | Frontend UI + multi-session chat |
| π¦ ChromaDB | Persistent vector store |
| π BM25 (rank_bm25) | Keyword search for hybrid RAG |
| π€ all-MiniLM-L6-v2 | Local embeddings β zero API cost |
| π DuckDuckGo DDGS | Live web search tool |
| π Wikipedia API | Factual enrichment tool |
| π RAGAS 0.4.x | Production RAG evaluation (reference-free) |
| π Langfuse v4 | LLM observability + score tracking |
| π Render | Cloud deployment |
| π³ Docker | Containerised production build |
MediaMind
β
βββ app.py # Streamlit UI β multi-session chat, source management
βββ agent.py # LangGraph multi-agent pipeline + evaluation trigger
βββ rag.py # Hybrid RAG (ChromaDB + BM25) β retrieve_context_with_chunks()
βββ evaluation.py # RAGAS evaluation service (fire-and-forget, non-blocking)
βββ mcp_tools.py # MCP tool registry (4 tools, per-agent access control)
βββ llm.py # Groq LLM client (3 temperature modes)
βββ prompts.py # All LLM prompts β ChatPromptTemplate + Few-Shot + CoT
βββ guardrails.py # Input validation, content moderation, output sanitization
βββ tracer.py # Langfuse v4 observability wrapper
βββ schemas.py # Pydantic v2 schemas for I/O validation
βββ config.py # Central config β models, RAG params, eval thresholds
βββ tracer.py # Langfuse v4 SDK wrapper (create_score, spans, traces)
βββ Dockerfile # Multi-stage production build
βββ docker-compose.yml # Local dev + persistent volumes
βββ requirements.txt
βββ .env # API keys (NOT pushed to GitHub)
βββ README.md
User Query
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Supervisor Node β
β Reads query, decides routing (temp=0.0) β
ββββββ¬βββββββββββ¬βββββββββββββββ¬βββββββββββββββββββββββββ
β β β β
βΌ βΌ βΌ βΌ
βββββββββββ βββββββββββ βββββββββββ ββββββββββββββ
βSummarizeβ βHighlightβ β Social β β Q&A Agent β
β Agent β β Agent β β Agent β β β
ββββββ¬βββββ ββββββ¬βββββ ββββββ¬βββββ βββββββ¬βββββββ
β β β β
βΌ βΌ βΌ βΌ
Wikipedia Wikipedia Web Search Wikipedia
Web Search Web Search (only) Web Search
β β β β
βΌ βΌ βΌ βΌ
Groq 0.3 Groq 0.0 Groq 0.75 Groq 0.3
(balanced) (precise) (creative) (balanced)
β β β β
βββββββββββββ΄ββββββββββββ΄ββββββββββββββ
β
βΌ
Output Guardrails
(validation + sanitization)
β
βΌ
Final Response β UI
β
βΌ (background daemon thread)
RAGAS Evaluation (non-blocking)
β
βΌ
Langfuse Scores Dashboard
| Query type | Example | Routes to |
|---|---|---|
| Wants a summary / overview | "summarize this video" | summarize_agent |
| Wants highlights / key moments | "what are the key points?" | highlight_agent |
| Wants social media content | "write a LinkedIn post" | social_agent |
| Asks a direct question | "what does X mean?" / "who is Y?" | qa_agent |
Routing rule: If the query contains question words β what, why, how, who, when, explain, define, tell me β the supervisor always routes to
qa_agent. The Q&A Agent answers in 2β5 sentences grounded in transcript content, no structured reports.
User Query
β
ββββββββββββββββββββββββββββββββ
βΌ βΌ
ChromaDB Vector Search BM25 Keyword Search
(semantic similarity) (exact term matching)
all-MiniLM-L6-v2 embeddings rank_bm25 BM25Okapi
Top-4 chunks (60% weight) Top-4 chunks (40% weight)
β β
ββββββββββββ¬ββββββββββββββββββββ
βΌ
Merge + Deduplicate
(vector results get priority)
β
βΌ
retrieve_context_with_chunks()
returns: (joined_str, List[str])
β β
βΌ βΌ
LLM Prompt RAGAS Evaluation
retrieve_context_with_chunks()returns both the joined context string (for the LLM prompt) and the raw chunk list (for RAGAS evaluation) in a single retrieval call β zero double-fetching.
MediaMind automatically evaluates every production query using RAGAS 0.4.x β no ground truth or human labels required.
run_agent() completes
β
βΌ (fire-and-forget daemon thread β user never waits)
EvaluationService.evaluate_fire_and_forget()
β
βΌ
_run_ragas_sync()
βββ Faithfulness (is answer grounded in context?)
βββ Answer Relevancy (does answer address the question?)
βββ LLMContextPrecisionWithoutReference (is retrieval pulling clean chunks?)
β
βΌ
_check_thresholds() β WARNING logs + UI alerts if below threshold
β
βΌ
tracer.score_response() β client.create_score() β Langfuse dashboard
| Metric | What it measures | Threshold |
|---|---|---|
| Faithfulness | Is the answer grounded in retrieved context? Low = hallucination risk | >= 0.70 |
| Answer Relevancy | Does the answer actually address the query? | >= 0.65 |
| Context Precision | Are retrieved chunks mostly relevant? Low = noisy retrieval | >= 0.60 |
| Hallucination Score | Derived: 1 - faithfulness. High = fabrication risk |
<= 0.30 |
All metrics are reference-free β no ground truth needed. Scores appear in Langfuse within ~10β20s of each response.
Every pipeline run is fully traced in Langfuse v4:
| What is traced | Langfuse object |
|---|---|
| Full pipeline run | Root span (mediamind_pipeline) |
| Supervisor routing decision | Child span |
| RAG retrieval | Child span (chunk count + latency) |
| Every LLM call (LangGraph) | Auto-traced via CallbackHandler |
| Guardrail checks | Child span (pass/fail + reason) |
| RAGAS scores | create_score() per metric |
| User thumbs up / down | create_score("user_feedback") |
Langfuse v4 note: Uses
get_client()+start_as_current_observation()+create_score(). The old.score()method silently did nothing β fixed tocreate_score()withdata_type="NUMERIC".
Three-layer protection on every request:
Input Query
β
βΌ
1. Pydantic QueryInput validation
(min/max length, whitespace, injection patterns)
β
βΌ
2. Content moderation
(off-topic, harmful, ambiguous β rule-based, no API cost)
β
βΌ
3. Output guardrails
(HighlightOutput schema validation, prompt-leak sanitization)
| Tool | Description | Agent Access |
|---|---|---|
youtube_transcript |
Fetches full transcript from YouTube URL | Research agent |
web_search |
Live DuckDuckGo search for news & trends | All agents |
wikipedia_search |
Factual background on people & topics | Summarize, Highlight, Q&A |
read_file |
Reads local .txt / .srt / .md transcript | Research agent |
Each agent gets only the tools it needs β deliberate access control, not default behaviour.
git clone https://github.com/hari9618/mediamind
cd mediamindpython -m venv venv
source venv/bin/activate # Mac/Linux
venv\Scripts\activate # Windowspip install -r requirements.txtCreate a .env file (see .env.example):
# Required
GROQ_API_KEY=your_groq_api_key_here
# Langfuse observability (v4 SDK)
LANGFUSE_PUBLIC_KEY=pk-lf-...
LANGFUSE_SECRET_KEY=sk-lf-...
LANGFUSE_BASE_URL=https://us.cloud.langfuse.com # or https://cloud.langfuse.com for EU
# RAGAS evaluation
EVAL_ENABLED=true
EVAL_LOG_TO_LANGFUSE=true
EVAL_THRESH_FAITHFULNESS=0.70
EVAL_THRESH_PRECISION=0.60
EVAL_THRESH_RELEVANCY=0.65
EVAL_THRESH_HALLUCINATION=0.30Get your free Groq API key at console.groq.com
Get your Langfuse keys at cloud.langfuse.com
streamlit run app.pydocker compose up --build # first run
docker compose up # subsequent runs
docker compose down -v # stop + wipe volumes1οΈβ£ User sends a query (or pastes a YouTube URL)
β
2οΈβ£ Input guardrails β Pydantic validation + content moderation
β
3οΈβ£ YouTube URL detected? β Fetch transcript β Clear ChromaDB β Re-index
β
4οΈβ£ retrieve_context_with_chunks() β ChromaDB semantic + BM25 keyword β Top-4 chunks
β returns both joined string AND raw list
β
5οΈβ£ Supervisor reads query β Routes to Summarize / Highlight / Social / Q&A agent
β (question words detected? β qa_agent for direct concise answer)
β
6οΈβ£ Agent calls MCP tools (Wikipedia, DuckDuckGo) via ReAct reasoning
β
7οΈβ£ Agent formats prompt β Groq LLM β Output guardrails β Response to UI
β
8οΈβ£ Background: RAGAS evaluates faithfulness + relevancy + precision
β Scores posted to Langfuse via create_score() (~10β20s delay)
β
9οΈβ£ Response rendered in chat β markdown or styled highlight cards
User can submit π/π feedback β score_response("user_feedback") β Langfuse
β LangGraph StateGraph β building real state machines with typed state and conditional edges
β Hybrid RAG Engineering β combining vector + keyword search with weighted merging
β MCP Tool Architecture β per-agent access control, tool binding, ToolMessage conversations
β Multi-Session State Management β Streamlit session_state design for complex apps
β Production RAG Deployment β PersistentClient ChromaDB, real-time re-indexing
β LLM Temperature Strategy β precise / balanced / creative modes for different task types
β YouTube API Integration β youtube-transcript-api v1.x, URL parsing, live ingestion
β Intelligent Task Routing β keyword-based intent detection to separate Q&A from generation tasks
β RAGAS Evaluation β reference-free production RAG evaluation with Faithfulness, Relevancy, Context Precision
β Langfuse v4 Observability β tracing, spans, scores, create_score() API, US vs EU region config
β Production Guardrails β Pydantic v2 input/output validation, prompt injection detection, content moderation
β SDK Version Debugging β diagnosed breaking changes across RAGAS 0.1β0.4 and Langfuse v2βv4 APIs
πΉ Cross-encoder reranking β add cross-encoder/ms-marco-MiniLM-L-6-v2 between retrieval and TOP-K slice
πΉ Semantic chunking β replace character splitter with SemanticChunker for boundary-aware chunks
πΉ Offline CI evaluation β RAGAS batch evaluation against collected JSONL dataset in GitHub Actions
πΉ Speaker diarization β identify who said what in transcripts
πΉ Multi-turn Q&A β follow-up questions that remember previous answers in session
πΉ Multi-document RAG β index multiple videos/files simultaneously
πΉ Audio file support β direct .mp3/.wav upload with Whisper transcription
πΉ Synthetic dataset generation β RAGAS testset generator for automated benchmark creation
Hari Krishna T
AI Engineer | Multi-Agent Systems Builder | Gen AI Developer
π GitHub: github.com/hari9618
π LinkedIn: linkedin.com/in/hari-krishna-thota-06b850275
If you like this project:
β Star the repository
π’ Share with others
π΄ Fork and build on top of it
AI Multi-Agent LangGraph LangChain Groq RAG ChromaDB BM25 Streamlit YouTube MCP RAGAS Langfuse Evaluation Observability Guardrails Python Generative AI LLM Render Docker
