A sophisticated multi-agent system that analyzes software repositories, generates comprehensive documentation, and provides intelligent question-answering capabilities. Built with LangGraph, integrated with Cohere LLM, Jina embeddings, and Qdrant vector database.
This system demonstrates advanced multi-agent concepts:
A Streamlit-based web application is available for easy repository analysis:
pip install streamlit streamlit run streamlit_app.py
The web app allows you to:
Note: Users must provide their own API keys for Cohere, Jina AI, and Qdrant Cloud.
cd multiagent-repo-assistant python -m venv venv venv\Scripts\activate # Windows # source venv/bin/activate # macOS/Linux
pip install -r requirements.txt
.env file):# Qdrant Cloud QDRANT_URL=https://your-instance.qdrant.io QDRANT_API_KEY=your_api_key QDRANT_COLLECTION=repo_chunks EMBEDDING_DIM=1024 # Cohere COHERE_API_KEY=your_api_key # Jina JINA_API_KEY=your_api_key JINA_EMBEDDING_MODEL=jina-embeddings-v3
# Using LangGraph orchestrator (default) python main.py analyze --repo path/to/repo # Save results to JSON python main.py analyze --repo path/to/repo --output results.json # Use simple orchestrator python main.py analyze --repo path/to/repo --orchestrator simple
# Interactive QA python main.py ask --repo path/to/repo --query "how to install?" # Specify number of context results python main.py ask --repo path/to/repo --query "what is this project?" --top-k 10
# Run complete analysis pipeline python main.py pipeline --repo path/to/repo --output analysis.json
# Start interactive Q&A session python main.py interactive --repo path/to/repo
from orchestrator.langgraph_flow import run_langgraph_pipeline from agents.qa_agent import QAAgent # Run complete pipeline result = run_langgraph_pipeline("path/to/repo") # Use QA agent qa = QAAgent() answer = qa.answer("How to use this project?", top_k=5) print(answer)
graph TB subgraph User["User Interface Layer"] CLI["CLI Interface"] Web["Web UI<br/>Streamlit"] API["REST API"] end subgraph Orchestration["Orchestration Layer"] LG["LangGraph<br/>Pipeline"] end subgraph Agents["Agent Layer - 7 Specialized Agents"] RA["๐ Repository<br/>Analyzer"] EA["๐ข Embedding<br/>Agent"] MR["๐ท๏ธ Metadata<br/>Recommender"] CI["โจ Content<br/>Improver"] RV["โ Reviewer<br/>Agent"] QA["โ QA<br/>Agent"] AG["๐ Article<br/>Generator"] end subgraph Tools["Tools Layer - 5 Custom Tools"] FL["๐ File<br/>Loader"] TS["โ๏ธ Text<br/>Splitter"] CA["๐ Code<br/>Analyzer"] WS["๐ Web<br/>Search"] VS["๐ฆ Vector<br/>Store"] end subgraph External["External Services"] COHERE["๐ค Cohere<br/>LLM API"] JINA["๐ง Jina<br/>Embeddings"] QDRANT["๐๏ธ Qdrant<br/>Vector DB"] end CLI --> LG Web --> LG API --> LG LG --> RA LG --> EA LG --> MR LG --> CI LG --> RV LG --> QA LG --> AG RA --> FL RA --> CA EA --> TS EA --> VS CI --> COHERE MR --> COHERE RV --> COHERE QA --> COHERE VS --> JINA VS --> QDRANT style User fill:#0277BD,stroke:#01579B,color:#fff style Orchestration fill:#5E35B1,stroke:#311B92,color:#fff style Agents fill:#00796B,stroke:#004D40,color:#fff style Tools fill:#F57C00,stroke:#E65100,color:#fff style External fill:#C62828,stroke:#B71C1C,color:#fff
graph LR A["๐ Repository<br/>Input"] -->|Load & Parse| B["๐ Analyze<br/>Structure"] B -->|Extract| C["๐ Parse<br/>Content"] C -->|Split| D["โ๏ธ Chunk Text<br/>800 tokens"] D -->|Embed| E["๐ง Generate<br/>Vectors"] E -->|Store| F["๐๏ธ Qdrant<br/>Database"] F -->|Recommend| G["๐ท๏ธ Metadata<br/>0.5s"] F -->|Analyze| H["โจ Content<br/>1.2s"] F -->|Review| I["โ Completeness<br/>0.4s"] G --> J["๐ Analysis<br/>Report"] H --> J I --> J style A fill:#0277BD,stroke:#01579B,color:#fff style B fill:#00796B,stroke:#004D40,color:#fff style C fill:#F57C00,stroke:#E65100,color:#fff style D fill:#FBC02D,stroke:#F9A825,color:#000 style E fill:#5E35B1,stroke:#311B92,color:#fff style F fill:#C62828,stroke:#B71C1C,color:#fff style G fill:#0097A7,stroke:#006064,color:#fff style H fill:#6A1B9A,stroke:#4A148C,color:#fff style I fill:#00897B,stroke:#004D40,color:#fff style J fill:#D84315,stroke:#BF360C,color:#fff
graph LR Start([๐ข Start]) --> S1["1๏ธโฃ Analyze<br/>Repository<br/>2.3s"] S1 --> S2["2๏ธโฃ Extract<br/>Metadata<br/>0.6s"] S2 --> S3["3๏ธโฃ Generate<br/>Embeddings<br/>0.8s"] S3 --> S4["4๏ธโฃ Recommend<br/>Metadata<br/>0.5s"] S4 --> S5["5๏ธโฃ Improve<br/>Content<br/>1.2s"] S5 --> S6["6๏ธโฃ Review &<br/>Validate<br/>0.4s"] S6 --> S7["7๏ธโฃ Generate<br/>Report"] S7 --> End([๐ด Complete]) style Start fill:#2E7D32,stroke:#1B5E20,color:#fff style End fill:#C62828,stroke:#B71C1C,color:#fff style S1 fill:#0277BD,stroke:#01579B,color:#fff style S2 fill:#0277BD,stroke:#01579B,color:#fff style S3 fill:#5E35B1,stroke:#311B92,color:#fff style S4 fill:#FBC02D,stroke:#F9A825,color:#000 style S5 fill:#FBC02D,stroke:#F9A825,color:#000 style S6 fill:#F57C00,stroke:#E65100,color:#fff style S7 fill:#D84315,stroke:#BF360C,color:#fff
graph TB subgraph Input["INPUT"] Repo["Repository<br/>Source Code<br/>Documentation"] end subgraph Analysis["ANALYSIS PHASE"] RA["๐ Repository Analyzer<br/>โโโโโโโ<br/>Extract files<br/>Detect type<br/>Find gaps"] end subgraph Semantic["SEMANTIC PHASE"] EA["๐ข Embedding Agent<br/>โโโโโโโ<br/>Generate vectors<br/>Store in DB<br/>Enable search"] end subgraph Enhancement["ENHANCEMENT PHASE"] MR["๐ท๏ธ Metadata Recommender<br/>โโโโโโโ<br/>Suggest titles<br/>Generate tags<br/>Create summary"] CI["โจ Content Improver<br/>โโโโโโโ<br/>Improve README<br/>Add examples<br/>Score quality"] end subgraph Validation["VALIDATION PHASE"] RV["โ Reviewer Agent<br/>โโโโโโโ<br/>Check completeness<br/>Identify issues<br/>Calculate score"] end subgraph Interaction["INTERACTION PHASE"] QA["โ QA Agent<br/>โโโโโโโ<br/>Answer queries<br/>Search vectors<br/>Generate response"] end subgraph Output["OUTPUT"] JSON["๐ Analysis Results<br/>Metadata<br/>Recommendations"] end Repo --> Analysis Analysis --> Semantic Semantic --> Enhancement Enhancement --> Validation Validation --> Interaction Interaction --> Output style Repo fill:#0277BD,stroke:#01579B,color:#fff style RA fill:#00796B,stroke:#004D40,color:#fff style EA fill:#5E35B1,stroke:#311B92,color:#fff style MR fill:#F57C00,stroke:#E65100,color:#fff style CI fill:#D84315,stroke:#BF360C,color:#fff style RV fill:#6A1B9A,stroke:#4A148C,color:#fff style QA fill:#0097A7,stroke:#006064,color:#fff style JSON fill:#C62828,stroke:#B71C1C,color:#fff
Role: Initial assessment and structure extraction
Responsibilities:
Output: Structured repository metadata and analysis
Role: Semantic indexing and retrieval
Responsibilities:
Output: Indexed vectors in Qdrant, search results for queries
Role: Project metadata suggestion
Responsibilities:
Output: Metadata suggestions with confidence scores
Role: Documentation enhancement
Responsibilities:
Output: Improved README sections, suggestions for enhancement
Role: Quality assurance and validation
Responsibilities:
Output: Issues, recommendations, and priority action items
Role: Interactive question answering
Responsibilities:
Output: Contextual answers with supporting evidence
Role: Publication-ready content creation
Responsibilities:
Output: Publication-ready markdown articles
| Operation | Mean Time | Std Dev | P95 |
|---|---|---|---|
| Repository Analysis | 2.3s | 0.4s | 3.1s |
| Embedding Generation | 0.8s per 100 chunks | 0.15s | 1.2s |
| Metadata Recommendation | 0.5s | 0.1s | 0.7s |
| Content Analysis | 1.2s | 0.2s | 1.6s |
| Vector Search (10 results) | 0.15s | 0.03s | 0.2s |
graph LR A["โฑ๏ธ Processing Speed"] --> B["Repository<br/>Analysis<br/>2.3s"] A --> C["Embedding<br/>Generation<br/>0.8s"] A --> D["Metadata<br/>Recommend<br/>0.5s"] A --> E["Content<br/>Analysis<br/>1.2s"] A --> F["Vector<br/>Search<br/>0.15s"] A --> G["Review<br/>Analysis<br/>0.4s"] H["๐ Quality Metrics"] --> I["README<br/>Accuracy<br/>92%"] H --> J["Missing<br/>Detection<br/>95%"] H --> K["Project<br/>Classification<br/>89%"] H --> L["Pattern<br/>Detection<br/>84%"] style A fill:#0277BD,stroke:#01579B,color:#fff style H fill:#F57C00,stroke:#E65100,color:#fff style B fill:#00796B,stroke:#004D40,color:#fff style C fill:#5E35B1,stroke:#311B92,color:#fff style D fill:#FBC02D,stroke:#F9A825,color:#000 style E fill:#D84315,stroke:#BF360C,color:#fff style F fill:#6A1B9A,stroke:#4A148C,color:#fff style G fill:#2E7D32,stroke:#1B5E20,color:#fff style I fill:#00897B,stroke:#004D40,color:#fff style J fill:#0097A7,stroke:#006064,color:#fff style K fill:#00796B,stroke:#004D40,color:#fff style L fill:#00695C,stroke:#004D40,color:#fff
Run performance benchmarks:
# Generate performance report python tools/benchmark_performance.py # Profile specific agent python -m cProfile -s cumulative main.py analyze --repo data/sample_repo
multiagent-repo-assistant/
โโโ agents/ # 7 specialized agents
โ โโโ repo_analyzer.py # Repository structure analysis
โ โโโ embedding_agent.py # Semantic embeddings & retrieval
โ โโโ metadata_recommender.py # Metadata suggestions
โ โโโ content_improver.py # README enhancement
โ โโโ reviewer.py # Content validation & scoring
โ โโโ qa_agent.py # Question answering
โ โโโ article_generator.py # Publication content
โ โโโ __init__.py
โโโ tools/ # 5 utility tools
โ โโโ file_loader.py # File extraction & processing
โ โโโ text_splitter.py # Text chunking (800 tokens, 100 overlap)
โ โโโ code_analyzer.py # Code structure analysis
โ โโโ web_search.py # Web search integration
โ โโโ test_llm_embeddings.py # LLM testing
โ โโโ test_qdrant.py # Database testing
โ โโโ benchmark_performance.py # Performance metrics
โโโ orchestrator/ # Workflow orchestration
โ โโโ langgraph_flow.py # LangGraph pipeline
โ โโโ simple_pipeline.py # Alternative pipeline
โโโ config/ # Configuration
โ โโโ config.py # Service initialization
โโโ data/ # Sample data
โ โโโ sample_repo/ # Test repository
โโโ main.py # CLI entry point
โโโ app.py # Flask/API server (optional)
โโโ requirements.txt # Python dependencies
โโโ .env.example # Environment template
โโโ docker-compose.yml # Docker services
โโโ Dockerfile # Container definition
โโโ LICENSE # MIT License
โโโ README.md # This file
qdrant-client - Vector database clientcohere - LLM SDKrequests - HTTP client for API callspython-dotenv - Environment variable managementstreamlit - Web interface (optional)sentence-transformers - Local embedding fallback# Test LLM and embeddings python tools/test_llm_embeddings.py # Test Qdrant integration python tools/test_qdrant.py # Full pipeline test python main.py analyze --repo data/sample_repo --output test_results.json
{ "title_alternatives": ["Repo Assistant", "Multi-Agent Analyzer", "Smart Repo Analysis"], "one_line_summary": "Intelligent multi-agent system for repository analysis", "tags": ["python", "multi-agent", "langchain", "ai", "semantic-search"], "project_type": "Python Library", "reasoning": { "detected_type": "Python Library", "languages": [".py", ".md", ".txt"], "main_dependencies": ["langchain-core", "qdrant-client", "cohere"] } }
{ "issues": [ "โ No LICENSE file - add to clarify usage rights", "โ ๏ธ Add badges (build status, coverage, downloads) for credibility" ], "recommendations": [ "๐ก Add CI/CD pipeline (GitHub Actions, GitLab CI)", "๐ก Add CHANGELOG to track version history" ], "priority_fixes": ["Add LICENSE file", "Create CONTRIBUTING.md", "Add examples"], "overall_health": 78 }
.env, never commit to repositorypython-dotenv for configurationQDRANT_URL # Qdrant Cloud instance URL QDRANT_API_KEY # Qdrant authentication key QDRANT_COLLECTION # Collection name (default: repo_chunks) EMBEDDING_DIM # Vector dimension (default: 1024) COHERE_API_KEY # Cohere API key JINA_API_KEY # Jina AI API key JINA_EMBEDDING_MODEL # Model name (default: jina-embeddings-v3)
tools/text_splitter.pyagents/qa_agent.pyagents/content_improver.pyagents/repo_analyzer.pydocker build -t multiagent-repo-assistant . docker run -e COHERE_API_KEY=xxx -e QDRANT_URL=xxx multiagent-repo-assistant
docker-compose up -d # Services: Qdrant database + Application
FastAPI-based REST API can be deployed for:
The system includes interactive Mermaid diagrams that render automatically on GitHub. The diagrams illustrate:
See DIAGRAMS.md for:
Using Mermaid.live (Easiest):
Using Draw.io (Most Flexible):
Using Canva (Most Polished):
This project demonstrates advanced multi-agent concepts. Areas for enhancement:
MIT License - See LICENSE file for details
Built with: