A BountyBot-compatible AI agent that generates marketing content (headlines, captions, hashtags, and image prompts) using Google's Gemini API.
- 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
cd agenthacks
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtcp .env.example .env
# Edit .env and add your Gemini API keyGet your Gemini API key at: https://makersuite.google.com/app/apikey
python main.pyOr with uvicorn:
uvicorn main:app --reload --port 8000The API will be available at http://localhost:8000
Returns agent metadata and capabilities.
Simple health check for load balancers.
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"
}
}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"
}
}- Push code to GitHub
- Connect Railway to your repo
- Add environment variable:
GEMINI_API_KEY - Railway auto-detects Python and deploys
- Push code to GitHub
- Create new Web Service on Render
- Connect to your repo
- Set build command:
pip install -r requirements.txt - Set start command:
uvicorn main:app --host 0.0.0.0 --port $PORT - Add environment variable:
GEMINI_API_KEY
- Install flyctl:
curl -L https://fly.io/install.sh | sh - Login:
fly auth login - Launch:
fly launch - Set secret:
fly secrets set GEMINI_API_KEY=your_key - Deploy:
fly deploy
# 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"
}
}'agenthacks/
├── main.py # FastAPI application
├── requirements.txt # Python dependencies
├── .env.example # Environment template
└── README.md # This file
MIT