Google ADK

Integrating Google ADK with Agentipy

This guide demonstrates how to integrate Google's Agent Development Kit (ADK) with Agentipy to create intelligent agents that can interact with blockchain networks.

Prerequisites

  • Python 3.9+

  • A Solana wallet private key

  • Google API key

Setup

  1. Install required packages

pip install agentipy google-adk python-dotenv
  1. Create an environment file

Create a .env file in your project root with the following variables:

PRIVATE_KEY=your_solana_private_key
GOOGLE_GENAI_USE_VERTEXAI=FALSE
GOOGLE_API_KEY=your_google_api_key

Folder Structure

Basic Structure

The integration follows these key steps:

  1. Create your AgentiPy kit for the specific blockchain

  2. Define domain-specific tools/functions

  3. Create a Google LlmAgent and provide your tools

  4. Set the LlmAgent as your root agent

Example: Solana Balance Checker

Running Your Agent

Create a file named main.py to run your agent:

To ensure proper execution, utilize either adk web or adk run commands. Confirm execution from the root folder

Extending Your Agent

You can add more tools to your agent by:

  1. Creating additional functions that use the AgentiPy kit

  2. Adding these functions to your LlmAgent's tools list

Example of adding a token transfer tool:

Best Practices

  1. Error Handling: Always include proper error handling in your tool functions

  2. Documentation: Provide clear docstrings for all tools

  3. Environment Variables: Keep sensitive information in environment variables

  4. Modular Design: Create specific agents for different functionalities

  5. Testing: Test your agents with various inputs before deployment

Resources

Last updated