Skip to content

bhancockio/deploy-adk-agent-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ADK Short Bot

A Python-based agent that helps shorten messages using Google's Agent Development Kit (ADK) and Vertex AI.

Prerequisites

  • Python 3.12+
  • Poetry (Python package manager)
  • Google Cloud account with Vertex AI API enabled
  • Google Cloud CLI (gcloud) installed and authenticated

Installation

  1. Clone the repository:
git clone https://github.com/bhancockio/deploy-adk-agent-engine.git
cd adk-short-bot
  1. Install Poetry if you haven't already:
curl -sSL https://install.python-poetry.org | python3 -
  1. Install project dependencies:
poetry install
  1. Activate the virtual environment:
source $(poetry env info --path)/bin/activate

Configuration

  1. Create a .env file in the project root with the following variables:
GOOGLE_GENAI_USE_VERTEXAI=TRUE
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_LOCATION=your-location  # e.g., us-central1
GOOGLE_CLOUD_STAGING_BUCKET=gs://your-bucket-name
  1. Set up Google Cloud authentication:
gcloud auth login
gcloud config set project your-project-id
  1. Enable required APIs:
gcloud services enable aiplatform.googleapis.com

Usage

Local Testing

  1. Create a new session:
poetry run deploy-local --create_session
  1. List all sessions:
poetry run deploy-local --list_sessions
  1. Get details of a specific session:
poetry run deploy-local --get_session --session_id=your-session-id
  1. Send a message to shorten:
poetry run deploy-local --send --session_id=your-session-id --message="Shorten this message: Hello, how are you doing today?"

Remote Deployment

  1. Deploy the agent:
poetry run deploy-remote --create
  1. Create a session:
poetry run deploy-remote --create_session --resource_id=your-resource-id
  1. List sessions:
poetry run deploy-remote --list_sessions --resource_id=your-resource-id
  1. Send a message:
poetry run deploy-remote --send --resource_id=your-resource-id --session_id=your-session-id --message="Hello, how are you doing today? So far, I've made breakfast today, walkted dogs, and went to work."
  1. Clean up (delete deployment):
poetry run deploy-remote --delete --resource_id=your-resource-id

Project Structure

adk-short-bot/
├── adk_short_bot/          # Main package directory
│   ├── __init__.py
│   ├── agent.py           # Agent implementation
│   └── prompt.py          # Prompt templates
├── deployment/            # Deployment scripts
│   ├── local.py          # Local testing script
│   └── remote.py         # Remote deployment script
├── .env                  # Environment variables
├── poetry.lock          # Poetry lock file
└── pyproject.toml       # Project configuration

Development

To add new features or modify existing ones:

  1. Make your changes in the relevant files
  2. Test locally using the local deployment script
  3. Deploy to remote using the remote deployment script
  4. Update documentation as needed

Troubleshooting

  1. If you encounter authentication issues:

    • Ensure you're logged in with gcloud auth login
    • Verify your project ID and location in .env
    • Check that the Vertex AI API is enabled
  2. If deployment fails:

    • Check the staging bucket exists and is accessible
    • Verify all required environment variables are set
    • Ensure you have the necessary permissions in your Google Cloud project

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

[Your chosen license]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages