CoolFace
Apppublic

Agents-MCP-Hackathon/Novus-Synapse

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
1likes
App README
  • ## Novus Synapse: AI Research Companion An enterprise-grade platform for AI-assisted research and ideation, powered by a multi-agent simulation framework.
  • # 🚀 Project Overview Novus Synapse transforms the traditional research workflow into a dynamic, interactive, and AI-accelerated process. It establishes a Collaborative Research Arena where diverse AI agents, each embodying a unique analytical persona, interact to generate, critique, and refine complex ideas. By leveraging state-of-the-art LLMs and advanced reasoning techniques, Novus Synapse facilitates rapid ideation, robust adversarial validation, and transparent insight generation. It's designed for enterprise readiness, emphasizing high-performance compute, secure operations, and a highly aesthetic user experience.

tag: "mcp-server-track"

tag: "custom-component-track"

tag: "agent-demo-track"

  • # ✨ Key Features & Functionalities Novus Synapse integrates several innovative components to create a seamless research ecosystem:

Collaborative Research Arena: Initiate and manage multi-agent simulations where specialized AI personas (e.g., Proposer, Critic, Hazard Simulator, Epistemology Tutor) interact to explore research questions, generate hypotheses, and refine concepts through iterative "turns."

Living Canvas (Interactive Research Graph): A custom-built Gradio component featuring a D3.js force-directed graph that visualizes the entire research progression. Each node represents an agent's contribution, allowing users to intuitively trace the evolution of ideas and identify key decision points.

Advanced Knowledge Ingestion: Seamlessly integrate external knowledge into your research.

ArXiv Integration: Automatically fetch and process relevant academic papers from ArXiv to seed your knowledge base.

Multi-Format File Uploads: Ingest diverse document types including PDFs, text files, and images. Our system can extract structured information from PDFs and use multi-modal LLMs to describe image content for inclusion in the knowledge base.

Automated Peer Review & Reporting: Generate comprehensive PDF reports summarizing the entire research arena's transcript, including score evolution graphs. Additionally, a dedicated AI Peer Reviewer agent can critique these reports for clarity, consistency, and impact, providing automated feedback.

Hypothetical Branching: Intervene at any point in the simulation to explore "what-if" scenarios, allowing for flexible steering of the AI's reasoning process and comparative analysis of different research paths.

Adversarial Rigor: Employ a dedicated Cognitive Hazard Simulator agent that actively attempts to identify logical fallacies, biases, and potential ethical pitfalls in proposals, enhancing the robustness and safety of generated insights.

Epistemological Insight: Leverage a Scientific Epistemology Tutor agent that analyzes the underlying reasoning of propositions, ensuring scientific rigor and logical coherence.

In-memory State Management: For rapid prototyping and deployment on platforms like Hugging Face Spaces, current arena states and knowledge bases are managed in-memory, providing a responsive user experience.

  • # 🛠️ Core Technologies Novus Synapse is built on a robust and modern tech stack:

Python: The primary programming language for all backend logic, agent orchestration, and Gradio application development.

Gradio (v5.33.0): Used for building the elegant and interactive web-based user interface, including advanced custom components.

LangChain (Core & OpenAI): Powers the conversational chains and agentic orchestration, providing flexible interfaces for interacting with various LLMs.

LLM Models: Integrates state-of-the-art models via the Nebius AI platform (Yandex Cloud) including:

google/gemma-3-27b-it: For general reasoning and proposal generation.

Qwen/Qwen2.5-VL-72B-Instruct: Leveraged for multi-modal capabilities like image understanding.

Other models like DeepSeek-R1, Llama-3.3-70B-Instruct for diverse agent behaviors.

Sentence Transformers: Utilized for generating high-quality semantic embeddings from text content.

FAISS (Facebook AI Similarity Search - CPU version): Provides efficient and scalable vector search capabilities for the knowledge base (RAG).

PyMuPDF & Pillow: For robust file processing, enabling text extraction from PDFs and image manipulation.

D3.js (v7): The JavaScript library powering the interactive "Living Canvas" graph visualization on the frontend, enabling dynamic data representation.

Matplotlib: Used for generating data visualizations, such as the score evolution graphs in PDF reports.

pdfkit (wkhtmltopdf): Facilitates the generation of rich, structured PDF reports from HTML content.

ArXiv API: For programmatic access and ingestion of academic papers.

  • # Project Images image/png image/png image/png image/png image/png image/png image/png
  • # Novus Synapse makes significant contributions across all three hackathon tracks by leveraging a sophisticated architecture that integrates high-performance AI, advanced user experience, and robust system design.
  • # 🔧 Track 1: MCP Tool / Server ("Adversarial Rigor as a Service") Novus Synapse embodies a powerful Multi-Compute-Process (MCP) Server through its deep integration with https://www.google.com/search?q=Modal.com. The entire backend logic, including the multi-agent simulations and knowledge base operations, is designed to run as distributed, high-performance functions on Modal's infrastructure. Distributed Architecture: The project's core functionality (runmatssimulation, evaluateproposalconcurrently, createkbfromarxivmodal, createkbfromuploadedfilesmodal, exportreportmodal, reviewreportmodal) are all decorated with @stub.function or @stub.cls, signifying them as independent, scalable Modal functions. This allows for parallel execution across dedicated GPUs (L40SGPUSTR, T4GPUSTR) and managed container concurrency, directly fulfilling the "high-performance compute" requirement. Stateful Service: The use of modal.Dict (e.g., arenastates, knowledgebases, auditlogs, userfeedbackdb) provides a shared, persistent state across ephemeral function calls. This enables the "Dynamic Research Arena" to be a continuous, stateful environment, rather than a series of disconnected requests. Adversarial Rigor as a Service: The inclusion of the CognitiveHazardSimulator and ScientificEpistemologyTutor agents, running as integral parts of the distributed simulation, directly implements the "Adversarial Rigor as a Service" concept. These agents actively challenge proposals within the distributed environment, making the output more robust. Automated Deployment: The deployartifactmodal function demonstrates the capability to programmatically deploy a self-contained application (an "artifact" of the simulation) using Modal's CLI via subprocess.run(). While the user experience of calling this from a notebook might be external to the Gradio UI itself, the underlying mechanism showcases the server's ability to orchestrate complex deployments.
  • # 🧩 Track 2: Custom Components for Agents ("Living Canvas of Thought") The "Living Canvas" is the standout custom component, transforming abstract research logs into an intuitive, interactive visual narrative. Interactive Graph Visualization: The LIVINGCANVASHTML string, embedded directly within the Gradio interface and the deployed artifacts, defines a custom HTML component powered by D3.js. This JavaScript code (renderLivingCanvas function) dynamically draws a force-directed graph. This is not just a static image; it's a fully interactive component supporting pan, zoom, and node dragging, providing a "Living Canvas of Thought." Data-Driven Transparency: The Python function formattranscriptforgraphui (and its counterpart formattranscriptforgraphartifact) meticulously processes the raw transcript data into a structured nodes and links format, enriching each node with details (full entry data including agent, action, content snippet, score, and model used). This data is then passed to the D3.js frontend via a hidden gr.JSON component and a demo.load JavaScript call, enabling the rich tooltips on hover. Intuitive Exploration: Users can click on rows in the transcript DataFrame to view the selectedentrycontentdisplay with full details of a specific turn, demonstrating how the custom component enhances understanding and allows users to delve into specific moments of the AI's "thought process." Hypothetical Branching Support: The resumeturn_dropdown functionality directly enables "Hypothetical Branching." By allowing users to select any previous turn to restart the simulation from, the system facilitates "what-if" scenarios, directly interacting with the graph's historical data to create new analytical paths.
  • # 🤖 Track 3: Agentic Demo Showcase (Full Novus Synapse Application) Novus Synapse presents a complete, end-to-end AI-assisted research workflow within a single, seamless Gradio application, demonstrating a full "AI-assisted discovery lifecycle." Comprehensive Workflow: The Gradio interface (creategradiointerface) orchestrates the entire research journey: Multi-Modal Ingestion: Users can drag-and-drop diverse files (PDFs, text, images) using gr.File. The backend functions (createkbfromuploadedfilesmodal and FileProcessor.describeimagewithllm) handle automatic text extraction and AI-powered image description, demonstrating intelligent data fusion. Dynamic Research Arena: The "Start New Simulation" button triggers runmatssimulation, which in turn orchestrates a dynamic debate among heterogeneous AI agents (ProposerAgent, ReflectiveCriticAgent, CognitiveHazardSimulator, ScientificEpistemologyTutor) powered by various LLM models (Config.MODELREGISTRY). This showcases a complex, iterative reasoning process. Live Visualization & Interaction: The "Living Canvas" (as detailed in Track 2) provides real-time visualization of this debate. Users can interact with the graph and provide feedback via the "Quality Score" and "Ethical/Safety Concern" inputs, influencing future AI iterations. Automated Reporting: With a single click on "Generate & Download PDF Report" (exportreportmodal), the system compiles the entire simulation transcript, including performance graphs, into a professional PDF document. AI Peer Review: The "Automated Peer Review of Report" feature allows users to upload a generated PDF, which is then analyzed by the PeerReviewerAgent (reviewreport_modal). This agent provides critical feedback on the report's quality, completeness, and impact, showcasing an unprecedented level of AI-driven meta-analysis. Intellectual Depth: The ScientificEpistemologyTutor agent provides meta-commentary on the epistemological underpinnings of research claims, demonstrating the project's commitment to intellectual rigor beyond mere content generation. Seamless User Experience: The entire application is presented through an elegant and intuitive Gradio interface, designed for clarity and ease of use, making complex multi-agent interactions accessible to researchers. This delivers on the promise of a "seamless lifecycle" and a compelling "before and after" narrative for AI-assisted research.
  • # 🔬 Underlying Research Concepts The architecture and functionalities of Novus Synapse are inspired by cutting-edge research in AI and cognitive science:

Multi-Agent Systems (MAS): The core design principle, where specialized agents collaborate and compete, drawing from concepts in distributed AI and swarm intelligence.

Multi-Agent Tree Search (MATS): Forms the backbone of the iterative reasoning engine, allowing agents to explore and prune "branches" of hypotheses.

Retrieval-Augmented Generation (RAG): The integration of FAISS with LLMs enables agents to retrieve relevant information from custom knowledge bases, enhancing the factual grounding and reducing hallucinations.

Multi-modal AI: The ability to process and fuse information from diverse data types (text, images) reflects advancements in multi-modal learning.

Adversarial Networks & Red Teaming: The Cognitive Hazard Simulator is a direct application of adversarial AI principles, aiming to stress-test ideas and identify vulnerabilities.

Explainable AI (XAI) & Transparency: The "Living Canvas" aims to provide transparency into the agents' reasoning processes, moving beyond opaque black-box models.

Episodic Memory: The agents' ability to remember recent interactions and integrate them into current context (getcontextfor_agents) draws from concepts of episodic memory in cognitive architectures.

Value Alignment through Reinforcement via Preferences (RVP): The user feedback mechanism hints at principles of human-in-the-loop learning and alignment research.

  • # 💡 Future Innovative Scopes Novus Synapse is designed with extensibility in mind, opening avenues for significant future development towards an enterprise-ready application:

Robust Persistent Storage: Implement persistent backend databases (e.g., Firestore, PostgreSQL, or dedicated vector databases like Qdrant/Weaviate) to ensure arena states, knowledge bases, and audit logs are durable and accessible across sessions and deployments, providing true enterprise-grade data management.

Enhanced Scalability & Distribution: Further optimize for horizontal scaling using technologies like Kubernetes or deeper integration with cloud-native serverless functions to handle high-throughput, concurrent multi-agent simulations.

Advanced Multi-Modal Fusion: Incorporate video and audio analysis capabilities (e.g., using FFMPEG, Speech-to-Text models, Bark/ElevenLabs for voice/avatars), enabling more comprehensive multi-modal content ingestion and reasoning.

Sophisticated Governance & Explainability: Fully implement dynamic ethicist thresholds, a safety mode visualizer, and an interactive ethical audit score, providing adaptive and transparent safety features critical for responsible AI deployment in enterprises. This includes evolving the "Agent Replay Theater" with animated avatars and synthesized voice commentary for enhanced user understanding.

Programmable Workflows & Plugins: Develop a more sophisticated plugin architecture, allowing users to define custom agent behaviors, integrate proprietary tools, and design complex research workflows through a flexible API or visual builder.

Real-time Collaboration Features: Implement multi-user support with real-time updates, presence indicators, and collaborative editing of research arenas, enabling true team-based AI-assisted discovery.

Advanced Analytics & Reporting: Integrate business intelligence tools for deeper analysis of simulation trends, agent performance metrics, and research impact over time.

Integration with Enterprise Systems: Develop connectors for existing enterprise knowledge management systems, CRMs, ERPs, and internal data lakes to streamline data flow and contextualize AI-generated insights within business operations.

Security Hardening: Implement role-based access control (RBAC), end-to-end encryption, and comprehensive audit trails with immutable logging for stringent enterprise security compliance.

  • # 🚀 Getting Started (Hugging Face Spaces) To deploy your own instance of Novus Synapse on Hugging Face Spaces:

Create a New Space:

Go to Hugging Face Spaces.

Choose a Space name (e.g., your-username/novus-synapse-ai-companion).

Select Gradio as the Space SDK.

Choose DockerFile as the Docker template. This is crucial for installing wkhtmltopdf.

Select appropriate Hardware (e.g., a GPU instance like A10G Large is highly recommended for optimal LLM performance).

Upload Files:

In your new Space, navigate to the "Files" tab.

Upload the following three files directly:

app.py (the entire code from this README)

requirements.txt (see below)

Dockerfile (see below)

Set Environment Variables (Secrets):

Go to the "Settings" tab of your Space.

Scroll down to "Repository secrets" and add the following:

NEBIUSAPIKEY: Your API key for Nebius AI (Yandex Cloud) models.

NEBIUSBASEURL: (Optional) The base URL for the Nebius API, defaults to https://llm.api.cloud.yandex.net/v1.

Monitor Build: Hugging Face Spaces will automatically detect your Dockerfile and app.py and begin building your application. You can monitor the build progress and logs in the "Logs" tab.

Access Your App: Once the build is successful and the Space is running, your Novus Synapse application will be live at your Space's public URL!

  • # requirements.txt Create a file named requirements.txt in the same directory as app.py:

modal==1.0.3 gradio==5.33.0 langchain-core==0.3.64 langchain-openai==0.3.21 pdfkit==1.0.0 jinja2==3.1.4 PyMuPDF==1.24.9 sentence-transformers==3.0.1 torch>=2.0.0 # Required by sentence-transformers numpy==1.26.4 faiss-cpu # Using CPU version for broader compatibility. For GPU, use 'faiss-gpu' and ensure CUDA is configured. arxiv==2.2.0 matplotlib==3.9.2 Pillow

  • # Dockerfile Create a file named Dockerfile in the same directory as app.py and requirements.txt:

FROM python:3.10-slim-bookworm

#Install system dependencies, including wkhtmltopdf and git RUN apt-get update && apt-get install -y \ wkhtmltopdf \ git \ build-essential \ software-properties-common \ #Clean up apt caches to reduce image size && rm -rf /var/lib/apt/lists/*

#Set environment variable to disable oneDNN if needed (as in original code) ENV TFENABLEONEDNN_OPTS=0

#Set environment variable for unbuffered Python output ENV PYTHONUNBUFFERED=1

#Copy requirements file and install Python dependencies COPY requirements.txt /app/requirements.txt WORKDIR /app RUN pip install --no-cache-dir -r requirements.txt

#Copy the application code COPY app.py /app/app.py

#Expose the Gradio port EXPOSE 7860

#Define the command to run your Gradio application CMD ["python", "app.py"]

  • # 🤝 Contributing We welcome contributions to Novus Synapse! If you have suggestions, bug reports, or want to contribute code, please refer to the project's repository (once established) for guidelines on how to get involved.
  • # 📄 License This project is licensed under the MIT License. See the LICENSE file (if applicable) for more details.