Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# Project-specific ignores
# Workspace directory with generated files
workspace/
*.pyc

# Configuration files with sensitive data
config.yaml
*.key
*.pem
*.p12
*.pfx

# IDE files
.vscode/
.idea/
*.swp
*.swo
*~

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Logs
*.log
logs/

# Temporary files
*.tmp
*.temp
temp/
tmp/
97 changes: 84 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,48 @@ This approach ensures correctness through differential testing while achieving o
- Python 3.8 or higher
- pip package manager

### Step 1: Clone the Repository
### Quick Setup (Recommended)

```bash
git clone <repository-url>
cd temp-agents
# 1. Clone the repository
git clone <repo-url>
cd Meta-HackerCup-AI-StarterKit

# 2. Run the automated setup
python3 setup.py
```

The setup script will:
- Create `config.yaml` from template
- Create workspace directory
- Check for required files
- Provide next steps guidance

### Manual Setup (Alternative)

If you prefer manual setup:

#### Step 1: Clone the Repository

```bash
git clone https://github.com/amankumarkeshu/Meta-HackerCup-AI-StarterKit.git
cd Meta-HackerCup-AI-StarterKit
```

### Step 2: Install Dependencies
#### Step 2: Install Dependencies

```bash
pip install -r requirements.txt
```

This installs:
- `langchain` - Multi-agent framework
- `langchain-google-genai` - Google Gemini integration (FREE tier)
- `pyyaml` - Configuration management
- `langchain==0.3.0` - Multi-agent framework
- `langchain-google-genai==2.0.0` - Google Gemini integration (FREE tier)
- `pyyaml==6.0.2` - Configuration management
- `pytest==8.0.0` - Testing framework
- `pytest-cov==4.0.0` - Test coverage

### Step 3: Get FREE API Key
#### Step 3: Get FREE API Key

**Google Gemini (FREE)**

Expand All @@ -63,14 +86,16 @@ This installs:

### Set API Key

Edit `config.yaml`:
After running `python3 setup.py`, edit the generated `config.yaml`:

```yaml
api_keys:
# Google Gemini API Key - FREE TIER AVAILABLE!
google: "AIza...your-google-api-key"
google: "AIza...your-google-api-key" # Replace with your actual key
```

**Security Note**: The setup script creates `config.yaml` from `config.template.yaml`. Never commit your actual API key to version control.

### Choose Models

The system uses **FREE** Google Gemini models. Default configuration:
Expand Down Expand Up @@ -194,16 +219,57 @@ workspace/
```


## 🧪 Testing & Development

### Run Tests

The project includes a comprehensive test suite:

```bash
# Run all tests
python run_tests.py

# Or use pytest directly
pytest tests/ -v

# Run tests with coverage
pytest tests/ --cov=. --cov-report=html
```

### Test Coverage

- **CodeExecutor**: Tests for code execution, error handling, timeouts
- **OutputComparator**: Tests for file comparison and diff generation
- **ProblemSolverOrchestrator**: Tests for configuration and initialization
- **Integration Tests**: End-to-end workflow validation

### Development Setup

```bash
# Install development dependencies
pip install -r requirements.txt

# Run setup script
python3 setup.py

# Run tests to verify installation
python run_tests.py
```

## 📦 Project Structure

```
temp-agents/
Meta-HackerCup-AI-StarterKit/
├── PROBLEM.txt # Your problem statement (REQUIRED)
├── config.yaml # Configuration file
├── config.yaml # Configuration file (created by setup.py)
├── config.template.yaml # Secure configuration template
├── setup.py # Automated project setup script
├── run_tests.py # Test runner script
├── main.py # Entry point
├── orchestrator.py # Multi-agent coordinator
├── viewer.html # Web-based results viewer
├── requirements.txt # Python dependencies
├── requirements.txt # Python dependencies (pinned versions)
├── .gitignore # Git ignore rules (includes sensitive files)
├── README.md # This file
├── QUICKSTART.md # Quick reference guide
├── LICENSE # MIT License
Expand All @@ -217,6 +283,11 @@ temp-agents/
│ ├── executor.py # Code execution utility
│ ├── comparator.py # Output comparison utility
│ └── progress.py # Live progress indicators
├── tests/ # Unit test suite
│ ├── __init__.py
│ ├── test_executor.py # CodeExecutor tests
│ ├── test_comparator.py # OutputComparator tests
│ └── test_orchestrator.py # Orchestrator tests
└── workspace/ # Generated files (gitignored)
└── ...
```
Expand Down
40 changes: 40 additions & 0 deletions config.template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Multi-Agent Programming Task Solver Configuration Template
# Copy this file to config.yaml and fill in your API keys

# API Keys Configuration
api_keys:
# Google Gemini API Key - FREE TIER AVAILABLE!
# Get yours at: https://aistudio.google.com/app/apikey
google: "your-google-api-key-here"

# Model Configuration for Each Agent
# FORMAT: "google:model-name"
#
# Available Google Gemini Models (FREE TIER):
# It has a generous free tier for APIs, can start from here. (Details: https://ai.google.dev/gemini-api/docs/rate-limits)
# - "google:gemini-2.5-pro" # Most capable, slower (100 free requests / day) - winning model
# - "google:gemini-2.5-flash" # Latest & fastest (250 free requests / day)
# - "google:gemini-2.5-flash-lite" # Fast & Cheap (1000 free requests / day) - good for testing
#
models:
tester_agent: "google:gemini-2.5-flash-lite"
brute_agent: "google:gemini-2.5-flash-lite"
optimal_agent: "google:gemini-2.5-flash-lite"

# Execution Parameters
execution:
max_optimal_attempts: 5
timeout_seconds: 30 # Timeout for code execution

# Output Configuration
output:
workspace_dir: "./workspace"
preserve_intermediate: true # Keep all generated files

# File Names
files:
test_inputs: "small_inputs.txt"
brute_solution: "brute.py"
brute_outputs: "small_outputs.txt"
optimal_solution: "optimal.py"
optimal_outputs: "op.txt"
8 changes: 5 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
langchain>=0.3.0
langchain-google-genai>=2.0.0
pyyaml>=6.0
langchain==0.3.0
langchain-google-genai==2.0.0
pyyaml==6.0.2
pytest==8.0.0
pytest-cov==4.0.0
30 changes: 30 additions & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
"""
Test runner for Meta HackerCup AI StarterKit.
"""
import unittest
import sys
import os

# Add the project root to the Python path
project_root = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, project_root)


def run_tests():
"""Run all unit tests."""
# Discover and run tests
loader = unittest.TestLoader()
start_dir = os.path.join(project_root, 'tests')
suite = loader.discover(start_dir, pattern='test_*.py')

# Run tests
runner = unittest.TextTestRunner(verbosity=2)
result = runner.run(suite)

# Return exit code based on test results
return 0 if result.wasSuccessful() else 1


if __name__ == '__main__':
sys.exit(run_tests())
Loading