Skip to content

dimichoueiry/agenthacks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Marketing Content Agent for BountyBot

A BountyBot-compatible AI agent that generates marketing content (headlines, captions, hashtags, and image prompts) using Google's Gemini API.

Features

  • Headline Generation: Creates catchy, attention-grabbing headlines
  • Caption Variations: Generates 3-5 social media caption options
  • Hashtag Suggestions: Provides 10-15 relevant hashtags
  • Image Prompts: Creates detailed prompts for AI image generation
  • Call-to-Action: Suggests compelling CTAs
  • Async Processing: Handles tasks asynchronously with callback support

Quick Start

1. Clone and Install

cd agenthacks
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt

2. Configure Environment

cp .env.example .env
# Edit .env and add your Gemini API key

Get your Gemini API key at: https://makersuite.google.com/app/apikey

3. Run Locally

python main.py

Or with uvicorn:

uvicorn main:app --reload --port 8000

The API will be available at http://localhost:8000

API Endpoints

GET / - Agent Info

Returns agent metadata and capabilities.

GET /health - Health Check

Simple health check for load balancers.

POST /execute - BountyBot Task Execution

Main endpoint for BountyBot integration.

Request:

{
  "task_id": "unique-task-id",
  "bounty_id": "bounty-123",
  "input_data": {
    "description": "Create social media content for our new summer collection",
    "data": {
      "brand_name": "SunStyle Fashion",
      "product": "Summer 2024 Collection",
      "platform": "Instagram",
      "tone": "Fun and energetic",
      "target_audience": "Young adults 18-35"
    }
  },
  "callback_url": "https://bountybot.example.com/callback"
}

Immediate Response:

{
  "status": "accepted",
  "task_id": "unique-task-id",
  "estimated_completion_seconds": 30
}

Callback Payload (sent to callback_url):

{
  "task_id": "unique-task-id",
  "status": "completed",
  "result": {
    "headline": "Summer Vibes Start Here",
    "captions": ["Caption 1...", "Caption 2...", "Caption 3..."],
    "hashtags": ["summer", "fashion", "style", ...],
    "image_prompt": "Detailed image generation prompt...",
    "image_url": null,
    "call_to_action": "Shop the collection now!",
    "tone": "Fun and energetic",
    "target_audience": "Young adults 18-35",
    "generated_at": "2024-01-15T12:00:00Z"
  },
  "metrics": {
    "processing_time_ms": 2500,
    "captions_generated": 4,
    "hashtags_generated": 12,
    "image_generated": false,
    "model_used": "gemini-1.5-flash"
  }
}

POST /test - Local Testing

Synchronous endpoint for testing without callbacks.

{
  "description": "Create content for a coffee shop grand opening",
  "data": {
    "brand_name": "Brew Haven",
    "product": "Grand Opening Event",
    "platform": "Instagram",
    "tone": "Warm and inviting"
  }
}

Deployment

Deploy to Railway

  1. Push code to GitHub
  2. Connect Railway to your repo
  3. Add environment variable: GEMINI_API_KEY
  4. Railway auto-detects Python and deploys

Deploy to Render

  1. Push code to GitHub
  2. Create new Web Service on Render
  3. Connect to your repo
  4. Set build command: pip install -r requirements.txt
  5. Set start command: uvicorn main:app --host 0.0.0.0 --port $PORT
  6. Add environment variable: GEMINI_API_KEY

Deploy to Fly.io

  1. Install flyctl: curl -L https://fly.io/install.sh | sh
  2. Login: fly auth login
  3. Launch: fly launch
  4. Set secret: fly secrets set GEMINI_API_KEY=your_key
  5. Deploy: fly deploy

Testing with cURL

# Health check
curl http://localhost:8000/health

# Test endpoint (synchronous)
curl -X POST http://localhost:8000/test \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Create Instagram content for a tech startup launch",
    "data": {
      "brand_name": "TechNova",
      "product": "AI Writing Assistant",
      "platform": "Instagram",
      "tone": "Professional and innovative",
      "target_audience": "Business professionals and content creators"
    }
  }'

Project Structure

agenthacks/
├── main.py           # FastAPI application
├── requirements.txt  # Python dependencies
├── .env.example      # Environment template
└── README.md         # This file

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages