Feat(Expansion Pack): Part 1 - Google Cloud Setup
This commit is contained in:
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 181 KiB |
@@ -0,0 +1,13 @@
|
|||||||
|
# 1. Create new Google Cloud Project
|
||||||
|
gcloud projects create {{PROJECT_ID}} --name="{{COMPANY_NAME}} AI Agent System"
|
||||||
|
|
||||||
|
# 2. Set default project
|
||||||
|
gcloud config set project {{PROJECT_ID}}
|
||||||
|
|
||||||
|
# 3. Enable required APIs
|
||||||
|
gcloud services enable aiplatform.googleapis.com
|
||||||
|
gcloud services enable storage.googleapis.com
|
||||||
|
gcloud services enable cloudfunctions.googleapis.com
|
||||||
|
gcloud services enable run.googleapis.com
|
||||||
|
gcloud services enable firestore.googleapis.com
|
||||||
|
gcloud services enable secretmanager.googleapis.com
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# 1. Create new Google Cloud Project
|
||||||
|
gcloud projects create {{PROJECT_ID}} --name="{{COMPANY_NAME}} AI Agent System"
|
||||||
|
|
||||||
|
# 2. Set default project
|
||||||
|
gcloud config set project {{PROJECT_ID}}
|
||||||
|
|
||||||
|
# 3. Enable required APIs
|
||||||
|
gcloud services enable aiplatform.googleapis.com
|
||||||
|
gcloud services enable storage.googleapis.com
|
||||||
|
gcloud services enable cloudfunctions.googleapis.com
|
||||||
|
gcloud services enable run.googleapis.com
|
||||||
|
gcloud services enable firestore.googleapis.com
|
||||||
|
gcloud services enable secretmanager.googleapis.com
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{{company_name}}-ai-agents/
|
||||||
|
├── agents/
|
||||||
|
│ ├── __init__.py
|
||||||
|
│ ├── {{team_1}}/
|
||||||
|
│ │ ├── __init__.py
|
||||||
|
│ │ ├── {{agent_1}}.py
|
||||||
|
│ │ └── {{agent_2}}.py
|
||||||
|
│ └── {{team_2}}/
|
||||||
|
├── tasks/
|
||||||
|
│ ├── __init__.py
|
||||||
|
│ ├── {{task_category_1}}/
|
||||||
|
│ └── {{task_category_2}}/
|
||||||
|
├── templates/
|
||||||
|
│ ├── {{document_type_1}}/
|
||||||
|
│ └── {{document_type_2}}/
|
||||||
|
├── checklists/
|
||||||
|
├── data/
|
||||||
|
├── workflows/
|
||||||
|
├── config/
|
||||||
|
│ ├── settings.py
|
||||||
|
│ └── agent_config.yaml
|
||||||
|
├── main.py
|
||||||
|
└── deployment/
|
||||||
|
├── Dockerfile
|
||||||
|
└── cloudbuild.yaml
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import os
|
||||||
|
from pydantic import BaseSettings
|
||||||
|
|
||||||
|
class Settings(BaseSettings):
|
||||||
|
# Google Cloud Configuration
|
||||||
|
project_id: str = "{{PROJECT_ID}}"
|
||||||
|
location: str = "{{LOCATION}}" # e.g., "us-central1"
|
||||||
|
|
||||||
|
# Company Information
|
||||||
|
company_name: str = "{{COMPANY_NAME}}"
|
||||||
|
industry: str = "{{INDUSTRY}}"
|
||||||
|
business_type: str = "{{BUSINESS_TYPE}}"
|
||||||
|
|
||||||
|
# Agent Configuration
|
||||||
|
default_model: str = "gemini-1.5-pro"
|
||||||
|
max_iterations: int = 10
|
||||||
|
timeout_seconds: int = 300
|
||||||
|
|
||||||
|
# Storage Configuration
|
||||||
|
bucket_name: str = "{{COMPANY_NAME}}-ai-agents-storage"
|
||||||
|
database_name: str = "{{COMPANY_NAME}}-ai-agents-db"
|
||||||
|
|
||||||
|
# API Configuration
|
||||||
|
session_service_type: str = "vertex" # or "in_memory" for development
|
||||||
|
artifact_service_type: str = "gcs" # or "in_memory" for development
|
||||||
|
memory_service_type: str = "vertex" # or "in_memory" for development
|
||||||
|
|
||||||
|
# Security
|
||||||
|
service_account_path: str = "./{{COMPANY_NAME}}-ai-agents-key.json"
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
env_file = ".env"
|
||||||
|
|
||||||
|
settings = Settings()
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import asyncio
|
||||||
|
from google.adk.agents import LlmAgent
|
||||||
|
from google.adk.runners import Runner
|
||||||
|
from google.adk.sessions import VertexAiSessionService
|
||||||
|
from google.adk.artifacts import GcsArtifactService
|
||||||
|
from google.adk.memory import VertexAiRagMemoryService
|
||||||
|
from google.adk.models import Gemini
|
||||||
|
|
||||||
|
from config.settings import settings
|
||||||
|
from agents.{{primary_team}}.{{main_orchestrator}} import {{MainOrchestratorClass}}
|
||||||
|
|
||||||
|
class {{CompanyName}}AISystem:
|
||||||
|
def __init__(self):
|
||||||
|
self.settings = settings
|
||||||
|
self.runner = None
|
||||||
|
self.main_orchestrator = None
|
||||||
|
|
||||||
|
async def initialize(self):
|
||||||
|
"""Initialize the AI agent system"""
|
||||||
|
|
||||||
|
# Create main orchestrator
|
||||||
|
self.main_orchestrator = {{MainOrchestratorClass}}()
|
||||||
|
|
||||||
|
# Initialize services
|
||||||
|
session_service = VertexAiSessionService(
|
||||||
|
project=self.settings.project_id,
|
||||||
|
location=self.settings.location
|
||||||
|
)
|
||||||
|
|
||||||
|
artifact_service = GcsArtifactService(
|
||||||
|
bucket_name=self.settings.bucket_name
|
||||||
|
)
|
||||||
|
|
||||||
|
memory_service = VertexAiRagMemoryService(
|
||||||
|
rag_corpus=f"projects/{self.settings.project_id}/locations/{self.settings.location}/ragCorpora/{{COMPANY_NAME}}-knowledge"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create runner
|
||||||
|
self.runner = Runner(
|
||||||
|
app_name=f"{self.settings.company_name}-AI-System",
|
||||||
|
agent=self.main_orchestrator,
|
||||||
|
session_service=session_service,
|
||||||
|
artifact_service=artifact_service,
|
||||||
|
memory_service=memory_service
|
||||||
|
)
|
||||||
|
|
||||||
|
print(f"✅ {self.settings.company_name} AI Agent System initialized successfully!")
|
||||||
|
|
||||||
|
async def run_agent_interaction(self, user_id: str, session_id: str, message: str):
|
||||||
|
"""Run agent interaction"""
|
||||||
|
if not self.runner:
|
||||||
|
await self.initialize()
|
||||||
|
|
||||||
|
async for event in self.runner.run_async(
|
||||||
|
user_id=user_id,
|
||||||
|
session_id=session_id,
|
||||||
|
new_message=message
|
||||||
|
):
|
||||||
|
yield event
|
||||||
|
|
||||||
|
# Application factory
|
||||||
|
async def create_app():
|
||||||
|
ai_system = {{CompanyName}}AISystem()
|
||||||
|
await ai_system.initialize()
|
||||||
|
return ai_system
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# Development server
|
||||||
|
import uvicorn
|
||||||
|
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
steps:
|
||||||
|
# Build the container image
|
||||||
|
- name: 'gcr.io/cloud-builders/docker'
|
||||||
|
args: ['build', '-t', 'gcr.io/{{PROJECT_ID}}/{{COMPANY_NAME}}-ai-agents:$COMMIT_SHA', '.']
|
||||||
|
|
||||||
|
# Push the container image to Container Registry
|
||||||
|
- name: 'gcr.io/cloud-builders/docker'
|
||||||
|
args: ['push', 'gcr.io/{{PROJECT_ID}}/{{COMPANY_NAME}}-ai-agents:$COMMIT_SHA']
|
||||||
|
|
||||||
|
# Deploy container image to Cloud Run
|
||||||
|
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
|
||||||
|
entrypoint: gcloud
|
||||||
|
args:
|
||||||
|
- 'run'
|
||||||
|
- 'deploy'
|
||||||
|
- '{{COMPANY_NAME}}-ai-agents'
|
||||||
|
- '--image'
|
||||||
|
- 'gcr.io/{{PROJECT_ID}}/{{COMPANY_NAME}}-ai-agents:$COMMIT_SHA'
|
||||||
|
- '--region'
|
||||||
|
- '{{LOCATION}}'
|
||||||
|
- '--platform'
|
||||||
|
- 'managed'
|
||||||
|
- '--allow-unauthenticated'
|
||||||
|
|
||||||
|
images:
|
||||||
|
- 'gcr.io/{{PROJECT_ID}}/{{COMPANY_NAME}}-ai-agents:$COMMIT_SHA'
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
# BMad Expansion Pack: Google Cloud Vertex AI Agent System
|
||||||
|
|
||||||
|
[](https://opensource.org/licenses/MIT)
|
||||||
|
[](https://www.google.com/search?q=https://github.com/antmikinka/BMAD-METHOD)
|
||||||
|
[](https://cloud.google.com/)
|
||||||
|
|
||||||
|
This expansion pack provides a complete, deployable starter kit for building and hosting sophisticated AI agent systems on Google Cloud Platform (GCP). It bridges the gap between the BMad Method's natural language framework and a production-ready cloud environment, leveraging Google Vertex AI, Cloud Run, and the Google Agent Development Kit (ADK).
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
* **Automated GCP Setup**: `gcloud` scripts to configure your project, service accounts, and required APIs in minutes.
|
||||||
|
* **Production-Ready Deployment**: Includes a `Dockerfile` and `cloudbuild.yaml` for easy, repeatable deployments to Google Cloud Run.
|
||||||
|
* **Rich Template Library**: A comprehensive set of BMad-compatible templates for Teams, Agents, Tasks, Workflows, Documents, and Checklists.
|
||||||
|
* **Pre-configured Agent Roles**: Includes powerful master templates for key agent archetypes like Orchestrators and Specialists.
|
||||||
|
* **Highly Customizable**: Easily adapt the entire system with company-specific variables and industry-specific configurations.
|
||||||
|
* **Powered by Google ADK**: Built on the official Google Agent Development Kit for robust and native integration with Vertex AI services.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
Before you begin, ensure you have the following installed and configured:
|
||||||
|
|
||||||
|
* A Google Cloud Platform (GCP) Account with an active billing account.
|
||||||
|
* The [Google Cloud SDK (`gcloud` CLI)](https://www.google.com/search?q=%5Bhttps://cloud.google.com/sdk/docs/install%5D\(https://cloud.google.com/sdk/docs/install\)) installed and authenticated.
|
||||||
|
* [Docker](https://www.docker.com/products/docker-desktop/) installed on your local machine.
|
||||||
|
* Python 3.11+
|
||||||
|
|
||||||
|
## Quick Start Guide
|
||||||
|
|
||||||
|
Follow these steps to get your own AI agent system running on Google Cloud.
|
||||||
|
|
||||||
|
### 1\. Configure Setup Variables
|
||||||
|
|
||||||
|
The setup scripts use placeholder variables. Before running them, open the files in the `/scripts` directory and replace the following placeholders with your own values:
|
||||||
|
|
||||||
|
* `{{PROJECT_ID}}`: Your unique Google Cloud project ID.
|
||||||
|
* `{{COMPANY_NAME}}`: Your company or project name (used for naming resources).
|
||||||
|
* `{{LOCATION}}`: The GCP region you want to deploy to (e.g., `us-central1`).
|
||||||
|
|
||||||
|
### 2\. Run the GCP Setup Scripts
|
||||||
|
|
||||||
|
Execute the setup scripts to prepare your Google Cloud environment.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Navigate to the scripts directory
|
||||||
|
cd scripts/
|
||||||
|
|
||||||
|
# Run the project configuration script
|
||||||
|
sh 1-initial-project-config.sh
|
||||||
|
|
||||||
|
# Run the service account setup script
|
||||||
|
sh 2-service-account-setup.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
These scripts will enable the necessary APIs, create a service account, assign permissions, and download a JSON key file required for authentication.
|
||||||
|
|
||||||
|
### 3\. Install Python Dependencies
|
||||||
|
|
||||||
|
Install the required Python packages for the application.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# From the root of the expansion pack
|
||||||
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4\. Deploy to Cloud Run
|
||||||
|
|
||||||
|
Deploy the entire agent system as a serverless application using Cloud Build.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# From the root of the expansion pack
|
||||||
|
gcloud builds submit --config deployment/cloudbuild.yaml .
|
||||||
|
```
|
||||||
|
|
||||||
|
This command will build the Docker container, push it to the Google Container Registry, and deploy it to Cloud Run. Your agent system is now live\!
|
||||||
|
|
||||||
|
## How to Use
|
||||||
|
|
||||||
|
Once deployed, the power of this system lies in its natural language templates.
|
||||||
|
|
||||||
|
1. **Define Your Organization**: Go to `/templates/teams` and use the templates to define your agent teams (e.g., Product Development, Operations).
|
||||||
|
2. **Customize Your Agents**: In `/templates/agents`, use the `Master-Agent-Template.yaml` to create new agents or customize the existing Orchestrator and Specialist templates. Define their personas, skills, and commands in plain English.
|
||||||
|
3. **Build Your Workflows**: In `/templates/workflows`, link agents and tasks together to create complex, automated processes.
|
||||||
|
|
||||||
|
The deployed application reads these YAML and Markdown files to dynamically construct and run your AI workforce. When you update a template, your live agents automatically adopt the new behaviors.
|
||||||
|
|
||||||
|
## What's Included
|
||||||
|
|
||||||
|
This expansion pack has a comprehensive structure to get you started:
|
||||||
|
|
||||||
|
```
|
||||||
|
/
|
||||||
|
├── deployment/ # Dockerfile and cloudbuild.yaml for deployment
|
||||||
|
├── scripts/ # GCP setup scripts (project config, service accounts)
|
||||||
|
├── src/ # Python source code (main.py, settings.py)
|
||||||
|
├── templates/
|
||||||
|
│ ├── agents/ # Master, Orchestrator, Specialist agent templates
|
||||||
|
│ ├── teams/ # Team structure templates
|
||||||
|
│ ├── tasks/ # Generic and specialized task templates
|
||||||
|
│ ├── documents/ # Document and report templates
|
||||||
|
│ ├── checklists/ # Quality validation checklists
|
||||||
|
│ ├── workflows/ # Workflow definition templates
|
||||||
|
│ └── ...and more
|
||||||
|
├── config/ # Customization guides and variable files
|
||||||
|
└── requirements.txt # Python package dependencies
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Contributions are welcome\! Please follow the main project's `CONTRIBUTING.md` guidelines. For major changes or new features for this expansion pack, please open an issue or discussion first.
|
||||||
Reference in New Issue
Block a user