Google’s Agent Development Kit (ADK) is a comprehensive framework for developing and deploying AI agents. It provides intelligent workflow orchestration, multi-agent coordination, and seamless integration with Google Cloud services.
# Install and initialize Google Cloud CLIcurl https://sdk.cloud.google.com | bashgcloud init# Set up Application Default Credentialsgcloud auth application-default login# Set environment variablesexport GOOGLE_CLOUD_PROJECT="your-project-id"export GOOGLE_CLOUD_LOCATION="us-central1"export KUBIYA_API_KEY="your-kubiya-api-key"
# weather_agent.pyfrom google.adk.agents import Agentdef get_weather(city: str) -> dict: """Get current weather for a city. Args: city: Name of the city Returns: dict: Weather information """ # Mock implementation - replace with real weather API if city.lower() == "new york": return { "status": "success", "weather": "Sunny, 25°C (77°F)", "city": city } else: return { "status": "error", "message": f"Weather data for {city} not available" }# Create the agentweather_agent = Agent( name="weather_assistant", model="gemini-2.0-flash", description="Provides weather information for cities", instruction="You help users get current weather information for any city.", tools=[get_weather])if __name__ == "__main__": # Run interactive session import asyncio asyncio.run(weather_agent.run_interactive())
Copy
Ask AI
# weather_agent.pyfrom google.adk.agents import Agentdef get_weather(city: str) -> dict: """Get current weather for a city. Args: city: Name of the city Returns: dict: Weather information """ # Mock implementation - replace with real weather API if city.lower() == "new york": return { "status": "success", "weather": "Sunny, 25°C (77°F)", "city": city } else: return { "status": "error", "message": f"Weather data for {city} not available" }# Create the agentweather_agent = Agent( name="weather_assistant", model="gemini-2.0-flash", description="Provides weather information for cities", instruction="You help users get current weather information for any city.", tools=[get_weather])if __name__ == "__main__": # Run interactive session import asyncio asyncio.run(weather_agent.run_interactive())
Copy
Ask AI
// WeatherAgent.javaimport com.google.adk.agents.Agent;import com.google.adk.agents.tools.Tool;public class WeatherAgent { @Tool(description = "Get current weather for a city") public Map<String, Object> getWeather(String city) { // Mock implementation if ("new york".equalsIgnoreCase(city)) { return Map.of( "status", "success", "weather", "Sunny, 25°C (77°F)", "city", city ); } else { return Map.of( "status", "error", "message", "Weather data for " + city + " not available" ); } } public static void main(String[] args) { Agent agent = Agent.builder() .name("weather_assistant") .model("gemini-2.0-flash") .description("Provides weather information for cities") .instruction("You help users get current weather information for any city.") .tools(new WeatherAgent()) .build(); agent.runInteractive(); }}
# adk_orchestration_server.pyfrom kubiya_workflow_sdk.server.orchestration_server import create_orchestration_serverfrom kubiya_workflow_sdk.providers.adk import ADKProviderfrom google.adk.agents import Agentdef get_weather(city: str) -> dict: """Get weather for a city""" # Implementation here passdef get_time(city: str) -> dict: """Get current time for a city""" # Implementation here pass# Create ADK agentweather_agent = Agent( name="weather_time_agent", model="gemini-2.0-flash", description="Agent for weather and time information", instruction="I can help you get weather and time information for cities.", tools=[get_weather, get_time])# Initialize ADK provideradk_provider = ADKProvider( agents=[weather_agent], models=["gemini-2.0-flash", "gemini-2.0-flash-thinking"])# Create orchestration serverserver = create_orchestration_server( name="ADK Weather Service", provider=adk_provider, port=8001)if __name__ == "__main__": server.run()
from google.adk.agents import LlmAgent# Coordinator agent that decides which agents to usecoordinator = LlmAgent( name="smart_coordinator", model="gemini-2.0-flash-thinking", sub_agents=[ specialist_agent_1, specialist_agent_2, specialist_agent_3 ], instruction=""" You are a smart coordinator. Based on the user's request, decide which specialist agents to use and in what order. You can transfer tasks between agents as needed. """)