Posts

google adk - memory bank we can use to store our agentic application

Image
 With memorybank we can store user conversation and these conversations are stored based on app_name and user_id.  Another important point to note is we need both ImMorySessionService and VertexAiMemoryBankService.  import asyncio import os from google import adk from google . adk . agents . callback_context import CallbackContext from google . adk . memory import VertexAiMemoryBankService from google . adk . sessions import InMemorySessionService from google . adk . tools . preload_memory_tool import PreloadMemoryTool from google . genai import types os . environ [ "GOOGLE_GENAI_USE_ENTERPRISE" ] = "TRUE" os . environ [ "GOOGLE_CLOUD_PROJECT" ] = "project-xxxxxxxx" os . environ [ "GOOGLE_CLOUD_LOCATION" ] = "australia-southeast1" APP_NAME = "APP_NAME" # Memories are scoped per (app_name, user_id), so keep user_id stable # across sessions or the agent won't find earlier memories. USER_ID ...

google adk - compactiing conversation

We can easily compact our conversation by using the following code. Notice we are using App and EventsCompactionConfig (it is experimental) that can help to optimized latency and reduces cost. How we choose to compact our conversation is defined here Threshold approach # 3. Compaction config compaction_config = EventsCompactionConfig (     # Token-based (primary): compact when the prompt exceeds this many tokens     token_threshold = 1000 ,     event_retention_size = 3 ,       # keep the last 3 events raw     # Sliding window (supplementary): compact every N invocations     compaction_interval = 3 ,     overlap_size = 1 ,     summarizer = summarizer , ) If you opt for sliding window compact approach Sliding window approach   compaction_config = EventsCompactionConfig (     compaction_interval = 10 ,   # Number of new invocations between standard compactions     overlap_...

Developer guide for Gemini Carbon Model

Here is the link that you can check it out  https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/guides/gemini-4-carbon

gke autopilot simulating 7 days upgrade pause

Image
We will simulate 7 days upgrade delay for GKE Autopilot cluster. First we make a pdb that will prevent node upgrade. You can use the following command to do that.  cat <<'EOF' | kubectl apply -f - apiVersion : apps/v1 kind : Deployment metadata :   name : big spec :   replicas : 2   selector :     matchLabels :       app : big   template :     metadata :       labels :         app : big     spec :       nodeSelector :         cloud.google.com/compute-class : autopilot       containers :       - name : nginx         image : nginx         resources :           requests : { cpu : "500m" , memory : 512Mi }           limits :   { cpu : "500m" , memory : 512Mi } --- apiVersion : policy/v1 kind : PodDisruptionBudget metadata ...

gke autopilot faqs

Image
How does Autopilot bill you?  Standard bills for the node VMs (the whole machine), whether or not your pods use the capacity. Autopilot bills for what your pods request (CPU, memory, ephemeral storage), not for nodes and not for limits. What if I requested a pod memory or cpu limit surpasses a node capacity?  Then autopilot will create a node that is able to meet the request. You will still be charge based on request not burst (limit). If it exceed the limit, then it will get an OOM. Can you install app or agent from marketplace in autopilot?  No, it is not possible.  How does GKE Autopilot differ from GKE Standard regarding privileged containers and security policy enforcement? Autopilot enforces security guardrails that prohibits priviledge containers  A platform team wants to protect a long-running, fault-intolerant game server Pod from eviction during cluster node upgrades. How does GKE Autopilot differ from GKE Standard for this requirement? Autopilot sup...

gcp agentic platform - monitoring serverless model for example gemini flash

Image
How can you tell if your model is being responsive enough especially for serverless model which you do not have to deploy and configure monitoring? You can do that via Metric Explorer .  https://console.cloud.google.com/projectselector/monitoring/metrics-explorer?supportedpurview=project,folder,organizationId In the metrics, please look for Vertex AI.  And then you will be able to identify relevant metric as shown here. Here we are able to show breakdown  And you can see more refine analysis especially if you hitting 429, all the way down to which model you're currently using.  In my case it is hydrogen and gemini flash  

gcp cloud build getting started

 In this tutorial we are going to use google cloud build to build an image and then deploy to cloud run.  lets create a project and add the following files in there cloudbuild.yaml In cloud build, every name used is a docker image step and argument are the command that we would like to run on that steps. In this case, we are using docker image to do a docker build, then we are pushing it to artefact registry using docker image too and finally we deploy our image using cloud-sdk image. steps :   # 1. Build the container image   - name : 'gcr.io/cloud-builders/docker'     args : [ 'build' , '-t' , 'us-west2-docker.pkg.dev/project-xxxx/quickstart-docker-repo/hello-world-image:${_TAG}' , '.' ]   # 2. Push it to Artifact Registry   - name : 'gcr.io/cloud-builders/docker'     args : [ 'push' , 'us-west2-docker.pkg.dev/project-xxxxx/quickstart-docker-repo/hello-world-image:${_TAG}' ]   # 3. Deploy to Cloud Run   - name : 'gcr...