TechSetupGuides
IntermediateAutoGPTAIPythonFastAPINext.jsPostgreSQLRedisRabbitMQDockerPoetryOpenAI

AutoGPT: AI Agent Platform Setup

Complete setup guide for AutoGPT - the autonomous AI agent platform that empowers everyone to build and deploy AI agents. Includes Docker-based installation, Python development environment, API configuration, and production deployment with FastAPI, Next.js, PostgreSQL, Redis, and RabbitMQ.

  1. Step 1

    System Prerequisites

    Before installing AutoGPT, ensure you have the required tools installed. AutoGPT supports both Docker-based (recommended) and local development setups. You'll need a stable internet connection for pulling Docker images and making LLM API calls.

    # Check versions (minimum requirements)
    python --version  # Python 3.8+
    docker --version  # Docker 20.10+
    docker-compose --version  # Docker Compose 2.0+
    git --version
    node --version  # Node.js 18+
    npm --version
    ⚠ Heads up: AutoGPT requires access to ports 3000 (frontend), 8006 (REST API), 8001 (WebSocket), 5432 (PostgreSQL), 6379 (Redis), and 5672 (RabbitMQ). Ensure these ports are available.
  2. Step 2

    Clone the AutoGPT Repository

    Clone the official AutoGPT repository from Significant-Gravitas. This contains the complete platform including frontend, backend, and infrastructure configuration.

    git clone https://github.com/Significant-Gravitas/AutoGPT.git
    cd AutoGPT
  3. Step 3

    Install Poetry (Python Dependency Manager)

    AutoGPT uses Poetry for Python dependency management. Poetry unifies dependency management, virtual environments, building, and publishing into a single tool driven by pyproject.toml.

    # Install Poetry
    curl -sSL https://install.python-poetry.org | python3 -
    
    # Add Poetry to PATH (add to ~/.bashrc or ~/.zshrc)
    export PATH="$HOME/.local/bin:$PATH"
    
    # Verify installation
    poetry --version
  4. Step 4

    Configure Environment Variables

    Create a .env file from the template to configure API keys and service settings. The .env file stores sensitive credentials and should never be committed to version control.

    # Copy the template
    cp .env.template .env
    
    # Edit .env with your preferred editor
    nano .env
  5. Step 5

    Set OpenAI API Key

    AutoGPT requires an OpenAI API key to function. Get your API key from the OpenAI platform and add it to your .env file. For GPT-4 access (recommended for best results), you need a paid OpenAI account. Free accounts are limited to GPT-3.5 with only 3 requests per minute.

    # In your .env file, add:
    OPENAI_API_KEY=sk-your-actual-api-key-here
    
    # Optional: Configure other API keys
    GOOGLE_API_KEY=your-google-api-key  # For Google Search
    ELEVENLABS_API_KEY=your-elevenlabs-key  # For speech mode
    ⚠ Heads up: Do not add spaces or quotes around the API key. The format should be: OPENAI_API_KEY=sk-xxx... Get your API key from: https://platform.openai.com/account/api-keys
  6. Step 6

    Docker-Based Installation (Recommended)

    The Docker setup orchestrates all services including FastAPI backend, Next.js frontend, PostgreSQL with pgvector, Redis, and RabbitMQ. This is the recommended approach for both development and production.

    # Build and start all services
    docker-compose up -d
    
    # View logs
    docker-compose logs -f
    
    # Check service status
    docker-compose ps
  7. Step 7

    Verify Services Are Running

    After starting Docker Compose, verify that all services are healthy. The platform runs multiple interconnected services that need to be operational for AutoGPT to function correctly.

    # Check that all containers are running
    docker-compose ps
    
    # Test the frontend (Next.js)
    curl http://localhost:3000
    
    # Test the REST API
    curl http://localhost:8006/health
    
    # Test PostgreSQL connection
    docker-compose exec postgres psql -U postgres -c "SELECT version();"
    ⚠ Heads up: If any service fails to start, check the logs with: docker-compose logs [service-name]
  8. Step 8

    Access the AutoGPT Interface

    Once all services are running, open your browser to access the AutoGPT web interface. The Next.js frontend provides a user-friendly interface for creating and managing AI agents.

    # Open in your default browser (macOS)
    open http://localhost:3000
    
    # Or manually navigate to:
    # http://localhost:3000
  9. Step 9

    Local Development Setup (Without Docker)

    For development work on the AutoGPT codebase itself, you can run services locally. This gives you more control and faster iteration cycles. Start with installing Python dependencies using Poetry.

    # Navigate to the backend directory
    cd autogpt_platform/backend
    
    # Install dependencies with Poetry
    poetry install
    
    # Activate the virtual environment
    poetry shell
  10. Step 10

    Set Up Local PostgreSQL

    For local development, install PostgreSQL with the pgvector extension for semantic search capabilities. The pgvector extension enables vector similarity search across agent descriptions and block catalogs.

    # Install PostgreSQL (Ubuntu/Debian)
    sudo apt update
    sudo apt install postgresql postgresql-contrib
    
    # Install pgvector extension
    sudo apt install postgresql-15-pgvector
    
    # Start PostgreSQL
    sudo systemctl start postgresql
    sudo systemctl enable postgresql
    
    # Create database
    sudo -u postgres createdb autogpt
    
    # Enable pgvector extension
    sudo -u postgres psql -d autogpt -c "CREATE EXTENSION vector;"
  11. Step 11

    Set Up Redis

    Redis handles ephemeral state including session caching, rate limit counters, and queue management for the execution scheduler. Install Redis 6.2 or later for full compatibility.

    # Install Redis (Ubuntu/Debian)
    sudo apt install redis-server
    
    # Start Redis
    sudo systemctl start redis-server
    sudo systemctl enable redis-server
    
    # Test Redis connection
    redis-cli ping
    # Should return: PONG
  12. Step 12

    Set Up RabbitMQ

    RabbitMQ provides message queuing for the execution engine. It ensures reliable communication between distributed components of the AutoGPT platform.

    # Install RabbitMQ (Ubuntu/Debian)
    sudo apt install rabbitmq-server
    
    # Start RabbitMQ
    sudo systemctl start rabbitmq-server
    sudo systemctl enable rabbitmq-server
    
    # Enable management plugin (optional, for web UI)
    sudo rabbitmq-plugins enable rabbitmq_management
    
    # Access management UI at: http://localhost:15672
    # Default credentials: guest/guest
  13. Step 13

    Run Database Migrations

    Initialize the PostgreSQL database schema using Prisma migrations. This creates all necessary tables for user accounts, agent definitions, execution metadata, and marketplace listings.

    # From the backend directory
    cd autogpt_platform/backend
    
    # Run Prisma migrations
    poetry run prisma migrate deploy
    
    # Generate Prisma client
    poetry run prisma generate
  14. Step 14

    Start the FastAPI Backend

    Launch the FastAPI backend server. The backend provides REST API endpoints for agent management and execution, with automatic OpenAPI schema generation and Pydantic-based validation.

    # From the backend directory
    cd autogpt_platform/backend
    
    # Start the FastAPI server
    poetry run uvicorn main:app --host 0.0.0.0 --port 8006 --reload
    
    # The API will be available at:
    # - REST API: http://localhost:8006
    # - WebSocket: http://localhost:8001
    # - API Docs: http://localhost:8006/docs
    ⚠ Heads up: The --reload flag enables auto-restart on code changes. Remove it for production deployments.
  15. Step 15

    Start the Next.js Frontend

    In a new terminal, start the Next.js frontend application. The frontend provides the web interface for creating agents, monitoring executions, and viewing real-time streaming updates via WebSocket.

    # Navigate to the frontend directory
    cd autogpt_platform/frontend
    
    # Install dependencies
    npm install
    
    # Start the development server
    npm run dev
    
    # Frontend will be available at:
    # http://localhost:3000
  16. Step 16

    Configure Authentication (Optional)

    For production deployments, configure Supabase Auth (GoTrue) for user authentication. The platform uses JWT tokens validated by Kong gateway before forwarding requests to the backend.

    # In your .env file, add Supabase credentials:
    SUPABASE_URL=https://your-project.supabase.co
    SUPABASE_ANON_KEY=your-anon-key
    SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
    
    # Configure JWT secret for token validation
    JWT_SECRET=your-jwt-secret-key
    ⚠ Heads up: The service role key bypasses Row Level Security. Only use it in backend services, never expose it to the client.
  17. Step 17

    Create Your First AI Agent

    With AutoGPT running, you can now create your first autonomous AI agent through the web interface. Agents can be configured with goals, constraints, and tools to accomplish complex tasks autonomously.

    1. Open http://localhost:3000 in your browser
    2. Click "Create New Agent"
    3. Define agent goals and constraints
    4. Configure available tools and APIs
    5. Set memory and execution parameters
    6. Launch the agent and monitor real-time execution
  18. Step 18

    Monitor Agent Execution

    AutoGPT streams real-time updates via WebSocket during agent execution. Each node transition is pushed as an event, and LLM responses appear incrementally character by character. Use the execution logs and monitoring dashboard to track agent behavior.

    # View backend logs
    docker-compose logs -f backend
    
    # View Redis activity (optional)
    redis-cli monitor
    
    # Check RabbitMQ queues
    sudo rabbitmqctl list_queues
  19. Step 19

    Production Deployment Considerations

    For production deployments, implement proper security, scaling, and monitoring. The FastAPI backend is stateless and can be horizontally scaled. Use Redis for distributed locking to prevent concurrent execution conflicts.

    # docker-compose.prod.yml example
    services:
      backend:
        replicas: 3  # Scale backend instances
        environment:
          - ENVIRONMENT=production
          - LOG_LEVEL=info
      
      postgres:
        volumes:
          - postgres_data:/var/lib/postgresql/data
      
      redis:
        command: redis-server --appendonly yes
        volumes:
          - redis_data:/data
    
    volumes:
      postgres_data:
      redis_data:
    ⚠ Heads up: Always use environment variables for secrets, enable SSL/TLS for all services, implement rate limiting, and set up comprehensive logging and monitoring.
  20. Step 20

    Troubleshooting Common Issues

    If you encounter problems, here are solutions to common issues. Check that all required ports are available and not blocked by firewalls. Ensure all API keys are correctly configured in .env.

    # Reset Docker environment
    docker-compose down -v
    docker-compose up -d
    
    # Reinstall Python dependencies
    poetry install --no-cache
    
    # Clear Poetry cache
    poetry cache clear pypi --all
    
    # Check service connectivity
    telnet localhost 5432  # PostgreSQL
    telnet localhost 6379  # Redis
    telnet localhost 5672  # RabbitMQ
    
    # View detailed error logs
    docker-compose logs backend | tail -100
  21. Step 21

    Update AutoGPT

    Keep AutoGPT up to date to receive the latest features, bug fixes, and security patches. Always backup your data before updating.

    # Pull latest changes
    git pull origin main
    
    # Update Docker images
    docker-compose pull
    docker-compose up -d --build
    
    # For local development, update dependencies
    cd autogpt_platform/backend
    poetry update
    
    cd ../frontend
    npm update
    ⚠ Heads up: Always backup your PostgreSQL database before updating: docker-compose exec postgres pg_dump -U postgres autogpt > backup.sql

Feature requests

Sign in to suggest features or vote on existing ones.

No feature requests yet.

Discussion

0 people marked this as worked·Sign in to mark your own.

Sign in to join the discussion.

No comments yet.