# Project export: Airpool

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 11.0
- Tagline: Airpool is a decentralized network where individuals share unused GPU power, enabling startups and small developers to access high-performance computational services at an affordable cost.
- Devpost: https://devpost.com/software/airpool
- GitHub: https://github.com/Raghxv11/CalHacks
- Team: 2 GitHub contributor(s) — Raghxv11 (13 commits), a-rishabh (3 commits)

## Devpost submission (written by the team)

No Devpost description available.

## README (from the GitHub repository)

# Cal Hacks 11.0 Project
<h1 align="center">AIRPOOL</h1>

![image](https://github.com/user-attachments/assets/006d0a8f-3eff-440a-a0de-b52de78ab131)

## Project Flow
![flow](https://github.com/user-attachments/assets/bb6bc52e-e215-44fc-8232-6e852e79f0bc)



## About Us
Airpool is open-source decentralized network that allows individuals and startups to contribute their unused GPU resources. By pooling these resources, we create a shared infrastructure for distributing computational services that are accessible to small companies and developers. 
This empowers them to tackle sophisticated AI models and perform large-scale data analysis without heavy upfront investment in GPU hardware.

## Tech Stack
- **Frontend**: Next.js + Typescript
- **Backend**: Python, Flask
- **Other Technologies**: Fetch.ai

## Getting Started

Follow the instructions below to set up the project on your local machine.

### Prerequisites
Make sure you have the following installed:
- Node.js
- Python 3.x
- npm (Node Package Manager)
- Poetry

### Installation and Setup

1. **Clone the repository:**
   ```bash
   git clone https://github.com/Raghxv11/CalHacks.git
   cd CalHacks
   ```

2. **Set up the backend:**
   ```bash
   cd server/Multi_agent
   ```

3. **Initialize and activate virtual environment:**
   We use Poetry to manage our Python environment (optional but recommended):
   ```bash
   poetry init -n && poetry shell
   ```

4. **Install uAgents Framework and other dependencies:**
   ```bash
   poetry add uagents
   ```

5. **Verify installation:**
   ```bash
   poetry show uagents
   ```

6. **Install frontend dependencies:**
   ```bash
   cd ../../client
   npm install
   ```

## Running the Project

1. **Start the Backend Server:**
   In the `server` directory:
   ```bash
   python server.py
   ```

2. **Run the Multi-Agent System:**
   In a new terminal, navigate to `server/Multi_agent` and run:
   ```bash
   python run_simulation.py
   ```

3. **Start the Frontend Development Server:**
   In another terminal, navigate to the `client` directory and run:
   ```bash
   npm run dev
   ```

4. **Access the Project:**
   Open your web browser and navigate to `http://localhost:3000`.

## Project Structure

- `/server`: Contains the backend server and multi-agent system
  - `/Multi_agent`: Houses the AirPool multi-agent system
- `/client`: Contains the frontend React application




## Detected evidence (automated analysis)

Indexed codebase: 34 recognized source files, 55 KB.
- CSS (language) — detected in the code
- JavaScript (language) — detected in the code
- Next.js (technology) — detected in the code
- Python (language) — detected in the code
- React (technology) — detected in the code
- Tailwind CSS (technology) — detected in the code
- TypeScript (language) — detected in the code
- Flask (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (53 of 53)

```
client/.eslintrc.json
client/.gitignore
client/next.config.mjs
client/package.json
client/postcss.config.mjs
client/public/planet/license.txt
client/public/planet/scene.gltf
client/README.md
client/src/app/globals.css
client/src/app/layout.tsx
client/src/app/page.tsx
client/src/components/About.jsx
client/src/components/canvas/Earth.jsx
client/src/components/canvas/index.js
client/src/components/canvas/Stars.jsx
client/src/components/db.tsx
client/src/components/Hero.tsx
client/src/components/Loader.jsx
client/src/components/Navbar.tsx
client/src/components/typewriter/TypewriterBox.css
client/src/components/typewriter/TypewriterBox.tsx
client/src/hoc/index.js
client/src/hoc/SectionWrapper.jsx
client/src/styles.js
client/src/utils/motion.js
client/tailwind.config.ts
client/tsconfig.json
README.md
server/AI_agents/ca_2.py
server/AI_agents/central_lead.py
server/AI_agents/contributor_agent.py
server/AI_agents/lead_agent.py
server/AI_agents/multi_agent.py
server/AI_agents/poetry.lock
server/AI_agents/pyproject.toml
server/AI_agents/resources.json
server/AI_agents/shared_resources.json
server/AI_agents/shared_resources.py
server/moderator_decision.json
server/Multi_agent/contributor_agent.py
server/Multi_agent/dynamic_moderator.py
server/Multi_agent/lead_agent.py
server/Multi_agent/moderator_decision_tested.json
server/Multi_agent/moderator_decision.json
server/Multi_agent/poetry.lock
server/Multi_agent/pyproject.toml
server/Multi_agent/resource_generator.py
server/Multi_agent/run_simulation.py
server/Multi_agent/shared_resources_34.json
server/Multi_agent/shared_resources.py
server/README.md
server/server.py
server/shared_resources.json
```

### Dependencies

- client/package.json: @react-three/drei@^9.114.6, @react-three/fiber@^8.17.10, @types/node@^20, @types/react@^18, @types/react-dom@^18, eslint@^8, eslint-config-next@14.2.15, framer-motion@^11.11.9, next@14.2.15, postcss@^8, react@^18, react-dom@^18, tailwindcss@^3.4.1, three@^0.169.0, typescript@^5
- server/AI_agents/pyproject.toml: uagents@^0.16.2
- server/Multi_agent/pyproject.toml: uagents@^0.16.2

### Recent commits (newest first)

- Update README.md - removed extra space
- Update README.md - heading chnaged
- Update README.md
- Update README.md
- Update README.md
- Update README.md
- Update README.md
- Merge branch 'main' of https://github.com/Raghxv11/CalHacks
- updated typewriter
- Update README.md
- Update README.md
- Create README.md
- about
- canvas
- convo
- integrated-full

## Key source files (fetched from GitHub, selected and truncated for size)

### client/package.json

```
{
  "name": "cal-hacks",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@react-three/drei": "^9.114.6",
    "@react-three/fiber": "^8.17.10",
    "framer-motion": "^11.11.9",
    "next": "14.2.15",
    "react": "^18",
    "react-dom": "^18",
    "three": "^0.169.0"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "eslint": "^8",
    "eslint-config-next": "14.2.15",
    "postcss": "^8",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
}

```

### server/AI_agents/pyproject.toml

```
[tool.poetry]
name = "ai-agents"
version = "0.1.0"
description = ""
authors = ["Rishabh Agarwal <aggarw266@umn.edu>"]
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
uagents = "^0.16.2"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

```

### server/Multi_agent/pyproject.toml

```
[tool.poetry]
name = "multi-agent"
version = "0.1.0"
description = ""
authors = ["Rishabh Agarwal <aggarw266@umn.edu>"]
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
uagents = "^0.16.2"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

```

### server/server.py

```python
from flask import Flask, jsonify
import json
from flask_cors import CORS

app = Flask(__name__)
CORS(app)  # Enable Cross-Origin Resource Sharing

# Route to serve the JSON file
@app.route('/api/data')
def serve_data_json():
    # Open the JSON file and load it into a Python dictionary
    with open('Multi_agent/moderator_decision.json', 'r') as json_file:
        data = json.load(json_file)
    return jsonify(data)

@app.route('/conversation')
def serve_conversation_json():
    # Open the JSON file and load it into a Python dictionary
    with open('shared_resources.json', 'r') as json_file:
        conversation = json.load(json_file)
    return jsonify(conversation)

# Home route to test if the server is running
@app.route('/')
def home():
    return jsonify({'message': 'Flask backend is running on localhost!'})

if __name__ == '__main__':
    app.run(debug=True, port=8080)

```

### client/src/hoc/index.js

```javascript
import SectionWrapper from "./SectionWrapper";

export { SectionWrapper };

```

### client/src/app/page.tsx

```typescript
import Image from "next/image";
import Hero from "@/components/Hero";
import DB from "@/components/db";
import About from "@/components/About";
import StarsCanvas from "@/components/canvas/Stars";
import TypewriterBox from "@/components/typewriter/TypewriterBox";

export default function Home() {
  return (
    <div>
      <Hero />
      {/* <TypewriterBox /> */}
      <div className="relative z-0">
        <DB />
        <StarsCanvas />
      </div>
      {/* <DB /> */}
      <div className="relative z-0">
        <About />
        <StarsCanvas />
      </div>
    </div>
  );
}

```

### client/src/app/layout.tsx

```typescript
import type { Metadata } from "next";
import localFont from "next/font/local";
import "./globals.css";

const geistSans = localFont({
  src: "./fonts/GeistVF.woff",
  variable: "--font-geist-sans",
  weight: "100 900",
});
const geistMono = localFont({
  src: "./fonts/GeistMonoVF.woff",
  variable: "--font-geist-mono",
  weight: "100 900",
});

export const metadata: Metadata = {
  title: "AirPool",
  description: "Fueling Innovation. Democratizing Computation.",
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en">
      <body
        className={`${geistSans.variable} ${geistMono.variable} antialiased`}
      >
        {children}
      </body>
    </html>
  );
}

```

### client/src/components/canvas/index.js

```javascript
import EarthCanvas from "./Earth";
import StarsCanvas from "./Stars";

export { EarthCanvas, StarsCanvas };

```

### client/tailwind.config.ts

```typescript
import type { Config } from "tailwindcss";

const config: Config = {
  content: [
    "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
    "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
    "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
  ],
  theme: {
    extend: {
      colors: {
        background: "var(--background)",
        foreground: "var(--foreground)",
      },
    },
  },
  plugins: [],
};
export default config;

```

### server/Multi_agent/resource_generator.py

```python
import random
import string

def generate_agent_resources():
    names = ["Alice", "Bob", "Charlie", "Diana", "Ethan", "Fiona", "George", "Hannah", "Ian", "Julia"]
    
    return {
        "name": random.choice(names) + '_' + ''.join(random.choices(string.ascii_lowercase, k=3)),
        "resources": {
            "gpu_count": random.randint(1, 16),
            "memory_gb": random.choice([8, 16, 32, 64, 128]),
            "availability_hours": random.randint(1, 24)
        }
    }
```

[24 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]