Skip to main content

Installation Guide

This guide provides detailed installation instructions for both the backend AI agent and frontend web application.

System Requirements

Backend Requirements

  • Python: 3.11 or higher
  • pip or pdm for package management
  • Virtual environment (recommended)

Frontend Requirements

  • Node.js: 18.0 or higher
  • pnpm: Package manager (preferred over npm)
  • Modern browser with Web3 wallet support

Backend Installation

1. Navigate to Backend Directory

cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate

3. Install Dependencies

Choose one of the following methods:

pip install -e ".[dev]"

Option B: Using PDM

pdm install

4. Verify Installation

Check that key packages are installed:

python -c "import langgraph; print('LangGraph installed successfully')"
python -c "import langchain; print('LangChain installed successfully')"

Frontend Installation

1. Navigate to Frontend Directory

cd frontend

2. Install pnpm (if not installed)

npm install -g pnpm

3. Install Dependencies

pnpm install

4. Verify Installation

pnpm list next  # Should show Next.js version

Environment Configuration

Backend Environment

  1. Copy the environment template:
cp .env.example .env
  1. Edit .env with your configuration:
# Required API Keys
OPENAI_API_KEY=your_openai_api_key
EXA_API_KEY=your_exa_api_key
POLYMARKET_API_KEY=your_polymarket_api_key
POLYMARKET_API_SECRET=your_polymarket_secret

# Polymarket Configuration
POLYMARKET_HOST=https://clob.polymarket.com
POLYGON_WALLET_PRIVATE_KEY=your_wallet_private_key

# Optional Keys
ANTHROPIC_API_KEY=your_anthropic_key
TAVILY_API_KEY=your_tavily_key
LANGCHAIN_API_KEY=your_langchain_key

# Development Settings
LANGCHAIN_TRACING_V2=true
LANGGRAPH_DEPLOYMENT_URL=http://localhost:2024

Frontend Environment

  1. Copy environment template:
cp .env.example .env.local
  1. Configure frontend variables:
# Privy Web3 Authentication
NEXT_PUBLIC_PRIVY_APP_ID=your_privy_app_id
PRIVY_SECRET=your_privy_secret
PRIVY_JWKS_ENDPOINT=your_privy_jwks_endpoint

# Polymarket Integration
NEXT_PUBLIC_POLYMARKET_PROXY_ADDRESS=your_proxy_address
NEXT_PUBLIC_USDCE_ADDRESS=0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174

# Backend Connection
LANGGRAPH_DEPLOYMENT_URL=http://localhost:2024

Testing the Installation

Backend Testing

  1. Start the LangGraph server:
make lg-server
  1. Verify server is running:
curl http://localhost:2024/health  # Should return server status
  1. Run tests (optional):
make test

Frontend Testing

  1. Start the development server:
pnpm dev
  1. Visit http://localhost:3000 in your browser

  2. Run linting:

pnpm lint

Build Commands

Backend Build Commands

Available Make commands:

make lg-server      # Start LangGraph dev server
make test # Run all tests
make test TEST_FILE=tests/specific_test.py # Run specific test
make lint # Run linting (ruff + mypy)
make format # Format code with ruff

Frontend Build Commands

Available pnpm commands:

pnpm dev           # Start development server with turbopack
pnpm build # Create production build
pnpm start # Start production server
pnpm lint # Run ESLint

Development Tools

Backend Development

  • Testing: pytest with asyncio support
  • Linting: ruff for code formatting and linting
  • Type Checking: mypy with strict mode
  • Development Server: LangGraph dev server

Frontend Development

  • Framework: Next.js 15 with App Router
  • UI Library: Shadcn UI with Radix components
  • Styling: TailwindCSS with custom configuration
  • Web3: Privy + WAGMI for wallet integration
  • State Management: TanStack React Query

Troubleshooting Installation

Python Issues

"Python version too old"

  • Install Python 3.11+ from python.org
  • Use pyenv for version management: pyenv install 3.11.0

"Package installation failed"

  • Update pip: pip install --upgrade pip
  • Clear pip cache: pip cache purge
  • Try alternative: pdm install

Node.js Issues

"Node version too old"

  • Install Node.js 18+ from nodejs.org
  • Use nvm for version management: nvm install 18

"pnpm not found"

  • Install pnpm globally: npm install -g pnpm
  • Or use npx: npx pnpm install

Permission Issues

Linux/Mac permission errors

  • Use sudo for global installs (not recommended for local packages)
  • Check file permissions: ls -la
  • Use virtual environments for Python packages

Next Steps

After successful installation:

  1. Configure API Keys - Set up required API integrations
  2. Polymarket Setup - Configure Polymarket trading
  3. First Run - Test the system with a market analysis

Having issues? Check the Troubleshooting Guide for common solutions.