autogpt_platform/backend/load-tests/README.md
Clean, streamlined load testing infrastructure for the AutoGPT Platform using k6.
# 1. Set up Supabase service key (required for token generation)
export SUPABASE_SERVICE_KEY="your-supabase-service-key"
# 2. Generate pre-authenticated tokens (first time setup - creates 160+ tokens with 24-hour expiry)
node generate-tokens.js --count=160
# 3. Set up k6 cloud credentials (for cloud testing - see Credential Setup section below)
export K6_CLOUD_TOKEN="your-k6-cloud-token"
export K6_CLOUD_PROJECT_ID="4254406"
# 4. Run orchestrated load tests locally
node orchestrator/orchestrator.js DEV local
# 5. Run orchestrated load tests in k6 cloud (recommended)
node orchestrator/orchestrator.js DEV cloud
The AutoGPT Platform uses a comprehensive load test orchestrator (orchestrator/orchestrator.js) that runs 12 optimized tests with maximum VU counts:
/api/credits, /api/graphs, /api/blocks, /api/executions)# Run 12 optimized tests locally (for debugging)
node orchestrator/orchestrator.js DEV local
# Run 12 optimized tests in k6 cloud (recommended for performance testing)
node orchestrator/orchestrator.js DEV cloud
# Run against production (coordinate with team!)
node orchestrator/orchestrator.js PROD cloud
# Run individual test directly with k6
K6_ENVIRONMENT=DEV VUS=100 DURATION=3m k6 run tests/api/core-api-test.js
# Run orchestrator locally
npm run local
# Run orchestrator in k6 cloud
npm run cloud
node generate-tokens.js --count=160 to create tokensconfigs/pre-authenticated-tokens.js (gitignored for security)node generate-tokens.js --count=160 when tokens expire after 24 hourshttp://localhost:8006 (local development)https://dev-api.agpt.co (development environment)https://api.agpt.co (production environment - coordinate with team!)k6-cloud-results.txt/api/credits, /api/graphs, /api/blocks, /api/executions1. Authentication Failures
ā No valid authentication token available
ā Token has expired
node generate-tokens.js --count=160 to create fresh 24-hour tokens--count parameter to generate appropriate number of tokens for your test scale2. Cloud Credentials Missing
ā Missing k6 cloud credentials
K6_CLOUD_TOKEN and K6_CLOUD_PROJECT_ID=42544063. k6 Cloud VU Scaling Issue
ā Test shows only 5 VUs instead of requested 100+ VUs
K6_ENVIRONMENT=DEV VUS=160 k6 cloud run test.js (incorrect)k6 cloud run --env K6_ENVIRONMENT=DEV --env VUS=160 test.js (correct)run-tests.js) already uses the correct syntax4. Setup Verification Failed
ā Verification failed
1. Supabase Service Key (Required for all testing):
# Option 1: From your local environment (if available)
export SUPABASE_SERVICE_KEY="your-supabase-service-key"
# Option 2: From Kubernetes secret (for platform developers)
kubectl get secret supabase-service-key -o jsonpath='{.data.service-key}' | base64 -d
# Option 3: From Supabase dashboard
# Go to Project Settings > API > service_role key (never commit this!)
2. Generate Pre-Authenticated Tokens (Required):
# Creates 160 tokens with 24-hour expiry - prevents auth rate limiting
node generate-tokens.js --count=160
# Generate fewer tokens for smaller tests (minimum 10)
node generate-tokens.js --count=50
# Regenerate when tokens expire (every 24 hours)
node generate-tokens.js --count=160
3. k6 Cloud Credentials (Required for cloud testing):
# Get from k6 cloud dashboard: https://app.k6.io/account/api-token
export K6_CLOUD_TOKEN="your-k6-cloud-token"
export K6_CLOUD_PROJECT_ID="4254406" # AutoGPT Platform project ID
# Verify credentials work by running orchestrator
node orchestrator/orchestrator.js DEV cloud
load-tests/
āāā README.md # This documentation
āāā generate-tokens.js # Generate pre-auth tokens (MAIN TOKEN SETUP)
āāā package.json # Node.js dependencies and scripts
āāā orchestrator/
ā āāā orchestrator.js # Main test orchestrator (MAIN ENTRY POINT)
āāā configs/
ā āāā environment.js # Environment URLs and configuration
ā āāā pre-authenticated-tokens.js # Generated tokens (gitignored)
āāā tests/
ā āāā basic/
ā ā āāā connectivity-test.js # Basic connectivity validation
ā ā āāā single-endpoint-test.js # Individual API endpoint testing
ā āāā api/
ā ā āāā core-api-test.js # Core authenticated API endpoints
ā ā āāā graph-execution-test.js # Graph workflow pipeline testing
ā āāā marketplace/
ā ā āāā public-access-test.js # Public marketplace browsing
ā ā āāā library-access-test.js # Authenticated marketplace/library
ā āāā comprehensive/
ā āāā platform-journey-test.js # Complete user journey simulation
āāā results/ # Local test results (auto-created)
āāā unified-results-*.json # Orchestrator results (auto-created)
āāā *.log # Test execution logs (auto-created)
node generate-tokens.js --count=160 before testingDEV local for debugging and developmentDEV cloud for actual performance testingFor granular control over individual test scripts:
# k6 Cloud execution (recommended for performance testing)
# IMPORTANT: Use --env syntax for k6 cloud to ensure proper VU scaling
k6 cloud run --env K6_ENVIRONMENT=DEV --env VUS=160 --env DURATION=5m --env RAMP_UP=30s --env RAMP_DOWN=30s tests/marketplace/library-access-test.js
# Local execution with cloud output (debugging)
K6_ENVIRONMENT=DEV VUS=10 DURATION=1m \
k6 run tests/api/core-api-test.js --out cloud
# Local execution with JSON output (offline testing)
K6_ENVIRONMENT=DEV VUS=10 DURATION=1m \
k6 run tests/api/core-api-test.js --out json=results.json
# Generate specific number of tokens
node generate-tokens.js --count=200
# Generate tokens with custom timeout
node generate-tokens.js --count=100 --timeout=60
For questions or issues, please refer to the AutoGPT Platform issues.