An intelligent multi-agent system built with Google ADK for creating and iterating on social media content. This agent demonstrates advanced AI orchestration patterns with two distinct operational modes: fast interactive design assistance and autonomous quality assurance through "Deep Think Mode."
- Dual-Mode Operation: Choose between speed (Regular Mode) or quality (Deep Think Mode)
- Intelligent Image Generation: Powered by Gemini's image generation capabilities
- Reference Image Support: Upload images for style and composition guidance
- Versioned Asset Management: Automatic versioning and organization of created content
- Autonomous Quality Loop: Multi-agent review and refinement system
- Context Awareness: Maintains session state for iterative improvements
The agent consists of several specialized sub-agents:
- Main Social Media Agent: Handles user interactions and routing
- Content Generation Agent: Creates and edits images with detailed instructions
- Content Review Agent: Evaluates quality across multiple dimensions
- Loop Control Agent: Makes intelligent decisions about iteration continuation
- Deep Think Loop: Orchestrates autonomous creative iteration
- Python 3.13+
- Google ADK (
pip install google-adk) - Gemini API key with image generation access
-
Clone the repository:
git clone <repository-url> cd social_media_agent
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.envfile in the project root:GEMINI_API_KEY=your_gemini_api_key_here
-
Verify installation:
python -c "import google.adk; print('ADK installed successfully')"
Start the ADK development server:
adk webThen navigate to http://127.0.0.1:8000/dev-ui in your browser and interact with the agent through the web interface.
Simple, direct interaction for quick iterations:
User: "Create a holiday promotion poster in 16:9 aspect ratio"
Agent: [Generates image quickly using generate_image tool]
User: "Make the text larger"
Agent: [Uses edit_image tool for quick refinement]
Autonomous quality assurance with multiple iterations:
User: "Deep think create a professional product launch announcement"
Agent: [Enters autonomous loop]
1. Generates initial content
2. Reviews for quality and adherence
3. Refines based on feedback
4. Repeats until professional standard
5. Presents final result
Upload inspiration images for style guidance:
User: [Uploads reference image] "Create a social media post in this style"
Agent: [Automatically saves reference as reference_image_v1.png]
[Uses reference for style and composition guidance]
- Regular Generation:
"Create a [description]" - Deep Think Mode:
"Deep think create a [description]" - With Reference: Upload image +
"Create something in this style" - List Assets:
"Show me all my assets" - List References:
"What reference images do I have?" - Load Previous:
"Show me [asset_name_v2.png]"
social_media_agent/
├── agent.py # Main agent configuration
├── deep_think_loop.py # Deep think mode implementation
├── tools/
│ └── post_creator_tool.py # Image generation and editing tools
├── requirements.txt # Python dependencies
└── README.md # This file
The agent can be customized by modifying:
- Max iterations: Change
max_iterations=5indeep_think_loop.py - Models: Update model names in agent configurations
- Instructions: Modify agent instructions for different behaviors
- Tools: Add or remove tools from the agent's toolkit
-
"GEMINI_API_KEY environment variable not set"
- Ensure your
.envfile contains the API key - Verify the key has image generation permissions
- Ensure your
-
"Artifact service is not initialized"
- The agent uses
InMemoryArtifactServiceby default - For production, consider using
GcsArtifactService
- The agent uses
-
"Deep think mode not activating"
- Ensure you include "deep think" in your prompt
- Check that
sub_agents=[deep_think_loop]is configured
Enable detailed logging:
export PYTHONPATH=.
python -c "
import logging
logging.basicConfig(level=logging.DEBUG)
from social_media_agent.agent import runner
# Your agent interaction code here
"Provide meaningful names for better organization:
# In your prompts, specify asset names
"Create a holiday_promotion poster"
# Results in: holiday_promotion_v1.png, holiday_promotion_v2.png, etc.# List all reference images
"What reference images do I have?"
# Use specific reference
"Create a design using reference_image_v2.png as inspiration"
# Use latest uploaded reference
"Create something based on the latest reference image"- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
For issues and questions:
- Check the troubleshooting section above
- Review ADK documentation: https://google.github.io/adk-docs/
- Open an issue in the repository