Skip to content

Commit 5d7d7c9

Browse files
authored
Merge pull request bmad-code-org#369 from antmikinka/pr/part-1-gcp-setup
Feat(Expansion Pack): Part 1 - Google Cloud Setup
2 parents dd2b4ed + c7fc5d3 commit 5d7d7c9

File tree

8 files changed

+392
-0
lines changed

8 files changed

+392
-0
lines changed

expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/Complete AI Agent System - Flowchart.svg

Lines changed: 102 additions & 0 deletions
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# 1. Create new Google Cloud Project
2+
gcloud projects create {{PROJECT_ID}} --name="{{COMPANY_NAME}} AI Agent System"
3+
4+
# 2. Set default project
5+
gcloud config set project {{PROJECT_ID}}
6+
7+
# 3. Enable required APIs
8+
gcloud services enable aiplatform.googleapis.com
9+
gcloud services enable storage.googleapis.com
10+
gcloud services enable cloudfunctions.googleapis.com
11+
gcloud services enable run.googleapis.com
12+
gcloud services enable firestore.googleapis.com
13+
gcloud services enable secretmanager.googleapis.com
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# 1. Create new Google Cloud Project
2+
gcloud projects create {{PROJECT_ID}} --name="{{COMPANY_NAME}} AI Agent System"
3+
4+
# 2. Set default project
5+
gcloud config set project {{PROJECT_ID}}
6+
7+
# 3. Enable required APIs
8+
gcloud services enable aiplatform.googleapis.com
9+
gcloud services enable storage.googleapis.com
10+
gcloud services enable cloudfunctions.googleapis.com
11+
gcloud services enable run.googleapis.com
12+
gcloud services enable firestore.googleapis.com
13+
gcloud services enable secretmanager.googleapis.com
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{{company_name}}-ai-agents/
2+
├── agents/
3+
│ ├── __init__.py
4+
│ ├── {{team_1}}/
5+
│ │ ├── __init__.py
6+
│ │ ├── {{agent_1}}.py
7+
│ │ └── {{agent_2}}.py
8+
│ └── {{team_2}}/
9+
├── tasks/
10+
│ ├── __init__.py
11+
│ ├── {{task_category_1}}/
12+
│ └── {{task_category_2}}/
13+
├── templates/
14+
│ ├── {{document_type_1}}/
15+
│ └── {{document_type_2}}/
16+
├── checklists/
17+
├── data/
18+
├── workflows/
19+
├── config/
20+
│ ├── settings.py
21+
│ └── agent_config.yaml
22+
├── main.py
23+
└── deployment/
24+
├── Dockerfile
25+
└── cloudbuild.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import os
2+
from pydantic import BaseSettings
3+
4+
class Settings(BaseSettings):
5+
# Google Cloud Configuration
6+
project_id: str = "{{PROJECT_ID}}"
7+
location: str = "{{LOCATION}}" # e.g., "us-central1"
8+
9+
# Company Information
10+
company_name: str = "{{COMPANY_NAME}}"
11+
industry: str = "{{INDUSTRY}}"
12+
business_type: str = "{{BUSINESS_TYPE}}"
13+
14+
# Agent Configuration
15+
default_model: str = "gemini-1.5-pro"
16+
max_iterations: int = 10
17+
timeout_seconds: int = 300
18+
19+
# Storage Configuration
20+
bucket_name: str = "{{COMPANY_NAME}}-ai-agents-storage"
21+
database_name: str = "{{COMPANY_NAME}}-ai-agents-db"
22+
23+
# API Configuration
24+
session_service_type: str = "vertex" # or "in_memory" for development
25+
artifact_service_type: str = "gcs" # or "in_memory" for development
26+
memory_service_type: str = "vertex" # or "in_memory" for development
27+
28+
# Security
29+
service_account_path: str = "./{{COMPANY_NAME}}-ai-agents-key.json"
30+
31+
class Config:
32+
env_file = ".env"
33+
34+
settings = Settings()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import asyncio
2+
from google.adk.agents import LlmAgent
3+
from google.adk.runners import Runner
4+
from google.adk.sessions import VertexAiSessionService
5+
from google.adk.artifacts import GcsArtifactService
6+
from google.adk.memory import VertexAiRagMemoryService
7+
from google.adk.models import Gemini
8+
9+
from config.settings import settings
10+
from agents.{{primary_team}}.{{main_orchestrator}} import {{MainOrchestratorClass}}
11+
12+
class {{CompanyName}}AISystem:
13+
def __init__(self):
14+
self.settings = settings
15+
self.runner = None
16+
self.main_orchestrator = None
17+
18+
async def initialize(self):
19+
"""Initialize the AI agent system"""
20+
21+
# Create main orchestrator
22+
self.main_orchestrator = {{MainOrchestratorClass}}()
23+
24+
# Initialize services
25+
session_service = VertexAiSessionService(
26+
project=self.settings.project_id,
27+
location=self.settings.location
28+
)
29+
30+
artifact_service = GcsArtifactService(
31+
bucket_name=self.settings.bucket_name
32+
)
33+
34+
memory_service = VertexAiRagMemoryService(
35+
rag_corpus=f"projects/{self.settings.project_id}/locations/{self.settings.location}/ragCorpora/{{COMPANY_NAME}}-knowledge"
36+
)
37+
38+
# Create runner
39+
self.runner = Runner(
40+
app_name=f"{self.settings.company_name}-AI-System",
41+
agent=self.main_orchestrator,
42+
session_service=session_service,
43+
artifact_service=artifact_service,
44+
memory_service=memory_service
45+
)
46+
47+
print(f"✅ {self.settings.company_name} AI Agent System initialized successfully!")
48+
49+
async def run_agent_interaction(self, user_id: str, session_id: str, message: str):
50+
"""Run agent interaction"""
51+
if not self.runner:
52+
await self.initialize()
53+
54+
async for event in self.runner.run_async(
55+
user_id=user_id,
56+
session_id=session_id,
57+
new_message=message
58+
):
59+
yield event
60+
61+
# Application factory
62+
async def create_app():
63+
ai_system = {{CompanyName}}AISystem()
64+
await ai_system.initialize()
65+
return ai_system
66+
67+
if __name__ == "__main__":
68+
# Development server
69+
import uvicorn
70+
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
steps:
2+
# Build the container image
3+
- name: 'gcr.io/cloud-builders/docker'
4+
args: ['build', '-t', 'gcr.io/{{PROJECT_ID}}/{{COMPANY_NAME}}-ai-agents:$COMMIT_SHA', '.']
5+
6+
# Push the container image to Container Registry
7+
- name: 'gcr.io/cloud-builders/docker'
8+
args: ['push', 'gcr.io/{{PROJECT_ID}}/{{COMPANY_NAME}}-ai-agents:$COMMIT_SHA']
9+
10+
# Deploy container image to Cloud Run
11+
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
12+
entrypoint: gcloud
13+
args:
14+
- 'run'
15+
- 'deploy'
16+
- '{{COMPANY_NAME}}-ai-agents'
17+
- '--image'
18+
- 'gcr.io/{{PROJECT_ID}}/{{COMPANY_NAME}}-ai-agents:$COMMIT_SHA'
19+
- '--region'
20+
- '{{LOCATION}}'
21+
- '--platform'
22+
- 'managed'
23+
- '--allow-unauthenticated'
24+
25+
images:
26+
- 'gcr.io/{{PROJECT_ID}}/{{COMPANY_NAME}}-ai-agents:$COMMIT_SHA'
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# BMad Expansion Pack: Google Cloud Vertex AI Agent System
2+
3+
[](https://opensource.org/licenses/MIT)
4+
[](https://www.google.com/search?q=https://github.com/antmikinka/BMAD-METHOD)
5+
[](https://cloud.google.com/)
6+
7+
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).
8+
9+
## Features
10+
11+
* **Automated GCP Setup**: `gcloud` scripts to configure your project, service accounts, and required APIs in minutes.
12+
* **Production-Ready Deployment**: Includes a `Dockerfile` and `cloudbuild.yaml` for easy, repeatable deployments to Google Cloud Run.
13+
* **Rich Template Library**: A comprehensive set of BMad-compatible templates for Teams, Agents, Tasks, Workflows, Documents, and Checklists.
14+
* **Pre-configured Agent Roles**: Includes powerful master templates for key agent archetypes like Orchestrators and Specialists.
15+
* **Highly Customizable**: Easily adapt the entire system with company-specific variables and industry-specific configurations.
16+
* **Powered by Google ADK**: Built on the official Google Agent Development Kit for robust and native integration with Vertex AI services.
17+
18+
## Prerequisites
19+
20+
Before you begin, ensure you have the following installed and configured:
21+
22+
* A Google Cloud Platform (GCP) Account with an active billing account.
23+
* 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.
24+
* [Docker](https://www.docker.com/products/docker-desktop/) installed on your local machine.
25+
* Python 3.11+
26+
27+
## Quick Start Guide
28+
29+
Follow these steps to get your own AI agent system running on Google Cloud.
30+
31+
### 1\. Configure Setup Variables
32+
33+
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:
34+
35+
* `{{PROJECT_ID}}`: Your unique Google Cloud project ID.
36+
* `{{COMPANY_NAME}}`: Your company or project name (used for naming resources).
37+
* `{{LOCATION}}`: The GCP region you want to deploy to (e.g., `us-central1`).
38+
39+
### 2\. Run the GCP Setup Scripts
40+
41+
Execute the setup scripts to prepare your Google Cloud environment.
42+
43+
```bash
44+
# Navigate to the scripts directory
45+
cd scripts/
46+
47+
# Run the project configuration script
48+
sh 1-initial-project-config.sh
49+
50+
# Run the service account setup script
51+
sh 2-service-account-setup.sh
52+
```
53+
54+
These scripts will enable the necessary APIs, create a service account, assign permissions, and download a JSON key file required for authentication.
55+
56+
### 3\. Install Python Dependencies
57+
58+
Install the required Python packages for the application.
59+
60+
```bash
61+
# From the root of the expansion pack
62+
pip install -r requirements.txt
63+
```
64+
65+
### 4\. Deploy to Cloud Run
66+
67+
Deploy the entire agent system as a serverless application using Cloud Build.
68+
69+
```bash
70+
# From the root of the expansion pack
71+
gcloud builds submit --config deployment/cloudbuild.yaml .
72+
```
73+
74+
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\!
75+
76+
## How to Use
77+
78+
Once deployed, the power of this system lies in its natural language templates.
79+
80+
1. **Define Your Organization**: Go to `/templates/teams` and use the templates to define your agent teams (e.g., Product Development, Operations).
81+
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.
82+
3. **Build Your Workflows**: In `/templates/workflows`, link agents and tasks together to create complex, automated processes.
83+
84+
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.
85+
86+
## What's Included
87+
88+
This expansion pack has a comprehensive structure to get you started:
89+
90+
```
91+
/
92+
├── deployment/ # Dockerfile and cloudbuild.yaml for deployment
93+
├── scripts/ # GCP setup scripts (project config, service accounts)
94+
├── src/ # Python source code (main.py, settings.py)
95+
├── templates/
96+
│ ├── agents/ # Master, Orchestrator, Specialist agent templates
97+
│ ├── teams/ # Team structure templates
98+
│ ├── tasks/ # Generic and specialized task templates
99+
│ ├── documents/ # Document and report templates
100+
│ ├── checklists/ # Quality validation checklists
101+
│ ├── workflows/ # Workflow definition templates
102+
│ └── ...and more
103+
├── config/ # Customization guides and variable files
104+
└── requirements.txt # Python package dependencies
105+
```
106+
107+
## Contributing
108+
109+
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.

0 commit comments

Comments
 (0)