AI Agents In Production Infrastructure: What The Industry Learned The Hard Way with JP Morgan Chase

AI Agents In Production Infrastructure: What The Industry Learned The Hard Way with JP Morgan Chase — Ai4

Ai4

AI-assisted summary of AI Agents In Production Infrastructure: What The Industry Learned The Hard Way with JP Morgan Chase — original source. Check the original for full context.

Source published:

Detailed notes

## Background Published on YouTube by the Ai4 channel on August 19, 2026, this session features Rahul Tanniru, Senior Vice President of Software Engineering at JPMorgan Chase. According to the description, the presentation details the real-world failures, prompt engineering patterns, agentic architectures, and governance guardrails developed when deploying Claude-based autonomous AI agents across enterprise Infrastructure as Code (IaC) and SRE workflows.

## TL;DR Rahul Tanniru examines the operational shift from reactive autocomplete assistants to fully autonomous agentic workflows capable of writing Terraform, triaging incidents, and managing Kubernetes clusters. He breaks down common production failure modes—including context dilution, embedding mismatch across environments, and ambiguous ticketing prompts—and presents proven patterns like root-level AGENTS.md configurations, multi-worker agent loops, and hard retry budgets. Through real-world enterprise case studies like EKS flapping node remediation and multi-cloud migrations, the talk outlines vital guardrails including test-first agent development, mutation testing, and least-privilege access control. Finally, the presentation provides an ROI framework balancing raw token costs against first-pass reliability, urging engineers to become proactive architects rather than passive tool subscribers.

## Atmosphere & style The presentation carries a pragmatic, engineering-first tone that deliberately cuts through AI hype to focus on battle-tested production realities. Tanniru speaks with the candid, measured authority of a seasoned platform leader, treating autonomous agents with the same rigorous scrutiny one would apply to a junior engineer. The narrative builds methodically from messy real-world failures and edge-case pitfalls into actionable architectural solutions, leaving technical viewers with a grounded, highly disciplined blueprint for enterprise AI adoption.

## Key takeaways - [00:04](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=4s) Agentic coding shifts AI from reactive autocomplete within a single file to autonomous, multi-file execution that evaluates logic gates, drafts execution plans, and resolves infrastructure errors. - [01:52](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=112s) A five-stage closed-loop pattern (Plan, Context Assembly, Tool Invocation, Observation, and Replanning) allows agents to detect subtle omissions—like missing DB subnet groups—before executing a terraform apply. - [04:28](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=268s) Standard context retrieval methods often fail in infrastructure: grep misses multi-level variable lookups, vector search blends dev and prod configurations, and direct file injection quickly exhausts context windows. - [07:02](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=422s) Autonomous triage and remediation workflows can compress SRE diagnostic and patching cycles from 1.5 hours down to approximately 15 minutes, as proven in live EKS flapping node incidents. - [08:49](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=529s) Autonomous agents should be treated like new junior hires, governed by strict least-privilege permissions, confined to non-production environments during validation, and backed by end-to-end trace logging. - [10:48](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=648s) Evaluating LLMs purely by token cost is deceptive; higher-cost models with superior first-pass accuracy (such as Claude) reduce expensive multi-turn retry loops and yield lower overall operational spend. - [13:03](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=783s) Standardizing root-level AGENTS.md configuration templates provides a persistent single source of truth for disaster recovery regions, backend state locking, and corporate compliance rules. - [15:29](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=929s) Relying on raw, colloquial issue tracker descriptions introduces catastrophic hallucination risks, such as an agent interpreting 'reiterate the database' as a directive to delete and recreate the database. - [17:35](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1055s) Production architectures must enforce a strict three-retry budget rule; if an agent fails to resolve an infrastructure bug after three attempts, it will churn randomly and must escalate to a human engineer. - [21:45](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1305s) Effective automated incident remediation uses a multi-agent orchestrator-worker hierarchy with Model Context Protocol (MCP) tool integration rather than monolithic end-to-end agents. - [30:42](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1842s) Validating AI-generated infrastructure requires robust test-first frameworks, property-based testing, LLM-as-a-judge inspections, and mutation testing to catch latent configuration and security gaps. - [36:56](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=2216s) Engineering teams must become architects rather than passive tool subscribers, measuring agent ROI through operational stability and business outcomes rather than vanity metrics like PR count or lines of code.

## Detailed walkthrough ### [00:04](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=4s) Introduction and Coding Assistants vs. Agentic Coding

Rahul Tanniru, Senior Vice President of Software Engineering at JPMorgan Chase, opens the session by addressing the shift from experimental AI to real-time industrial deployment of agentic architecture workflows. Rather than treating artificial intelligence as a theoretical novelty, organizations are actively deploying agents into mission-critical infrastructure to write Terraform, handle incident triage, and manage cloud resources. The objective of the talk is to transparently examine the failures encountered along the way, how teams overcame them, the prompt engineering patterns that survived production load, and the architectural design of multi-agent systems.

To establish a baseline, Tanniru contrasts conventional coding assistants with true agentic coding across three core dimensions: triggers, scope, and error handling. Traditional coding assistants function primarily as reactive autocomplete engines. If an engineer sets out to define an AWS RDS module in Terraform, a standard assistant simply suggests inline resource blocks within a single active file. In contrast, agentic coding operates autonomously across an entire repository or module structure; it evaluates logic gates, drafts a Terraform execution plan, triggers tools, and can autonomously run `terraform plan` and `terraform apply`.

When handling errors, traditional assistants require constant human intervention to read error logs, diagnose the issue, and manually implement a fix in that isolated file. Agentic systems, however, are capable of ingesting operational runbooks, determining the necessary remediation steps across multiple files, and triggering automated workflows to fix the errors directly.

| Dimension | Traditional Coding Assistant | Agentic Coding | |:--- |:--- |:--- | | **Trigger & Execution** | Reactive autocomplete for resource snippets | Evaluates logic gates, drafts execution plans, and executes tools/commands | | **Operational Scope** | Single isolated file | Whole repository, module hierarchy, and multi-file dependencies | | **Error Handling** | Relies on human to diagnose and apply fixes | Ingests runbooks, diagnoses root causes, and autonomously resolves errors |

---

[01:52](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=112s) Anatomy of Agentic Loops and the Five-Stage Closed-Loop Pattern

The technical anatomy of agentic development begins with a clear developer goal or intent, such as provisioning an EC2 instance or adding a read replica to an existing RDS database instance. The developer entrusts this goal to a Large Language Model (LLM), which auto-generates the corresponding resource blocks. However, enterprise production demands strict adherence to organizational guardrails, such as mandatory resource tagging, encryption enforcement, and security baseline compliance. In a typical development loop, code pushed to GitHub or Bitbucket triggers an automated feedback loop where validation policies check the code against organizational standards, prompting the agent to iteratively refine the implementation until it meets all governance criteria.

```mermaid flowchart TD accTitle: Five-Stage Agentic Infrastructure Closed-Loop accDescr: Flowchart showing the five stages of an agentic infrastructure loop from intent to observation and apply.

subgraph Phase1["1. Planning & Context"] A["Goal / Intent<br/>(e.g., Create RDS Read Replica)"] --> B["Context Assembly<br/>(Read State & Terraform Files)"] end

subgraph Phase2["2. Execution & Verification"] B --> C["Tool Invocation<br/>(Generate Code & Run Plan)"] C --> D{"Observation & Validation<br/>(Analyze Plan Output)"} end

subgraph Phase3["3. Self-Correction & Apply"] D -- "Missing Subnet Group Detected" --> E["Replanning & Auto-Fix<br/>(Inject DB Subnet Group)"] E --> C D -- "Plan Verified Clean" --> F["Terraform Apply<br/>(Execute to Cloud Infrastructure)"] end ```

Tanniru highlights a five-stage closed-loop pattern: 1. **Plan / Intent:** The developer specifies the desired end state (e.g., "create a read replica for an RDS database"). 2. **Context Assembly:** The agent gathers ambient context by scanning repository files and inspecting current Terraform state to determine precisely where modifications belong. 3. **Tool Invocation:** The agent generates the necessary HCL configurations and invokes the Terraform CLI to generate an execution plan. 4. **Observation:** The critical evaluation phase where the agent analyzes the plan output. Tanniru notes a common pitfall in infrastructure: "The plan looks good, nothing to destroy, but apply fails." A sufficiently intelligent agent catches hidden omissions during observation—realizing, for instance, that while the plan reports one resource to add and zero to destroy, the read replica lacks an explicit DB subnet group association that will trigger an API error during actual deployment. 5. **Replanning and Apply:** Recognizing the missing configuration, the agent enters an internal correction loop, injects the missing DB subnet group into the resource definition, re-verifies the plan, and safely proceeds with the apply phase.

---

[04:28](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=268s) Context Retrieval Failure Modes: Grep, Embeddings, and Direct Reads

Tanniru polls the audience on whether anyone has ever asked an AI agent to perform a task and received a 100% accurate, completely hallucination-free result on the first attempt. Acknowledging that hallucinations are an inherent reality of LLMs, he dissects how different context retrieval strategies fail in infrastructure codebases:

- **File Search / Grep Matching:** When tasked with updating security group rules for a resource named `SecurityGroupA`, an agent utilizing simple keyword search or grep behaves like a `Ctrl+F` scan. While it successfully finds direct references to the string, it fails completely when security group IDs or rules are abstracted two or three levels deep through variable lookups, local maps, or module outputs. Failing to resolve these indirect references leads directly to configuration drift and production outages. - **Semantic Search / Vector Embeddings:** Instead of matching literal strings, embedding-based approaches search by conceptual meaning. When an agent attempts to retrieve configuration patterns for an RDS database, semantic similarity matches database definitions across development, staging, and production environments indiscriminately. Because different environments maintain different database engine versions, parameter groups, or sizing tiers, cross-referencing across environments can cause the agent to blend configurations—such as applying a development version tag to a production deployment. - **Direct File Reads:** Providing explicit file paths and structured guidelines yields the highest precision, as the agent reads the exact source code required. However, direct file injection only scales across a small number of files. When applied to massive repositories, it saturates the model's context window, introduces noise, triggers false inferences, and significantly increases API token costs.

---

[07:02](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=422s) Real-World Incident Walkthrough: Autonomous EKS Flapping Node Remediation

To illustrate agentic workflows under real operational pressure, Tanniru walks through an automated incident response scenario involving an Amazon EKS cluster suffering from flapping worker nodes.

```mermaid flowchart LR accTitle: Real-Time EKS Flapping Node Auto-Remediation Flow accDescr: Step-by-step incident response flow executed by an AI agent to resolve flapping Kubernetes nodes.

A["Alert Ingestion<br/>EKS Flapping Nodes"] --> B["Cluster Triage<br/>Execute kubectl diagnostics"] B --> C["Config Inspection<br/>Evaluate Node Group Terraform"] C --> D{"Root Cause Analysis<br/>Spot Eviction vs Lifecycle Hook"} D --> E["Code Remediation<br/>Fix Spot Config & Add Drain Hook"] E --> F["Safe Deployment<br/>Plan, Verify & Apply Terraform"] ```

When the monitoring alert fires, the agent executes an end-to-end remediation sequence: 1. **Diagnosis:** Ingesting the alert, the agent invokes `kubectl` CLI commands to identify specifically which worker nodes are in an unhealthy or flapping state. 2. **Configuration Inspection:** It locates the corresponding node group Terraform files responsible for those nodes to evaluate the underlying provisioning code. 3. **Hypothesis Testing:** The agent formulates two potential root causes: aggressive spot instance interruptions or misconfigured EC2 Auto Scaling lifecycle hooks. It cross-references diagnostic data across running instances and confirms that spot instance market evictions are destabilizing the cluster. 4. **Remediation and Future Prevention:** The agent updates the Terraform configuration to resolve the node group capacity settings. Critically, it acts proactively rather than merely applying a temporary patch: it configures an Auto Scaling lifecycle termination hook combined with cluster drain selection annotations to ensure graceful pod eviction during future termination events. 5. **Execution and Validation:** The agent generates the Terraform plan, validates syntax and structural integrity, executes `terraform apply`, and verifies recovery across monitoring dashboards.

Tanniru emphasizes the dramatic efficiency gains: while an on-call Site Reliability Engineer (SRE) typically spends 1 to 1.5 hours diagnosing, patching, and testing such an incident manually, the autonomous agentic architecture completed the entire triage and remediation loop in roughly 15 minutes.

---

[08:49](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=529s) Principle of Least Privilege and LLM Evaluation Dimensions

Deploying AI agents requires treating them like human personnel: "Think of your agent as a new member who joined the team." Organizations do not grant root credentials or unrestricted access to production databases to a new hire on day one; similarly, autonomous agents must be governed by strict least-privilege access controls. In production architectures, agent execution should be confined to isolated CI/CD pipeline stages and restricted to non-production or development environments while models and toolchains are being validated. Furthermore, robust observability is mandatory. Teams must capture comprehensive trace logs of all agent actions, tool calls, and execution outputs to determine conclusively during an outage whether an error was introduced by a human engineer or an autonomous agent.

Evaluating foundation models for infrastructure agents requires balancing five core metrics: - **Code Correction / Accuracy:** The percentage of syntactically and semantically valid infrastructure code the LLM generates without human intervention. - **Context Retention:** The model's capacity to process expansive input state files and multi-module schemas without degrading or truncating output accuracy. - **Tool Use Reliability:** How consistently and accurately the model structures arguments for Model Context Protocol (MCP) servers, cloud APIs, and local CLI tools. - **Execution Latency:** The turnaround time for reasoning loops and tool calling during time-critical incidents. - **Inference Cost:** The ongoing operational expenditure associated with high-token agentic loops.

Tanniru notes that recent benchmark data demonstrates Anthropic's Claude leads the industry in code correction and technical accuracy for infrastructure workflows, though it represents a more expensive option relative to alternative foundation models.

[10:48](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=648s) Model Selection: Code Reliability vs. Raw Token Cost

When teams evaluate LLMs for infrastructure automation, comparing models purely on API token cost is a deceptive metric. While some models appear cheaper on paper, models like Anthropic's Claude often come out ahead in practice because of first-pass code reliability. If a cheaper model produces incorrect or brittle infrastructure code, engineers find themselves executing three to four retry loops to get a working configuration. Those repeated roundtrips quickly multiply token usage and inflate overall costs. Claude often delivers syntactically correct and reliable infrastructure code on the first attempt, drastically cutting down on retries. Selecting an LLM for agentic workloads requires evaluating how well its reliability profile offsets the raw per-token price tag.

[11:31](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=691s) Tested Prompt Engineering Patterns: Context Injection and Chain of Thought

Real-world deployments highlight critical lessons around structured context injection and downstream dependency handling. In one case, an agent was given a simple prompt: *"Hey, can you please add me an auto scaling group of AWS EC2 instance?"* The model successfully generated the Auto Scaling Group (ASG) resource block, but because it lacked operational guidelines, it defaulted arbitrarily to a minimum of two instances and a maximum of four, tied to a generic CPU threshold. That default might technically work, but it rarely matches actual production workload demands. Providing a tightly structured prompt that details exact replica bounds, specific evaluation time windows, and target CPU/memory thresholds ensures the agent outputs actionable infrastructure code instead of guesswork.

```mermaid flowchart TD accTitle: Structured Context Injection vs Naive Prompting subgraph Naive["Naive Prompting"] N1["Prompt: Add EC2 ASG"] --> N2["Agent Guesses Attributes"] N2 --> N3["Random Bounds: Min 2, Max 4<br>Arbitrary CPU Metric"] end

subgraph Structured["Structured Prompt Injection"] S1["Prompt + Workload Specs"] --> S2["Agent Ingests Context"] S2 --> S3["Deterministic ASG Config<br>Exact Replica & Metric Rules"] end ```

Single-shot Chain of Thought prompts can still introduce subtle infrastructure breakage. When asked to modify existing VPC cluster configurations, an agent successfully updated the target VPC subnet groups and security group references. However, the agent broke all indirect references that relied on variable lookups and implicit downstream dependencies rather than direct VPC IDs. Without explicit dependency mappings, agents routinely miss implicitly coupled resources across Infrastructure as Code (IaC) codebases.

[13:03](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=783s) Grounding Agents with Root-Level `AGENTS.md` Templates

To enforce organization-wide infrastructure guardrails, teams should define a root-level `AGENTS.md` configuration template. This file acts as the single source of truth for the agent whenever it generates or updates resources:

```markdown # Infrastructure Standards Template - AWS: - Primary Region: us-east-1 - DR / Backup Region: us-west-2 - GCP: - Dedicated Data Platform Region: us-central1 - Terraform State Management: - State Backend: Amazon S3 with DynamoDB state locking - Workspace Strategy: Dedicated dev workspaces - Security & Tagging Policies: - Mandatory default encryption across all resources - Strict ban on hardcoded account IDs and regions - Standardized corporate tagging schemas enforced ```

By reading this file upfront, the agent consistently honors designated disaster recovery regions, backend storage configurations, and compliance policies, preventing invalid or unauthorized infrastructure changes.

[14:32](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=872s) The Emerging Tooling Ecosystem for Agentic Infrastructure

Modern infrastructure automation stacks are rapidly converging on specialized tooling across the entire agent lifecycle:

| Layer | Popular Tooling & Platforms | |:--- |:--- | | **IDE Agents** | Cursor, GitHub Copilot, Windsurf | | **CLI & Terminal Agents** | Claude Code | | **Agent Orchestration** | LangGraph, AutoGen | | **Context Management** | Root-level `AGENTS.md` configuration templates | | **IaC Validation & Security** | `terraform plan`, Terratest, tfsec, proprietary internal linters | | **Agent Observability** | LangGraph tracing, AWS CloudTrail integrations, event logs |

[15:29](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=929s) Feature Engineering: Mitigating Hallucinations and the Jira Risk

Reducing hallucinations in production agentic workflows requires feeding the model continuous, deterministic context:

- **Terraform Plan & Output Pairing:** Ingesting `terraform plan` along with `terraform show` output lets the agent compare the desired state against the planned diff, verifying its own work before changes apply. - **CloudTrail & Git History Integration:** Correlating AWS CloudTrail event streams with GitHub commit history provides the agent with chronological context on who changed what, narrowing down unexpected drift. - **Side-by-Side Terratest Integration:** Passing active Terratest test suites directly into the agent's context window ensures code generation is immediately measured against formal acceptance tests. - **Upstream & Downstream Dependency Maps:** Maintaining an explicit service graph lets the agent know exactly which dependent systems need parallel updates whenever an upstream resource changes.

Relying on unstructured Jira descriptions alone is a major anti-pattern. Because engineers write tickets using ambiguous, colloquial phrasing, agents can misinterpret intent. In one real-world incident, a Jira ticket asked an agent to *"reiterate the database evaluations."* The agent interpreted "reiterate" as an instruction to delete and recreate the database, wiping out the resource. Production integrations with issue trackers require strict, structured ticket templates rather than raw natural language.

```mermaid flowchart LR accTitle: Grounded IaC Context Engine subgraph Inputs["Context Sources"] A["Terraform Plan & Show Output"] B["CloudTrail + Git Commits"] C["Terratest Test Suites"] D["Service Dependency Graph"] end

subgraph AgentEngine["Agent Processing"] E["Context Injection & Validation"] end

subgraph Output["Safe IaC Execution"] F["Verified, Grounded Code Changes"] end

A --> E B --> E C --> E D --> E E --> F ```

[17:35](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1055s) Hyperparameter Tuning and Production Guardrails

Operating agentic cloud systems requires tuning key operational knobs to keep agents reliable and budget-conscious:

- **Context Window Management:** Carefully balance the token ratio between injected context and generated output to avoid degradation. - **The Three-Retry Budget Rule:** Enforce a hard ceiling on automated retries. If an agent fails to resolve an infrastructure bug within three retries, subsequent attempts almost never fix the root issue; the model merely churns and swaps random lines of code. Escalate to an engineer when the retry budget hits three. - **Multi-File Task Chunking:** Avoid dumping 20 to 30 files into a single context window. Massive multi-file payloads trigger context dilution and hallucinations. Break workloads into smaller, logically grouped multi-file chunks.

[18:57](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1137s) Common Failed Approaches in Cloud Agent Adoption

Teams frequently run into four common architectural failure modes when introducing autonomous agents:

- **Prompting Without Infrastructure Context:** Requesting resources without explicit boundary conditions yields arbitrary configurations (such as auto-scaling groups with default, unvetted sizing parameters). - **Premature `terraform apply` Permissions:** Granting agents autonomous apply permissions too early invites catastrophic outages. Treat every new agent like a new junior engineer: restrict its initial scope to isolated sandbox environments, and require mandatory human-in-the-loop approval before running applies in production. - **Multi-Service Auto-Completion Across Helm Charts:** Agents indexing cross-environment Helm configurations frequently mix up parameters, accidentally copying staging or dev configurations directly into production releases. - **Monolithic End-to-End CI/CD Agents:** Assigning a single agent to manage an entire end-to-end CI/CD pipeline causes context overflow as it progresses through build, test, and release phases. Instead, assign isolated, single-purpose agents to each distinct stage of the pipeline.

[20:38](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1238s) The Shift in Incident Response: Manual Triage vs. Agentic Workflows

Traditional production incident response is slow and manual. When an alert fires:

1. The on-call engineer gets paged. 2. The engineer logs in, identifies the broken application, and sifts through system logs. 3. If the root cause is unclear, the engineer pages subject-matter experts (SMEs), hoping they pick up quickly. 4. Once the engineer identifies the root cause, they write a patch, test it in a development environment, open a pull request, wait for human approvals, and deploy to production.

Even when everyone responds immediately, this traditional workflow routinely takes two to three hours. Agentic engineering transforms this lifecycle by autonomously ingesting the initial alert page, parsing telemetry logs, and kicking off immediate automated remediation steps.

[21:45](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1305s) Multi-Agent Architecture for Automated Remediation

Autonomous incident remediation relies on a structured sequence where an agent queries logging pipelines, analyzes application logs, consults historical runbooks for documented fixes, and tests the remediation via a `terraform plan` in the development environment before submitting a draft pull request for human approval. This end-to-end cycle compresses an engineering task that typically takes 30 minutes to 3 hours down to roughly 20 to 25 minutes.

To coordinate these responsibilities, a multi-agent system uses a central orchestrator paired with specialized worker agents. A planner agent evaluates broad high-level goals and breaks them into smaller subtasks, dispatching specific workers for code generation, automated testing, or documentation. Balancing agent granularity is critical: over-indexing on single-purpose agents creates significant maintenance overhead, requiring teams to deliberately combine compatible tasks into unified agent runs.

```mermaid flowchart TD accTitle: Multi-Agent Architecture for Automated Remediation subgraph Planning["Coordination & State"] ORC["Central Orchestrator"] --> PLAN["Planner Agent"] ORC <--> MEM[("Memory Store / Vector DB<br/>(Session & State Info)")] end

subgraph Workers["Worker Agents & Tools"] PLAN --> W_CODE["Code Worker"] PLAN --> W_TEST["Test Worker"] PLAN --> W_DOC["Documentation Worker"] PLAN --> MCP["MCP Worker Node"] MCP <--> TOOLS["External Tools<br/>(GitHub, Bitbucket, Confluence)"] end ```

- **Session State Storage**: Similar to maintaining state files during a Terraform execution, agents persist dynamic session state and context within a vector database memory store. - **Model Context Protocol (MCP)**: Tool integration across enterprise repositories (e.g., Confluence, GitHub, Bitbucket) is routed through dedicated MCP worker agents.

---

[24:20](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1460s) Developer Productivity and SRE Operations

Platform engineers leverage agentic workflows to compress three to four days of manual engineering effort into a single day without displacing the developer's role. A standard daily workflow illustrates this velocity increase: triaging an incident at 9:00 AM takes 30 minutes (down from 1 to 2 hours), followed immediately by drafting Prometheus alert rules, authoring Terraform modules, generating Terratest coverage suites, and shipping to production. Rather than replacing engineers, "it's basically increasing the productivity of developer, how many tasks he can do."

In site reliability engineering (SRE), subject matter experts define service level agreements (SLAs), service level objectives (SLOs), and error budgets using natural language prompts. The agent ingests these operational requirements and provisions dashboards directly within monitoring platforms like Dynatrace. Runbook automation functions similarly: on-call engineers supply baseline operational procedures, and autonomous agents cross-reference and execute the documented steps during active service disruptions.

---

[26:39](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1599s) Enterprise Migration Case Studies: EKS, Multi-Cloud Terraform, and Logging

Real-world production rollouts highlight substantial efficiency gains across large-scale migration and provisioning initiatives when standard templates guide agentic execution:

```mermaid flowchart LR accTitle: Agentic Infrastructure Migration Workflow subgraph Prep["1. Standardization"] TPL["Define Golden Templates<br/>(Patterns, Tags, Security Policies)"] end

subgraph Gen["2. Agentic Parallel Run"] EXEC["Parallel Generation / Upgrade<br/>(200+ Clusters / 80+ Modules)"] TEST["Parallel Test Suite Creation<br/>(Terratest / Dev Deployments)"] end

subgraph Validation["3. Promotion & Review"] AUTO["Auto-Validated Workloads<br/>(Dev Verified)"] HUMAN["Human Review / Approval<br/>(Edge Cases & Interconnects)"] MAIN["Merge to Master/Main"] end

TPL --> EXEC EXEC --> TEST TEST --> AUTO TEST --> HUMAN AUTO --> MAIN HUMAN --> MAIN ```

- **Amazon EKS Cluster Upgrades (v1.24 to v1.29)**: - Scope: Migrating 200+ Kubernetes workloads under a strict 8-week AWS deprecation deadline, a process typically requiring 6 to 7 weeks of manual configuration audits. - Outcome: Standardized migration patterns enabled agents to identify configuration mismatches, update cluster manifests, and generate test suites in parallel. 190 of the 200+ workloads were upgraded and validated in development autonomously, leaving only complex edge cases for manual engineering review. - **Multi-Cloud Terraform Modules (AWS & GCP)**: - Scope: Developing 80+ enterprise Terraform modules complying with internal encryption, resource tagging, and security baselines, which normally requires months of engineering. - Outcome: The agent generated multi-cloud resource blocks alongside corresponding Terratest suites simultaneously, cutting total project delivery time down to 2 weeks. Complex cross-cloud network interconnectivity was flagged for human validation prior to merging to the `main` branch. - **Logging Library Upgrades**: - Scope: Refactoring deprecated logging framework versions across distributed architectures. - Outcome: The agent successfully located dependencies and upgraded 38 out of 40 services, with engineers handling the remaining 2 legacy edge cases.

---

[30:42](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1842s) Production Realities and Infrastructure Testing Strategies

Real-world deployments show a clear split between speed and full autonomy: 55% of respondents observe substantially faster delivery cycles, yet 38% encounter security gaps where agents fail to apply required controls. While agents reliably pass basic unit and integration tests, deeper system health checks still fail to reach 100% pass rates, highlighting the absolute necessity of automated guardrails and mandatory human approval gates.

``` +-----------------------------------------------------------------------+ | AI Code Generation Engine | +-----------------------------------------------------------------------+ | v +-----------------------------------------------------------------------+ | Testing & Validation Harness | | | | [Property-Based Testing] [LLM-as-a-Judge] [Mutation Testing] | | Validate resource props Secondary LLM Inject deliberate | | and config states prior validates logic faults to verify | | to infrastructure rollout against errors agent detection | +-----------------------------------------------------------------------+ | v +-----------------------------------------------------------------------+ | Human-in-the-Loop & Governance Gates | +-----------------------------------------------------------------------+ ```

To validate AI-generated infrastructure before deployment, engineering teams use three core testing methodologies:

- **Property-Based Testing**: Validates granular Terraform resource properties and state configurations against target infrastructure rules before provisioning resources. - **LLM-as-a-Judge**: Employs an independent, secondary LLM model to inspect the primary model's infrastructure manifests. Discrepancies between model outputs flag logic errors for inspection. - **Mutation Testing**: Introduces deliberate faults and misconfigurations into the agent-generated code to verify whether the AI test harness correctly catches the breakage.

[32:49](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1969s) Test-First Agentic Development and Production Guardrails

When developing agentic systems, testing cannot be an afterthought. Engineering teams must establish their unit tests, integration tests, and outcome-based functional tests before letting an agent write any application logic. By defining the test suite first, the agent can inspect the target specifications, understand what constitutes correct functionality, and generate code specifically designed to satisfy those test cases. This test-first methodology significantly reduces hallucination and constrains the agent's generative output to verifiable functional requirements.

```mermaid flowchart TD accTitle: Test-Driven Agentic Development Workflow subgraph Spec ["1. Specification & Testing"] A["Define Functional Requirements"] --> B["Write Unit & Integration Tests"] end subgraph AgentLoop ["2. Agentic Execution"] B --> C["Agent Reads Test Suite"] C --> D["Generate Implementation Code"] end subgraph Validation ["3. Production Gate"] D --> E{"Tests Pass & Least Privilege Met?"} E -- No --> C E -- Yes --> F["Human-in-the-Loop Review"] F --> G["Deploy to Production"] end ```

Beyond test-driven generation, autonomous agents must operate under strict security boundaries. Teams should enforce least-privilege execution, granting the agent only the bare minimum permissions required to perform its task. Under no circumstances should agents have unrestricted autonomy in live infrastructure; robust human-in-the-loop approval gates are mandatory before any automated action modifies a production environment.

- **Test-Driven Agent Development**: Writing integration and outcome-based test suites upfront gives the agent clear boundaries, drastically cutting down on hallucinations. - **Least-Privilege Execution**: Limit autonomous agents strictly to the minimal IAM and API scopes needed for the assigned task. - **Production Gating**: Require explicit human-in-the-loop approvals whenever an agent touches or mutates production state.

---

[33:44](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=2024s) Data Freshness, Bias, Observability, and Compliance Governance

Prompt injection defense and data integrity are central to safe agent operations. A cautionary example highlights the danger of stale reference data: a company implemented an AI resume-filtering agent for hiring, only to find the hiring manager asking, *"Hey, why are we getting all of our interview resumes only for men? Why are women not being selected at all?"* The agent had been fed outdated historical hiring data where men predominated, leading it to mirror and amplify that past bias in its screening decisions. If an agent references stale or skewed datasets, it inherently produces flawed and biased outcomes. Continuous data freshness and validation are critical.

Full observability into agent behavior is equally necessary. Teams must monitor the end-to-end execution paths, logging every action, tool call, and decision branch the agent takes. From a governance standpoint, evaluating cost and token consumption must go hand-in-hand with measuring code correctness and reliability. Deploying AI-generated code without rigorous guardrails exposes organizations to legal, compliance, and security risks—including open-source licensing violations, introduced vulnerabilities, and demographic bias.

- **Data Freshness and Bias Mitigation**: Stale reference data causes agents to perpetuate historical biases; knowledge bases and reference datasets must be actively updated and audited. - **Full Execution Observability**: Maintain complete telemetry on workflows, tool invocations, and intermediate reasoning steps taken by autonomous agents. - **Legal and Compliance Safeguards**: Scan all AI-generated code for security vulnerabilities, software licensing risks, and compliance policy violations before integration.

---

[35:24](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=2124s) The Economics of AI Coding and ROI Modeling

Quantifying the economic viability of AI coding agents requires a structured token-cost modeling framework. To calculate true return on investment (ROI), teams must track the direct token cost of running an agent through a specific task, multiply that cost across the anticipated operational volume, and measure it against the net reduction in developer hours.

Calculating agent economics involves looking well beyond base API pricing:

| Cost Factor | Operational Impact | Evaluation Metric | |:--- |:--- |:--- | | **Direct Token Spend** | Base API cost per run multiplied by total execution volume | Total task cost vs. developer hours saved | | **Prompt Engineering & Retries** | Developer time spent refining prompts and managing retries to yield structured outputs | Engineering hours spent on prompt iteration | | **Infrastructure Utilization** | Compute, hosting, and orchestration overhead for running agent frameworks | Active runtime vs. idle compute hosting costs | | **Model Drift** | Upstream LLM version updates causing unexpected behavioral shifts or regressions | Regression rate across model version upgrades |

---

[36:56](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=2216s) Becoming Architects, Not Subscribers: Focusing on Business Outcomes

Engineers must evolve into "architects, not subscribers." Rather than passively consuming AI APIs or relying on shallow tooling, technical teams should master context engineering, embrace disciplined agentic workflow designs, and align their efforts directly with concrete business impact.

Organizations should avoid falling into the trap of using legacy or vanity developer productivity metrics for AI adoption. Evaluating engineering performance based on raw commit counts, lines of code written, number of pull requests merged, or token volume consumed is counterproductive. True productivity and system health must be measured solely on functional outcomes, operational stability, and the business value delivered to users.

## Notable quotes > [01:52](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=112s) The plan looks good, nothing to destroy, but apply fails. — Rahul Tanniru

> [08:49](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=529s) Think of your agent as a new member who joined the team. — Rahul Tanniru

> [11:31](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=691s) Hey, can you please add me an auto scaling group of AWS EC2 instance?

> [15:29](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=929s) reiterate the database evaluations.

> [24:20](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1460s) it's basically increasing the productivity of developer, how many tasks he can do. — Rahul Tanniru

> [33:44](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=2024s) Hey, why are we getting all of our interview resumes only for men? Why are women not being selected at all?

> [36:56](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=2216s) architects, not subscribers. — Rahul Tanniru

## Mentioned Rahul Tanniru, JPMorgan Chase, AWS, Amazon RDS, Amazon EC2, GitHub, Bitbucket, Amazon EKS, EC2 Auto Scaling, Kubernetes, Anthropic, Claude, Cursor, GitHub Copilot, Windsurf, Claude Code, LangGraph, AutoGen, Terraform, Terratest, tfsec, AWS CloudTrail, DynamoDB, Amazon S3, Google Cloud Platform (GCP), Jira, Helm, Model Context Protocol (MCP), Confluence, Dynatrace, Prometheus

## Video description Rahul Tanniru - Senior Vice President of Software Engineering, JP Morgan Chase

AI agents are already writing Terraform, triaging incidents, and modifying Kubernetes configs in production and most teams are learning the hard way what goes wrong. In this talk, I'll share real failures from deploying Claude-based agentic systems across IaC and SRE workflows, including terraform apply disasters, runbook hallucinations, and CI/CD context overflow. I'll walk through the prompt engineering patterns, agentic loop architectures, and production guardrails that actually held up under real infrastructure load. Attendees will leave with a concrete model selection framework, a security and governance checklist for autonomous agents, and three live scenario walkthroughs, EKS auto-remediation and SLO dashboard generation.

[Source](https://www.youtube.com/watch?v=vWdwtvP0lbk)

中文简报

生产基础设施中的 AI Agent:行业与摩根大通的惨痛教训 Rahul Tanniru 探讨了从被动自动补全助手向完全自主的 Agent 工作流的运维转变,这类工作流具备编写 Terraform、排查故障并管理 Kubernetes 集群的能力。他详细剖析了生产环境中常见的失效模式——包括上下文稀释、跨环境嵌入不匹配以及含糊不清的工单提示词——并提出了经过验证的应对模式,例如根目录 AGENTS.md 配置、多 Worker Agent 循环和硬性重试预算。通过 EKS 节点抖动修复和多云迁移等企业真实案例,本次演讲概述了核心防护栏,包括测试先行的 Agent 开发、变异测试以及最小权限访问控制。最后,演讲提供了一个权衡原始 Token 成本与首次通过可靠性的 ROI 框架,呼吁工程师成为主动的架构师,而非被动的工具订阅者。 Agent 编码推动 AI 从单文件内的被动自动补全,转变为能够评估逻辑门、起草执行计划并解决基础设施错误的自主跨文件执行。 (0:04) 五阶段闭环模式(规划、上下文组装、工具调用、观察与重新规划)使 Agent 能够在执行 terraform apply 之前发现细微遗漏,例如缺失的数据库子网组。 (1:52) 标准的上下文检索方法在基础设施中往往容易失效:grep 会遗漏多级变量查找,向量搜索会混淆开发与生产配置,而直接注入文件则会迅速耗尽上下文窗口。 (4:28) 在真实的 EKS 节点抖动事件中已证实,自主分诊与修复工作流可将 SRE 的诊断和修补周期从 1.5 小时压缩至约 15 分钟。 (7:02) 自主 Agent 应被视作初级新员工,需受严格的最小权限原则约束,在验证期间仅限在非生产环境中运行,并辅以端到端的链路追踪日志。 (8:49)

Reading summary

Deploying autonomous AI agents into enterprise cloud infrastructure requires shifting from reactive inline code suggestion to closed-loop validation, rigorous context engineering, and least-privilege governance. Rahul Tanniru of JPMorgan Chase argues that while agentic systems deliver massive velocity gains, production stability depends on constraining model autonomy with multi-tiered testing and structured guardrails. Closed-Loop Execution Across Repository Scopes (1:52) Traditional coding assistants function merely as reactive autocomplete tools confined to single files, requiring humans to manually read error logs and implement fixes. In contrast, agentic infrastructure tools operate across entire repository hierarchies to evaluate logic gates, generate execution plans, and interact autonomously with tools like the Terraform CLI. Tanniru outlines a five-stage operational pattern: intent specification, context assembly, tool invocation, observation, and replanning. In this loop, the agent observes the output of commands like `terraform plan` to catch omissions—such as a missing database subnet group association—before executing an apply, autonomously rectifying code before infrastructure breakage occurs. Context Retrieval Failures and Structured Grounding (4:28) Standard information retrieval methods frequently fail within complex Infrastructure as Code (IaC) codebases. Keyword grep scans miss resources abstracted behind nested variable maps or module outputs, while semantic vector embeddings frequently conflate environments, applying development parameters to production workloads. Injecting raw file dumps causes context saturation, cost spikes, and hallucinations. Relying on conversational natural-language inputs poses operational risks; in one incident, an agent interpreted an ambiguous Jira instruction to 'reiterate the database evaluations' as a mandate to delete and recreate the production database. To prevent configuration drift, teams must ground models with structured context. Best practices include establishing a root-level `AGENTS.md` file specifying corporate tagging, backup regions, and backend state policies. Agents must also consume deterministic context: pairing `terraform plan` with `terraform show`, tracking Git and CloudTrail audit logs, and maintaining explicit upstream and downstream dependency graphs. Least-Privilege Governance and Rigorous Infrastructure Testing (8:49) Autonomous agents should be treated like new team members, restricted to sandbox environments under strict least-privilege IAM permissions with complete telemetry logging. Tanniru emphasizes that automated retries must be capped at three attempts, as further iterations typically result in random code churn rather than genuine error resolution. Production environments require mandatory human-in-the-loop approvals before executing `terraform apply`. While 55% of surveyed practitioners report faster delivery cycles, 38% encounter security gaps where agents overlook required controls. Standard unit tests prove insufficient for infrastructure safety. Reliable deployments instead depend on test-first development—where functional integration tests precede code generation—alongside property-based testing, secondary LLM-as-a-judge validation, and mutation testing to verify that test harnesses properly flag injected infrastructure faults. Operational Velocity, Large Migrations, and Economics (7:02) When governed by standardized templates, multi-agent architectures deliver notable efficiency gains across site reliability engineering and enterprise migrations. In an EKS flapping worker node incident, an autonomous agent analyzed `kubectl` metrics, diagnosed spot instance market evictions, updated Terraform configurations with termination drain hooks, and applied fixes within 15 minutes—a process that normally demands 1 to 1.5 hours of manual SRE intervention. Across large initiatives, agents upgraded 190 of 200+ Kubernetes clusters under an eight-week deprecation deadline and generated 80+ multi-cloud Terraform modules with test suites in two weeks, leaving only complex edge cases for manual review. Evaluating the economics of AI infrastructure agents requires looking beyond baseline token pricing. While models like Anthropic's Claude have higher direct per-token costs, Tanniru notes their first-pass code accuracy eliminates the three to four costly retry loops common in cheaper models. Net ROI must be calculated by weighing operational compute, prompt maintenance, and model regression risks directly against developer hours saved. Tanniru concludes that engineers must act as system architects rather than passive API subscribers, measuring productivity through operational stability and business value rather than vanity metrics like commit counts. Significant challenges remain unresolved, including preventing data staleness that reinforces historic operational or demographic bias, and closing the gap where deep system checks still fall short of 100% autonomous pass rates.

精炼阅读摘要

摩根大通软件工程高级副总裁 Rahul Tanniru 指出,将 AI Agent 部署于生产级云基础设施时,决定成败的核心在于结构化上下文工程与自动化测试防护网,而非单次代码补全或模型基础 API 成本。 从被动补全走向闭环自愈 (0:04) 传统代码助手仅在单个文件内提供被动的行内补全,报错时完全依赖工程师手动排查与修复;Agentic 架构则能跨越整个代码仓库与模块层级,自主评估逻辑门并执行工具链。Tanniru 归纳了包含意图输入、上下文装配、工具调用、观测分析与重新规划执行的五阶段闭环模式。在基础设施代码场景中,执行计划通过并不等同于部署成功,高成熟度的 Agent 必须在观测阶段识别出遗漏的隐式依赖并自动触发补偿修复,例如在生成 RDS 只读副本时补齐缺失的数据库子网组。 上下文检索失效模式与防护注入 (4:28) 在真实基础设施代码库中,常用的上下文检索方案均存在固有缺陷:基于 grep 的关键字搜索会因变量查找或模块输出等多层抽象而遗漏间接引用;向量语义检索则常因配置相似性混淆开发、预发与生产环境,导致低环境参数被错误应用到生产环境;直接读取完整源文件虽然准确,但极易撑满上下文窗口并显著推高 API 成本。生产实践表明,非结构化的 Jira 工单存在严重语义歧义风险,曾有工单中的口语化表述导致 Agent 误删并重建数据库。团队应在项目根目录维护 AGENTS.md 规范文件,向模型注入明确的区域策略、后端存储标准、标签规则以及依赖拓扑图。 模型选型与三轮重试预算防线 (10:48) 评估用于基础设施自动化的基础大模型时,单纯对比 API Token 单价往往具有误导性。廉价模型若代码生成可靠性较低,会导致工程团队陷入三到四轮调试重试,累计消耗的 Token 总量与时间反而远超单价更高但一次性通过率更优的模型(如 Anthropic 的 Claude)。为防止 Agent 在出现逻辑缺陷时无休止地随机试错,生产运维必须设置三轮重试预算上限:一旦自动化修复重试达到三次仍未解决,模型往往只会无效调换代码行,系统应立刻中断调用并升级人工排查。 大规模基础设施运维与分层验证机制 (7:02) 在真实的运维场景中,Agentic 架构展现出极高的提效应能。在 Amazon EKS 节点抖动故障中,Agent 自主完成诊断、归因至竞价实例驱逐并更新 Terraform 配置与生命周期钩子,将传统需耗时 1 至 1.5 小时的排障流程缩短至约 15 分钟;在涉及 200 多个 EKS 集群由 1.24 向 1.29 的版本迁移中,标准化模板驱动的 Agent 自动化验证并推进了其中 190 个工作负载。调查数据显示,尽管有 55% 的受访者见证了交付加速,仍有 38% 遭遇过 Agent 遗漏安全控制策略的隐患。企业必须推行测试优先的开发模式,通过基于属性的测试、大模型裁判(LLM-as-a-Judge)以及变异测试建立多重防线,并坚持最小权限原则和生产环境人工审批门禁。 Tanniru 强调,工程师的角色应当从被动的 API 使用者转变为系统架构师,企业对 AI 引入成效的衡量也不应依赖代码行数或提交频次等虚荣指标,而应聚焦于业务稳定性与端到端净耗时削减;同时,如何妥善解决陈旧参考数据引发的隐性系统偏差,仍是持续落地中的关键治理挑战。

Detailed notes — zh

## Background 本内容由 Ai4 频道于 2026 年 8 月 19 日在 YouTube 平台发布。视频由摩根大通(JP Morgan Chase)软件工程高级副总裁 Rahul Tanniru 主讲,深入探讨了生产级基础设施中落地 AI Agent 所经历的真实踩坑教训,涵盖 Terraform 生成、SRE 故障自愈、上下文窗口溢出以及生产治理护栏等实战经验。 ## TL;DR Rahul Tanniru 详细对比了传统编码助手与端到端 Agent 架构的核心差异,指出生产级基础设施需要具备闭环推理、上下文组装与错误自愈能力。演讲通过 EKS 节点抖动排查、200 多个集群跨版本升级以及 80 多个多云 Terraform 模块开发等真实案例,剖析了文件检索幻觉、隐式依赖丢失等典型败局。同时,他提出了通过 agents.md 规范模板、测试先行开发、多 Agent 协作架构及严格的最小权限与 ROI 评估体系,构建安全高效的生产级 Agent 落地路径。 ## Atmosphere & style 整场演讲呈现出硬核、务实且极具工程实战色彩的分享基调。讲师不讲虚浮的概念,而是直接从“现场无人举手表示 Agent 能给出 100% 准确代码”的冷酷现实切入,直面生产 Apply 崩溃与幻觉灾难。叙事逻辑层层推进,在剖析失败血泪史的同时给出极具落地性的架构解法,带给听众一种既警醒又醍醐灌顶的专业工程师共鸣。 ## Key takeaways - [00:04](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=4s) 生产级基础设施正在从单文件代码补全的编码助手(Coding Assistant)向具备跨仓库上下文、自主生成执行计划并能读取 Runbook 自动修复报错的 Agentic Coding 架构演进。 - [01:52](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=112s) 基础设施 Agent 遵循由计划、上下文组装、工具调用、观察与重规划组成的五阶段闭环;其中观察阶段识别隐式依赖(如遗漏的子网配置)是防止 apply 崩溃的关键。 - [04:28](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=268s) Grep 模式无法追踪多层变量引用,向量嵌入易混淆环境版本,直接读取全文件则易引发上下文溢出;上下文检索机制设计不当是导致 Agent 幻觉的核心根因。 - [07:02](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=422s) 在生产 EKS 节点抖动排障实战中,Agent 在 15 分钟内完成了定位 Spot 抢占根因、更新 Terraform 代码并添加防 Drain 生命周期钩子的自愈闭环,较人工排查效率提升数倍。 - [10:48](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=648s) 大模型选型需考量首发准确度与重试惩罚:单价低但错误率高的模型在经历 3 至 4 次重试后综合成本暴涨,而 Claude 凭借高首发准确率大幅压低了实际总成本。 - [13:03](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=783s) 通过在仓库根目录维护 agents.md 规范文件(固化多云区域、S3+DynamoDB 状态后端及安全打标红线),可有效消除 Agent 自行脑补非法参数的风险。 - [15:29](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=929s) 特征工程需要将 Terraform Output、CloudTrail 日志及微服务依赖拓扑注入上下文,同时严禁直接向 Agent 灌入未经结构化约束的日常 Jira 描述以防误操作。 - [18:57](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1137s) 生产治理必须贯彻最小权限原则并引入人在回路(Human-in-the-Loop)审批,在 CI/CD 流水线中针对不同阶段拆解专一 Agent,且单任务重试次数不宜超过 3 次。 - [21:45](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1305s) 多智能体架构依托 Orchestrator 与 Planner 调度代码、测试及 MCP 工具子节点,在 EKS 跨版本升级(190+ 负载自动通过)和多云 80+ 模块交付中展现出显著提效。 - [30:42](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1842s) 生产实战表明 AI 带来了 55% 的交付加速,但仍存在 38% 的安全合规盲区,必须通过测试驱动开发(TDD)、属性测试、变异测试与大模型裁判(LLM as a Judge)构建防护网。 - [03:24](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=204s) Agent 的 ROI 经济学必须兼顾开发者工时对冲与隐性成本(Prompt 调优、算力闲置及大模型版本漂移),企业应摒弃代码行数等虚荣指标,聚焦真实业务影响。 ## Detailed walkthrough ### [00:04](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=4s) 生产基础设施中的 AI Agent 与传统编码助手 摩根大通(JP Morgan Chase)软件工程高级副总裁 Rahul Tanniru 开门见山地指出,当前大部分企业仍停留在使用基础编码助手(Coding Assistant)的阶段,而生产级基础设施需要迈向真正的 Agent 架构(Agentic Coding)。两者在四个核心维度上存在根本差异: ```mermaid flowchart TD accTitle: 传统编码助手与 Agent 编码架构的对比 subgraph Assistant["传统编码助手 (Coding Assistant)"] A1["单文件代码补全 (Auto-complete)"] --> A2["单文件/代码片段视角"] A2 --> A3["报错依赖人工介入排查修复"] end subgraph Agentic["Agent 编码架构 (Agentic Coding)"] B1["自主生成 Plan / 执行逻辑门评估"] --> B2["跨 Repo / 跨模块全局上下文"] B2 --> B3["读取 Runbook 自动修复报错并 Apply"] end ``` - **触发机制(Trigger)**:编码助手仅在用户输入时进行单点代码补全(例如自动补齐一个 AWS RDS Terraform 模块);Agent 则能自主编写完整的 Terraform 执行计划、评估逻辑门(Logic Gates),并端到端调度执行 `terraform plan` 和 `terraform apply`。 - **作用域(Scope)**:编码助手局限于当前正在编辑的单个 `.tf` 文件;Agent 能够解析和理解跨模块结构(Module Structure)以及整个仓库中的所有关联文件。 - **错误处理(Error Handling)**:编码助手遇到执行错误时完全依赖人类工程师去定位与修改;Agent 则具备读取运维排错手册(Runbooks)的能力,能够根据指引自动触发修复流程并纠正代码错误。 ### [01:52](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=112s) 基础设施闭环生成工作流(Closed-Loop Architecture) 在将意图转化为生产基础设施的过程中,Agent 遵循一套严格的闭环生命周期,避免了传统开发中因规范不一致而反复人工返工的问题。 ```mermaid flowchart LR accTitle: 基础设施 Agent 五阶段闭环工作流 subgraph Loop["五阶段闭环状态流"] S1["1. Plan 意图解析<br/>(创建 RDS 只读副本)"] --> S2["2. Context Assembly<br/>(读取状态与 tf 文件)"] S2 --> S3["3. Tool Invocation<br/>(生成并运行 terraform plan)"] S3 --> S4["4. Observation<br/>(识别潜在 Apply 隐患)"] S4 --> S5["5. Replanning / Apply<br/>(补全子网组并应用)"] end ``` 以创建 RDS 数据库只读副本(Read Replica)为例,Agent 的标准执行闭环分为五个关键阶段: 1. **计划阶段(Plan)**:捕获开发者的目标与核心意图(Intent)。 2. **上下文组装(Context Assembly)**:检索目标代码的修改位置,读取相关的状态文件(State Files)与对应的 Terraform 配置文件。 3. **工具调用(Tool Invocation)**:调用底层工具链,为目标资源生成精确的 Terraform 执行计划。 4. **观察阶段(Observation)**:这是整个闭环中最关键的步骤。在实际生产中,经常出现“`plan` 看起来很完美(增加 1 个资源,销毁 0 个),但实际 `apply` 时报错崩溃”的情况。Agent 具备在观察阶段智能诊断隐式依赖的能力——例如精准提示:“Plan 显示正常,但遗漏了 DB Subnet Group 配置;若不补齐,底层 `apply` 必然失败。” 5. **重规划与应用(Replanning & Execution)**:Agent 自动追加遗漏的 DB Subnet Group,重新生成 Plan,最终安全执行 Apply。 ### [04:28](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=268s) 上下文检索的三种模式与幻觉陷阱 针对现场提问“有多少人让 Agent 写代码得到过 100% 准确、毫无伪造信息的答案”,全场无人举手。Rahul 借此深入拆解了 Agent 在检索与组装上下文时的三种常见模式及其引发幻觉的底层根因: | 检索模式 | 工作原理 | 核心优势 | 潜在缺陷 / 故障场景 | |:--- |:--- |:--- |:--- | | **文件搜索 / Grep 模式** (`file search / grep`) | 类似 `Ctrl+F`,通过匹配安全组(Security Group)名称等硬编码字符串定位文件。 | 针对特定显式命名资源定位迅速。 | 无法追踪 2 到 3 层深度的变量引用(Variable Lookups),导致关键数据缺失,引发生产事故。 | | **向量嵌入模式** (`Embedding / Semantic Search`) | 基于语义相似度提取 DB Group 或 RDS 等通用配置语义。 | 能够跨文件捕获模块语义关系。 | **环境混淆**:无法严格隔离 Dev、Test 与 Prod 环境中的特定版本配置,极易发生跨环境版本错配。 | | **直接全文件读取** (`Direct File Reads`) | 严格按照指令读取指定路径文件与操作规则。 | 语义精确度高,单文件表现优异。 | 仓库规模庞大时会导致**上下文窗口溢出(Context Overflow)**,带来高昂 API 成本并诱发幻觉。 | ### [07:02](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=422s) 实战案例:EKS 节点频繁抖动(Flapping Nodes)的 15 分钟自愈 Rahul 分享了一个真实发生在线上的典型故障自愈全流程:生产环境 EKS 节点组发生持续的节点抖动(Flapping Nodes),监控系统触发警报。 ```mermaid flowchart TD accTitle: EKS Flapping Nodes 自动排查与自愈流程 E1["监控告警: EKS Flapping Nodes"] --> E2["执行 kubectl 获取异常节点"] E2 --> E3["检索分析节点组 Terraform 代码"] E3 --> E4{"根因分支二选一假设"} E4 -->|"假设 A"| E5["排查 Spot 实例中断波动"] E4 -->|"假设 B"| E6["排查 Lifecycle Hook 错误配置"] E5 --> E7["确认 Spot 抢占为真实根因"] E7 --> E8["自动修复 Terraform 代码并增加防 Drain 抖动配置"] E8 --> E9["执行 Terraform Apply 并验证监控面板 (耗时 < 15 分钟)"] ``` - **故障定位**:Agent 接收告警后,自主执行 `kubectl` 命令列举出处于不可用状态的异常节点。 - **根因推演**:Agent 定位到对应节点组的 Terraform 基础设施代码,迅速列出两种可能的根因假设:① Spot 实例规格被抢占中断;② 节点生命周期钩子(Lifecycle Hook)配置异常。 - **测试与验证**:Agent 并发运行多组诊断测试,确认 Spot 实例中断是本次抖动的直接根因。 - **主动防御与修复**:Agent 修改了 Terraform 节点配置,不仅修复了实例配置,还主动添加了防止 Drain 抖动的集群节点生命周期配置注解(Lifecycle Configuration Hook),从架构层面杜绝同类故障再次发生。 - **成效对比**:传统 SRE 人工跨多系统排查、比对代码与验证通常耗时 **1 到 1.5 小时**;而该 Agent 闭环在 **15 分钟内**完成了从告警、根因分析、代码修复、Plan 检查到最终 Apply 验证的全流程。 ### [08:49](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=529s) 生产安全治理与大模型能力选型 在将自主 Agent 引入生产环境时,团队必须建立严格的治理原则与选型评估体系: - **最小权限原则(Least Privilege)**:“把 Agent 当作刚入职的新员工(New Team Member)”。绝不能在初期赋予 Production Root 权限或数据库直连访问权限;必须限定在 CI/CD 流水线的特定 Stage 中,先在开发环境(Dev)中跑通验证。 - **全链路 Trace 审计(Agent Traces Logging)**:必须完整记录 Agent 调用的每一步操作轨迹,确保在系统出现变更异常时,能够清晰界定究竟是“人类工程师的操作”还是“Agent 产生的破坏”。 - **主流大模型评估指标**: - **代码修正率(Code Correction)**:模型在首次生成与自我迭代中输出正确代码的比例。在实际评测中,**Claude 模型的代码修正质量最高**,但推理成本相对更加高昂。 - **上下文保持能力(Context Retention)**:评估处理超大 Token 输入并稳定输出有效配置的能力。 - **工具调用可靠性(Tool Use Reliability)**:评估模型与 MCP(Model Context Protocol)服务器及外部基础设施 API 交互时的稳定性与准确度。 - **延迟与成本平衡(Latency vs Cost)**:在 SRE 实时响应要求(低延迟)与企业规模化运行成本之间做权衡。 ### [10:48](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=648s) 模型选型考量:首发准确度与隐性重试成本 在评估和选择大语言模型(LLM)时,成本并非唯一的决定因素。很多团队倾向于选择单次调用便宜的模型,但如果模型生成的代码不可靠、首次准确率低下,就会导致开发者或自动化循环经历 3 到 4 次重试。这种高频重试会迅速抵消单次调用的微弱价格优势,使总成本成倍暴涨。 Claude 之所以受到青睐,核心优势在于其生成代码的高可靠性,往往能“一次写对”("reliable code at the first time itself"),从而大幅压低了重试次数。企业在评估 LLM 时,必须将重试惩罚和实际工程效率纳入评估指标中。 ```mermaid flowchart TD accTitle: 模型选型成本与重试循环对比 subgraph LowQuality["低可靠性模型(表面单价低)"] L1["单次调用成本低"] --> L2["首发代码错误"] L2 --> L3["经历 3-4 次重试循环"] L3 --> L4["综合成本剧增 + 延迟极高"] end subgraph HighQuality["高可靠性模型(例如 Claude)"] H1["单次调用成本略高"] --> H2["首发代码质量高"] H2 --> H3["重试次数极少"] H3 --> H4["总体成本更低 + 落地速度更快"] end ``` ### [11:31](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=691s) Prompt 工程实战:结构化上下文与隐式依赖的教训 提示词工程(Prompt Engineering)直接决定了 Agent 的产出质量。如果仅给 Agent 极其简略、模糊的指令(例如“请帮我添加一个 AWS EC2 Auto Scaling Group”),Agent 虽然能生成语法正确的配置,但会自动脑补参数——随意设置最小实例数 2、最大实例数 4,并绑定不合适的 CPU 指标。这种配置根本无法直接应用于实际生产。必须使用结构化 Prompt,明确规定副本数、触发扩缩容的具体 CPU/内存阈值与运行时间。 另一个典型踩坑点是思维链(Chain of Thought)对下游隐式依赖的处理。当要求 Agent 修改某个 VPC 集群配置时,Agent 能够找到关联的子网组和安全组并进行调整;但对于通过变量查找(Variable Lookups)等隐式方式引用该 VPC 的下游资源,Agent 无法感知,最终导致下游依赖全面崩溃。这证明了在提示中显式梳理下游依赖映射至关重要。 ### [13:03](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=783s) 规范定义:通过 agents.md 打造基础设施规则模板 "Context is the King"(上下文为王)。为了避免 Agent 输出偏离规范,JP Morgan 团队在仓库根目录下引入了 `agents.md` 文件,作为全流程的规则根模板(Root Level Template)。当 Agent 尝试创建或修改资源时,必须优先读取并参照该规范: - **多云多区域策略**:显式指定 AWS 主区域为 `us-east-1`,灾备/备份区域为 `us-west-2`;GCP 的 `us-central1` 仅限特定数据平台使用。 - **Terraform 开发标准**:状态后端必须统一采用 S3 + DynamoDB,强制使用 dev 工作空间规范。 - **安全与合规红线**:严禁硬编码敏感信息及 AWS 账号 ID;默认开启静态加密;强制执行严格的安全策略和预设打标签(Tagging)机制。 通过统一模板注入边界约束,可以彻底根除 Agent 自行脑补非法配置的风险。 ### [14:32](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=872s) Agentic 基础设施技术栈生态 当前企业构建 Agent 自动化时,形成了一套分层的基础设施工具链: | 领域分类 | 常见工具与实践 | |:--- |:--- | | **IDE 级 Agent** | Cursor、GitHub Copilot、Windsurf | | **CLI 级 Agent** | Cloud Code 等终端智能工具 | | **工作流编排(Orchestrator)** | LangGraph、AutoGen | | **上下文规范管理** | `agents.md`(集中管理区域、标签、安全与后端规则) | | **IaC 校验与安全审查** | Terraform Plan、TerraTest、tfsec 及企业内部合规校验平台 | | **Agent 可观测性(Observability)** | LangGraph 追踪、CloudTrail 日志队列监控等 | ### [15:29](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=929s) 特征工程:降低 Agent 幻觉的关键手段与反面教材 在真实生产场景中,直接把未经加工的自然语言抛给 Agent 会引发灾难性后果。通过针对性的特征与上下文工程,可以大幅压降 Agent 的幻觉率: - **Terraform State / Plan / Output 对比注入**:在运行 `terraform plan` 时,将 `terraform output show` 作为即时上下文注入给 Agent,让其直接比对真实执行计划与当前输出,消除参数幻觉。 - **CloudTrail 变更历史与 Git 提交图联动**:将 CloudTrail 记录的云上实际变更日志与 GitHub 的 Commit Graph 结合作为输入,为 Agent 还原完整的操作上下文。 - **TerraTest 联动校验**:在开发阶段让 Agent 参照对应的 TerraTest 测试阶段,强化正确性闭环。 - **微服务依赖拓扑(Service Dependency Maps)**:向 Agent 注入上下游依赖拓扑图,使应用在更新或排障时能精准评估改动波及范围。 - **反面教材:裸 Jira 需求描述**:绝对不能直接让 Agent 基于日常的 Jira Description 执行操作。由于每个人描述习惯不同,极易引发严重误读。例如曾有工程师在 Jira 中写道“请重新迭代数据库评估”("Can you reiterate the database evaluations?"),Agent 却“聪明过头”地将 reiterate 理解为清空重建,直接删除了该数据库。与 Jira 集成时必须使用结构化模板约束。 ### [17:35](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1055s) Agent 超参数调优:上下文窗口、重试预算与分块大小 构建 Agent 自动化时需要精确把控几个核心技术参数("technical knobs"): 1. **上下文窗口(Context Window)管理**:精细评估输入与输出配额,防止无关信息挤占关键约束。 2. **重试预算(Retry Budget)设限**:行业中普遍存在“多给几次重试 Agent 就能修好”的误区。实际上,**一旦重试超过 3 次,Agent 往往就已经陷入无意义的细枝末节微调中**。若 3 次内无法解决,必须立即阻断并排查输入 Prompt 或上下文设计缺陷。 3. **多文件任务的分块大小(Chunk Size)**:若一次性向 Agent 灌入 20 到 30 个代码文件,上下文极易发生灾难性丢失并诱发严重幻觉。必须根据文件大小将任务拆分为更小的文件子集进行分组处理。 ### [18:57](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1137s) 云工程 Agent 落地四大典型败局与对策 团队在实践中踩出的四大典型教训包括: - **无基础设施约束的裸 Prompt 提示**:缺少具体规格与阈值,导致生成不可用的随机实例数。 - **过早授予 Agent `terraform apply` 权限**:“必须将 Agent 视同新入职员工(New Hire)”,先在沙箱环境中验证其能力并逐步提升权限;在生产环境中执行 `terraform apply` 必须强制保留人工审批(Human Approval)。 - **跨多服务自动补全导致的环境配置污染**:当 Agent 自动跨多个 Helm Chart 补全多环境配置时,极易混淆 staging、production 与 dev 的参数,造成生产参数被写入开发环境等事故。 - **单个 Agent 贯穿整条 CI/CD 流水线**:单 Agent 串联多阶段必然面临严重的上下文漂移与丢失。正确的架构是流水线的每个独立阶段/任务块配置专一职责的单一 Agent。 ### [20:38](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1238s) 运维演进:传统 On-Call 排障对比 Agent 自动化闭环 传统事故响应流程冗长且高度依赖人工协同: ```mermaid flowchart TD accTitle: 传统生产事故响应流程与耗时 P["生产告警触发 PagerDuty"] --> ID["值班人员确认故障应用"] ID --> L["查阅日志与监控指标"] L --> SME["尝试呼叫领域专家 (SME) 协同"] SME --> RC["定位根因 (Root Cause)"] RC --> C["编写代码/配置修复 Patch"] C --> D["部署至 Dev 验证并申请 Production 人工审批"] D --> FIN["整个过程通常耗时 2-3 小时"] ``` 在理想响应速度下,整套传统人工流程也需耗费 2 到 3 小时;而在引入自动化 Agent 闭环后,从告警捕获、日志解析到修复方案起草均由系统自动触发处理。 ### [21:45](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1305s) 自动化故障修复闭环与多智能体系统架构 在实际运维场景中,智能体能够精准调取目标应用程序的特定日志流水线,解析底层报错并定位根因。理解日志后,智能体进一步检索运维手册(Runbooks),匹配预定义的已知故障与修复方案。它在完成方案评估后提取并执行补丁,在开发环境中直接触发 `terraform plan` 与验证;确认无误后,自动向生产环境发起草稿 PR(Draft Pull Request),等待人工最终审核批准。整个端到端流程仅耗时 20 至 25 分钟,而过去同类故障排查与修复通常需要近 3 小时到半天,大幅压缩了平均恢复时间(MTTR)。 为实现这一自动化闭环,必须依靠严谨的多智能体协同架构(Multi-Agent Architecture)。核心 Orchestrator 负责统筹协调所有子智能体;Planner Agent 负责接收顶层目标并拆解为可执行的细粒度子任务(如分发给专门编写代码、执行测试或撰写文档的 Worker Agents)。然而,智能体的切分并非越多越好,过多颗粒化的智能体会急剧增加维护成本,因此在系统架构设计时需要巧妙平衡,将高内聚任务合并至单次智能体运行中。 ```mermaid flowchart TD accTitle: Multi-Agent Architecture and Incident Triage Flow subgraph Core ["协调与规划层"] ORCH["Orchestrator<br/>中央协调器"] PLANNER["Planner Agent<br/>任务拆解与调度"] ORCH --> PLANNER end subgraph Workers ["执行工作层 (Worker Nodes)"] W_CODE["代码编写 Agent"] W_TEST["测试执行 Agent"] W_DOC["文档生成 Agent"] W_MCP["MCP Agent<br/>(GitHub / Bitbucket / Confluence)"] PLANNER --> W_CODE PLANNER --> W_TEST PLANNER --> W_DOC PLANNER --> W_MCP end subgraph Storage ["状态与持久化"] MEM[("Memory Store<br/>Vector DB / 会话状态")] ORCH <--> MEM end ``` - **会话状态管理(Memory Store)**:智能体执行任务(如 Terraform 配置生成)时,必须通过向量数据库(Vector DB)或状态存储维护会话上下文与执行状态。 - **工具集成协议(MCP)**:智能体通过模型上下文协议(Model Context Protocol, MCP)调取外部工具链(包括 GitHub、Bitbucket、Confluence 等)。 --- ### [24:20](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1460s) 平台工程师的一天:从 4 天工作量到 1 天搞定 业界常有“AI 将取代人类工作”的担忧,但在实际工程落地中,智能体的核心价值在于成倍放大开发人员的单日产出。以一位平台工程师(Platform Engineer)的实际工作日程为例,过去需要耗费 3 至 4 天才能完成的一系列繁复工作,如今在单日内即可高效交付。 早上 9:00 收到突发事件告警,工程师将故障上下文投递给智能体,智能体在 30 分钟内完成日志分析与方案修复(此前单次排查往往需要 45 分钟到 2 小时)。紧接着,工程师利用节省下的时间在半小时内配置好 Prometheus 告警规则,随后开展 Terraform 模块编写并自动生成 Terratest 测试用例,顺利完成交付。AI 并没有剥夺岗位,而是通过压缩机械重复的操作,将工程师从繁琐流程中解放出来。 - **9:00 Incident Triage**:智能体辅助排障,30 分钟内闭环交付。 - **监控与告警编排**:半小时内完成 Prometheus Alert 编写与上线。 - **基础设施即代码与测试**:并行构建 Terraform 模块与 Terratest 自动化测试套件。 --- ### [25:37](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1537s) SRE 场景落地:自然语言指标编排与运行手册自动化 在站点可靠性工程(SRE)领域,领域专家(SME)对应用程序架构与业务指标有着最深刻的理解。借助智能体,SRE 无需手动在监控控制台中配置复杂图表,只需在输入框中输入自然语言需求——例如“为该业务应用设定此 SLA 与 SLO,并基于此生成错误预算(Error Budgets)”,智能体便能精准解析意图,自动在 Dynatrace 或日志平台中构建对应的可视化监控大盘。 与此同时,SRE 团队的运维知识资产(Runbook)得以最大化复用。值班工程师将历史故障的处理经验固化为标准化文档,智能体在告警触发时主动引用运行手册中的策略,自主执行修复动作。“我们依然需要专家来定义要做什么,而智能体负责高效执行”,人机协同的边界因此变得更加清晰。 --- ### [26:39](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1599s) 生产实战案例:EKS 集群升级、多云 Terraform 与日志库迁移 大规模基础设施变更一直是运维团队的痛点。某生产场景需要将 200 多个 Kubernetes 负载从 EKS 1.24 跨版本升级至 1.29,且必须保证零停机(Zero Downtime)和极高的配置准确性。面对 AWS 仅给出的 8 周硬性升级窗口期(传统人工排查需要 6 到 7 周),团队引入了智能体流水线:首先由智能体提炼出配置差异与升级模板,随后并发扫描 200 个集群的差异项并生成补丁,同步编写测试用例在开发环境中验证。最终在 200 多个负载中,智能体自主成功升级了 190 多个,仅留下少数复杂边缘场景交由人工介入审批。 ```mermaid flowchart LR accTitle: Real-World Infrastructure Modernization Scenarios subgraph EKS ["EKS 1.24 -> 1.29 升级 (8周红线)"] E1["提取统一变更模板"] --> E2["并发扫描 200+ 负载"] E2 --> E3["自动编写测试并在 Dev 验证"] E3 --> E4["190+ 负载自动化通过<br/>(少数边缘交由人工)"] end subgraph TF ["多云 80+ Terraform 模块开发"] T1["固化安全/合规/Tagging 基线"] --> T2["并行生成 AWS/GCP 模块与 Terratest"] T2 --> T3["人工复核多云连通性并合入主干"] end ``` 在另一项多云基础设施建设任务中,团队需要针对 AWS 和 GCP 编写 80 多个 Terraform 模块,正常开发往往耗时数月。通过智能体模式,工程师先定义好安全策略、统一打标(Tagging)和加密基线标准,智能体在批量生成多云资源块的同时,并发生成对应的 Terratest 测试代码并在 Dev 环境中执行验证,最终仅耗时 2 周便完成了全量交付。此外,在全组织 40 个微服务的日志库跨版本升级(Migrating Logging Libraries)任务中,智能体同样独立完成了 38 个服务的全自动迁移与验证。 --- ### [30:42](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1842s) 生产真实数据与 AI 生成基础设施的测试策略 评估智能体在生产基础设施中的表现,需要依赖客观的度量指标。实际生产数据显示,55% 的场景实现了显著的交付加速;但与此同时,生成代码中暴露出 38% 的安全漏洞/合规盲区(Security Gaps),且尽管智能体在常规单元测试与集成测试中表现优异,但在底层深度健康检查(Deeper Level Health Checks)上仍无法达到 100% 通过率。这印证了对 AI 生成代码施加严格治理护栏(Governance Guardrails)与人工审核闭环的必要性。 | 评估指标 | 生产统计表现 | 核心影响与应对措施 | |:--- |:--- |:--- | | **交付加速比 (Faster Delivery)** | **55%** 显著提升 | 研发吞吐量大幅提高,常规模块开发周期从“月”缩短至“周”。 | | **安全合规盲区 (Security Gaps)** | **38%** 存在缺陷 | AI 无法自主覆盖所有企业特定合规项,必须结合预定义安全策略硬性拦截。 | | **测试通过表现 (Test Pass Rate)** | 基础测试表现良好 | 浅层单测通过率极高,但深度系统级健康检查需人工介入调优。 | 为了严谨验证 AI 生成的基础设施即代码(IaC),业界总结出三套关键测试方法: 1. **基于属性的测试(Property-Based Testing)**:捕获 Terraform 资源配置的具体指标与属性,要求智能体在生成业务代码前先编写属性断言,进行先验测试。 2. **大模型裁判(LLM as a Judge)**:利用异构的第二模型作为审查仲裁者;若裁判模型对生成结果提出分歧判定,则提示主生成链路存在潜在幻觉或逻辑缺陷。 3. **变异测试(Mutation Testing)**:故意在智能体生成的代码中注入错误变更或故障,验证智能体及其测试流水线是否具备敏锐的自省与错误识别能力。 ### [03:49](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=229s) 测试驱动开发:以测试用例锚定 Agent 的代码生成 在展开 Agent 的实际开发前,首要任务是建立健全的测试框架。无论是单元测试(Unit Test)、集成测试(Integration Test),还是基于业务结果的功能性测试(Outcome-based / Functional Testing),都应当遵循“测试先行”的原则。当先编写好详尽的测试用例并提供给 Agent 时,Agent 会自动捕捉这些测试规范与边界条件,并严格对齐这些标准来生成应用程序代码。 这种方法的核心优势在于能够显著抑制大模型的幻觉(Hallucination)。通过让 Agent 提前理解“要实现正确的应用功能,必须满足哪些测试条件”,Agent 生成的代码质量会大幅提升。因此,在启动任何 Agent 开发任务之前,团队必须优先搭建测试框架并固化测试用例。 ```mermaid flowchart LR accTitle: 测试先行的 Agent 开发流程 subgraph TestFirst ["规范定义"] A["编写测试用例<br>(单元/集成/功能测试)"] end subgraph AgentLoop ["Agent 实施"] B["Agent 解析测试规范"] C["生成对齐测试的代码"] end subgraph Verification ["验证与交付"] D["自动化运行验证<br>(大幅降低幻觉)"] end A --> B B --> C C --> D ``` --- ### [03:29](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=209s) 安全防线与数据治理:从最小权限到规避数据偏见 在生产环境中部署 Agent 时,必须贯彻“最小权限执行(Least Privilege Execution)”原则,切忌赋予 Agent 过大的系统权限与执行范围;凡涉及生产环境变更的关键节点,必须强制引入“人在回路(Human-in-the-Loop)”审批关卡。针对数据注入与模型偏见防御,讲师分享了一个真实的招聘 Agent 案例:某企业使用 Agent 筛选求职者简历,某天一位主管提出疑问:“为什么推过来的面试简历清一色全都是男性,完全没有女性?”排查后发现,该 Agent 依赖了未经清洗和更新的历史旧数据进行参考,导致其决策逻辑直接继承了历史性别偏见。 这一事故表明,Agent 引用的外部数据与知识库必须保持最新状态与精准性。如果数据缺乏动态更新与校验,Agent 就会反复提取陈旧数据并输出糟糕的决策结果。此外,治理体系还需涵盖以下维度: - **全链路可观测性(Full Observability)**:完整记录并追踪 Agent 的每一步执行动作、决策链路与工作流走向。 - **合规与法律风险规避**:对生成的代码进行深度审计,排查是否存在开源许可证合规风险(Licensing Risk)及潜在的安全漏洞(Security Vulnerabilities)。 - **质量与可靠性评估**:在控制 Token 成本的同时,将代码正确性(Correctness)、系统可靠性与无偏见性作为首要衡量基准。 --- ### [03:24](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=204s) AI 编程的经济学:Token 成本建模与 ROI 评估体系 量化 Agent 的经济效益需要一套严谨的投资回报率(ROI)计算框架。团队首先应当测量 Agent 执行特定任务的单次 Token 成本,将其乘以预期的总执行频次,随后评估该流程能够为团队削减多少“开发者工时(Developer Hours)”。将节省的工时价值与实际 Token 消耗成本进行对冲,即可精确判断引入 Agent 究竟是在节省成本还是在制造浪费。 ```mermaid flowchart TD accTitle: Agent ROI 与真实成本核算框架 subgraph DirectMetric ["直接成本与收益"] T["单任务 Token 消耗 × 频次"] D["节省的开发者工时"] ROI["计算实际 ROI 价值"] T --> ROI D --> ROI end subgraph HiddenCosts ["不可忽视的隐性成本"] P["Prompt 工程与重试耗时"] I["基础设施托管与闲置率"] M["大模型版本漂移 (Model Drift) 适配"] end HiddenCosts --> ROI ``` 在评估真实成本时,团队必须将以下隐性支出纳入考量: - **Prompt 工程与调试耗时**:为了让 Agent 产出高结构化、高稳定性的输出,开发者必须花费大量时间编写高质量 Prompt 并反复重试调整。 - **基础设施托管开销**:部署和支撑 Agent 体系所需的底层算力与设施成本,包括实际运行时间与非活跃闲置时间的资源消耗。 - **模型漂移(Model Drift)**:当底层大语言模型供应商推送新版本时,新模型的行为变更是否会对现有业务系统造成意料之外的漂移与破坏,以及修复这些漂移所需的适配成本。 --- ### [03:56](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=236s) 成为未来的系统架构师,而非盲目的工具订阅者 在演讲的结尾,讲师提出了“成为未来的架构师,而非订阅者(Future Architects, Not Subscribers)”的倡议。工程团队不应停留在被动调用 AI 工具的层面,而应主动掌握上下文工程(Context Engineering)的核心方法论,深度采纳 Agent 化工作流,并将全部精力聚焦于真实的业务影响(Business Impact)。 许多公司往往会陷入虚荣指标的陷阱,盲目以代码提交次数(Commits)、代码行数、Pull Request 数量或消耗的 Token 总量来评估工程师的绩效。讲师特别强调应当彻底摒弃此类机械指标:“请不要看这些表面数据,务必只基于最终的业务产出与实际成效来衡量价值。” ## Notable quotes > [08:49](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=529s) 把 Agent 当作刚入职的新员工(New Team Member) — Rahul Tanniru > [10:48](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=648s) reliable code at the first time itself — Rahul Tanniru > [13:03](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=783s) Context is the King — Rahul Tanniru > [15:29](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=929s) Can you reiterate the database evaluations? — Rahul Tanniru > [17:35](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1055s) 一旦重试超过 3 次,Agent 往往就已经陷入无意义的细枝末节微调中 — Rahul Tanniru > [18:57](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1137s) 必须将 Agent 视同新入职员工(New Hire) — Rahul Tanniru > [25:37](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=1537s) 我们依然需要专家来定义要做什么,而智能体负责高效执行 — Rahul Tanniru > [03:29](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=209s) 为什么推过来的面试简历清一色全都是男性,完全没有女性? — Rahul Tanniru > [03:56](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=236s) 成为未来的架构师,而非订阅者(Future Architects, Not Subscribers) — Rahul Tanniru > [03:56](https://www.youtube.com/watch?v=vWdwtvP0lbk&t=236s) 请不要看这些表面数据,务必只基于最终的业务产出与实际成效来衡量价值。 — Rahul Tanniru ## Mentioned Rahul Tanniru, JP Morgan Chase, AWS, Amazon RDS, Amazon EKS, Kubernetes, Terraform, Claude, LangGraph, AutoGen, Cursor, GitHub Copilot, Windsurf, Cloud Code, Terratest, tfsec, AWS CloudTrail, Google Cloud Platform (GCP), Prometheus, Dynatrace, Jira, PagerDuty, Bitbucket, Confluence, Model Context Protocol (MCP) ## Video description Rahul Tanniru - Senior Vice President of Software Engineering, JP Morgan Chase AI agents are already writing Terraform, triaging incidents, and modifying Kubernetes configs in production and most teams are learning the hard way what goes wrong. In this talk, I'll share real failures from deploying Claude-based agentic systems across IaC and SRE workflows, including terraform apply disasters, runbook hallucinations, and CI/CD context overflow. I'll walk through the prompt engineering patterns, agentic loop architectures, and production guardrails that actually held up under real infrastructure load. Attendees will leave with a concrete model selection framework, a security and governance checklist for autonomous agents, and three live scenario walkthroughs, EKS auto-remediation and SLO dashboard generation. [Source](https://www.youtube.com/watch?v=vWdwtvP0lbk)

Source quotes

[8:49] Rahul Tanniru: 把 Agent 当作刚入职的新员工(New Team Member) [10:48] Rahul Tanniru: reliable code at the first time itself [13:03] Rahul Tanniru: Context is the King [15:29] Rahul Tanniru: Can you reiterate the database evaluations? [17:35] Rahul Tanniru: 一旦重试超过 3 次,Agent 往往就已经陷入无意义的细枝末节微调中 [18:57] Rahul Tanniru: 必须将 Agent 视同新入职员工(New Hire) [25:37] Rahul Tanniru: 我们依然需要专家来定义要做什么,而智能体负责高效执行 [3:29] Rahul Tanniru: 为什么推过来的面试简历清一色全都是男性,完全没有女性? [3:56] Rahul Tanniru: 成为未来的架构师,而非订阅者(Future Architects, Not Subscribers) [3:56] Rahul Tanniru: 请不要看这些表面数据,务必只基于最终的业务产出与实际成效来衡量价值。

Source quotes

[1:52] Rahul Tanniru: The plan looks good, nothing to destroy, but apply fails. [8:49] Rahul Tanniru: Think of your agent as a new member who joined the team. [11:31] Hey, can you please add me an auto scaling group of AWS EC2 instance? [15:29] reiterate the database evaluations. [24:20] Rahul Tanniru: it's basically increasing the productivity of developer, how many tasks he can do. [33:44] Hey, why are we getting all of our interview resumes only for men? Why are women not being selected at all? [36:56] Rahul Tanniru: architects, not subscribers.

Original transcript

[0:04] Hello everyone. Uh this is Rahul working in  JP Morgan Chase. I know it's kind of delayed [0:10] schedules are here, but let me start right away.  So today I'm going to talk about some of the AI [0:16] agentic architecture workflows which we have  implemented industry real time. What are the [0:22] failure scenarios? How we overcame it? How  are the best prompt engineering cases done? [0:27] How are the multi-agent architectures  developed? Right? So let's start. [0:37] Right. So let's start with the basic thing. So  right now most of our companies use the coding [0:43] assistance. So let's start with the basic  difference of coding assistance and agentic [0:48] coding. So let's start with some of the attributes  or dimensions which I'm going to start with. [0:52] Let's start with trigger. So whenever you choose  a trigger method the coding assistance will try [0:58] to auto complete your stuff. Let's say I want  to create the RDS module of Terraform. Yes, [1:03] it tries to create your Terraform module and  gives you an auto complete feature. Great. [1:07] But what does the agentic coding do? It kind of  writes a Terraform plan, evaluate the logic gates, [1:13] and also tries to run Terraform plan and apply.  Scope Scope for your coding assistance is always [1:19] going to be a single Terraform file where exactly  it's going to be look over. And for agentic code, [1:25] it's obviously going to look over the whole module  structure and all the files in that specific repo. [1:31] Error handling So in the error handling, whenever  you see the agent code only looks for that [1:36] specific file, but you there's always a human role  who needs to fix that specific error whenever it's [1:41] attributing it to. But in coding agentic stuff  you read the run books what needs to be done, [1:48] the agent will kind of trigger run  books and fix the errors for yourselves. [1:52] Technical anatomy of this wipe coding is  whenever So whenever we start with the developer, [1:57] it's very important to start with a goal or the  intent what we are trying to achieve over here. [2:01] So, let's say we wanted to build um an EC2  instance. So, that's our goal or intent. Great. [2:08] Now, what we are going to do is going to write  that code and trust it to our LLM. LLM is going [2:14] to auto-generate that specific resource block.  Now, after the resource block is generated, [2:19] it goes into specific repository whether it's a  GitHub or Bitbucket. But, the important thing is [2:24] every industry has some practices like let's say  tagging needs to be enabled, encryption needs to [2:29] be enabled. These are some common standards  which you set across our organizations. [2:33] So, whenever we set this organization, it's a  feedback loop. Again, human interferes. He sets [2:38] those standards. Again, it coding agents generate  that specific code based on industry standards [2:44] and tries to commit again. It's like a circular  dependency around evaluation and developing it. [2:51] So, this is one of the example of five stages  of one of the closed loop. So, the first phase [2:56] is called plan. The goal is to create a read  replica for one of the RDS DB instance. Great. [3:02] So, that's our goal or intent by developer.  What happens next? Goes to the context assembly. [3:07] What does context assembly mean? Context Context  assembly means trying to gather information where [3:14] exactly that code needs to be modified. So, it'll  try to read the respective state of that files, [3:19] going to read the Terraform files  where exactly it's going to deploy it. [3:23] Once it's uh identified the context,  the next step is to technically plan it. [3:28] So, what does that mean? It'll go to the tool  invocation stage where it'll write the Terraform [3:33] plan for that specific resource. Once the plan  has been established, it's good It goes into [3:37] the observation stage. And this is the important  part I want everyone to be focusing on because [3:43] I'm pretty sure whenever you create certain  Terraform resources, the plan looks good, [3:49] nothing to destroy, but apply fails. There'll  be a lot of cases which happens in these ways. [3:55] So, agent is smart enough to identify, "Hey, plan  looks good. One resource to add, zero to destroy, [4:01] but you need to add the DB subnet group. If you  don't add, the apply is going to fail." It was [4:06] technically intelligent enough to give that  attribute and say. So, what it's going to do, [4:09] it replans, fixes, or adds that specific DB  subnet group and tries to go ahead and apply. [4:15] So, what is the important step over here  is whenever you're trying to write a code, [4:19] observe the agentic stuff what exactly it  is producing, is that an intent or not. [4:28] So, let me ask a quick question.  How many of you over here [4:33] has asked an agent, "Hey, I wanted to  produce this." And it gave a 100% accurate [4:38] answer without any sort of fake information.  Like, let's raise your hands over there. [4:45] Right? So, technically, that's called the  hallucination of the agent. And that's an [4:49] expected behavior, by the way. So, let me explain  some of the basic concepts how hallucination works [4:55] in behind the agents. The first is called the  file search or grep. So, whenever we say file [5:00] search or grep, let's say I wanted to modify  some security group rules of a security group. [5:06] Uh so, I'll say, "Hey, can you modify security  group rules for name security group name A?" [5:11] It's going to grab that specific file name like  a control F and search for that specific file [5:16] name itself to see whether it is going or not.  So, what it's going to do is it'll find that [5:21] specific names and try to modify it. But, what the  agent doesn't do is whenever there's a root level [5:27] attributes like two or three levels under where  it has been referenced as a variable lookups, [5:32] agent is not able to identify those things.  So, what happens, it's going to basically say, [5:37] "I didn't identify the data which are  referenced." And you obviously production outages. [5:42] The second thing is embedded embedding approach. [5:45] So, in the embedding approach, rather than going  the specific file names, basically what it's [5:49] going to do is going to specify the meaning  of the content of that specific resource. [5:54] Let's say an example, I wanted to create a DB  group or RDS instance. So, agent has already [5:59] have that context of what a DB instance needs. So,  it's going to deploy that specific configuration. [6:06] And once the deployed configuration is done, it's  going to compare across multiple environments. [6:10] So, what happens with this? The values which  are specified in multiple environments going to [6:15] mess up. Let's say you're running a specific  version in your dev, test, and production. [6:21] If we don't mention that in the semantic approach,  it will obviously cross-reference these versions. [6:25] And obviously, you'll get incorrect database  pinned up in different different environments. [6:31] But what is good? Direct file reads.  So, you basically say your agent, "Hey, [6:36] I want my agent to read a specific file, specific  guideline on reading this stuff, and get the [6:42] specific attributes." This is a good work. But  what happens? It works only for a single file [6:48] or multiple files. When you have a large chunk of  repo where it needs to scan multiple files, your [6:53] context size is going to be very bigger. Probably,  you'll get false data, and also cost more. [7:02] So, this is one of the real-time example. So, [7:07] they said, "We are having a EKS node group  with a flapping nodes. Okay, great." So, [7:12] I'm going to explain the real-time attribute how  the explain how the agentic flow happened, what. [7:18] So, first, it's going to identify it got an  alert, I'm getting EKS flap node group. Great. [7:23] Now, the next step is going to identify which  nodes. So, it ran some Q control commands to [7:28] identify which nodes have been in the bad state.  Once the specific nodes have been identified, [7:33] the next step agent did is, "Fine, I know what  nodes have been messed up. Let me go and see [7:37] the specific node group Terraform files." So, it  goes into the specific node group Terraform files, [7:42] tries to evaluate that code, and based on  the code evaluations, it got two cases. [7:47] Either it might be a root cause of spot instances  or maybe a misconfigured lifecycle hook. [7:54] So, to evaluate these cases of root cause, it has  runs a multiple instances by itself to evaluate [7:59] which one is the root cause and identified spot  instances a issue. So, it immediately fixed that, [8:05] wrote specific Terraform code, write a plan,  and did a Terraform check. It was good. But, the [8:11] important part over here is agent was very clear  enough to say, "How can I avoid this in future?" [8:16] So, it also added a lifecycle configuration  hook by preventing drain selection annotations [8:21] which have been enabled on the cluster, so it  cannot happen in the future. Once that is done, [8:26] it went go ahead and apply it, and once apply  is done, probably it's evaluating its monitoring [8:32] dashboards. So, this whole scenario, generally in  human nature, it's going to take like a maybe a [8:38] one one and a half hour to identify all these root  causes between the incidents. And this is like [8:42] hardly a 15-minute job which has been done by the  agentic architecture which saves a lot of time. [8:49] Now, so think your agent as a  new member who joined the team. [8:55] So, whenever a new member joins the team,  obviously, you'll not give him root access. You'll [9:00] not give him access to whatever the instances  are production database directly. You start [9:04] with a very limited access. In similar manner,  you're going to start with the tool execution of [9:10] Think of it as a pipeline job or specific stage  where you give limited permissions on what to do, [9:16] limited permissions on what it can touch.  When I say what it can touch, obviously, [9:20] you'll be running in the dev environments.  You don't want to give access to directly to [9:23] production before you train your models. Important  factor. So, start with the least privilege factor, [9:29] and then the important part is you  have to log your agent traces, too. [9:34] So, how do you know what your agent did and  what your agent break. Is it a user or is [9:39] it an agent? So, it's important to capture all  those log traces what agent is capturing, too. [9:47] So, this is a a model comparisons which has  been This report has been recently released. [9:53] So, there are certain attributes which needs to be  taken care. The first one is the code correction. [9:58] So, the code correction, how much amount of code  is given correct by the agent by different LLMs. [10:04] So, these are some metrics which have been done.  Context retention. As you build the agenting [10:10] stuff, it's important to see how many how much  amount of input data it is taking and how much [10:15] amount of output data it is spitting out. So,  having a good decent bigger context size is [10:19] always important. Tool use reliability. So, tool  use reliability is how much reliable the code is [10:25] giving out and how much reliable the code  is calling the other MCP servers and all [10:30] those stuff. That's an important metric, too.  Latency. Again, we wanted everything to be quick. [10:35] The latency is also one of the important metric  and finally the cost. So, if you see over here [10:41] uh in this data Claude have the highest uh code  correction period, but it has also expensive, [10:48] but people say Claude won for that report. Why is  that? So, the important factor is it's whenever [10:54] you're choosing any sort of model or LLM, it's not  about only the cost because whenever if it is not [11:00] producing a reliable code and the code correction  is pretty low, you're going to do three to four [11:05] time of retries. Obviously, again, that will  increase the cost. Even though it is low, you're [11:09] doing it three to four times, which will obviously  increase the cost of the Claude code in this case. [11:14] Saying, I'm giving a reliable code at the first  time itself. The number of retries got reduced. [11:18] So, it's obviously important to evaluate  whenever you're implementing any sort of LLMs [11:24] and value which one is suits better for my  app. You need to consider these metrics. [11:31] Prompt engineering tested patterns. So, here  are some tested patterns in real time, what [11:36] worked and what didn't work. So, first one, let me  start with the structured context injection. So, [11:43] they gave, "Hey, can you please add me an  auto scaling group of AWS EC2 instance?" [11:50] So, the agent was um smart enough, it created  a auto scaling group, all the attributes, but [11:57] what happened is it took a minimum of two, maximum  four, it picked a random metric of CPU, and great. [12:05] But, does it really suit your application? No.  But, what if I give a structured prompt saying, [12:10] "I wanted a replica of two and three for these  times, whenever the CPU is this much higher, [12:16] whenever the memory is high?" So, giving it as  much context and good prompts is very important [12:21] whenever you're building that stuff. If you  don't give If you give limited information, [12:25] agent is going to build the stuff, but  it might not be useful for your purposes. [12:30] The second thing is single shot of chain of  thoughts. So, here in the second example, they [12:34] said, "Can you modify VPC clusters information?"  So, it go gone and went ahead modified some of [12:41] the subnet group, security groups reference  to that specific VPC where it was referenced. [12:45] Great, but what didn't work was wherever  it was referenced by a variable lookups, [12:50] rather than just giving the VPC ID, it broke all  those cases, and it's important to again reference [12:56] what are my downstream dependencies  where it has been implicitly defined. [13:03] So, context is the king. As I said, give as  much context as a possible, as much prompting [13:08] as a possible to give a better output results. So,  I'm going to explain a deep dive. This is one of [13:14] the sample example of agents.md file. So, this is  like a root level template. What we have defined [13:21] is saying, "Whenever you're defining any sort of  tools you're using, whether it's Terraform, cloud, [13:27] any monitoring tools, you define this template.  So, in this over here, I'm defining my AWS saying, [13:33] "Hey, do AWS use US East 1 as a primary region  and US West 2 as a backup or disaster recovery [13:39] region." Again, for GCP, I'm saying to use  uh Central US Central 1 as a region only for [13:45] some data platform. So, I specifically mentioned  what exactly the agent has to do whenever you're [13:50] deploying. Similarly, for Terraform patterns,  for what patterns you need to do. I wanted [13:56] obviously using my dev workspaces, I wanted  my state to be S3 and Dynamo. And similarly, [14:02] for tagging mechanisms on AWS, I don't want  any sort of hard codings, I don't want account [14:07] reference hard codings, I wanted some specific  regions, encryption as default, security policies. [14:14] So, once you capture this side of guidelines and  implement in the form of template, the agent will [14:20] whenever it's trying to create any new stuff, it  basically references this file and make sure it [14:24] creates the right data for you. So, you don't fall  into the false information what the agent created. [14:32] So, here are some uh tools which has  been popularly used in the recent times. [14:37] So, in the ID agents, many companies use the  cursor, GitHub co-let co-pilot, and Windsurf [14:43] has been really popular. CLI agents, again, Cloud  Code. Again, each company has own different sort [14:49] of metrics, so it's important to evaluate your  LLM's performance based on the previous slide [14:54] what I've mentioned. Orchestrator, we have  LangGraph, AutoGen, context management. Again, [14:59] write everything in your agents.md file, so  people know what exactly it should be using. [15:05] For IAC validation, Terraform plan, TerraTest,  TF sec, there are multiple tools outside, [15:11] but again, if you have your company in-built  platforms, you'll have to use that, too. [15:15] And then for observability for agents, as I said,  it's very important to capture the agent's logging [15:20] queue, what it's producing. There are certain  groups like LangGraph, home clone cloud trail. [15:29] Future engineering for agentic stack.  So, these are some use cases uh [15:34] for how how we reduce hallucination for the  agents in real time in the industry standards. [15:39] So, Terraform state, plan, and output context.  So, whenever you're running a Terraform plan, [15:45] writing the Terraform output show as  a context beside your agent was able [15:50] to validate the plan what was actually written  in the plan and what was the output given. So, [15:55] it was able to compare both of the things,  so which got reduced the hallucination stage. [16:00] Second thing is a cloud trail changes and history  as context. So, whenever the cloud trail changes [16:06] are happening, integration with the GitHub graphs  of what who has committed, what has been changed. [16:12] So, keeping these together also kind of reduce  the limitation of the hallucination happening. [16:17] Terra test integration and injection. So,  keeping your Terraform plan stages what [16:22] you're developed and writing your Terra test  stages keeping beside in those comparisons [16:26] for your agent also helps in reduction of  hallucination. Service dependency maps. As said, [16:32] your application might have multiple upstreams  and multiple downstreams. So, it's very important [16:37] for the agent to know what are my upstreams  or what are my downstreams. So, let's say [16:42] if something breaks on your application and if  something needs to be updated on an application, [16:46] it will know what are my upstreams and downstreams  I need to update and what changes I need to do. [16:51] So, in uh evaluating those things and  capturing that information to your agents [16:55] is also one of the important metric. What  didn't work? Jira descriptions alone. So, [17:00] each person writes a Jira story a different  manner. The intention might be different. [17:05] So, I'll just say one of the example happened.  In Jira, one of the uh person created, "Can you [17:11] reiterate the database evaluations?" And agent  was smart enough and said he's referring to delete [17:17] that database." and it has deleted the database.  So, it's important to write a specific template [17:23] standards for your Jira. So, make sure when your  agent is talking to your Jira version templates, [17:28] have some standardized templates rather than  the normal language because it messes up a lot. [17:35] Hyperparameter tuning. So, uh whenever you're  writing this agentic stuff, there are certain [17:41] technical knobs uh for your context to properly  work. Context window. So, if you if you do more [17:49] of context window, remember how much input  the context have to take and how much output [17:52] it has to produce. So, kind of evaluating  those metrics is one of the important thing. [17:58] Second thing is total call for your retry budget.  Most of the times, people think we ask multiple [18:04] retries for our agent, it's going to fix it.  But, trust me, if it is more than three retries, [18:10] your agent is basically not doing much work.  It's just modifying some lines and the limited [18:15] the amount of changes which you expect would be  very limited. So, if it is going more than three [18:20] retries, you have to really think why it's not  working and what needs to be changed. And again, [18:25] the chunk size for multi-file tasks multi-file  tasks. So, whenever you're giving 20 to 30 [18:32] files to evaluate, your context will be lost and  obviously things will break and it will lose agent [18:38] will again give some hallucination data. So, it's  important to keep very limited amount of files. [18:44] Again, the amount of files depends on each file  sizes. Try to evaluate the chunks and divide into [18:49] a sub groups, how many files we can contribute  and how many files we can segregate each other. [18:57] So, these are the common failed approaches in  agentic cloud engineering. So, the first one is [19:02] new prompting without infrastructure.  So, as I said in my previous slide too, [19:06] creating a random auto scaling  group created an auto scaling group [19:10] which created min and max replicas without  a proper metrics evaluation. So, the fix is [19:16] give as much as a intent as possible so it gives  the right metrics and right evaluations for yours. [19:22] Second thing is giving agents  Terraform apply access to early. So, [19:27] again, as I said before, think of any of agent  as a new hire. See how it is working and then [19:33] increase its level of permissions. So, start  with a limited environments. Try to run in your [19:38] sandbox environment. See how it is working,  if it is expected. And if you want to really [19:43] give a Terraform applies to some production  environments, obviously I recommend to use a [19:47] human approval. [snorts] Using auto complete for  multi-service. So, whenever we give this agent [19:54] auto completeness and reference of multiple helm  charts, what happens is each of the helm charts [19:59] for each of the respective environments  we have different set of configurations. [20:03] And agent was not clever enough initially.  It messed up staging values to production, [20:08] production values to dev environment, which  will cause a lot of mess and again it breaks. [20:14] One agent having one agent for full CI/CD  pipeline. So, if you have one agent, again, it [20:19] works, but the failure is whenever you're having  multiple stages, it will lose the context of my [20:25] initial draft to the end stage. So, it's obviously  important to save that context in a limited manner [20:30] having each pipeline or each block in the  pipeline having a single agent to do that job. [20:38] Now, shift to agentic engineering. So, um this is  one of the clear example how agentic workflow has [20:45] developed. So, I'll explain how was it before  and how was it after. Before, whenever we get a [20:51] production call, the first thing what's going to  happen is we get paged. And once the page is done, [20:57] oh, this is the app which is done. Okay. Once  the app is done, what are my next steps? Going to [21:02] check my logs and see what broken. Evaluate that  metrics, check the logs, call respective SMEs if [21:08] I don't understand some things, and I don't know  whether he'll lift the call or not. It's going to [21:12] take some decent amount of time. Let's assume the  developer who who has been paged has identified [21:17] a root cause, and now he wants to fix things. So,  he's going to write that specific code for a fix, [21:23] and once the fix is done, he's going to deploy  into dev environment, and if it is production, [21:27] obviously, it will be again human approvals,  and again done. So, this whole process, let's [21:32] say maybe 2 3 hours, assuming everyone responds  in a quicker manner. Now, in this agentic stuff, [21:38] what generally happens is the same thing, it got  paged. Agent came to know it was alerted for this [21:45] application. Agent was clear enough to call that  specific logging pipeline of that application, [21:51] understood the logs, what happened, and once  the logs has been understood, it went into the [21:55] run books if that specific error has already been  determined, and what is the run book fix for that. [22:00] It has evaluated that, captured  that fix, implemented that fix, [22:05] and tried to run it direct Terraform plan  on dev environment. Once it looks good, [22:10] kind of gave a draft PR to the production, and  that's when human approval needed and got done. [22:15] So, probably this whole done whole process took  like 20 to 25 minutes, which is like almost [22:21] 3 hours to half an hour. So, just imagine how  much time we have saved in this whole concept, [22:27] and also agent was clear enough to know  what step needs to be done. [snorts] [22:35] So, the multi-agent architecture here, the first  thing is orchestrator. It's a central coordinator [22:40] managing all of our agents. And we have something  called as planner agent. So, what does planner [22:45] agent do? It basically captures the whole goal  and decomposes the whole goal into smaller chunks. [22:52] So, let's say I wanted some worker agents to be  writing a code, and some agents to be testing, [22:57] some agents to be executing uh documentation. So,  my planner agent will say, "Hey, if you want your [23:03] code to be running use a worker node of this.  If you want your to be documentation writing, [23:08] planner agent will call one more worker  node saying to write this agent." So, [23:13] divide your agents in such a way that for  each task you assign specifically task. [23:18] And important thing is how many agents  you create, too. Because if you create [23:23] agents for each task, it's also important  to maintain those agents. So, we have to [23:27] cleverly think if there are any things which  you can be combined into a single agent run. [23:34] Oops. Uh previous slide, please. [23:43] Yeah, memory store. Sorry, I forgot  this. Uh in the memory store, obviously, [23:47] whenever you're calling this agents, it needs  to store that specific session state. So, [23:51] let's say simple example, if you're writing  Terraform, you need a state specific state [23:55] whenever it is running to know what's  happening. So, in similar manner, [23:59] it's important to store that state information  in your memory store in your vector DB. [24:03] And also, while calling for any sort of tools,  you're calling through MCP MCP has a separate [24:08] worker node or agent saying, "Hey, if you're  calling to try to integrate with our tools, [24:13] whether Confluence, GitHub, Bitbucket,  try to use this specific agent via MCP." [24:20] So, this is uh random slide. I spoke to one of my  friend uh who was working as a platform engineer, [24:28] and I got this. So, the reason  why I put this slide is previously [24:34] a platform engineer used to work a single job for  this whole task what I mentioned in this. He used [24:40] to work for three or four days. Now, it has been  reduced to one day. So, I'll explain how. So, [24:45] 9:00 he gets an incident triage. So, he feeds  that specific triage incident to an agent, [24:51] and agent will give you a respective information  got fixed. So, it's probably a 30-minute job which [24:55] has done. Previously, he used to do like  45 minutes, 1 hour or 2 hours. Next thing, [24:59] he wrote up Prometheus alerts in that half an  hour. He was working on some Terraform modules, [25:05] writing Terra test coverages, and  shipping it. The idea over here is [25:09] people say AI is losing jobs or whatever, but my  take is it's basically increasing the productivity [25:17] of developer, how many tasks he can do. So,  that is the take even in our today's morning [25:22] conversations, too. They were saying the same  thing. It improves the task how developer can do. [25:28] So, over here in this step the three or four  days of effort has been achieved in a single day. [25:37] So, this is one of the case study  as SRE server wide quotas. So, [25:42] as an SRE, let's say if you're an SRE, it's  important you know what needs to be done. [25:47] Let's say you're a subject matter expert,  you know what needs to be implemented, [25:50] you know perfectly about app, you know what needs  to done your SLA, SLO, and SLA. So, he comes in, [25:55] he writes in his plain English, "Hey, I wanted  an SLA of this, SLAs of this for this specific [26:01] applications, and you create me error budgets  in a plain English language." And agent was very [26:07] clear clear enough to capture that information and  create those dashboards in his log or Dynatrace. [26:13] Similarly, run book automation. An on-call  engineer previously knows if the specific issue [26:19] happens, this is the fix. So, you try to capture  that information in run book. So, whenever agent [26:24] is running, it trying to reference that run book  and trying to fix it by itself. So, it's about [26:30] we need a subject matter experts who says  what to do, agent will be doing that stuff. [26:39] Um so, this is a real world some of the challenges  uh scenarios happening. [snorts] How agents have [26:46] helped in uh doing the process quicker. So, we  have wanted to migrate Some of the industries [26:52] wanted to migrate 200 plus Kubernetes  workloads from EKS 1.24 to 1.29 version. [26:57] So, if anyone of you are working on EKS  or here pretty much know for each of the [27:03] version release, you need to inspect a lot of  configurations needs to be changed and lot of [27:08] configuration mismatches happens. It's important  to capture those metrics. So, what was done? [27:13] Scaling 200 applications needs to be done and you  have to have zero time deployment and within that [27:18] zero time deployment also you get the accurate  information. So, having all this information [27:24] in a normal day-to-day jobs will obviously take at  least 6 to 7 weeks to gather this information and [27:29] way to update. And AWS has a very hard deadline  of saying this has to be done in 8 weeks. So, [27:36] agentic approach, they started writing a agent.  The first agent was they build a standard template [27:40] of what patterns needs to be identified,  what are the changes I need to capture. So, [27:45] laid out a basic ground level template. Once the  template has been formed, the agent was running in [27:50] parallel to see where exactly these 200 clusters,  where exactly the changes needs to be in parallel. [27:57] Once these changes are implemented, it's obviously  about also writing these test coverages. So, [28:03] agent was very clear enough to write those  test coverages and see if it was able to do a [28:07] successful version upgrade from 1.24 to 1.29 in  dev environment. There were 200 plus workloads. [28:14] In those almost 190 workloads have been  successfully agentic way have successfully seen [28:20] the successful results in the dev environment.  There are few edge case scenarios which have which [28:24] needs a human approval and needs an interpretation  of changing those configurations. So, what exactly [28:29] are we learning from this? We obviously the  agentic workflow has identified the root cause, [28:35] not the root cause, but the upgrading approach and  evaluated in a very quicker fashion to migrate. [28:41] So, this is one of the second scenario, too. A  Terraform team wanted to write 80 plus Terraform [28:47] modules in multi-cloud both AWS and GCP. So in  real time if you wanted to write 80 plus modules [28:54] for multi-cloud providers, it's going  to take definitely months. So now [28:59] in this agentic approach, the first step what  they have done is they have defined the industry [29:04] standards or the specific company standards.  Let's say again, tagging, standard encryption, [29:09] some security policies for that specific company.  Once the template has been developed, they started [29:15] building the resource blocks of Terraform  modules for multi-cloud multi-cloud providers. [29:20] So agent was very clear enough while generating  that resource blocks of that specific module, [29:25] it took the architecture template of that  specific industry standards which developed [29:29] by the company and was able to successfully  generate. Once you during this generation, [29:34] in parallel to what it was also generating  the data test for that specific modules to see [29:38] if those modules are really working great or not  in deploying dev environment. So development of [29:43] modules and development of data test cases  was done in parallel. Once these are done, [29:49] there are some modules which need obviously human  interference to see whether these are specifically [29:54] working during the interconnectivity of  multi-clouds. And once that is done, it [29:58] performed into a push into your GitHub master  branch or main branch. So what we are seeing here, [30:03] this is a two weeks of effort. If you really  wanted to do without agentic approach, it's [30:08] obviously a months amount of effort. So this is  the amount of effort how much agents has reduced. [30:15] So this is a quick thing. One more  use case, migrating logging libraries. [30:19] Obviously for each logging library, they  wanted to respectively upgrade the version. [30:23] The task was to I upgrade version X to Y.  Agent was very clear enough to identify [30:28] where exactly the version needs to be  updated and how quicker it wants to do. [30:32] So 38 out of 40 services migrated and very few  edge cases have been captured by again human. [30:42] The production reality. So these are the numbers  which have been captured how much amount uh [30:48] agent code has been successful in real time.  So, 55% of the time everyone agreed that it [30:54] was very faster delivery. Agents have been very  successful in giving fastest delivery of that. [30:59] 38% of security gaps. So, what does that mean is  AI was able to generate code, but there are still [31:05] use cases agent was not able to determine or  fill those security gaps. So, that was the 38% [31:11] and test pass rate. It was able to pass all those  unit tests, integration tests, what was written [31:17] for app, but it was not able to pass 100% for a  deeper level health checks. Again, we don't expect [31:22] agent to run completely 100%, but the expectation  is once it is done a human approval or some [31:29] guidance or governance guardrails has to be given  to that specific agent and review those things. [31:37] So, how do we test our AI generated  infrastructure? So, okay, now AI is generating [31:43] stuff, but how do we test it? So, there are some  cases uh let's say for property-based testing. [31:49] For each of the properties which we write in  a Terraform, it's important to capture that [31:53] specific metric resource configuration, write  tests accordingly, and ask the agent to test [31:59] by itself before even developing it. That was one  of the approach. Second thing is LLM as a judge. [32:05] Obviously, I'm pretty sure every company has  multiple LLMs. So, once you test with one of [32:09] the LLM, obviously use a second LLM to validate if  this is something expected or not. If the second [32:15] LLM gives you something different output, there  is something issue with your first LLM which we [32:19] need to fix that. Mutation testing. So, mutation  testing is purposefully breaking some changes in [32:25] your code which was generated by your agent and  see if was agent was able to identify that change [32:32] or not. If it identifies, great, your LLM is  working great. If it doesn't identify, again, [32:37] we need to fix those things. So, these are some  quick level of test where which can be achieved. [32:44] Why testing new QA? So, previously, whenever we  write any app during the CD pipeline, it runs [32:49] the unit test, integration test, and specifically  all the outcome-based test, functional testing. [32:54] Right now, what we recommend is write your  test cases first, and then start your agentic [33:00] development. The reason why I say this is agent  will try to whenever we have this cases first, [33:07] agent will try to capture those test cases  and generate code accordingly. So, it [33:11] reduce you less amount of hallucination, and it  also understand the standard, oh, these are my [33:16] test cases to functional proper functionality of  the app. Let me generate the code in that way. So, [33:21] start your testing first or write that framework  first before you even start the agent development. [33:29] Uh treat the agent like again, whenever you're  treating an agent, least privilege, have the least [33:34] privilege execution. Don't give too much access to  it. Ob- obviously, have humans in the loop gates [33:40] as needed as possible, specifically when  you're touching production environment. [33:44] Injection defense. So, this is one of the  important story I want to say out. There was one [33:49] company where it was hiring people, and the hiring  was written in such a way that agent was able to [33:57] uh filter the resumes. So, at certain point, one  of the manager comes and say, "Hey, why are we [34:04] getting all of our interview resumes only for  men? Why are women not being selected at all?" [34:09] So, the agent has been trained in such a way  with the old information of data where it can [34:15] only pull the information of men, but not  women. So, the important point over here is [34:21] whenever agent is referencing some data, it's  important to make sure you update those data. If [34:26] you don't update those data, agent will obviously  capture the old data, and you'll get bad outcomes. [34:30] So, this was one of the important thing  why we have to make sure data is accurate. [34:35] Agent needs to catch always updated data. Full  observability. Have your agent make sure the [34:41] observability is obviously implemented what  needs be done, what the agent has implemented, [34:46] what the workflows it has been taken.  Cost and token governments. Again, [34:51] cost is an important factor for everyone, but  again, when you're evaluating cost, obviously make [34:56] sure you're evaluating based on code correctness  and reliability which I was saying before. [35:03] Make sure your AI generation code have some  because you don't want entering into any sort of [35:08] complaints or legal issues. So, make sure the data  you are pulling doesn't have any licensing risk, [35:14] security vulnerabilities, and the bias and  correctness which I was saying before. Make [35:19] sure it has accurate data information  while it is pulling. [clears throat] [35:24] The economics of white coding, uh so this is  one of the slide what they've quantified and [35:30] said what was working and how we can identify what  is not working. The first is token cost modeling. [35:36] Obviously, how are you calculating the token  cost is one of the important metric over here. [35:42] Try to run a specific task and see how much it  is being costed for you. Try to multiply that [35:48] how many times you're going to run that specific  task, and once you multiply that, evaluate based [35:54] on how many developer hours it's going to reduce.  That will give you the ROI calculation framework. [36:00] So, once you get those values, you'll really  understand whether agent has been really working [36:05] or not, and is it really saving or not. And some  of the important factors which you which we have [36:11] to consider while evaluating the cost of the token  is prompt engineering time. So, as I said before, [36:17] developers obviously write prompts. Again,  writing good prompts is important to get a [36:23] structured output from your agent. So, how much  time developers spending in doing the retries [36:28] to give a successful prompt engineering. Second  thing is evaluating the infrastructure. Whenever [36:33] team is hosting the agentic stuff, how much time  the infrastructure is being used, how much time [36:38] it's not being used. Model drift. So, whenever  LLMs are giving new set of versions of models, [36:45] how are we making sure that new model version  is causing a drift to our existing application [36:49] or not. This is also one of the important metrics  to consider while performing the cost evaluation. [36:56] Uh last, the future architects not subscribers.  So, I say this, so obviously master your [37:03] context engineering, adopt agentic workflows,  focus on business impact. I know many companies [37:08] says how much your performance is based on  your commit level commits of code, how many [37:13] lines you have committed, how many PRs you have  given, how much tokens are being evaluated. So, [37:18] please don't consider that, just base consider  based on the outcomes. So, that's it. Thank you.