Agent Initialization and Tool Definition

implementationChallenge

Prompt Content

Using Google ADK, define the initial agent structure. This should include an agent that can access current location, retrieve map data, and speak. Provide the Python code for initializing the `adk.Agent` and registering a simple `get_current_location` tool and a `speak` tool. Assume you have already set up your Google Cloud project and authenticated.

```python
import adk
from adk import agent_builder
from google.cloud import texttospeech_v1 as tts

def get_current_location():
    # Placeholder for actual location retrieval
    return {"latitude": 34.0195, "longitude": -118.4912}

def speak(text: str):
    # Placeholder for TTS output
    print(f"Agent says: {text}")

builder = agent_builder.AgentBuilder()
builder.add_tool(get_current_location)
builder.add_tool(speak)

# ... continue to build the rest of the agent
```

Try this prompt

Open the workspace to execute this prompt with free credits, or use your own API keys for unlimited usage.

Usage Tips

Copy the prompt and paste it into your preferred AI tool (Claude, ChatGPT, Gemini)

Customize placeholder values with your specific requirements and context

For best results, provide clear examples and test different variations