Skip to main content
Loading navigation
Back to prompt library

Google ADK Agent Setup with Gemini 2.5 Pro

Linked challenge: Multimodal Content Generator for Brand Safety

Prompt source

planning15 lines6 sectionsNo variables1 code block
Initialize your Google ADK environment and define a primary agent that leverages Gemini 2.5 Pro for its core generative capabilities. Structure the agent to handle multimodal inputs and produce structured multimodal outputs. Ensure the agent is configured to use Vertex AI for model access.

```python
import google.generativeai as genai
import vertexai
from vertexai.preview.generative_models import GenerationConfig, GenerativeModel, Part, Tool

# Initialize Vertex AI
vertexai.init(project="YOUR_GCP_PROJECT_ID", location="YOUR_GCP_REGION")

# Configure Gemini 2.5 Pro
model = GenerativeModel("gemini-1.5-pro-preview-0514") # Use 1.5 Pro as a stand-in if 2.5 Pro not public yet

def generate_multimodal_concept(topic: str, audience: str) -> dict:
    prompt = f"Generate a short video concept for '{topic}' targeting '{audience}'. Provide a script, visual description, and audio cues in JSON format.\nScript:\nVisual Description:\nAudio Cues:"
    response = model.generate_content(prompt, generation_config=GenerationConfig(response_mime_type="application/json"))
    return response.candidates[0].content.parts[0].text

# In a full ADK agent, this would be wrapped as a tool or agent capability.
```