Initial commit
This commit is contained in:
15
.claude-plugin/plugin.json
Normal file
15
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "004-jeremy-google-cloud-agent-sdk",
|
||||
"description": "Google Cloud Agent Development Kit (ADK) and Agent Starter Pack mastery - build containerized multi-agent systems with production-ready templates, deploy to Cloud Run/GKE/Agent Engine, RAG agents, ReAct agents, and multi-agent orchestration.",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Jeremy Longshore",
|
||||
"email": "jeremy@intentsolutions.io"
|
||||
},
|
||||
"skills": [
|
||||
"./skills"
|
||||
],
|
||||
"commands": [
|
||||
"./commands"
|
||||
]
|
||||
}
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# 004-jeremy-google-cloud-agent-sdk
|
||||
|
||||
Google Cloud Agent Development Kit (ADK) and Agent Starter Pack mastery - build containerized multi-agent systems with production-ready templates, deploy to Cloud Run/GKE/Agent Engine, RAG agents, ReAct agents, and multi-agent orchestration.
|
||||
376
commands/create-agent.md
Normal file
376
commands/create-agent.md
Normal file
@@ -0,0 +1,376 @@
|
||||
---
|
||||
name: create-agent
|
||||
description: Create a production-ready Google Cloud agent using ADK and Agent Starter Pack with CI/CD, deployment, and testing infrastructure
|
||||
model: sonnet
|
||||
---
|
||||
|
||||
# Create Production-Ready Google Cloud Agent
|
||||
|
||||
Scaffold a complete agent project using Google's Agent Development Kit (ADK) and Agent Starter Pack with production-ready infrastructure.
|
||||
|
||||
## What This Does
|
||||
|
||||
1. **Choose Agent Template**: Select from 5 production templates
|
||||
2. **Configure Deployment**: Select deployment target (Cloud Run, GKE, Agent Engine)
|
||||
3. **Generate Project**: Create complete project structure with CI/CD
|
||||
4. **Setup Instructions**: Provide step-by-step deployment guide
|
||||
|
||||
## Available Templates
|
||||
|
||||
### 1. adk_base (ReAct Agent)
|
||||
**Best for**: General-purpose agents with tool use
|
||||
**Includes**: Search, code execution, custom tools
|
||||
**Use case**: Q&A agents, research assistants, task automation
|
||||
|
||||
### 2. agentic_rag (RAG Agent)
|
||||
**Best for**: Document-based Q&A
|
||||
**Includes**: Vertex AI Search, Vector Search integration
|
||||
**Use case**: Knowledge bases, documentation agents, customer support
|
||||
|
||||
### 3. langgraph_base_react (LangGraph)
|
||||
**Best for**: Complex workflows with state management
|
||||
**Includes**: LangGraph orchestration, custom nodes
|
||||
**Use case**: Multi-step processes, conditional logic, state tracking
|
||||
|
||||
### 4. crewai_coding_crew (Multi-Agent)
|
||||
**Best for**: Collaborative multi-agent systems
|
||||
**Includes**: Specialized agents, role-based coordination
|
||||
**Use case**: Software development, research teams, content creation
|
||||
|
||||
### 5. adk_live (Multimodal RAG)
|
||||
**Best for**: Audio/video/text processing
|
||||
**Includes**: Multimodal understanding, live streaming
|
||||
**Use case**: Video analysis, audio transcription, media processing
|
||||
|
||||
## Deployment Targets
|
||||
|
||||
### Cloud Run (Serverless)
|
||||
**Pros:**
|
||||
- Automatic scaling 0→N
|
||||
- Pay-per-use pricing
|
||||
- Fast deployment
|
||||
- Custom domains
|
||||
|
||||
**Cons:**
|
||||
- 60-minute timeout
|
||||
- Limited memory (8GB max)
|
||||
|
||||
**Best for:** Web-facing agents, APIs, low-traffic services
|
||||
|
||||
### Agent Engine (Managed)
|
||||
**Pros:**
|
||||
- Fully managed runtime
|
||||
- Built-in observability
|
||||
- Auto-scaling
|
||||
- Integrated with Vertex AI
|
||||
|
||||
**Cons:**
|
||||
- Vertex AI pricing
|
||||
- Less customization
|
||||
|
||||
**Best for:** Production agents, high-scale deployment
|
||||
|
||||
### GKE (Kubernetes)
|
||||
**Pros:**
|
||||
- Full control
|
||||
- Advanced networking
|
||||
- Resource management
|
||||
- Multi-cluster
|
||||
|
||||
**Cons:**
|
||||
- Higher complexity
|
||||
- Cluster management overhead
|
||||
|
||||
**Best for:** Complex multi-agent systems, enterprise deployment
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
/create-agent
|
||||
```
|
||||
|
||||
Then provide:
|
||||
- Agent name
|
||||
- Template choice
|
||||
- Deployment target
|
||||
- GCP project ID
|
||||
- Region preference
|
||||
|
||||
## Example Workflow
|
||||
|
||||
**Input:**
|
||||
```
|
||||
Agent name: customer-support-agent
|
||||
Template: agentic_rag
|
||||
Deployment: cloud_run
|
||||
Project: my-gcp-project
|
||||
Region: us-central1
|
||||
```
|
||||
|
||||
**Generated Structure:**
|
||||
```
|
||||
customer-support-agent/
|
||||
├── src/
|
||||
│ ├── agent.py # Main agent implementation
|
||||
│ ├── tools/
|
||||
│ │ ├── search_tool.py
|
||||
│ │ └── custom_tools.py
|
||||
│ ├── config.py # Configuration
|
||||
│ └── prompts/
|
||||
│ └── system_prompt.txt
|
||||
├── deployment/
|
||||
│ ├── Dockerfile
|
||||
│ ├── cloudbuild.yaml
|
||||
│ ├── cloud-run.yaml
|
||||
│ └── terraform/
|
||||
│ ├── main.tf
|
||||
│ ├── variables.tf
|
||||
│ └── outputs.tf
|
||||
├── tests/
|
||||
│ ├── unit/
|
||||
│ │ ├── test_agent.py
|
||||
│ │ └── test_tools.py
|
||||
│ └── integration/
|
||||
│ └── test_e2e.py
|
||||
├── .github/workflows/
|
||||
│ ├── test.yaml # CI testing
|
||||
│ └── deploy.yaml # CD deployment
|
||||
├── requirements.txt
|
||||
├── pyproject.toml
|
||||
├── README.md
|
||||
└── .env.example
|
||||
```
|
||||
|
||||
## Step-by-Step Deployment
|
||||
|
||||
### 1. Install Dependencies
|
||||
```bash
|
||||
cd customer-support-agent
|
||||
python -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### 2. Configure GCP
|
||||
```bash
|
||||
# Authenticate
|
||||
gcloud auth login
|
||||
gcloud config set project my-gcp-project
|
||||
|
||||
# Enable APIs
|
||||
gcloud services enable \
|
||||
aiplatform.googleapis.com \
|
||||
run.googleapis.com \
|
||||
cloudbuild.googleapis.com
|
||||
```
|
||||
|
||||
### 3. Set Up Environment
|
||||
```bash
|
||||
# Copy example env
|
||||
cp .env.example .env
|
||||
|
||||
# Edit with your values
|
||||
vim .env
|
||||
```
|
||||
|
||||
**Required variables:**
|
||||
```env
|
||||
GOOGLE_CLOUD_PROJECT=my-gcp-project
|
||||
GOOGLE_CLOUD_REGION=us-central1
|
||||
GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
|
||||
VERTEX_AI_SEARCH_DATASTORE=datastore-id
|
||||
```
|
||||
|
||||
### 4. Test Locally
|
||||
```bash
|
||||
# Run agent locally
|
||||
python src/agent.py
|
||||
|
||||
# Or use ADK CLI
|
||||
adk serve --port 8080
|
||||
|
||||
# Test endpoint
|
||||
curl http://localhost:8080/query \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"question": "What are your support hours?"}'
|
||||
```
|
||||
|
||||
### 5. Run Tests
|
||||
```bash
|
||||
# Unit tests
|
||||
pytest tests/unit/
|
||||
|
||||
# Integration tests
|
||||
pytest tests/integration/
|
||||
|
||||
# Coverage report
|
||||
pytest --cov=src tests/
|
||||
```
|
||||
|
||||
### 6. Deploy to Cloud Run
|
||||
```bash
|
||||
# Using ADK CLI (recommended)
|
||||
adk deploy \
|
||||
--target cloud_run \
|
||||
--region us-central1 \
|
||||
--allow-unauthenticated
|
||||
|
||||
# Or using gcloud
|
||||
gcloud run deploy customer-support-agent \
|
||||
--source . \
|
||||
--region us-central1 \
|
||||
--allow-unauthenticated \
|
||||
--memory 2Gi \
|
||||
--cpu 2 \
|
||||
--timeout 300s
|
||||
```
|
||||
|
||||
### 7. Setup CI/CD
|
||||
```bash
|
||||
# Connect GitHub repo
|
||||
gh repo create customer-support-agent --public
|
||||
git init
|
||||
git add .
|
||||
git commit -m "Initial agent setup"
|
||||
git branch -M main
|
||||
git remote add origin https://github.com/USER/customer-support-agent.git
|
||||
git push -u origin main
|
||||
|
||||
# GitHub Actions automatically trigger on push
|
||||
```
|
||||
|
||||
### 8. Monitor Deployment
|
||||
```bash
|
||||
# View logs
|
||||
gcloud run services logs read customer-support-agent \
|
||||
--region us-central1 \
|
||||
--limit 100 \
|
||||
--format json
|
||||
|
||||
# Check metrics
|
||||
gcloud monitoring dashboards create \
|
||||
--config-from-file monitoring/dashboard.json
|
||||
```
|
||||
|
||||
## Advanced Features
|
||||
|
||||
### RAG Integration
|
||||
```python
|
||||
# Automatically included in agentic_rag template
|
||||
from vertexai.preview.rag import VectorSearchTool
|
||||
|
||||
vector_search = VectorSearchTool(
|
||||
index_endpoint="projects/PROJECT/locations/REGION/indexEndpoints/INDEX",
|
||||
deployed_index_id="deployed_index"
|
||||
)
|
||||
|
||||
agent.add_tool(vector_search)
|
||||
```
|
||||
|
||||
### Multi-Agent Orchestration
|
||||
```python
|
||||
# Automatically included in crewai_coding_crew template
|
||||
from crewai import Agent, Task, Crew
|
||||
|
||||
researcher = Agent(
|
||||
role="Researcher",
|
||||
goal="Research technical topics",
|
||||
tools=[search_tool]
|
||||
)
|
||||
|
||||
writer = Agent(
|
||||
role="Writer",
|
||||
goal="Write documentation",
|
||||
tools=[write_tool]
|
||||
)
|
||||
|
||||
crew = Crew(
|
||||
agents=[researcher, writer],
|
||||
tasks=[research_task, write_task]
|
||||
)
|
||||
```
|
||||
|
||||
### Custom Tools
|
||||
```python
|
||||
# Add custom tools to any agent
|
||||
from vertexai.preview.agents import FunctionTool
|
||||
|
||||
@FunctionTool
|
||||
def check_inventory(product_id: str) -> dict:
|
||||
"""Check product inventory levels"""
|
||||
# Your custom logic
|
||||
return {"in_stock": True, "quantity": 42}
|
||||
|
||||
agent.add_tool(check_inventory)
|
||||
```
|
||||
|
||||
## Cost Estimation
|
||||
|
||||
**Development:**
|
||||
- Local testing: Free
|
||||
- CI/CD (GitHub Actions): Free (2000 min/month)
|
||||
|
||||
**Production (Cloud Run):**
|
||||
- Idle: $0 (scales to zero)
|
||||
- Active: ~$0.10/hour at moderate load
|
||||
- Gemini API: $3.50/1M tokens
|
||||
|
||||
**Monthly estimate for typical agent:**
|
||||
- Infrastructure: $50-100
|
||||
- AI API costs: $100-300
|
||||
- Total: $150-400/month
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
**1. Authentication Errors**
|
||||
```bash
|
||||
# Fix: Set credentials
|
||||
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
|
||||
gcloud auth application-default login
|
||||
```
|
||||
|
||||
**2. Timeout Errors**
|
||||
```bash
|
||||
# Fix: Increase Cloud Run timeout
|
||||
gcloud run services update customer-support-agent \
|
||||
--timeout 300s
|
||||
```
|
||||
|
||||
**3. Memory Issues**
|
||||
```bash
|
||||
# Fix: Increase memory
|
||||
gcloud run services update customer-support-agent \
|
||||
--memory 4Gi
|
||||
```
|
||||
|
||||
**4. Rate Limiting**
|
||||
```bash
|
||||
# Fix: Implement exponential backoff
|
||||
# Code automatically included in templates
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
After deployment:
|
||||
1. **Add custom tools** for your use case
|
||||
2. **Configure RAG data sources** (if using agentic_rag)
|
||||
3. **Set up monitoring alerts**
|
||||
4. **Implement evaluation metrics**
|
||||
5. **Scale based on traffic**
|
||||
|
||||
## Resources
|
||||
|
||||
**Documentation:**
|
||||
- ADK Quickstart: https://google.github.io/adk-docs/
|
||||
- Agent Starter Pack: https://github.com/GoogleCloudPlatform/agent-starter-pack
|
||||
- Cloud Run Docs: https://cloud.google.com/run/docs
|
||||
|
||||
**Examples:**
|
||||
- Agent Gallery: https://cloud.google.com/vertex-ai/generative-ai/docs/samples
|
||||
- GitHub Samples: https://github.com/GoogleCloudPlatform/generative-ai
|
||||
|
||||
---
|
||||
|
||||
**This command scaffolds production-ready agent projects in <5 minutes with full CI/CD, testing, and deployment automation.**
|
||||
61
plugin.lock.json
Normal file
61
plugin.lock.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/productivity/004-jeremy-google-cloud-agent-sdk",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "156f0162d98d3d4e34356274f2a6a3891e4f10d7",
|
||||
"treeHash": "fd59a4e88bd1356e48c63f8415022905ab54a8bb1181a9a3052928601d784ef0",
|
||||
"generatedAt": "2025-11-28T10:18:02.285330Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "004-jeremy-google-cloud-agent-sdk",
|
||||
"description": "Google Cloud Agent Development Kit (ADK) and Agent Starter Pack mastery - build containerized multi-agent systems with production-ready templates, deploy to Cloud Run/GKE/Agent Engine, RAG agents, ReAct agents, and multi-agent orchestration.",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "702484aff7b742b872677177791a9ced7e9d71953118a59d291aedbf41e93868"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "3d5c586be4c5bf914a39a52cfba8bed88fe8425c03d3fce13bf1e8ac53785cb4"
|
||||
},
|
||||
{
|
||||
"path": "commands/create-agent.md",
|
||||
"sha256": "221851c3671fcc66e1ed7807b621407b6b7fd8975e73a37f775429cb50cd37e9"
|
||||
},
|
||||
{
|
||||
"path": "skills/agent-sdk-master/SKILL.md",
|
||||
"sha256": "7e27a38edbdc140cd508b7283de121603ec54558e0a811980fb2a1e92a95698f"
|
||||
},
|
||||
{
|
||||
"path": "skills/agent-sdk-master/references/README.md",
|
||||
"sha256": "db9680278e03728fef93321fc76c435387bc0c8fe1dcc9870bdf2fa236ea8ac3"
|
||||
},
|
||||
{
|
||||
"path": "skills/agent-sdk-master/scripts/README.md",
|
||||
"sha256": "f042646ad5b685556c044080a6b73202a490fb8288be8219328faefc12d5a30e"
|
||||
},
|
||||
{
|
||||
"path": "skills/agent-sdk-master/assets/README.md",
|
||||
"sha256": "33bfb083485b48c78a1738368c52cd9f202724a414bce507db181d8291b83aec"
|
||||
}
|
||||
],
|
||||
"dirSha256": "fd59a4e88bd1356e48c63f8415022905ab54a8bb1181a9a3052928601d784ef0"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
511
skills/agent-sdk-master/SKILL.md
Normal file
511
skills/agent-sdk-master/SKILL.md
Normal file
@@ -0,0 +1,511 @@
|
||||
---
|
||||
name: Google Cloud Agent SDK Master
|
||||
description: |
|
||||
Automatic activation for ALL Google Cloud Agent Development Kit (ADK) and Agent Starter Pack operations - multi-agent systems, containerized deployment, RAG agents, and production orchestration.
|
||||
**TRIGGER PHRASES:**
|
||||
- "adk", "agent development kit", "agent starter pack", "multi-agent", "build agent"
|
||||
- "cloud run agent", "gke deployment", "agent engine", "containerized agent"
|
||||
- "rag agent", "react agent", "agent orchestration", "agent templates"
|
||||
**AUTO-INVOKES FOR:**
|
||||
- Agent creation and scaffolding
|
||||
- Multi-agent system design
|
||||
- Containerized agent deployment
|
||||
- RAG (Retrieval-Augmented Generation) implementation
|
||||
- CI/CD pipeline setup for agents
|
||||
- Agent evaluation and monitoring
|
||||
allowed-tools: Read, WebFetch, WebSearch, Grep
|
||||
version: 1.0.0
|
||||
---
|
||||
|
||||
# Google Cloud Agent SDK Master - Production-Ready Agent Systems
|
||||
|
||||
This Agent Skill provides comprehensive mastery of Google's Agent Development Kit (ADK) and Agent Starter Pack for building and deploying production-grade containerized agents.
|
||||
|
||||
## Core Capabilities
|
||||
|
||||
### 🤖 Agent Development Kit (ADK)
|
||||
|
||||
**Framework Overview:**
|
||||
- **Open-source Python framework** from Google
|
||||
- Same framework powering Google Agentspace and CES
|
||||
- Build production agents in <100 lines of code
|
||||
- Model-agnostic (optimized for Gemini)
|
||||
- Deployment-agnostic (local, Cloud Run, GKE, Agent Engine)
|
||||
|
||||
**Supported Agent Types:**
|
||||
1. **LLM Agents**: Dynamic routing with intelligence
|
||||
2. **Workflow Agents**:
|
||||
- Sequential: Linear execution
|
||||
- Loop: Iterative processing
|
||||
- Parallel: Concurrent execution
|
||||
3. **Custom Agents**: User-defined implementations
|
||||
4. **Multi-agent Systems**: Hierarchical coordination
|
||||
|
||||
**Key Features:**
|
||||
- Flexible orchestration (workflow & LLM-driven)
|
||||
- Tool ecosystem (search, code execution, custom functions)
|
||||
- Third-party integrations (LangChain, CrewAI)
|
||||
- Agents-as-tools capability
|
||||
- Built-in evaluation framework
|
||||
- Cloud Trace integration
|
||||
|
||||
### 📦 Agent Starter Pack
|
||||
|
||||
**Production Templates:**
|
||||
1. **adk_base** - ReAct agent using ADK
|
||||
2. **agentic_rag** - Document retrieval + Q&A with search
|
||||
3. **langgraph_base_react** - LangGraph ReAct implementation
|
||||
4. **crewai_coding_crew** - Multi-agent coding system
|
||||
5. **adk_live** - Multimodal RAG (audio/video/text)
|
||||
|
||||
**Infrastructure Automation:**
|
||||
- CI/CD setup with single command
|
||||
- GitHub Actions or Cloud Build pipelines
|
||||
- Multi-environment support (dev, staging, prod)
|
||||
- Automated testing and evaluation
|
||||
- Deployment rollback mechanisms
|
||||
|
||||
### 🚀 Deployment Targets
|
||||
|
||||
**1. Vertex AI Agent Engine**
|
||||
- Fully managed runtime
|
||||
- Auto-scaling and load balancing
|
||||
- Built-in observability
|
||||
- Serverless architecture
|
||||
- Best for: Production-scale agents
|
||||
|
||||
**2. Cloud Run**
|
||||
- Containerized serverless
|
||||
- Pay-per-use pricing
|
||||
- Custom domain support
|
||||
- Traffic splitting
|
||||
- Best for: Web-facing agents
|
||||
|
||||
**3. Google Kubernetes Engine (GKE)**
|
||||
- Full container orchestration
|
||||
- Advanced networking
|
||||
- Resource management
|
||||
- Multi-cluster support
|
||||
- Best for: Complex multi-agent systems
|
||||
|
||||
**4. Local/Docker**
|
||||
- Development and testing
|
||||
- Custom infrastructure
|
||||
- On-premises deployment
|
||||
- Best for: POC and debugging
|
||||
|
||||
### 🔧 Technical Implementation
|
||||
|
||||
**Installation:**
|
||||
```bash
|
||||
# Agent Starter Pack (recommended)
|
||||
pip install agent-starter-pack
|
||||
|
||||
# or direct from GitHub
|
||||
uvx agent-starter-pack create my-agent
|
||||
|
||||
# ADK only
|
||||
pip install google-cloud-aiplatform[adk,agent_engines]>=1.111
|
||||
```
|
||||
|
||||
**Create Agent (ADK):**
|
||||
```python
|
||||
from google.cloud.aiplatform import agent
|
||||
from vertexai.preview.agents import ADKAgent
|
||||
|
||||
# Simple ReAct agent
|
||||
@agent.adk_agent
|
||||
class MyAgent(ADKAgent):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
model="gemini-2.5-pro",
|
||||
tools=[search_tool, code_exec_tool]
|
||||
)
|
||||
|
||||
def run(self, query: str):
|
||||
return self.generate(query)
|
||||
|
||||
# Multi-agent orchestration
|
||||
class OrchestratorAgent(ADKAgent):
|
||||
def __init__(self):
|
||||
self.research_agent = ResearchAgent()
|
||||
self.analysis_agent = AnalysisAgent()
|
||||
self.writer_agent = WriterAgent()
|
||||
|
||||
def run(self, task: str):
|
||||
research = self.research_agent.run(task)
|
||||
analysis = self.analysis_agent.run(research)
|
||||
output = self.writer_agent.run(analysis)
|
||||
return output
|
||||
```
|
||||
|
||||
**Using Agent Starter Pack:**
|
||||
```bash
|
||||
# Create project with template
|
||||
uvx agent-starter-pack create my-rag-agent \
|
||||
--template agentic_rag \
|
||||
--deployment cloud_run
|
||||
|
||||
# Generates complete structure:
|
||||
my-rag-agent/
|
||||
├── src/
|
||||
│ ├── agent.py # Agent implementation
|
||||
│ ├── tools/ # Custom tools
|
||||
│ └── config.py # Configuration
|
||||
├── deployment/
|
||||
│ ├── Dockerfile
|
||||
│ ├── cloudbuild.yaml
|
||||
│ └── terraform/
|
||||
├── tests/
|
||||
│ ├── unit_tests.py
|
||||
│ └── integration_tests.py
|
||||
└── .github/workflows/ # CI/CD pipelines
|
||||
```
|
||||
|
||||
**Deploy to Cloud Run:**
|
||||
```bash
|
||||
# Using ADK CLI
|
||||
adk deploy \
|
||||
--target cloud_run \
|
||||
--region us-central1 \
|
||||
--service-account sa@project.iam.gserviceaccount.com
|
||||
|
||||
# Manual with Docker
|
||||
docker build -t gcr.io/PROJECT/agent:latest .
|
||||
docker push gcr.io/PROJECT/agent:latest
|
||||
gcloud run deploy agent \
|
||||
--image gcr.io/PROJECT/agent:latest \
|
||||
--region us-central1 \
|
||||
--allow-unauthenticated
|
||||
```
|
||||
|
||||
**Deploy to Agent Engine:**
|
||||
```bash
|
||||
# Using Agent Starter Pack
|
||||
asp deploy \
|
||||
--env production \
|
||||
--target agent_engine
|
||||
|
||||
# Manual deployment
|
||||
from google.cloud.aiplatform import agent_engines
|
||||
agent_engines.deploy_agent(
|
||||
agent_id="my-agent",
|
||||
project="PROJECT_ID",
|
||||
location="us-central1"
|
||||
)
|
||||
```
|
||||
|
||||
### 📊 RAG Agent Implementation
|
||||
|
||||
**Vector Search Integration:**
|
||||
```python
|
||||
from vertexai.preview.rag import VectorSearchTool
|
||||
from google.cloud import aiplatform
|
||||
|
||||
# Set up vector search
|
||||
vector_search = VectorSearchTool(
|
||||
index_endpoint="projects/PROJECT/locations/LOCATION/indexEndpoints/INDEX_ID",
|
||||
deployed_index_id="deployed_index"
|
||||
)
|
||||
|
||||
# RAG agent with ADK
|
||||
class RAGAgent(ADKAgent):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
model="gemini-2.5-pro",
|
||||
tools=[vector_search, web_search_tool]
|
||||
)
|
||||
|
||||
def run(self, query: str):
|
||||
# Retrieves relevant docs automatically
|
||||
response = self.generate(
|
||||
f"Answer this using retrieved context: {query}"
|
||||
)
|
||||
return response
|
||||
```
|
||||
|
||||
**Vertex AI Search Integration:**
|
||||
```python
|
||||
from vertexai.preview.search import VertexAISearchTool
|
||||
|
||||
# Enterprise search integration
|
||||
vertex_search = VertexAISearchTool(
|
||||
data_store_id="DATA_STORE_ID",
|
||||
project="PROJECT_ID"
|
||||
)
|
||||
|
||||
agent = ADKAgent(
|
||||
model="gemini-2.5-pro",
|
||||
tools=[vertex_search]
|
||||
)
|
||||
```
|
||||
|
||||
### 🔄 CI/CD Automation
|
||||
|
||||
**GitHub Actions (auto-generated):**
|
||||
```yaml
|
||||
name: Deploy Agent
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Test Agent
|
||||
run: pytest tests/
|
||||
- name: Deploy to Cloud Run
|
||||
run: |
|
||||
gcloud run deploy agent \
|
||||
--source . \
|
||||
--region us-central1
|
||||
```
|
||||
|
||||
**Cloud Build Pipeline:**
|
||||
```yaml
|
||||
steps:
|
||||
# Build container
|
||||
- name: 'gcr.io/cloud-builders/docker'
|
||||
args: ['build', '-t', 'gcr.io/$PROJECT_ID/agent', '.']
|
||||
|
||||
# Run tests
|
||||
- name: 'gcr.io/$PROJECT_ID/agent'
|
||||
args: ['pytest', 'tests/']
|
||||
|
||||
# Deploy to Cloud Run
|
||||
- name: 'gcr.io/cloud-builders/gcloud'
|
||||
args:
|
||||
- 'run'
|
||||
- 'deploy'
|
||||
- 'agent'
|
||||
- '--image=gcr.io/$PROJECT_ID/agent'
|
||||
- '--region=us-central1'
|
||||
```
|
||||
|
||||
### 🎯 Multi-Agent Orchestration
|
||||
|
||||
**Hierarchical Agents:**
|
||||
```python
|
||||
# Coordinator agent with specialized sub-agents
|
||||
class ProjectManagerAgent(ADKAgent):
|
||||
def __init__(self):
|
||||
self.researcher = ResearchAgent()
|
||||
self.analyst = AnalysisAgent()
|
||||
self.writer = WriterAgent()
|
||||
self.reviewer = ReviewAgent()
|
||||
|
||||
def run(self, project_brief: str):
|
||||
# Coordinate multiple agents
|
||||
research = self.researcher.run(project_brief)
|
||||
analysis = self.analyst.run(research)
|
||||
draft = self.writer.run(analysis)
|
||||
final = self.reviewer.run(draft)
|
||||
return final
|
||||
```
|
||||
|
||||
**Parallel Agent Execution:**
|
||||
```python
|
||||
import asyncio
|
||||
|
||||
class ParallelResearchAgent(ADKAgent):
|
||||
async def research_topic(self, topics: list[str]):
|
||||
# Run multiple agents concurrently
|
||||
tasks = [
|
||||
self.specialized_agent(topic)
|
||||
for topic in topics
|
||||
]
|
||||
results = await asyncio.gather(*tasks)
|
||||
return self.synthesize(results)
|
||||
```
|
||||
|
||||
### 📈 Evaluation & Monitoring
|
||||
|
||||
**Built-in Evaluation:**
|
||||
```python
|
||||
from google.cloud.aiplatform import agent_evaluation
|
||||
|
||||
# Define evaluation metrics
|
||||
eval_config = agent_evaluation.EvaluationConfig(
|
||||
metrics=["accuracy", "relevance", "safety"],
|
||||
test_dataset="gs://bucket/eval_data.jsonl"
|
||||
)
|
||||
|
||||
# Run evaluation
|
||||
results = agent.evaluate(eval_config)
|
||||
print(f"Accuracy: {results.accuracy}")
|
||||
print(f"Relevance: {results.relevance}")
|
||||
```
|
||||
|
||||
**Cloud Trace Integration:**
|
||||
```python
|
||||
from google.cloud import trace_v1
|
||||
|
||||
# Automatic tracing
|
||||
@traced_agent
|
||||
class MonitoredAgent(ADKAgent):
|
||||
def run(self, query: str):
|
||||
# All calls automatically traced
|
||||
with self.trace_span("retrieval"):
|
||||
docs = self.retrieve(query)
|
||||
|
||||
with self.trace_span("generation"):
|
||||
response = self.generate(query, docs)
|
||||
|
||||
return response
|
||||
```
|
||||
|
||||
### 🔒 Security & Best Practices
|
||||
|
||||
**1. Service Account Management:**
|
||||
```bash
|
||||
# Create minimal-permission service account
|
||||
gcloud iam service-accounts create agent-sa \
|
||||
--display-name "Agent Service Account"
|
||||
|
||||
# Grant only required permissions
|
||||
gcloud projects add-iam-policy-binding PROJECT_ID \
|
||||
--member="serviceAccount:agent-sa@PROJECT.iam.gserviceaccount.com" \
|
||||
--role="roles/aiplatform.user"
|
||||
```
|
||||
|
||||
**2. Secret Management:**
|
||||
```python
|
||||
from google.cloud import secretmanager
|
||||
|
||||
def get_api_key():
|
||||
client = secretmanager.SecretManagerServiceClient()
|
||||
name = "projects/PROJECT/secrets/api-key/versions/latest"
|
||||
response = client.access_secret_version(name=name)
|
||||
return response.payload.data.decode('UTF-8')
|
||||
```
|
||||
|
||||
**3. VPC Service Controls:**
|
||||
```bash
|
||||
# Enable VPC SC for data security
|
||||
gcloud access-context-manager perimeters create agent-perimeter \
|
||||
--resources=projects/PROJECT_ID \
|
||||
--restricted-services=aiplatform.googleapis.com
|
||||
```
|
||||
|
||||
### 💰 Cost Optimization
|
||||
|
||||
**Strategies:**
|
||||
- Use Gemini 2.5 Flash for most operations
|
||||
- Cache embeddings for RAG systems
|
||||
- Implement request batching
|
||||
- Use preemptible GKE nodes
|
||||
- Monitor token usage in Cloud Monitoring
|
||||
|
||||
**Pricing Examples:**
|
||||
- Cloud Run: $0.00024/GB-second
|
||||
- Agent Engine: Pay-per-request pricing
|
||||
- GKE: Standard cluster costs
|
||||
- Gemini API: $3.50/1M tokens (Pro)
|
||||
|
||||
### 📚 Reference Architecture
|
||||
|
||||
**Production Agent System:**
|
||||
```
|
||||
┌─────────────────┐
|
||||
│ Load Balancer │
|
||||
└────────┬────────┘
|
||||
│
|
||||
┌────▼────┐
|
||||
│Cloud Run│ (Agent containers)
|
||||
└────┬────┘
|
||||
│
|
||||
┌────▼──────────┐
|
||||
│ Agent Engine │ (Orchestration)
|
||||
└────┬──────────┘
|
||||
│
|
||||
┌────▼────────────────┐
|
||||
│ Vertex AI Search │ (RAG)
|
||||
│ Vector Search │
|
||||
│ Gemini 2.5 Pro │
|
||||
└─────────────────────┘
|
||||
```
|
||||
|
||||
### 🎯 Best Practices for Jeremy
|
||||
|
||||
**1. Start with Templates:**
|
||||
```bash
|
||||
# Use Agent Starter Pack templates
|
||||
uvx agent-starter-pack create my-agent --template agentic_rag
|
||||
```
|
||||
|
||||
**2. Local Development:**
|
||||
```bash
|
||||
# Test locally first
|
||||
adk serve --port 8080
|
||||
curl http://localhost:8080/query -d '{"question": "test"}'
|
||||
```
|
||||
|
||||
**3. Gradual Deployment:**
|
||||
```bash
|
||||
# Deploy to dev → staging → prod
|
||||
asp deploy --env dev
|
||||
# Test thoroughly
|
||||
asp deploy --env staging
|
||||
# Final production push
|
||||
asp deploy --env production
|
||||
```
|
||||
|
||||
**4. Monitor Everything:**
|
||||
- Enable Cloud Trace
|
||||
- Set up error reporting
|
||||
- Track token usage
|
||||
- Monitor response times
|
||||
- Set up alerting
|
||||
|
||||
### 📖 Official Documentation
|
||||
|
||||
**Core Resources:**
|
||||
- ADK Docs: https://google.github.io/adk-docs/
|
||||
- Agent Starter Pack: https://github.com/GoogleCloudPlatform/agent-starter-pack
|
||||
- Agent Engine: https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/overview
|
||||
- Agent Builder: https://cloud.google.com/products/agent-builder
|
||||
|
||||
**Tutorials:**
|
||||
- Building AI Agents: https://codelabs.developers.google.com/devsite/codelabs/building-ai-agents-vertexai
|
||||
- Multi-agent Systems: https://cloud.google.com/blog/products/ai-machine-learning/build-and-manage-multi-system-agents-with-vertex-ai
|
||||
|
||||
## When This Skill Activates
|
||||
|
||||
This skill automatically activates when you mention:
|
||||
- Agent development, ADK, or Agent Starter Pack
|
||||
- Multi-agent systems or orchestration
|
||||
- Containerized agent deployment
|
||||
- Cloud Run, GKE, or Agent Engine deployment
|
||||
- RAG agents or ReAct agents
|
||||
- Agent templates or scaffolding
|
||||
- CI/CD for agents
|
||||
- Production agent systems
|
||||
|
||||
## Integration with Other Services
|
||||
|
||||
**Google Cloud:**
|
||||
- Vertex AI (Gemini, Search, Vector Search)
|
||||
- Cloud Storage (data storage)
|
||||
- Cloud Functions (triggers)
|
||||
- Cloud Scheduler (automation)
|
||||
- Cloud Logging & Monitoring
|
||||
|
||||
**Third-party:**
|
||||
- LangChain integration
|
||||
- CrewAI orchestration
|
||||
- Custom tool frameworks
|
||||
|
||||
## Success Metrics
|
||||
|
||||
**Track:**
|
||||
- Agent response time (target: <2s)
|
||||
- Evaluation scores (target: >85% accuracy)
|
||||
- Deployment frequency (target: daily)
|
||||
- System uptime (target: 99.9%)
|
||||
- Cost per query (target: <$0.01)
|
||||
|
||||
---
|
||||
|
||||
**This skill makes Jeremy a Google Cloud agent architecture expert with instant access to ADK, Agent Starter Pack, and production deployment patterns.**
|
||||
26
skills/agent-sdk-master/assets/README.md
Normal file
26
skills/agent-sdk-master/assets/README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Skill Assets
|
||||
|
||||
This directory contains static assets used by this skill.
|
||||
|
||||
## Purpose
|
||||
|
||||
Assets can include:
|
||||
- Configuration files (JSON, YAML)
|
||||
- Data files
|
||||
- Templates
|
||||
- Schemas
|
||||
- Test fixtures
|
||||
|
||||
## Guidelines
|
||||
|
||||
- Keep assets small and focused
|
||||
- Document asset purpose and format
|
||||
- Use standard file formats
|
||||
- Include schema validation where applicable
|
||||
|
||||
## Common Asset Types
|
||||
|
||||
- **config.json** - Configuration templates
|
||||
- **schema.json** - JSON schemas
|
||||
- **template.yaml** - YAML templates
|
||||
- **test-data.json** - Test fixtures
|
||||
26
skills/agent-sdk-master/references/README.md
Normal file
26
skills/agent-sdk-master/references/README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Skill References
|
||||
|
||||
This directory contains reference materials that enhance this skill's capabilities.
|
||||
|
||||
## Purpose
|
||||
|
||||
References can include:
|
||||
- Code examples
|
||||
- Style guides
|
||||
- Best practices documentation
|
||||
- Template files
|
||||
- Configuration examples
|
||||
|
||||
## Guidelines
|
||||
|
||||
- Keep references concise and actionable
|
||||
- Use markdown for documentation
|
||||
- Include clear examples
|
||||
- Link to external resources when appropriate
|
||||
|
||||
## Types of References
|
||||
|
||||
- **examples.md** - Usage examples
|
||||
- **style-guide.md** - Coding standards
|
||||
- **templates/** - Reusable templates
|
||||
- **patterns.md** - Design patterns
|
||||
24
skills/agent-sdk-master/scripts/README.md
Normal file
24
skills/agent-sdk-master/scripts/README.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Skill Scripts
|
||||
|
||||
This directory contains optional helper scripts that support this skill's functionality.
|
||||
|
||||
## Purpose
|
||||
|
||||
Scripts here can be:
|
||||
- Referenced by the skill for automation
|
||||
- Used as examples for users
|
||||
- Executed during skill activation
|
||||
|
||||
## Guidelines
|
||||
|
||||
- All scripts should be well-documented
|
||||
- Include usage examples in comments
|
||||
- Make scripts executable (`chmod +x`)
|
||||
- Use `#!/bin/bash` or `#!/usr/bin/env python3` shebangs
|
||||
|
||||
## Adding Scripts
|
||||
|
||||
1. Create script file (e.g., `analyze.sh`, `process.py`)
|
||||
2. Add documentation header
|
||||
3. Make executable: `chmod +x script-name.sh`
|
||||
4. Test thoroughly before committing
|
||||
Reference in New Issue
Block a user