@intentsolutionsio/jeremy-gcp-starter-examples 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +21 -0
- package/LICENSE +21 -0
- package/README.md +295 -0
- package/agents/gcp-starter-kit-expert.md +688 -0
- package/package.json +42 -0
- package/skills/gcp-examples-expert/SKILL.md +81 -0
- package/skills/gcp-examples-expert/references/ARD.md +72 -0
- package/skills/gcp-examples-expert/references/PRD.md +68 -0
- package/skills/gcp-examples-expert/references/best-practices-applied.md +38 -0
- package/skills/gcp-examples-expert/references/code-example-categories.md +160 -0
- package/skills/gcp-examples-expert/references/errors.md +54 -0
- package/skills/gcp-examples-expert/references/example-interactions.md +53 -0
- package/skills/gcp-examples-expert/references/examples.md +477 -0
- package/skills/gcp-examples-expert/references/workflow.md +38 -0
- package/skills/gcp-examples-expert/scripts/create-example.sh +93 -0
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@intentsolutionsio/jeremy-gcp-starter-examples",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Google Cloud starter kits and example code aggregator with ADK samples",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"google-cloud",
|
|
7
|
+
"adk-samples",
|
|
8
|
+
"genkit-examples",
|
|
9
|
+
"vertex-ai",
|
|
10
|
+
"agent-starter-pack",
|
|
11
|
+
"code-examples",
|
|
12
|
+
"starter-kits",
|
|
13
|
+
"templates",
|
|
14
|
+
"claude-code",
|
|
15
|
+
"claude-plugin",
|
|
16
|
+
"tonsofskills"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/jeremylongshore/claude-code-plugins-plus-skills.git",
|
|
21
|
+
"directory": "plugins/ai-ml/jeremy-gcp-starter-examples"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://tonsofskills.com/plugins/jeremy-gcp-starter-examples",
|
|
24
|
+
"bugs": "https://github.com/jeremylongshore/claude-code-plugins-plus-skills/issues",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"author": {
|
|
27
|
+
"name": "Jeremy Longshore",
|
|
28
|
+
"email": "jeremy@intentsolutions.io"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"README.md",
|
|
35
|
+
".claude-plugin",
|
|
36
|
+
"skills",
|
|
37
|
+
"agents"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"postinstall": "node -e \"console.log(\\\"\\\\n→ This npm package is a tracking/proof artifact. Install the plugin via:\\\\n ccpi install jeremy-gcp-starter-examples\\\\n or /plugin install jeremy-gcp-starter-examples@claude-code-plugins-plus in Claude Code\\\\n\\\")\""
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gcp-examples-expert
|
|
3
|
+
description: |
|
|
4
|
+
Generate production-ready Google Cloud code examples from official repositories including ADK samples, Genkit templates, Vertex AI notebooks, and Gemini patterns. Use when asked to "show ADK example" or "provide GCP starter kit". Trigger with relevant phrases based on skill purpose.
|
|
5
|
+
allowed-tools: Read, Write, Edit, Grep, Glob, Bash(cmd:*)
|
|
6
|
+
version: 2.1.0
|
|
7
|
+
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
8
|
+
license: MIT
|
|
9
|
+
effort: medium
|
|
10
|
+
argument-hint: "[framework or use-case]"
|
|
11
|
+
compatible-with: claude-code, codex, openclaw
|
|
12
|
+
tags: [ai, gcp, gcp-examples]
|
|
13
|
+
---
|
|
14
|
+
# GCP Examples Expert
|
|
15
|
+
|
|
16
|
+
## Overview
|
|
17
|
+
|
|
18
|
+
Generate production-ready Google Cloud Platform code examples sourced from official repositories including ADK samples, Agent Starter Pack, Firebase Genkit, Vertex AI samples, Generative AI examples, and AgentSmithy. This skill maps user requirements to the appropriate GCP framework and delivers working code with security, monitoring, and deployment best practices baked in.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
- Google Cloud project with billing enabled and Vertex AI API activated
|
|
23
|
+
- `gcloud` CLI authenticated with appropriate IAM roles (Vertex AI User, Cloud Run Developer)
|
|
24
|
+
- Node.js 18+ for Genkit/TypeScript examples or Python 3.10+ for ADK/Vertex AI examples
|
|
25
|
+
- Firebase CLI for Genkit deployments (`npm install -g firebase-tools`)
|
|
26
|
+
- API keys or service account credentials configured via Secret Manager (never hardcoded)
|
|
27
|
+
|
|
28
|
+
## Instructions
|
|
29
|
+
|
|
30
|
+
1. Identify the target framework by matching the request to one of six categories: ADK agents, Agent Starter Pack, Genkit flows, Vertex AI training, Generative AI multimodal, or AgentSmithy orchestration
|
|
31
|
+
2. Select the appropriate source repository and code pattern from `${CLAUDE_SKILL_DIR}/references/code-example-categories.md`
|
|
32
|
+
3. Adapt the template to the specified programming language (TypeScript, Python, or Go)
|
|
33
|
+
4. Configure security settings: IAM least-privilege service accounts, VPC Service Controls, Model Armor for prompt injection protection
|
|
34
|
+
5. Add monitoring instrumentation: Cloud Monitoring dashboards, alerting policies, structured logging, OpenTelemetry tracing
|
|
35
|
+
6. Set auto-scaling parameters with appropriate min/max instance counts for the deployment target
|
|
36
|
+
7. Include cost optimization: select Gemini 2.5 Flash for simple tasks, Gemini 2.5 Pro for complex reasoning, batch predictions for bulk workloads
|
|
37
|
+
8. Generate deployment configuration for the target platform (Cloud Run, Firebase Functions, or Vertex AI Endpoints)
|
|
38
|
+
9. Provide Terraform or IaC templates for reproducible infrastructure provisioning
|
|
39
|
+
10. Cite the source repository and link to official documentation for each pattern used
|
|
40
|
+
|
|
41
|
+
See `${CLAUDE_SKILL_DIR}/references/workflow.md` for the phased workflow and `${CLAUDE_SKILL_DIR}/references/best-practices-applied.md` for the full best-practices checklist.
|
|
42
|
+
|
|
43
|
+
## Output
|
|
44
|
+
|
|
45
|
+
- Complete, runnable code example with imports, configuration, and error handling
|
|
46
|
+
- Deployment configuration (Cloud Run service YAML, Firebase function config, or Terraform module)
|
|
47
|
+
- Environment variable template listing required secrets and API keys
|
|
48
|
+
- Monitoring setup: dashboard JSON, alerting policy definitions, log-based metrics
|
|
49
|
+
- Cost estimate guidance based on model selection and expected throughput
|
|
50
|
+
- Source repository citation and documentation links
|
|
51
|
+
|
|
52
|
+
## Error Handling
|
|
53
|
+
|
|
54
|
+
| Error | Cause | Solution |
|
|
55
|
+
|-------|-------|----------|
|
|
56
|
+
| Invalid GCP project or API not enabled | Vertex AI API disabled or project ID misconfigured | Run `gcloud services enable aiplatform.googleapis.com`; verify project ID in `gcloud config list` |
|
|
57
|
+
| Permission denied on Vertex AI resources | Service account missing required IAM roles | Grant `roles/aiplatform.user` and `roles/run.developer`; check VPC-SC perimeter allows access |
|
|
58
|
+
| Model not available in region | Requested Gemini model not deployed in specified location | Use `us-central1` or `europe-west4` where Gemini models are available; check regional availability docs |
|
|
59
|
+
| Quota exceeded for API calls | Rate limit hit on Vertex AI prediction endpoint | Request quota increase via Cloud Console; implement exponential backoff with jitter |
|
|
60
|
+
| Dependency version conflict | Incompatible versions of AI SDK, Genkit, or provider packages | Pin versions in `package.json` or `requirements.txt`; use lockfile to ensure reproducibility |
|
|
61
|
+
|
|
62
|
+
See `${CLAUDE_SKILL_DIR}/references/errors.md` for additional error scenarios.
|
|
63
|
+
|
|
64
|
+
## Examples
|
|
65
|
+
|
|
66
|
+
**Scenario 1: ADK Agent with Code Execution** -- Create a production ADK agent using `google/adk-samples` patterns. Enable Code Execution Sandbox with 14-day state TTL, configure Memory Bank for persistent context, apply VPC Service Controls and IAM least-privilege. Deploy to Vertex AI Agent Engine.
|
|
67
|
+
|
|
68
|
+
**Scenario 2: Genkit RAG Flow** -- Implement a retrieval-augmented generation system using Firebase Genkit. Define a retriever with text-embedding-gecko embeddings, connect to a vector database, build a RAG flow with Zod-validated input/output schemas. Deploy to Cloud Run with auto-scaling (2-10 instances).
|
|
69
|
+
|
|
70
|
+
**Scenario 3: Gemini Multimodal Analysis** -- Analyze video content using the `generative-ai` repository patterns. Create a multimodal prompt combining video URIs with text questions using Gemini 2.5 Pro. Include safety filter configuration, token counting for cost estimation, and structured output parsing.
|
|
71
|
+
|
|
72
|
+
See `${CLAUDE_SKILL_DIR}/references/example-interactions.md` for detailed interaction examples.
|
|
73
|
+
|
|
74
|
+
## Resources
|
|
75
|
+
|
|
76
|
+
- [google/adk-samples](https://github.com/google/adk-samples) -- ADK agent creation patterns
|
|
77
|
+
- [GoogleCloudPlatform/agent-starter-pack](https://github.com/GoogleCloudPlatform/agent-starter-pack) -- production agent templates
|
|
78
|
+
- [genkit-ai/genkit](https://github.com/genkit-ai/genkit) -- RAG flows, tool calling, evaluation
|
|
79
|
+
- [GoogleCloudPlatform/vertex-ai-samples](https://github.com/GoogleCloudPlatform/vertex-ai-samples) -- model training, tuning, deployment
|
|
80
|
+
- [GoogleCloudPlatform/generative-ai](https://github.com/GoogleCloudPlatform/generative-ai) -- Gemini multimodal, function calling, grounding
|
|
81
|
+
- [GoogleCloudPlatform/agentsmithy](https://github.com/GoogleCloudPlatform/agentsmithy) -- multi-agent orchestration
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# ARD: GCP Examples Expert
|
|
2
|
+
|
|
3
|
+
> Part of [Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)
|
|
4
|
+
|
|
5
|
+
## System Context
|
|
6
|
+
|
|
7
|
+
The GCP Examples Expert maps developer requirements to the correct Google Cloud AI repository and generates production-ready code adapted from official patterns. It operates as a code generation skill that bridges six official GCP AI repositories.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Developer Request ("Build a RAG system on GCP")
|
|
11
|
+
↓
|
|
12
|
+
[GCP Examples Expert]
|
|
13
|
+
├── Maps to: Framework selection (Genkit, ADK, Vertex AI, etc.)
|
|
14
|
+
├── Sources: 6 official GCP repositories
|
|
15
|
+
├── Adapts: language, security, monitoring, deployment
|
|
16
|
+
└── Generates: runnable code + deployment config + IaC
|
|
17
|
+
↓
|
|
18
|
+
Production-Ready Code Package
|
|
19
|
+
├── Application code (adapted from source repo)
|
|
20
|
+
├── Deployment config (Cloud Run / Functions / Agent Engine)
|
|
21
|
+
├── Terraform module (infrastructure)
|
|
22
|
+
└── Documentation (source citations, cost estimates)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Data Flow
|
|
26
|
+
|
|
27
|
+
1. **Input**: User request describing the AI use case, preferred language, and deployment target. May include constraints like model preference, cost budget, or compliance requirements.
|
|
28
|
+
2. **Processing**: Classify the request into one of six framework categories. Select the matching code pattern from the categorized reference. Adapt to the target language. Layer on security (IAM, VPC-SC, Secret Manager), monitoring (OpenTelemetry, dashboards), and deployment configuration. Generate Terraform when infrastructure provisioning is needed.
|
|
29
|
+
3. **Output**: Complete code package with application files, deployment config (YAML/JSON), Terraform module, environment variable template, monitoring setup, cost estimate, and source repository citations.
|
|
30
|
+
|
|
31
|
+
## Key Design Decisions
|
|
32
|
+
|
|
33
|
+
| Decision | Choice | Rationale |
|
|
34
|
+
|----------|--------|-----------|
|
|
35
|
+
| Six-category framework taxonomy | ADK, Starter Pack, Genkit, Vertex AI, Gen AI, AgentSmithy | Covers the complete GCP AI landscape; each category maps to a distinct official repo |
|
|
36
|
+
| Security-by-default | Every example includes IAM, Secret Manager, and VPC-SC | Production examples must not teach insecure patterns; developers copy-paste examples |
|
|
37
|
+
| Source attribution | Cite the specific repo and pattern for every adaptation | Enables developers to find updates and deeper documentation; maintains trust |
|
|
38
|
+
| Model selection guidance | Gemini 2.5 Flash for throughput, Pro for reasoning | Prevents cost surprises; Flash handles 80% of use cases at 10x lower cost |
|
|
39
|
+
| Multi-target deployment | Generate configs for Cloud Run, Firebase Functions, and Agent Engine | Different deployment targets suit different flow types; developers choose |
|
|
40
|
+
| Language adaptation | Transform patterns to TypeScript, Python, or Go | Each repo has language-specific conventions; adapt rather than translate literally |
|
|
41
|
+
| IaC inclusion | Terraform templates alongside application code | Production deployments need reproducible infrastructure, not just application code |
|
|
42
|
+
|
|
43
|
+
## Tool Usage Pattern
|
|
44
|
+
|
|
45
|
+
| Tool | Purpose |
|
|
46
|
+
|------|---------|
|
|
47
|
+
| Read | Inspect existing project files, requirements, and configuration to adapt examples to the user's codebase |
|
|
48
|
+
| Write | Create new application files, deployment configs, Terraform modules, and environment templates |
|
|
49
|
+
| Edit | Patch existing code to integrate GCP patterns, update dependencies, or add monitoring |
|
|
50
|
+
| Grep | Search for existing framework usage, import patterns, and configuration in the target project |
|
|
51
|
+
| Glob | Discover project structure to determine where generated code should be placed |
|
|
52
|
+
| Bash(cmd:*) | Run dependency installation, gcloud commands, firebase CLI, and validation scripts |
|
|
53
|
+
|
|
54
|
+
## Error Handling Strategy
|
|
55
|
+
|
|
56
|
+
| Error Class | Detection | Recovery |
|
|
57
|
+
|------------|-----------|----------|
|
|
58
|
+
| Framework mismatch | User request doesn't clearly map to a single category | Ask clarifying questions; present the two closest matches with trade-offs |
|
|
59
|
+
| API not enabled | `gcloud services list` missing required APIs | Provide the exact `gcloud services enable` command for each missing API |
|
|
60
|
+
| Region unavailability | Requested model not available in specified region | Suggest `us-central1` or `europe-west4` where Gemini models are available |
|
|
61
|
+
| Dependency conflict | Incompatible SDK versions in existing project | Pin versions explicitly; provide a clean `requirements.txt` or `package.json` |
|
|
62
|
+
| Quota exceeded | Rate limit on Vertex AI prediction endpoints | Include exponential backoff in generated code; provide quota increase request link |
|
|
63
|
+
|
|
64
|
+
## Extension Points
|
|
65
|
+
|
|
66
|
+
- Additional framework categories: add new GCP AI repos (e.g., MLOps pipelines) as they become official
|
|
67
|
+
- Language expansion: extend beyond TypeScript/Python/Go when Genkit or ADK adds language support
|
|
68
|
+
- Custom security profiles: allow enterprise users to specify compliance frameworks (SOC2, HIPAA) for stricter defaults
|
|
69
|
+
- Cost calculator integration: generate detailed cost projections based on expected query volume and model selection
|
|
70
|
+
- Template versioning: pin examples to specific SDK versions with automated upgrade paths
|
|
71
|
+
- Interactive selection: when multiple frameworks match, present a comparison table for the user to choose
|
|
72
|
+
- Batch generation: create examples for multiple frameworks from a single requirements document
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# PRD: GCP Examples Expert
|
|
2
|
+
|
|
3
|
+
**Version:** 2.1.0
|
|
4
|
+
**Author:** Jeremy Longshore <jeremy@intentsolutions.io>
|
|
5
|
+
**Status:** Active
|
|
6
|
+
**Marketplace:** [tonsofskills.com](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io)
|
|
7
|
+
**Portfolio:** [jeremylongshore.com](https://jeremylongshore.com)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Problem Statement
|
|
12
|
+
|
|
13
|
+
Google Cloud's AI ecosystem spans six major frameworks (ADK, Agent Starter Pack, Genkit, Vertex AI, Generative AI, AgentSmithy), each with its own repository, patterns, and deployment targets. Developers waste hours searching through scattered repos to find the right starting code for their use case, then spend more time adapting examples that lack security, monitoring, and production deployment configuration. The gap between "hello world" examples and production-ready code causes teams to ship insecure or unmonitored AI applications.
|
|
14
|
+
|
|
15
|
+
## Target Users
|
|
16
|
+
|
|
17
|
+
| User | Context | Primary Need |
|
|
18
|
+
|------|---------|-------------|
|
|
19
|
+
| AI Engineer | Starting a new GCP AI project and unsure which framework to use | Framework selection guidance with a production-ready code example |
|
|
20
|
+
| Backend Developer | Implementing a specific pattern (RAG, agent, multimodal) on GCP | Working code adapted from the correct official repository with deployment config |
|
|
21
|
+
| Solutions Architect | Evaluating GCP AI services for an enterprise deployment | Comprehensive example with security (IAM, VPC-SC), monitoring, and cost estimates |
|
|
22
|
+
| DevOps Engineer | Setting up deployment pipelines for GCP AI applications | Terraform/IaC templates with deployment configuration for Cloud Run or Agent Engine |
|
|
23
|
+
|
|
24
|
+
## Success Criteria
|
|
25
|
+
|
|
26
|
+
1. Map any GCP AI request to the correct source repository and code pattern within the first response
|
|
27
|
+
2. Generated examples include IAM least-privilege, Secret Manager for credentials, and monitoring instrumentation
|
|
28
|
+
3. Every example includes a deployment configuration for at least one target (Cloud Run, Firebase Functions, or Agent Engine)
|
|
29
|
+
4. Source repository and official documentation links are cited for every pattern used
|
|
30
|
+
5. Generated code uses currently available Gemini models (2.5 Flash/Pro), not deprecated versions
|
|
31
|
+
6. Environment variable template provided listing all required secrets and API keys
|
|
32
|
+
|
|
33
|
+
## Functional Requirements
|
|
34
|
+
|
|
35
|
+
1. Identify the target framework by matching the request to one of six categories: ADK agents, Agent Starter Pack, Genkit flows, Vertex AI training, Generative AI multimodal, or AgentSmithy orchestration
|
|
36
|
+
2. Select the appropriate source repository and code pattern from the categorized reference
|
|
37
|
+
3. Adapt the template to the specified programming language (TypeScript, Python, or Go)
|
|
38
|
+
4. Configure security: IAM least-privilege service accounts, VPC Service Controls, Model Armor
|
|
39
|
+
5. Add monitoring: Cloud Monitoring dashboards, alerting policies, structured logging, OpenTelemetry
|
|
40
|
+
6. Set auto-scaling parameters with min/max instance counts for the deployment target
|
|
41
|
+
7. Include cost optimization: model selection rationale, token estimates, caching strategy
|
|
42
|
+
8. Generate deployment configuration for the target platform
|
|
43
|
+
9. Provide Terraform or IaC templates for reproducible infrastructure provisioning
|
|
44
|
+
10. Cite the source repository and link to official documentation
|
|
45
|
+
|
|
46
|
+
## Non-Functional Requirements
|
|
47
|
+
|
|
48
|
+
- All generated code must be runnable without modification (given correct credentials and project setup)
|
|
49
|
+
- API keys and credentials must use Secret Manager references, never inline values
|
|
50
|
+
- Examples must target currently available Gemini models (2.5 Flash/Pro), not deprecated versions
|
|
51
|
+
- Code must follow the style conventions of the source repository it's adapted from
|
|
52
|
+
|
|
53
|
+
## Dependencies
|
|
54
|
+
|
|
55
|
+
- Google Cloud project with billing enabled and Vertex AI API activated
|
|
56
|
+
- `gcloud` CLI authenticated with appropriate IAM roles
|
|
57
|
+
- Node.js 18+ for Genkit/TypeScript examples or Python 3.10+ for ADK/Vertex AI examples
|
|
58
|
+
- Firebase CLI for Genkit deployments
|
|
59
|
+
- API keys or service account credentials configured via Secret Manager
|
|
60
|
+
|
|
61
|
+
## Out of Scope
|
|
62
|
+
|
|
63
|
+
- Running or executing the generated code (the skill produces code, not executions)
|
|
64
|
+
- Non-Google Cloud platforms (AWS SageMaker, Azure AI)
|
|
65
|
+
- Custom model training or fine-tuning workflows
|
|
66
|
+
- Frontend or UI development for AI applications
|
|
67
|
+
- Ongoing maintenance or version updates of generated examples
|
|
68
|
+
- Proprietary or non-open-source GCP patterns
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Best Practices Applied
|
|
2
|
+
|
|
3
|
+
## Best Practices Applied
|
|
4
|
+
|
|
5
|
+
### Security
|
|
6
|
+
✅ IAM least privilege service accounts
|
|
7
|
+
✅ VPC Service Controls for enterprise isolation
|
|
8
|
+
✅ Model Armor for prompt injection protection
|
|
9
|
+
✅ Encrypted data at rest and in transit
|
|
10
|
+
✅ No hardcoded credentials (use Secret Manager)
|
|
11
|
+
|
|
12
|
+
### Performance
|
|
13
|
+
✅ Auto-scaling configuration (min/max instances)
|
|
14
|
+
✅ Appropriate machine types and accelerators
|
|
15
|
+
✅ Caching strategies for repeated queries
|
|
16
|
+
✅ Batch processing for high throughput
|
|
17
|
+
✅ Token optimization for cost efficiency
|
|
18
|
+
|
|
19
|
+
### Observability
|
|
20
|
+
✅ Cloud Monitoring dashboards
|
|
21
|
+
✅ Alerting policies for errors and latency
|
|
22
|
+
✅ Structured logging with severity levels
|
|
23
|
+
✅ Distributed tracing with Cloud Trace
|
|
24
|
+
✅ Error tracking with Cloud Error Reporting
|
|
25
|
+
|
|
26
|
+
### Reliability
|
|
27
|
+
✅ Multi-region deployment for high availability
|
|
28
|
+
✅ Circuit breaker patterns for fault tolerance
|
|
29
|
+
✅ Retry logic with exponential backoff
|
|
30
|
+
✅ Health check endpoints
|
|
31
|
+
✅ Graceful degradation strategies
|
|
32
|
+
|
|
33
|
+
### Cost Optimization
|
|
34
|
+
✅ Use Gemini 2.5 Flash for simple tasks (cheaper)
|
|
35
|
+
✅ Gemini 2.5 Pro for complex reasoning (higher quality)
|
|
36
|
+
✅ Batch predictions for bulk processing
|
|
37
|
+
✅ Preemptible instances for non-critical workloads
|
|
38
|
+
✅ Token counting to estimate costs
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Code Example Categories
|
|
2
|
+
|
|
3
|
+
## Code Example Categories
|
|
4
|
+
|
|
5
|
+
### 1. ADK (Agent Development Kit) Samples
|
|
6
|
+
|
|
7
|
+
**Source**: google/adk-samples
|
|
8
|
+
|
|
9
|
+
**Examples Provided**:
|
|
10
|
+
- Basic agent creation with Code Execution Sandbox
|
|
11
|
+
- Memory Bank configuration for stateful agents
|
|
12
|
+
- A2A protocol implementation for inter-agent communication
|
|
13
|
+
- Multi-tool agent configuration
|
|
14
|
+
- VPC Service Controls integration
|
|
15
|
+
- IAM least privilege patterns
|
|
16
|
+
|
|
17
|
+
**Sample Pattern**:
|
|
18
|
+
```python
|
|
19
|
+
from google.cloud.aiplatform import agent_builder
|
|
20
|
+
|
|
21
|
+
def create_adk_agent(project_id: str, location: str):
|
|
22
|
+
agent_config = {
|
|
23
|
+
"display_name": "production-agent",
|
|
24
|
+
"model": "gemini-2.5-flash",
|
|
25
|
+
"code_execution_config": {
|
|
26
|
+
"enabled": True,
|
|
27
|
+
"state_ttl_days": 14
|
|
28
|
+
},
|
|
29
|
+
"memory_bank_config": {
|
|
30
|
+
"enabled": True
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
# Implementation from google/adk-samples
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 2. Agent Starter Pack
|
|
37
|
+
|
|
38
|
+
**Source**: GoogleCloudPlatform/agent-starter-pack
|
|
39
|
+
|
|
40
|
+
**Examples Provided**:
|
|
41
|
+
- Production agent with monitoring and observability
|
|
42
|
+
- Auto-scaling configuration
|
|
43
|
+
- Security best practices (Model Armor, VPC-SC)
|
|
44
|
+
- Cloud Monitoring dashboards
|
|
45
|
+
- Alerting policies
|
|
46
|
+
- Error tracking setup
|
|
47
|
+
|
|
48
|
+
**Sample Pattern**:
|
|
49
|
+
```python
|
|
50
|
+
def production_agent_with_observability(project_id: str):
|
|
51
|
+
agent = aiplatform.Agent.create(
|
|
52
|
+
config={
|
|
53
|
+
"auto_scaling": {
|
|
54
|
+
"min_instances": 2,
|
|
55
|
+
"max_instances": 10
|
|
56
|
+
},
|
|
57
|
+
"vpc_service_controls": {"enabled": True},
|
|
58
|
+
"model_armor": {"enabled": True}
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
# Full implementation from agent-starter-pack
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 3. Firebase Genkit
|
|
65
|
+
|
|
66
|
+
**Source**: genkit-ai/genkit
|
|
67
|
+
|
|
68
|
+
**Examples Provided**:
|
|
69
|
+
- RAG flows with vector search
|
|
70
|
+
- Multi-step workflows
|
|
71
|
+
- Tool calling integration
|
|
72
|
+
- Prompt templates
|
|
73
|
+
- Evaluation frameworks
|
|
74
|
+
- Deployment patterns (Cloud Run, Functions)
|
|
75
|
+
|
|
76
|
+
**Sample Pattern**:
|
|
77
|
+
```typescript
|
|
78
|
+
import { genkit, z } from 'genkit';
|
|
79
|
+
import { googleAI, gemini15ProLatest } from '@genkit-ai/googleai';
|
|
80
|
+
|
|
81
|
+
const ragFlow = ai.defineFlow({
|
|
82
|
+
name: 'ragSearchFlow',
|
|
83
|
+
inputSchema: z.object({ query: z.string() }),
|
|
84
|
+
outputSchema: z.object({ answer: z.string() })
|
|
85
|
+
}, async (input) => {
|
|
86
|
+
// Implementation from genkit-ai/genkit examples
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 4. Vertex AI Samples
|
|
91
|
+
|
|
92
|
+
**Source**: GoogleCloudPlatform/vertex-ai-samples
|
|
93
|
+
|
|
94
|
+
**Examples Provided**:
|
|
95
|
+
- Custom model training with Gemini
|
|
96
|
+
- Batch prediction jobs
|
|
97
|
+
- Hyperparameter tuning
|
|
98
|
+
- Model evaluation
|
|
99
|
+
- Endpoint deployment with auto-scaling
|
|
100
|
+
- A/B testing patterns
|
|
101
|
+
|
|
102
|
+
**Sample Pattern**:
|
|
103
|
+
```python
|
|
104
|
+
def fine_tune_gemini_model(project_id: str, training_data_uri: str):
|
|
105
|
+
job = aiplatform.CustomTrainingJob(
|
|
106
|
+
training_config={
|
|
107
|
+
"base_model": "gemini-2.5-flash",
|
|
108
|
+
"learning_rate": 0.001,
|
|
109
|
+
"adapter_size": 8 # LoRA
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
# Full implementation from vertex-ai-samples
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 5. Generative AI Examples
|
|
116
|
+
|
|
117
|
+
**Source**: GoogleCloudPlatform/generative-ai
|
|
118
|
+
|
|
119
|
+
**Examples Provided**:
|
|
120
|
+
- Gemini multimodal analysis (text, images, video)
|
|
121
|
+
- Function calling with live APIs
|
|
122
|
+
- Structured output generation
|
|
123
|
+
- Grounding with Google Search
|
|
124
|
+
- Safety filters and content moderation
|
|
125
|
+
- Token counting and cost optimization
|
|
126
|
+
|
|
127
|
+
**Sample Pattern**:
|
|
128
|
+
```python
|
|
129
|
+
from vertexai.generative_models import GenerativeModel, Part
|
|
130
|
+
|
|
131
|
+
def analyze_multimodal_content(video_uri: str, question: str):
|
|
132
|
+
model = GenerativeModel("gemini-2.5-pro")
|
|
133
|
+
video_part = Part.from_uri(video_uri, mime_type="video/mp4")
|
|
134
|
+
response = model.generate_content([video_part, question])
|
|
135
|
+
# Implementation from generative-ai examples
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 6. AgentSmithy
|
|
139
|
+
|
|
140
|
+
**Source**: GoogleCloudPlatform/agentsmithy
|
|
141
|
+
|
|
142
|
+
**Examples Provided**:
|
|
143
|
+
- Multi-agent orchestration
|
|
144
|
+
- Supervisory agent patterns
|
|
145
|
+
- Agent-to-agent communication
|
|
146
|
+
- Workflow coordination (sequential, parallel, conditional)
|
|
147
|
+
- Task delegation strategies
|
|
148
|
+
- Error handling and retry logic
|
|
149
|
+
|
|
150
|
+
**Sample Pattern**:
|
|
151
|
+
```python
|
|
152
|
+
from agentsmithy import Agent, Orchestrator, Task
|
|
153
|
+
|
|
154
|
+
def create_multi_agent_system(project_id: str):
|
|
155
|
+
orchestrator = Orchestrator(
|
|
156
|
+
agents=[research_agent, analysis_agent, writer_agent],
|
|
157
|
+
strategy="sequential"
|
|
158
|
+
)
|
|
159
|
+
# Full implementation from agentsmithy
|
|
160
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Error Handling Reference
|
|
2
|
+
|
|
3
|
+
## Authentication & Authorization
|
|
4
|
+
|
|
5
|
+
| Error | Cause | Solution |
|
|
6
|
+
|-------|-------|----------|
|
|
7
|
+
| `UNAUTHENTICATED: Request had invalid authentication credentials` | ADC not configured or expired token | Run `gcloud auth application-default login`; verify `GOOGLE_APPLICATION_CREDENTIALS` env var points to a valid service account key |
|
|
8
|
+
| `PERMISSION_DENIED: caller does not have permission` | Service account missing required IAM roles | Grant `roles/aiplatform.user` for Vertex AI, `roles/run.developer` for Cloud Run; use `gcloud projects get-iam-policy` to audit bindings |
|
|
9
|
+
| `PERMISSION_DENIED: VPC Service Controls` | Request originates outside the VPC-SC perimeter | Add the caller's IP or access level to the perimeter; check `gcloud access-context-manager perimeters describe` |
|
|
10
|
+
|
|
11
|
+
## API & Quota
|
|
12
|
+
|
|
13
|
+
| Error | Cause | Solution |
|
|
14
|
+
|-------|-------|----------|
|
|
15
|
+
| `API [aiplatform.googleapis.com] not enabled` | Vertex AI API disabled on the project | Run `gcloud services enable aiplatform.googleapis.com` |
|
|
16
|
+
| `RESOURCE_EXHAUSTED: quota exceeded` | Rate limit or daily token quota hit | Request quota increase via Cloud Console; implement exponential backoff with jitter; consider batching requests |
|
|
17
|
+
| `429 Too Many Requests` | Gemini API rate-limited | Back off and retry; use `google-cloud-aiplatform` client library (auto-retries); switch lower-priority tasks to Gemini Flash |
|
|
18
|
+
|
|
19
|
+
## Model & Region
|
|
20
|
+
|
|
21
|
+
| Error | Cause | Solution |
|
|
22
|
+
|-------|-------|----------|
|
|
23
|
+
| `Model not found: gemini-2.5-pro` | Model not available in the specified region | Use `us-central1` or `europe-west4` where Gemini 2.5 models are generally available; check [regional availability docs](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations) |
|
|
24
|
+
| `INVALID_ARGUMENT: unsupported model` | Using deprecated model name or wrong model ID | Verify model ID format: `gemini-2.5-pro`, `gemini-2.5-flash`; avoid legacy names like `gemini-1.0-pro` |
|
|
25
|
+
| `SAFETY_BLOCK` in response | Model safety filters triggered | Review prompt for policy violations; adjust safety settings if appropriate; add input sanitization layer |
|
|
26
|
+
|
|
27
|
+
## Dependency & Build
|
|
28
|
+
|
|
29
|
+
| Error | Cause | Solution |
|
|
30
|
+
|-------|-------|----------|
|
|
31
|
+
| `ModuleNotFoundError: No module named 'google.adk'` | ADK package not installed | Run `pip install google-adk`; verify virtual environment is activated |
|
|
32
|
+
| `Cannot find module '@genkit-ai/googleai'` | Genkit Google AI plugin not installed | Run `npm install @genkit-ai/googleai`; check `package.json` has correct version |
|
|
33
|
+
| `Version conflict` between AI SDK packages | Incompatible pinned versions | Pin all `@genkit-ai/*` packages to the same minor version; use lockfile (`package-lock.json` or `pnpm-lock.yaml`) |
|
|
34
|
+
| `ImportError: cannot import name 'Agent' from 'google.adk'` | Wrong import path for ADK Agent class | Use `from google.adk.agents import Agent` (not `from google.adk import Agent`) |
|
|
35
|
+
|
|
36
|
+
## Deployment
|
|
37
|
+
|
|
38
|
+
| Error | Cause | Solution |
|
|
39
|
+
|-------|-------|----------|
|
|
40
|
+
| `Cloud Run: Container failed to start` | Missing env vars or port misconfiguration | Ensure `PORT=8080` is set; verify `GOOGLE_GENAI_API_KEY` or credentials are passed via `--set-secrets` |
|
|
41
|
+
| `Cloud Run: Memory limit exceeded` | Container OOM during model inference | Increase memory with `--memory 1Gi` or higher; reduce batch sizes; use streaming responses |
|
|
42
|
+
| `Terraform: Error creating Agent` | Terraform provider version incompatible | Upgrade `hashicorp/google` provider to `~> 5.0`; run `terraform init -upgrade` |
|
|
43
|
+
| `adk deploy: timeout` | Large agent package or slow network | Increase timeout; verify `.gcloudignore` excludes `node_modules`, `venv`, and test data |
|
|
44
|
+
|
|
45
|
+
## Runtime
|
|
46
|
+
|
|
47
|
+
| Error | Cause | Solution |
|
|
48
|
+
|-------|-------|----------|
|
|
49
|
+
| `Timeout: request took longer than 300s` | Complex prompt or large context window | Reduce context size; use Gemini Flash for simple tasks; implement streaming for long generations |
|
|
50
|
+
| `INVALID_ARGUMENT: request payload too large` | Input exceeds model context limit | Chunk large documents; summarize before sending; use RAG to retrieve only relevant sections |
|
|
51
|
+
| `JSONDecodeError` when parsing structured output | Model returned non-JSON despite `response_mime_type: application/json` | Add explicit JSON schema in prompt; retry with lower temperature; validate output before parsing |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
*[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Example Interactions
|
|
2
|
+
|
|
3
|
+
## Example Interactions
|
|
4
|
+
|
|
5
|
+
### Example 1: ADK Agent Creation
|
|
6
|
+
**User**: "Show me how to create an ADK agent with Code Execution"
|
|
7
|
+
|
|
8
|
+
**Skill Activates**:
|
|
9
|
+
- Provides code example from google/adk-samples
|
|
10
|
+
- Includes Code Execution Sandbox configuration
|
|
11
|
+
- Shows 14-day state persistence setup
|
|
12
|
+
- Demonstrates security best practices
|
|
13
|
+
- Links to official ADK documentation
|
|
14
|
+
|
|
15
|
+
### Example 2: Genkit RAG Flow
|
|
16
|
+
**User**: "I need a Genkit starter template for RAG"
|
|
17
|
+
|
|
18
|
+
**Skill Activates**:
|
|
19
|
+
- Provides RAG flow code from genkit-ai/genkit
|
|
20
|
+
- Shows vector search integration
|
|
21
|
+
- Demonstrates embedding generation
|
|
22
|
+
- Includes context retrieval logic
|
|
23
|
+
- Provides deployment configuration
|
|
24
|
+
|
|
25
|
+
### Example 3: Production Agent Template
|
|
26
|
+
**User**: "What's the best way to deploy a production agent?"
|
|
27
|
+
|
|
28
|
+
**Skill Activates**:
|
|
29
|
+
- Provides Agent Starter Pack template
|
|
30
|
+
- Shows auto-scaling configuration
|
|
31
|
+
- Includes monitoring dashboard setup
|
|
32
|
+
- Demonstrates alerting policies
|
|
33
|
+
- Provides Terraform deployment code
|
|
34
|
+
|
|
35
|
+
### Example 4: Gemini Multimodal
|
|
36
|
+
**User**: "How do I analyze video with Gemini?"
|
|
37
|
+
|
|
38
|
+
**Skill Activates**:
|
|
39
|
+
- Provides multimodal code from generative-ai repo
|
|
40
|
+
- Shows video part creation
|
|
41
|
+
- Demonstrates prompt engineering
|
|
42
|
+
- Includes error handling
|
|
43
|
+
- Provides cost optimization tips
|
|
44
|
+
|
|
45
|
+
### Example 5: Multi-Agent System
|
|
46
|
+
**User**: "I want to build a multi-agent system"
|
|
47
|
+
|
|
48
|
+
**Skill Activates**:
|
|
49
|
+
- Provides AgentSmithy orchestration code
|
|
50
|
+
- Shows supervisory agent pattern
|
|
51
|
+
- Demonstrates A2A protocol usage
|
|
52
|
+
- Includes workflow coordination
|
|
53
|
+
- Provides testing strategies
|