A serverless, autonomous agent that posts trending tech content to X (Twitter). Built with Google Cloud Run Jobs, Vertex AI (Gemini + Veo), and Firestore.
- Orchestrator: Cloud Run Jobs (Python container)
- Brain: Vertex AI Gemini 1.5 Flash (Strategy & Scripting)
- Video: Vertex AI Veo (Video Generation)
- Database: Firestore (History & Deduplication)
- Secrets: Secret Manager (API Keys)
- Scheduler: Cloud Scheduler (7 daily triggers, AWST timezone)
- IaC: Terraform
- Google Cloud Project with Billing enabled
- X (Twitter) Developer Account with v2 API access
gcloudCLI installed and authenticated- Terraform installed (v1.0+)
- Firestore database already created in your project
# 1. Clone and navigate to terraform directory
cd terraform
# 2. Run the setup script with your project ID
./setup.sh YOUR_PROJECT_IDThe setup script will:
- Create APIs, Artifact Registry, and Service Account
- Build and push the Docker container
- Create Cloud Run Job and Cloud Scheduler triggers
If you prefer manual steps:
# Set your project
export PROJECT_ID="your-project-id"
export REGION="us-central1"
# Initialize and apply Terraform (prerequisites first)
cd terraform
terraform init
terraform apply -target=google_project_service.required_apis \
-target=google_artifact_registry_repository.phantom_repo \
-target=google_service_account.phantom_sa
# Build container image
cd ..
gcloud builds submit --tag ${REGION}-docker.pkg.dev/${PROJECT_ID}/phantom-influencer/phantom-influencer:latest .
# Apply remaining Terraform (Cloud Run Job, Scheduler)
cd terraform
terraform applyAfter deployment, add your Twitter API credentials:
echo -n 'your-consumer-key' | gcloud secrets versions add TWITTER_CONSUMER_KEY --data-file=-
echo -n 'your-consumer-secret' | gcloud secrets versions add TWITTER_CONSUMER_SECRET --data-file=-
echo -n 'your-access-token' | gcloud secrets versions add TWITTER_ACCESS_TOKEN --data-file=-
echo -n 'your-access-token-secret' | gcloud secrets versions add TWITTER_ACCESS_TOKEN_SECRET --data-file=-
echo -n 'your-bearer-token' | gcloud secrets versions add TWITTER_BEARER_TOKEN --data-file=- # OptionalAfter pushing new code to GitHub and pulling in GCP Cloud Shell:
cd ~/phantom
git pull
# Build new image and update Cloud Run job
gcloud builds submit --tag ${REGION}-docker.pkg.dev/${PROJECT_ID}/phantom-influencer/phantom-influencer:latest .
gcloud run jobs update phantom-influencer-job --image ${REGION}-docker.pkg.dev/${PROJECT_ID}/phantom-influencer/phantom-influencer:latest --region ${REGION}# Test the job (force post)
gcloud run jobs execute phantom-influencer-job --region us-central1 --update-env-vars FORCE_POST=true
# View logs
gcloud logging read 'resource.type=cloud_run_job AND resource.labels.job_name=phantom-influencer-job' --limit=50
# View scheduler status
gcloud scheduler jobs list --location=us-central1
# Check Terraform outputs
cd terraform && terraform output| Variable | Description | Default |
|---|---|---|
PROJECT_ID |
Your GCP Project ID | Required |
REGION |
GCP region for resources | us-central1 |
BUDGET_MODE |
True to disable video generation |
True |
TIMEZONE |
Scheduler timezone | Australia/Perth |
CURRENCY |
Currency for budget display | AUD |
# Install dependencies
pip install -r requirements.txt
# Run locally (requires GCP credentials)
python main.pyMIT