100x SRE: Building an Autonomous GKE Incident Responder with Google Antigravity 2.0
Disclaimer: This article serves as an illustrative example of what autonomous workflows can achieve. The architecture and workflows…

100x SRE: Building an Autonomous GKE Incident Responder with Google Antigravity 2.0
Disclaimer: This article serves as an illustrative example of what autonomous workflows can achieve. The architecture and workflows described involve granting AI agents permissions to interact with and modify infrastructure. While the guardrails discussed (such as Decide Hooks and IAM-secured Managed MCPs) are designed to prevent catastrophic actions, autonomous remediation should always be rigorously tested in isolated staging environments first. It is highly recommended to maintain strict human-in-the-loop (HITL) approval gates for all state-changing commands until the agent’s behavior is fully validated against your organization’s specific security and SRE policies.
For a Site Reliability Engineer (SRE) managing large-scale Google Kubernetes Engine (GKE) clusters, a significant portion of the day is spent diagnosing crash loops, scaling issues, and misconfigured deployments. Recently, the industry has begun exploring the capabilities of agentic loops — specifically, how teams can move beyond AI chat assistants that just generate kubectl commands, and instead build autonomous pipelines that actually diagnose, patch, and verify cluster health on their own.
When scaling AI agents for complex engineering tasks, engineering teams consistently run into two major roadblocks: context anxiety (where models lose track of their goals or wrap up prematurely as their context window fills) and the self-evaluation problem (where agents confidently praise their own mediocre or broken work).
With the launch of Google Antigravity 2.0 at I/O 2026, Google provided a native solution to these problems. By shifting away from standard chat interfaces and introducing a dedicated multi-agent orchestration platform powered by Gemini 3.5 Flash, Antigravity 2.0 allows developers to dynamically spawn parallel subagents. By separating the “doer” from the “checker,” SREs can force the AI to prove its work against objective reality.
This article explores how to build an autonomous SRE harness to resolve Kubernetes outages using Antigravity 2.0’s declarative approach across four completely different deployment surfaces, relying entirely on native GKE and Google Cloud observability.
The Dynamic Subagent Paradigm
If a naive LLM is asked to fix a crashing GKE deployment, it might guess the issue, execute a kubectl command, and confidently declare the outage resolved—even if the pods are still crash-looping.
To fix this, Antigravity’s Dynamic Subagents can map a standard SRE team into the agent’s workflow:
- The Planner (SRE Lead): Takes the initial alert and writes a high-level diagnostic spec (e.g., “Check pod events, review logs, verify image tags”).
- The Generator (On-Call Responder): Executes the diagnostics, formulates a fix (e.g., patching a deployment manifest), and proposes a “Sprint Contract” defining what success looks like.
- The Evaluator (QA/Monitor): Acts as the safety gate. It reviews the proposed fix before execution and, afterward, queries native GCP metrics to verify if the deployment actually reached a healthy state.
The Core Logic: Skills and Remote Managed MCP
In the Antigravity 2.0 ecosystem, there is no need to write complex Python loops to manage these subagents. The paradigm relies on modular, declarative Skills. SREs define the execution rules in a simple markdown file (SKILL.md), and the platform's built-in Agent Harness handles the "Think-Act-Observe" loop and context compaction automatically.
To ensure the Evaluator subagent is grounded in reality, Antigravity natively supports the Model Context Protocol (MCP). Because GKE automatically emits telemetry to Google Cloud, there is no need to install third-party tools like Prometheus inside the cluster or run local Node-based MCP adapters.
Instead, SREs can utilize Google’s Managed Remote MCP Servers. By connecting the agent directly to the global monitoring.googleapis.com/mcp endpoint via HTTP, the agent gains zero-infrastructure, secure access to Cloud Monitoring. This allows the evaluator to run strict metric validation (e.g., "Use the query_range tool to verify 5xx errors are at 0% before closing the incident").
Why the Antigravity Harness Makes This Easier
Before exploring how to deploy this system, it is worth examining why the Antigravity (agy) harness is a massive leap forward compared to traditional AI frameworks or DIY Python scripts.
- Zero Orchestration Boilerplate: In legacy frameworks, developers had to write
whileloops to manage the agent's "Think-Act-Observe" cycle, manually parse JSON, and handle API retries. Theagyharness absorbs all of this. SREs simply provide the declarativeSKILL.mdprotocol, and the harness drives the loop. - Automatic Context Compaction: GKE debugging sessions can generate thousands of lines of Cloud Logging output, quickly exhausting an LLM’s context window. The Antigravity harness seamlessly summarizes and compacts older terminal outputs in the background so the agent never forgets its initial goal.
- Native Subagent Management: Instead of manually passing chat histories between different AI instances, the runtime reads the
SKILL.mdand dynamically spawns the Evaluator subagent exactly when the validation phase is reached. - Enterprise Security & Model Armor: Connecting to Google’s Remote MCP servers enforces IAM authorization and centralized Audit Logging for every metric queried. Furthermore, Decide Hooks within the harness pause execution at the exact moment a dangerous tool call (like
kubectl delete namespace) is requested, allowing for human-in-the-loop approval before the cluster is touched.
Because the harness handles these complex mechanics behind the scenes, this single SRE Skill can be deployed across four different surfaces.
1. Antigravity 2.0 Desktop App: The Command Center
Best for: Active debugging, visual observability, and human-in-the-loop approvals.
The Antigravity 2.0 desktop application is a standalone command center built entirely for agent orchestration. It provides a rich GUI for teams to monitor the agent’s real-time execution.
Step-by-Step Deployment:
- Configure the Remote MCP Server: Antigravity 2.0 uses a centralized configuration file. Open
~/.gemini/config/mcp_config.jsonand map the Google Cloud Remote MCP endpoint:
{
"mcpServers": {
"cloud_monitoring": {
"serverUrl": "https://monitoring.googleapis.com/mcp",
"authProviderType": "google_credentials"
}
}
}
2. Initialize the Workspace: Open the infrastructure repository and create the agent configuration folder.
mkdir -p .agents/skills/gke_responder
mkdir -p .agents/hooks
3. Author the Skill: Create .agents/skills/gke_responder/SKILL.md:
# GKE Incident Responder
**Trigger:** Load this skill when the user reports a GKE outage, high 5xx errors, or pod crash loops.
**Protocol:**
1. **Diagnose:** * Run `kubectl get pods -n <namespace>`.
* Check pod events and logs to identify the root cause of the crash.
2. **Remediate:** * Formulate a fix (e.g., rollback the deployment or update the image tag).
* Apply the fix to the cluster.
3. **Evaluate (Safety Gate):** * Use the `cloud_monitoring` MCP server.
* Query Cloud Monitoring for `https/request_count` with a 5xx response code filter.
* **Failure Condition:** If 5xx errors remain > 10% after the fix, notify the user and immediately revert the changes.
4. Enforce Safety Hooks: To block destructive commands, create .agents/hooks/production_safety.json:
{
"hooks": [
{
"type": "pre_tool_call",
"name": "HardBlockNamespaceDeletion",
"target_tool": "execute_shell",
"condition": "matches(arguments.command, 'kubectl.*delete.*(namespace|ns)')",
"action": "block",
"message_to_user": "❌ CRITICAL: Deleting namespaces is strictly forbidden by SRE policy. Execution aborted."
},
{
"type": "pre_tool_call",
"name": "RequireApprovalForStateChanges",
"target_tool": "execute_shell",
"condition": "matches(arguments.command, 'kubectl.*(apply|delete|scale|rollout|edit)')",
"action": "pause_for_human",
"message_to_user": "⚠️ The agent is attempting to modify cluster state. Please review the command carefully."
},
{
"type": "pre_tool_call",
"name": "RestrictKubeSystemAccess",
"target_tool": "execute_shell",
"condition": "contains(arguments.command, '-n kube-system')",
"action": "pause_for_human",
"message_to_user": "⚠️ WARNING: The agent is trying to interact with the 'kube-system' namespace."
},
{
"type": "pre_tool_call",
"name": "ProtectPIIInObservability",
"target_tool": "cloud_monitoring",
"condition": "contains(arguments.query, 'textPayload')",
"action": "pause_for_human",
"message_to_user": "⚠️ The agent is querying raw log text payloads which may contain PII. Approve this data extraction?"
}
]
}
5. Execute: Open the Antigravity Desktop App and type: “Fix the checkout-service outage.” The UI will dynamically load the Skill, query Google Cloud Logging for context, apply the fix, and evaluate native GCP metrics.
2. Antigravity CLI (agy): The Terminal-Native Workflow
Best for: High-velocity execution and remote SSH sessions.
For SREs who live in their terminal, the Antigravity CLI (agy) delivers the exact same agent engine and workspace configuration as the desktop app, but without the graphical overhead.
Step-by-Step Deployment:
- Use the Same Workspace: The Go-based CLI utilizes the exact same
.agents/folder, JSON hooks, andmcp_config.jsoncreated for the desktop app. - Verify the MCP Connection: Open the terminal, launch the interactive CLI by typing
agy, and type/mcpto ensure the remotecloud_monitoringendpoint is connected. - In the Interactice CLI run: “The checkout-service in prod is crash-looping. Please investigate.”
- Handle Interactive Prompts: If the agent hits a safety Hook, execution pauses natively in the terminal:
[!] HOOK TRIGGERED: BlockDestructiveKubeCommands
⚠️ The agent is attempting: `kubectl delete pod checkout-service-xyz`
Allow execution? [y/N/modify]:
3. Antigravity SDK: Programmatic, Event-Driven Autonomy
Best for: CI/CD pipelines, custom orchestration, and webhook triggers.
The Antigravity SDK unlocks true event-driven automation. Available in Python, the SDK provides programmatic access to the underlying agent harness, allowing teams to host agents entirely on their own infrastructure.
Rather than relying on local markdown files and static JSON configurations, the SDK allows engineering teams to define the entire orchestration loop programmatically. By importing the Antigravity library into a backend service, you define the agent’s logic, attach the remote Cloud Monitoring MCP, and enforce your Decide Hooks directly in your codebase. Once configured, you wrap this agent execution logic in an API endpoint or event listener, wiring it directly to your observability stack (like a PagerDuty or Google Cloud Alerting webhook).
The following programmatic representation illustrates how this logic might look when initialized inside an application environment:
import asyncio
from antigravity import Agent
from antigravity.mcp import MCPServer
from antigravity.hooks import pre_tool_call_decide, HookResult
# Define a strict Decide Hook for safety
@pre_tool_call_decide
async def block_deletes(tool_call):
if "kubectl delete" in tool_call.arguments.get("command", ""):
return HookResult(allow=False, reason="Destructive command blocked.")
return HookResult(allow=True)
# Configure the Remote MCP server programmatically
gcp_monitoring_mcp = MCPServer(
url="https://monitoring.googleapis.com/mcp",
transport="http",
headers={"Authorization": "Bearer YOUR_GCP_OAUTH_TOKEN"}
)
async def main():
agent = Agent(
name="GKE Responder",
system_prompt="Diagnose the GKE cluster, spawn an evaluation subagent, and check native Cloud Monitoring metrics.",
tools=["execute_shell"],
mcp_servers=[gcp_monitoring_mcp],
hooks=[block_deletes]
)
print("Executing automated SRE response...")
result = await agent.run("Alert: checkout-service is crashing in prod.")
print(result.text)
if __name__ == "__main__":
asyncio.run(main())
4. Managed Agents API: Serverless Cloud Execution
Best for: Zero-maintenance infrastructure and enterprise-wide deployment.
The Managed Agents API moves the entire execution environment off of local machines or company-hosted servers and directly into Google Cloud’s serverless infrastructure. To implement this, the agent identity, core operating behavior, and structural boundaries are declared once via a centralized registration request to the Gemini API.
Because the agent runs entirely within Google Cloud, it utilizes native cloud-to-cloud integrations. The agent maps directly to Google’s global Remote MCP monitoring endpoints without requiring any credential passing or token refresh loops in the client payload. SRE teams invoke this hosted agent via a lightweight backend request whenever an incident occurs, letting Google Cloud handle the processing, sandbox isolation, and runtime infrastructure completely behind the scenes.
The following configuration endpoint invocation illustrates how an enterprise registers an agent blueprint onto the cloud substrate:
curl -X POST "https://generativelanguage.googleapis.com/v1beta/agents?key=$API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "gke-incident-responder",
"systemInstruction": "You are a GKE Responder. Use diagnostics tools, propose fixes, and evaluate via Cloud Monitoring metrics.",
"tools": [
{ "name": "kubernetes_mcp_gateway" },
{ "name": "cloud_monitoring" }
]
}'
Once registered, SRE teams or automated monitoring systems can invoke this hosted agent via a lightweight backend request whenever an incident occurs. By creating an Interaction, Google Cloud handles the processing, sandbox isolation, and runtime infrastructure completely behind the scenes.
The following Python snippet illustrates how an alerting payload triggers the agent programmatically:
from google import genai
client = genai.Client(api_key="YOUR_API_KEY")
# Trigger the remote Antigravity agent
interaction = client.interactions.create(
agent="gke-incident-responder",
input="Alert: The checkout-service in prod is crash-looping.",
environment="remote"
)
print(f"Incident Status: {interaction.status}")
print(f"Agent Output: {interaction.output}")
Conclusion
Automating incident response requires more than just an LLM that knows Kubernetes syntax; it requires a disciplined orchestration framework that enforces verifiable outcomes.
By utilizing Dynamic Subagents and leveraging the diverse deployment surfaces of the Antigravity 2.0 ecosystem alongside native Managed Remote MCP Servers, engineering teams can transition AI agents from simple code assistants into reliable, autonomous SRE teammates. Whether monitoring the agent visually in the Desktop App, orchestrating it via Python, or triggering it headlessly in the cloud, the tools to build the 100x SRE are finally here.
메타데이터
- post_id
- 5b5690ffed18
- slug
- 100x-sre-building-an-autonomous-gke-incident-responder-with-google-antigravity-2-0-5b5690ffed18
- url
- https://medium.com/@gabriel.bechara/100x-sre-building-an-autonomous-gke-incident-responder-with-google-antigravity-2-0-5b5690ffed18
- canonical_url
- https://medium.com/@gabriel.bechara/100x-sre-building-an-autonomous-gke-incident-responder-with-google-antigravity-2-0-5b5690ffed18
- author_url
- https://medium.com/@gabriel.bechara
- status
- ok
- fetched_at
- 2026-06-20 20:29:01