惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
Engineering at Meta
Engineering at Meta
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
F
Fortinet All Blogs
P
Privacy & Cybersecurity Law Blog
The Hacker News
The Hacker News
博客园 - 司徒正美
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
I
Intezer
WordPress大学
WordPress大学
Security Archives - TechRepublic
Security Archives - TechRepublic
Scott Helme
Scott Helme
T
Threat Research - Cisco Blogs
T
Tailwind CSS Blog
月光博客
月光博客
Recent Announcements
Recent Announcements
博客园 - 叶小钗
J
Java Code Geeks
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
News and Events Feed by Topic
A
Arctic Wolf
B
Blog RSS Feed
Recorded Future
Recorded Future
D
DataBreaches.Net
有赞技术团队
有赞技术团队
Project Zero
Project Zero
U
Unit 42
T
Tor Project blog
The GitHub Blog
The GitHub Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
C
CERT Recently Published Vulnerability Notes
博客园 - Franky
博客园 - 【当耐特】
Microsoft Security Blog
Microsoft Security Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Security Latest
Security Latest
C
Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Blog — PlanetScale
Blog — PlanetScale
H
Heimdal Security Blog
Vercel News
Vercel News
Stack Overflow Blog
Stack Overflow Blog
S
Securelist

rss.livelink.threads-in-node

Probably has less bugs than windows 11 | Microsoft Community Hub Quick question about window PC requirements for meta link cable? Is it possible to run ryujinx canary on an administrator account on windows? Why Windows 11 still depends on 1990s code iphone auf pc spiegeln windows 11 – Welche Methode funktioniert zuverlässig? CHERIoT-Ibex: Closing the door on memory safety vulnerabilities with hardware-enforced protection Known issue: Upgrading Microsoft Tunnel version 20260129.1 What's New in Microsoft Entra: May 2026 Carta de validación TSP (aka.ms/TSP_Achievement_Code_Enroll...) restricted across all accounts unable to enroll Class Admin Build observability for scalable AI apps and agents selling through Microsoft Marketplace Inspektor Gadget Completes Its First Independent Security Audit Retirement of Direct Exchange ActiveSync Certificate-Based Authentication by End of 2026 Export mixed text and tabular Excel to PDF Safely Migrating Terraform Managed Disks on Azure Using Stable Keys and Copilot Microsoft 365 & Power Platform Community call Microsoft 365 & Power Platform product updates call Course Retirement Announcement: AI-3022 The End is Nigh for DES and an Update for hunting down RC4 Unable to Access Scheduling Poll Options Title Plan Update - May 8, 2026 Secure Medallion Architecture Pattern on Azure Databricks (Part II) From Observability to Action: Building an AI-Powered AIOps Agent for Customer-Specific Operations General Availability of Mailbox Import and Export Microsoft Graph APIs Why External Participants Can—or Can’t—Join a Microsoft Teams Meeting CRITICAL: Data Loss on Build 26200.8328 - AI Storage Sense deleted 160+ apps with 870GB free space. Why is everyone hating on Windows 11? I was pissed at the Windows 11 context menu so I built this. Windows 11 Shows ASUS LOGO but then goes dark for 5 minutes Windows 11 causes discrete graphics cards to be locked at their base clock speed when idle In Windows 11 Insider Preview 26300.8346, the Start button is offset to the left and misaligned The Windows 10 update failed, so I'm planning to switch to Windows 11 Using the Microsoft Graph PowerShell SDK to Update User Profiles Someone please help me - Windows Insider Program How to Reduce No-Shows for WooCommerce Appointments Windows 11 Insider Program Download Update Beta Channel stuck at 99% How to transfer photos from iphone to pc on Windows 11 without itunes Windows 11 Dell Laptop Latitude 5500 New PC won’t boot up windows 11 Fresh Windows Install – Driver/Service Advice for G14 (2021 R9 5900HS + RTX 3050 Ti) AD Recycle Bin – “The specified value already exists” but Recycle Bin is non‑functional Why deleting files does not free up space on mac How to delete or clear cache on macbook air automatically Announcing Microsoft Host Integration Server 2028: Modern connectivity for IBM Mainframes Midranges From Test Cases to Trust: Elevating Enterprise Quality with GitHub Copilot Bootfähigen usb stick erstellen am mac für Windows 11? My modpack has this error and I can't find the cause Where is the option to attach file for parent Income Statement Form? Watching streamers with 2k resolution enabled makes my PC lag Update Your Exchange SE Hybrid On-premises Rich Coexistence to Graph Partner Blog | Unlock the cloud benefits in your partner benefits package with a streamlined activation experience Turn your Azure commitments into smarter cloud investments with Microsoft Marketplace Drive stronger Microsoft alignment and unlock co-sell growth at Ultimate Partner LIVE RECAP: Microsoft Elevate Partner Community Monthly Call - May 2026 Public Preview: Migrate your regional virtual machines to availability zones Security Dashboard for AI: 3 Ways CISOs Drive Impact Today PLANNER WILL NOT PUBLISH THE SCHEDULES FOR MY PLANS, BY CREATING AN iCALENDAR LINK....HELP | Microsoft Community Hub Firm AI for professional services: governed, agentic workflows built on Microsoft Azure Azure Incident Retrospective - Please register! Session 2 - Tracking ID: 5GP8-W0G Azure Incident Retrospective - Please register! Session 1 - Tracking ID: 5GP8-W0G Autoruns, ProcDump, ZoomIt, DebugView, NotMyFault, ProcExp, Procmon, and Linux tools Edge Canary not auto updating? Edge Dev on Windows - Tab sync not working Available today: GPT-5.5 Instant in Microsoft 365 Copilot Introducing the Azure Resource Manager MCP Server! Defender Threat & Vulnerability Management Reporting A New Chapter for Realtime AI: Reasoning, Translation, and Real-Time Transcription Plan a fun Family Wellness Month with Copilot Released: May 2026 Exchange Server Hotfix Update Service Bus SBMP Retirement: What BizTalk Server 2020 Customers Need to Know Azure Incident Retrospective Please register for one of the 2 sessions below! Planner Agent brings work management directly into Microsoft 365 Copilot Local account and MS account Cannot reset account password Announcing Windows Admin Center: Virtualization Mode Public Preview 2! Azure RBAC Custom Role Best Practices or Common Build Patterns Pivot Table Data Centering How to design production-ready AI architectures for apps and agents on Microsoft Marketplace Troubleshoot with OpenTelemetry in Azure Monitor - Public Preview Secure, Keyless Application Access with Managed Identities - Now GA in Azure Files SMB Help shape the Microsoft 365 Copilot community experience — your input matters Microsoft 365 Security Best Practices for Enterprises Running multimedia AI models on Container Apps with Serverless GPU (A100 & T4) SharePoint List Migration to new Tenant Windows 11: Task Manager: Background Processes: Stop Unnecessary Ones from Starting Automatically Detecting Plain‑Text Password Exposure Using Custom Regex in Microsoft Purview MVP Enthusiast Effective, engaging events in communities and storylines Change Optics Report released into Public Preview to showcase messages impacted by future changes RECAP: Microsoft Elevate Partner Community Monthly Call - April 2026 | Microsoft Community Hub Networking in Windows Server 2025 - Windows Server Summit Want to get more out of Microsoft Copilot Chat without adding another tool—or cost—to your stack? Announcing Public Preview: Security Copilot’s Email Summary in Microsoft Defender Copilot Chat in financial services: Is productivity moving faster than policy? How manufacturers can scale AI from pilot to production with Microsoft Marketplace SSO for a Python Teams Bot (M365 Agents SDK + FastAPI) — Single-Tenant, Multi-Tenant, and UAMI | Microsoft Community Hub Advice required for temp / agency staff | Microsoft Community Hub 'You've tried to sign in too many times with incorrect account/password' | Microsoft Community Hub When will Windows 11 natively support Auracast broadcasting? | Microsoft Community Hub Authenticator | Microsoft Community Hub
Turn Your App Service Web App Into a Self-Healing Agent: LLMOps Best Practices for Production
jordanselig · 2026-05-19 · via rss.livelink.threads-in-node

A user submits a prompt. The agent burns through 50,000 tokens looping on a malformed tool response. Another user trips a model rate limit and the agent silently fails. A bad prompt update goes out at 4 PM Friday and degrades success rate to 60%. Your APM dashboard shows green the entire time because none of that is a 500.

This post walks through the LLMOps stack we built into a working reference sample on Azure App Service: the SLIs that matter for agents, a budget circuit breaker, prompt-repair retries, and a fully automated slot-swap rollback when things go sideways. Every code snippet is from the deployable sample at the end of the post.

📦 Sample repo: seligj95/app-service-self-healing-agent-pythonazd up and you've got the whole stack live in your subscription in under 10 minutes.

Your web app's reliability model assumes a request maps to bounded work — a SQL query, a cache hit, a templated response. You alert on Http5xx, p95 latency, and dependency failures. Done.

An agent breaks that model in four ways:

  1. Cost is unbounded per request. An agent that loops on a flaky tool can spend $5 on one user prompt. The HTTP response is still 200.
  2. Failure can be silent. A model can hallucinate confident JSON, a tool can return malformed args, and the agent dutifully returns a wrong answer to the user. Zero exceptions logged.
  3. Latency is non-deterministic. A "simple" prompt that normally finishes in 2 seconds can blow out to 30s when the model picks an expensive plan. p95 latency tells you nothing.
  4. Quality regresses on prompt changes, not code changes. A prompt tweak that ships in seconds can crater tool-call accuracy by 30%. Your CI/CD pipeline didn't catch it because there were no failing tests.

Web-app SLOs (uptime, latency, error rate) are necessary but not sufficient. Agents need agent-shaped SLOs.

Before instrumenting anything, write down what "healthy" means. Here are the four SLIs we chose for the sample. None of them are Http5xx.

SLIWhat it measuresWhy it matters
Task success rate% of /chat requests that the agent self-classifies as completedCatches silent failures the HTTP layer misses
Cost per task$ spent (input + output tokens × model rate) per /chatThe unbounded-loop problem in one number
Tool success rate% of tool invocations that didn't raiseTool layer is where most agent failures live
Repair retriesTimes we re-prompted the model after a schema-validation failureLeading indicator of prompt drift

In our reference middleware these come out as agent.task.success, agent.cost.usd, agent.tool.success, and agent.repair.retry — eleven custom metrics in total. We emit them via OpenTelemetry so they land in App Insights customMetrics and the included KQL workbook visualizes them as SLO tiles.

App Service makes the observability story unusually easy because you get App Insights wired up automatically by azd — no agent install, no DaemonSet, no sidecar. The only thing you bring is the SDK init for your custom metrics:

# llmops_middleware/sli.py
from azure.monitor.opentelemetry import configure_azure_monitor
from opentelemetry import metrics

def configure_azure_monitor_if_available() -> bool:
    if not os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING"):
        return False
    configure_azure_monitor()
    return True

meter = metrics.get_meter("agent")
tokens_in    = meter.create_counter("agent.tokens.in")
cost_usd     = meter.create_counter("agent.cost.usd")
task_latency = meter.create_histogram("agent.task.latency")
tool_success = meter.create_counter("agent.tool.success")
# ...

We compute cost from a per-model rate card so the metric is in real dollars, not abstract tokens:

COST_PER_1K_TOKENS = {
    "gpt-4o":       {"in": 0.0025,   "out": 0.01},
    "gpt-4o-mini":  {"in": 0.00015,  "out": 0.0006},
}

def record_cost(model: str, tokens_in_count: int, tokens_out_count: int, tenant: str) -> float:
    rate = COST_PER_1K_TOKENS[model]
    cost = (tokens_in_count * rate["in"] + tokens_out_count * rate["out"]) / 1000
    cost_usd.add(cost, {"model": model, "tenant": tenant})
    return cost

Once those flow, the KQL queries write themselves:

// Top cost-burning tenants in the last hour
customMetrics
| where timestamp > ago(1h)
| where name == "agent.cost.usd"
| extend tenant = tostring(customDimensions["tenant"])
| summarize spend_usd = sum(valueSum) by tenant
| top 10 by spend_usd desc

The sample ships a 6-tile workbook (observability/workbook.json) deployed via Bicep. It renders SLO compliance, cost burn-down, tool failure breakdown, latency percentiles, budget breaches, and healing signals out of the box.

The deployed workbook in App Insights. The SLO panel dips during a chaos run and recovers as the agent self-heals — exactly the signal you want on a glass-pane dashboard.

Custom metrics tell you about cost after you spent it. To prevent runaways, you need a circuit breaker that bites before the model call happens.

The middleware in llmops_middleware/budget.py keeps a per-tenant counter in memory (per month) and returns a decision:

class BudgetDecision(Enum):
    ALLOW = "allow"             # under budget
    DOWNSHIFT = "downshift"     # ≥80% — switch to cheaper model
    BLOCK = "block"             # ≥100% — refuse the request

def evaluate(tenant: str) -> BudgetDecision:
    spent = _spend.get((tenant, _current_period()), 0.0)
    if spent >= BUDGET_USD_PER_TENANT:
        return BudgetDecision.BLOCK
    if spent >= BUDGET_USD_PER_TENANT * 0.80:
        return BudgetDecision.DOWNSHIFT
    return BudgetDecision.ALLOW

The agent loop reads that decision and downshifts from gpt-4o to gpt-4o-mini — a 16× cost reduction ($0.0025 / 1K input tokens vs $0.00015) — when a tenant crosses 80% of their monthly budget. The user keeps getting answers; the bill stops climbing.

def _pick_model(tenant: str) -> str:
    decision = budget.evaluate(tenant)
    if decision == BudgetDecision.DOWNSHIFT:
        sli.model_downshift.add(1, {"tenant": tenant})
        return DOWNSHIFT_MODEL
    return PRIMARY_MODEL

For the demo we keep state in memory; production should swap the dict for Redis (atomic INCRBY) or Cosmos with optimistic concurrency. The interface in budget.py is intentionally tiny so this is a 10-line change.

There are three patterns in the sample, each addressing a different failure class.

The most common agent failure isn't a tool exception — it's the model returning malformed JSON that fails schema validation on tool args. The fix is to feed the validation error back into the model and ask it to repair the call:

# llmops_middleware/repair.py
async def retry_with_repair(call_fn, args, *, max_attempts=2):
    for attempt in range(max_attempts):
        try:
            return await call_fn(args)
        except (ValidationError, RepairableError) as exc:
            sli.repair_retry.add(1, {"attempt": str(attempt)})
            args = await _ask_model_to_repair(args, str(exc))
    raise

This single pattern recovers 50–70% of "the agent returned garbage" cases without escalating.

When a primary tool times out or fails open, try a cheaper or simpler one:

async def tool_fallback_chain(primary, *fallbacks, args):
    for fn in (primary, *fallbacks):
        try:
            return await fn(args)
        except ToolUnavailable:
            sli.tool_success.add(1, {"tool": fn.__name__, "status": "fallback"})
    raise NoToolAvailable()

Lookup-style tools especially benefit: web search → cached snapshot → static knowledge base.

Here's the killer feature App Service brings that's a slog on K8s: deployment slots. You always have a known-good previous version warmed up and one ARM API call away from production traffic. We wire that up to fire automatically when our SLI breaches.

The chain is:

  1. Metric alert on Http5xx > 5 in 5 minutes (the platform metric, free)
  2. Action Group that POSTs to a Logic App webhook (SAS-signed callback URL)
  3. Logic App that calls POST /sites/{name}/slots/staging/slotsswap via its managed identity (granted Website Contributor on the target web app)

The whole healer is one trigger + two actions: receive the alert webhook, call ARM slotsswap, return a status payload to the caller.

The two actions in Bicep:

SwapSlots: {
  type: 'Http'
  inputs: {
    method: 'POST'
    uri: '${environment().resourceManager}@{parameters(\'targetSiteId\')}/slots/staging/slotsswap?api-version=2024-04-01'
    body: { targetSlot: 'production' }
    authentication: {
      type: 'ManagedServiceIdentity'
      audience: environment().resourceManager
    }
  }
}

No code to deploy, no secrets to manage, no second runtime to babysit. From alert-fire to swapped-slot is about 4 minutes in our tests — under the SLA most agent products have for "user-visible degraded mode."

Why not a Function App? We started there. The Logic App is 60 lines of Bicep and zero application code. For a one-action workflow like "swap a slot," the Function adds packaging, deployment, and a runtime to monitor for no benefit.

You can't trust a self-healing system you haven't broken. The sample ships a chaos CLI and an in-process injection point so you can practice failures on demand.

In-process: llmops_middleware/chaos.py exposes four modes (off, throttle, malformed, outage) togglable via POST /admin/chaos. When set, tool calls roll a die and raise the matching exception with the configured probability:

class ChaosController:
    def maybe_inject(self) -> None:
        if random.random() > self.probability:
            return
        if self.mode == "outage":
            raise ChaosOutage("simulated tool outage")
        if self.mode == "throttle":
            raise ChaosThrottled("simulated 429")
        if self.mode == "malformed":
            raise ChaosMalformed("simulated bad tool output")

External: chaos/inject.py is a small async load driver that sets /admin/chaos then drives /chat at a target RPS, tallying response codes:

python chaos/inject.py \
  --base-url https://my-agent.azurewebsites.net \
  --mode outage --probability 1.0 --rps 10 --duration 300

Running that for 5 minutes against the deployed sample reliably:

  1. Drives customMetrics(name="agent.task.failure") over 50/min
  2. Trips the Http5xx > 5 metric alert (~90 seconds after threshold breach)
  3. Fires the Logic App run (succeeded in 1.2 seconds in our test)
  4. Flips the slot — /health instance ID changes

The repo's observability/queries.kql has the canonical KQL for each of these signals, and observability/workbook.json is the deployable workbook that visualizes them.

Everything in this post is in seligj95/app-service-self-healing-agent-python. The Python package llmops_middleware/ is the part you'd vendor into your own agent — sli.py, budget.py, repair.py, chaos.py. The agent loop and the Bicep are demo-quality but production-shaped.

Run it yourself:

git clone https://github.com/seligj95/app-service-self-healing-agent-python
cd app-service-self-healing-agent-python
azd auth login
azd up

You'll have an agent + AOAI + workbook + healer running in about 8 minutes. Then run the chaos script and watch the slot flip.

Deployable workbook JSON, dropped into the resource group by Bicep. Six panels:

  • SLO tile — % of tasks where agent.task.success was emitted (grouped by tenant)
  • Cost burn-down — running spend per tenant against the monthly budget
  • Top failing tools — failure count by tool, broken down by error class
  • Latency p50/p95/p99agent.task.latency histogram
  • Budget breaches — count and tenant list
  • Healing signalsagent.repair.retry + agent.model.downshift + agent.chaos.injected over time

It's observability/workbook.jsonloadTextContent-ed into infra/shared/monitoring.bicep so you get it deployed automatically.

After building this, the appeal of App Service for agents is clearer than I expected going in:

  • Slots are an unfair advantage. A pre-warmed previous version, one ARM call from production. K8s blue/green needs you to build it.
  • Managed identity to Azure OpenAI removes the entire key-rotation problem. The sample sets disableLocalAuth: true on the AOAI account — there literally is no key.
  • App Insights is auto-wired so your custom metrics land in customMetrics and your KQL queries work day one.
  • Bicep + azd lets you ship a full LLMOps stack in one repo: app, infra, healing, observability, chaos.

If you're standing up a new agent and you don't already have a Kubernetes platform you love, App Service is a strong default.

If you take three things from this post:

  1. Define agent SLOs in your own terms — task success, cost per task, tool reliability — not just web-app SLOs.
  2. Put a circuit breaker between the user and the model. A budget breaker that downshifts to a cheaper model is the highest-ROI middleware you can ship.
  3. Make rollback boring. Slot swap + a one-action Logic App + a metric alert is a self-healing system you can build in an afternoon and trust at 3 AM.

The sample has all of it wired up.

The middleware in this sample (SLIs + telemetry, cost guardrails, policy/audit hooks) is exactly the kind of thing we're evaluating as first-class App Service platform features — opt-in sidecars or built-in capabilities so you don't have to vendor a middleware package into every agent you ship. Concretely, we're tracking ideas like:

  • Agent Observatory — a sidecar that intercepts SDK calls (Semantic Kernel, LangChain, Crew AI, AutoGen) and captures full reasoning traces with zero code changes
  • AI Cost Guardian — platform-level quotas and spend caps across Azure OpenAI, Anthropic, and other model providers, with real-time enforcement
  • Policy Guard — governance, PII masking, model-approval lists, and an immutable audit log for regulated workloads

If any of those would land for your team — or if you're solving these problems differently and want to push back on the shape — we want to hear it. Drop a comment on this post: the roadmap is genuinely shaped by feedback at this stage.