Research Agent with Gaia

May 6, 2025 ยท View on GitHub

Research Agent Demo

A sophisticated AI-powered research assistant built with Next.js and Gaia. This research agent helps you conduct thorough and structured research on any topic by leveraging Gaia's decentralized computing infrastructure.

About Gaia

Gaia is a decentralized computing infrastructure that enables everyone to create, deploy, scale, and monetize their own AI agents. This project uses Gaia's AI capabilities to provide an intelligent research agent that can analyze, synthesize, and present information in a structured manner.

Features

Core Research Capabilities

  • ๐Ÿค– Automated research planning and execution
  • ๐Ÿ“š Multi-step research process
  • ๐Ÿ” Intelligent search and analysis
  • ๐Ÿง  Information synthesis and summarization
  • ๐Ÿ”ฌ Deep research capabilities with "dig deeper" functionality

User Interface

  • ๐ŸŽจ Modern, responsive design with Tailwind CSS
  • ๐Ÿ“ฑ Interactive tabs for different research views
  • โœจ Smooth animations and transitions
  • ๐Ÿ“Š Real-time progress tracking
  • โ™ฟ Accessibility features (including reduced motion support)

Research Workflow

  1. Planning Phase: Creates a structured research plan
  2. Execution Phase: Carries out the research steps
  3. Evaluation Phase: Analyzes and processes findings
  4. Synthesis Phase: Summarizes research results
  5. Deep Research: Explores topics further with additional steps

Research Artifacts

  • ๐ŸŒ Web page analysis
  • ๐Ÿ“„ Academic paper processing
  • ๐Ÿ’ป GitHub repository analysis
  • ๐Ÿ”Ž Search result processing
  • ๐Ÿ“ Summary generation

Setting Up Your Gaia Node

To use your own Gaia node with this application, follow these steps:

Option 1: Run Your Own Node

  1. Install GaiaNet Node:

    curl -sSfL 'https://github.com/GaiaNet-AI/gaianet-node/releases/latest/download/install.sh' | bash
    
  2. Initialize with a Model:

    # For Llama-3-Groq-8B model (recommended for this project)
    gaianet init --config https://raw.githubusercontent.com/GaiaNet-AI/node-configs/main/llama-3-groq-8b-tool/config.json
    
  3. Start the Node:

    gaianet start
    
  4. Update Your Application:

    • Modify the API endpoint to point to your local node:
    const GAIA_API_ENDPOINT = 'URL';
    const GAIA_MODEL = 'Llama-3-Groq-8B-Tool';
    

Option 2: Get an API Key

  1. Create an Account:

  2. Generate an API Key:

    • Click on your profile dropdown and select Settings
    • Navigate to Gaia API Keys and click Create API Key
    • Give your key a name and save it securely
  3. Update Your Application:

    • Add your API key to the environment variables:
    GAIA_API_KEY=your_api_key_here
    

System Requirements

If running your own node, ensure your system meets these requirements:

SystemMinimum Requirements
OSX with Apple Silicon (M1-M4 chip)16GB RAM (32GB recommended)
Ubuntu Linux 20.04 with Nvidia CUDA 12 SDK8GB VRAM on GPU
Azure/AWSNvidia T4 GPU Instance

Tech Stack

  • Next.js 15.3.1
  • TypeScript
  • Tailwind CSS
  • Framer Motion
  • AI SDK Integration

Getting Started

Prerequisites

  • Node.js (Latest LTS version recommended)
  • pnpm (Package manager)

Installation

  1. Clone the repository:
git clone git@github.com:meowyx/research-agent.git
cd research-agent
  1. Install dependencies:
pnpm install
  1. Set up environment variables:
# Create a .env file in the root directory
touch .env

Add the following environment variables to your .env file:

GAIA_MODEL_BASE_URL=
GAIA_API_KEY=
BRAVE_API_KEY=your_brave_api_key
  1. Start the development server:
pnpm dev
  1. Open http://localhost:3000 in your browser.

Project Structure

RESEARCH-AGENT/
โ”œโ”€โ”€ app/                        # Main application directory
โ”‚   โ”œโ”€โ”€ api/                    # API routes
โ”‚   โ”‚   โ””โ”€โ”€ research/          # Research API endpoints
โ”‚   โ”‚       โ”œโ”€โ”€ dig-deeper/    # Deep research functionality
โ”‚   โ”‚       โ”‚   โ””โ”€โ”€ route.ts
โ”‚   โ”‚       โ”œโ”€โ”€ execute/       # Research execution
โ”‚   โ”‚       โ”‚   โ””โ”€โ”€ route.ts
โ”‚   โ”‚       โ”œโ”€โ”€ start/         # Start research process
โ”‚   โ”‚       โ”‚   โ””โ”€โ”€ route.ts
โ”‚   โ”‚       โ””โ”€โ”€ stream-summarize/ # Streaming summarization
โ”‚   โ”‚           โ””โ”€โ”€ route.ts
โ”‚   โ”œโ”€โ”€ favicon.ico            # Site favicon
โ”‚   โ”œโ”€โ”€ globals.css            # Global CSS styles
โ”‚   โ”œโ”€โ”€ layout.tsx             # Root layout component
โ”‚   โ””โ”€โ”€ page.tsx               # Main page component
โ”œโ”€โ”€ components/                # Reusable UI components
โ”‚   โ”œโ”€โ”€ ui/                    # UI component library
โ”‚   โ”‚   โ”œโ”€โ”€ button.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ card.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ tabs.tsx
โ”‚   โ”‚   โ””โ”€โ”€ textarea.tsx
โ”‚   โ””โ”€โ”€ ResearchAgent.tsx      # Main research agent component
โ”œโ”€โ”€ lib/                       # Library code and utilities
โ”‚   โ”œโ”€โ”€ ai/                    # AI-related functionality
โ”‚   โ”‚   โ””โ”€โ”€ config.ts         # AI configuration settings
โ”‚   โ”œโ”€โ”€ store/                 # State management
โ”‚   โ”‚   โ””โ”€โ”€ sessions.ts       # Session management
โ”‚   โ”œโ”€โ”€ tools/                 # Research tools
โ”‚   โ”‚   โ”œโ”€โ”€ ResearchPlanner.ts # Research planning tool
โ”‚   โ”‚   โ”œโ”€โ”€ SummarizationTool.ts # Content summarization tool
โ”‚   โ”‚   โ””โ”€โ”€ WebSearchTool.ts   # Web search functionality
โ”‚   โ””โ”€โ”€ types/                 # TypeScript type definitions
โ”‚       โ”œโ”€โ”€ index.ts          # Main type exports
โ”‚       โ””โ”€โ”€ utils.ts          # Utility types
โ”œโ”€โ”€ public/                    # Static assets
โ”‚  
โ”œโ”€โ”€ .env.example               # Environment variables example
โ”œโ”€โ”€ .gitignore                 # Git ignore file
โ”œโ”€โ”€ components.json            # Components configuration
โ”œโ”€โ”€ README.md                  # Project documentation
โ””โ”€โ”€ tailwind.config.ts         # Tailwind CSS configuration

Usage

  1. Enter your research query in the input field
  2. The agent will create a research plan
  3. Watch as it executes the research steps
  4. Review the results in different tabs:
    • Plan: View the research strategy
    • Results: See gathered information
    • Summary: Read the synthesized findings
  5. Use "Dig Deeper" to explore topics further

Development

Available Scripts

  • pnpm dev - Start development server with Turbopack
  • pnpm build - Build for production
  • pnpm start - Start production server
  • pnpm lint - Run ESLint

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgments