{"id":35887417,"url":"https://github.com/The-Swarm-Corporation/Multi-Agent-RAG-Template","last_synced_at":"2026-01-15T06:00:44.358Z","repository":{"id":262326764,"uuid":"886887021","full_name":"The-Swarm-Corporation/Multi-Agent-RAG-Template","owner":"The-Swarm-Corporation","description":"This template demonstrates how to create a collaborative team of AI agents that work together to process, analyze, and generate insights from documents.","archived":false,"fork":false,"pushed_at":"2025-01-13T21:43:05.000Z","size":52,"stargazers_count":41,"open_issues_count":2,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-21T23:42:06.554Z","etag":null,"topics":["agents","ai","anthropic","autogen","chromadb","crewai","discord","gpt-5","gpt35","gpt4","langchain","multi-agent","openai","pinecone","rag","swarms","weaviate"],"latest_commit_sha":null,"homepage":"https://swarms.xyz/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/The-Swarm-Corporation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["kyegomez"]}},"created_at":"2024-11-11T19:34:21.000Z","updated_at":"2025-09-16T15:05:17.000Z","dependencies_parsed_at":"2025-01-13T20:33:52.804Z","dependency_job_id":"9acf5291-0107-4780-aa42-fcd12523b2a3","html_url":"https://github.com/The-Swarm-Corporation/Multi-Agent-RAG-Template","commit_stats":null,"previous_names":["the-swarm-corporation/multi-agent-rag-template"],"tags_count":0,"template":false,"template_full_name":"The-Swarm-Corporation/Swarms-Example-1-Click-Template","purl":"pkg:github/The-Swarm-Corporation/Multi-Agent-RAG-Template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/The-Swarm-Corporation%2FMulti-Agent-RAG-Template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/The-Swarm-Corporation%2FMulti-Agent-RAG-Template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/The-Swarm-Corporation%2FMulti-Agent-RAG-Template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/The-Swarm-Corporation%2FMulti-Agent-RAG-Template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/The-Swarm-Corporation","download_url":"https://codeload.github.com/The-Swarm-Corporation/Multi-Agent-RAG-Template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/The-Swarm-Corporation%2FMulti-Agent-RAG-Template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28444124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T05:05:00.929Z","status":"ssl_error","status_checked_at":"2026-01-15T05:04:58.515Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agents","ai","anthropic","autogen","chromadb","crewai","discord","gpt-5","gpt35","gpt4","langchain","multi-agent","openai","pinecone","rag","swarms","weaviate"],"created_at":"2026-01-08T22:00:39.537Z","updated_at":"2026-01-15T06:00:44.346Z","avatar_url":"https://github.com/The-Swarm-Corporation.png","language":"Python","funding_links":["https://github.com/sponsors/kyegomez"],"categories":["Agent Categories"],"sub_categories":["\u003ca name=\"Unclassified\"\u003e\u003c/a\u003eUnclassified"],"readme":"\n# Multi-Agent-RAG-Template\n\n[![Join our Discord](https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge\u0026logo=discord\u0026logoColor=white)](https://discord.gg/agora-999382051935506503) [![Subscribe on YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge\u0026logo=youtube\u0026logoColor=white)](https://www.youtube.com/@kyegomez3242) [![Connect on LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white)](https://www.linkedin.com/in/kye-g-38759a207/) [![Follow on X.com](https://img.shields.io/badge/X.com-Follow-1DA1F2?style=for-the-badge\u0026logo=x\u0026logoColor=white)](https://x.com/kyegomezb)\n\n\n[![GitHub stars](https://img.shields.io/github/stars/The-Swarm-Corporation/Legal-Swarm-Template?style=social)](https://github.com/The-Swarm-Corporation/Legal-Swarm-Template)\n[![Swarms Framework](https://img.shields.io/badge/Built%20with-Swarms-blue)](https://github.com/kyegomez/swarms)\n\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)\n[![Swarms Framework](https://img.shields.io/badge/Built%20with-Swarms-orange)](https://swarms.xyz)\n\nA production-ready template for building Multi-Agent RAG (Retrieval-Augmented Generation) systems using the Swarms Framework. This template demonstrates how to create a collaborative team of AI agents that work together to process, analyze, and generate insights from documents.\n\n\n## 🌟 Features\n\n- **Plug-and-Play Agent Architecture**\n  - Easily swap or modify agents without disrupting the system\n  - Add custom agents with specialized capabilities\n  - Define your own agent interaction patterns\n  - Scale from 2 to 100+ agents seamlessly\n  - Any LLM can be used, this template uses GROQ but you can use any other LLM such as OpenAI, Anthropic, Cohere, etc.\n\n- **Adaptable Document Processing**\n  - Support for any document format through custom extractors\n  - Flexible document storage options (local, cloud, or hybrid)\n  - Customizable chunking and embedding strategies\n  - Dynamic index updates without system restart\n  - Any RAG system can be used, this template uses LlamaIndexDB but you can use any other RAG system.\n\n- **Configurable Workflows**\n  - Design custom agent communication patterns\n  - Implement parallel or sequential processing\n  - Add conditional logic and branching workflows\n  - Adjust system behavior through environment variables\n\n\n## 🚀 Quick Start\n\n1. **Clone the Repository**\n```bash\ngit clone https://github.com/The-Swarm-Corporation/Multi-Agent-RAG-Template.git\ncd Multi-Agent-RAG-Template\n```\n\n2. **Set Up Environment**\n```bash\n# Create and activate virtual environment (optional but recommended)\npython -m venv venv\nsource venv/bin/activate  # On Windows: .\\venv\\Scripts\\activate\n\n# Install dependencies\npip install -r requirements.txt\n```\n\n3. **Configure Environment Variables**\n```bash\n# Create .env file\n\n# Edit .env file with your credentials\nGROQ_API_KEY=\"your-api-key-here\"\nWORKSPACE_DIR=\"agent_workspace\"\nOPENAI_API_KEY=\"your-openai-api-key-here\"\n```\n\n4. **Run the Example**\n```bash\npython main.py\n```\n\n## 🏗️ Project Structure\n\n```\nMulti-Agent-RAG-Template/\n├── main.py                    # Main entry point\n├── multi_agent_rag/\n│   ├── agents.py             # Agent definitions\n│   └── memory.py             # RAG implementation\n├── docs/                      # Place your documents here\n├── requirements.txt           # Project dependencies\n└── .env                      # Environment variables\n```\n\n## 🔧 Customization\n\n### Adding New Agents\n\n1. Open `multi_agent_rag/agents.py`\n2. Create a new agent using the Agent class:\n\n```python\nnew_agent = Agent(\n    agent_name=\"New-Agent\",\n    system_prompt=\"Your system prompt here\",\n    llm=model,\n    max_loops=1,\n    # ... additional configuration\n)\n```\n\n### Modifying the Agent Flow\n\nIn `main.py`, update the `flow` parameter in the `AgentRearrange` initialization:\n\n```python\nflow=f\"{agent1.agent_name} -\u003e {agent2.agent_name} -\u003e {new_agent.agent_name}\"\n```\n\n## Integrating RAG\n\n- The `memory_system` parameter in the `AgentRearrange` initialization is used to configure the RAG system.\n- The `memory_system` parameter is an instance of `LlamaIndexDB`, which is a database class for storing and retrieving medical documents.\n- The `memory_system` class must have a `query(query: str)` method that returns a string for the agent to use it.\n\n```python\n\n# Import the AgentRearrange class for coordinating multiple agents\nfrom swarms import AgentRearrange\n\nfrom multi_agent_rag.agents import (\n    diagnostic_specialist,\n    medical_data_extractor,\n    patient_care_coordinator,\n    specialist_consultant,\n    treatment_planner,\n)\n\nfrom multi_agent_rag.memory import LlamaIndexDB\n\nrouter = AgentRearrange(\n    name=\"medical-diagnosis-treatment-swarm\",\n    description=\"Collaborative medical team for comprehensive patient diagnosis and treatment planning\",\n    max_loops=1,\n    agents=[\n        medical_data_extractor,\n        diagnostic_specialist,\n        treatment_planner,\n        specialist_consultant,\n        patient_care_coordinator,\n    ],\n    memory_system=LlamaIndexDB(\n        data_dir=\"docs\",\n        filename_as_id=True,\n        recursive=True,\n        similarity_top_k=10,\n    ),\n    flow=f\"{medical_data_extractor.agent_name} -\u003e {diagnostic_specialist.agent_name} -\u003e {treatment_planner.agent_name} -\u003e {specialist_consultant.agent_name} -\u003e {patient_care_coordinator.agent_name}\",\n)\n\nif __name__ == \"__main__\":\n    router.run(\n        \"Analyze this Lucas Brown's medical data to provide a diagnosis and treatment plan\"\n    )\n\n```\n\n\n## Pinecone Example\n\nHere is an example of how to use Pinecone as the RAG system.\n\n- Make sure you have a Pinecone index created and the `PINECONE_API_KEY`, `PINECONE_INDEX_NAME`, and `PINECONE_ENVIRONMENT` environment variables set.\n- See the `pinecone_swarm.py` file for the full example.\n- The `PineconeManager` class is used to interface with the Pinecone API.\n\n```python\nimport os\nfrom swarms import AgentRearrange\nfrom multi_agent_rag.agents import (\n    diagnostic_specialist,\n    medical_data_extractor,\n    patient_care_coordinator,\n    specialist_consultant,\n    treatment_planner,\n)\nfrom multi_agent_rag.pinecone_wrapper import PineconeManager\n\nrouter = AgentRearrange(\n    name=\"medical-diagnosis-treatment-swarm\",\n    description=\"Collaborative medical team for comprehensive patient diagnosis and treatment planning\",\n    max_loops=1,\n    agents=[\n        medical_data_extractor,\n        diagnostic_specialist,\n        treatment_planner,\n        specialist_consultant,\n        patient_care_coordinator,\n    ],\n    memory_system=PineconeManager(\n        api_key=os.getenv(\"PINECONE_API_KEY\"),\n        index_name=os.getenv(\"PINECONE_INDEX_NAME\"),\n        environment=os.getenv(\"PINECONE_ENVIRONMENT\"),\n    ),\n    flow=f\"{medical_data_extractor.agent_name} -\u003e {diagnostic_specialist.agent_name} -\u003e {treatment_planner.agent_name} -\u003e {specialist_consultant.agent_name} -\u003e {patient_care_coordinator.agent_name}\",\n)\n\nif __name__ == \"__main__\":\n    router.run(\n        \"Analyze this Lucas Brown's medical data to provide a diagnosis and treatment plan\"\n    )\n\n\n```\n\n\n## 📚 Documentation\n\nFor detailed documentation on:\n- [Swarms Framework](https://swarms.xyz)\n- [LlamaIndex](https://docs.llamaindex.ai)\n- [GROQ](https://groq.com)\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\ng\n\n## 🛠 Built With\n\n- [Swarms Framework](https://github.com/kyegomez/swarms)\n- Python 3.10+\n- GROQ API Key or you can change it to use any model from [Swarm Models](https://github.com/The-Swarm-Corporation/swarm-models)\n- LlamaIndexDB for storing and retrieving medical documents\n\n## 📬 Contact\n\nQuestions? Reach out:\n- Twitter: [@kyegomez](https://twitter.com/kyegomez)\n- Email: kye@swarms.world\n\n---\n\n## Want Real-Time Assistance?\n\n[Book a call with here for real-time assistance:](https://cal.com/swarms/swarms-onboarding-session)\n\n---\n\n⭐ Star us on GitHub if this project helped you!\n\nBuilt with ♥ using [Swarms Framework](https://github.com/kyegomez/swarms)\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FThe-Swarm-Corporation%2FMulti-Agent-RAG-Template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FThe-Swarm-Corporation%2FMulti-Agent-RAG-Template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FThe-Swarm-Corporation%2FMulti-Agent-RAG-Template/lists"}