跳到主内容
@wquguru
精选86Cloudflare 博客(RSS)产品发布/更新

Cloudflare推出Issues功能,将生产错误自动发送给AI Agent

Detect and send production issues straight to your agent

原文
发到 X
推荐理由

Agent落地场景的关键基础设施更新,实现了从监控到修复的自动化闭环,做Serverless和Agent的同学值得重点关注。

As agents help us build more complex applications, both humans and agents need a better way to stay on top of what goes wrong in production. Coding agents can already query observability data, navigate a repository, change code, write tests, and open a pull request. What remains manual is connecting those steps: recognizing that repeated failures come from the same bug, gathering the relevant logs and traces, sending that context to an agent, and checking whether the fix worked. Without that structured handoff, the agent must search raw telemetry to reconstruct the scope and context of the failure before it can investigate.

随着代理帮助我们构建更复杂的应用程序,人类和代理都需要一种更好的方式来掌握生产环境中出现的问题。编码代理已经可以查询可观测性数据、导航代码仓库、修改代码、编写测试用例并创建拉取请求。目前仍需人工完成的是将这些步骤连接起来:识别出重复失败源于同一 bug、收集相关的日志和追踪信息、将该上下文发送给代理,以及检查修复是否有效。如果没有这种结构化的交接,代理必须在调查之前搜索原始遥测数据,以重建故障的范围和上下文。

Today, we are introducing Issues, built-in error monitoring for Cloudflare Workers (now in open beta!) to streamline this workflow. Issues can:

今天,我们推出 Issues(问题),这是 Cloudflare Workers 内置的错误监控功能(现已开放公测!),旨在简化此工作流程。Issues 可以:

  • Group repeated exceptions, 5xx responses, and error logs into one issue.
  • Send the error, stack trace, logs, traces, and Worker version to a configured coding agent.
  • Trigger the agent’s configured workflow — from triaging an issue to querying more data to opening a pull request.
  • 将重复的异常、5xx 响应和错误日志归并为一个问题。
  • 将错误、堆栈跟踪、日志、追踪信息和 Worker 版本发送给配置的编码代理。
  • 触发代理的配置工作流——从问题分类到查询更多数据,再到创建拉取请求。

Fix your first issue with the following prompt for your agent with CF CLI or checkout the documentation to get started:

使用以下提示词通过 CF CLI 为你的代理解决第一个问题,或查看文档以开始使用:

Copy prompt: Set up for cf

复制提示词:为 cf 设置环境

代码 · 4 行
Set up cf: https://developers.cloudflare.com/cf/. Enable Issues for this Worker in cloudflare.config.ts; show the diff and ask before deploying. After approved deployment, wait 1 minute, then find the most frequent issue and retrieve an occurrence using its returned ID:
cf observability issues list --order-by count --order desc --per-page 1
cf observability issues occurrences <ISSUE_ID> --per-page 1
If no issues exist, report that. Otherwise, diagnose from the details, fix locally, run relevant checks, and show the diff and results. Ask before deploying the fix.

Catch failures automatically

自动捕获失败

With one line of configuration, you can start receiving Issues detected on your Worker with no additional instrumentation required. Issues are built into the Workers runtime, so there is no SDK to install or application wrapper to add.

只需一行配置,即可开始接收在您的 Worker 上检测到的 Issues,无需额外安装任何工具。Issues 已内置于 Workers 运行时中,因此无需安装 SDK 或添加应用程序包装器。

Once enabled, Issues records uncaught exceptions, failed invocations, HTTP 5xx responses, output from console.log() and console.error(), and logs that contain a stack trace. It also flags runaway alarm conditions and code that writes large volumes of logs inside loops.

启用后,Issues 会记录未捕获的异常、失败的调用、HTTP 5xx 响应、console.log() 和 console.error() 的输出,以及包含堆栈跟踪的日志。它还会标记失控的警报条件和在循环内写入大量日志的代码。

Consider a Worker whose handler starts throwing errors after a deployment. Every failed request has a different request ID, but they all come from the same bug. Issues groups them together and shows when the error first appeared, how many times it has happened, and whether it is becoming more frequent.

考虑一个部署后其处理函数开始抛出错误的 Worker。每个失败的请求都有不同的请求 ID,但它们都源于同一个 bug。Issues 将它们分组在一起,并显示错误首次出现的时间、发生次数以及频率是否增加。

When you open an issue you can see the error, a stack trace when available, the logs and traces leading up to it, the Worker version, request details and trend of the issue over time, as shown below:

当您打开一个问题时,您可以看到错误信息、可用的堆栈跟踪、导致该错误之前的日志和追踪信息、Worker 版本、请求详情以及随时间推移的问题趋势,如下所示:

Contextualizing errors for your agent

为您的代理提供错误上下文

Cloudflare can capture what happened inside the Worker, but it does not know which users, accounts, or sessions matter to your application. Use the Worker runtime's built-in OpenTelemetry API to add those identifiers, without installing another package:

Cloudflare 可以捕获 Worker 内部发生的情况,但它不知道哪些用户、账户或会话对您的应用程序至关重要。使用 Worker 运行时内置的 OpenTelemetry API 添加这些标识符,无需安装其他包:

Those identifiers appear with each occurrence. In this issue, you can now see whether failures are concentrated in one account or session before sending the issue to an agent.

这些标识符会随每次出现而显示。在此问题中,您现在可以在将问题发送给代理之前,查看失败是否集中在某个账户或会话中。

Send detected issues to your agent

将检测到的问题发送给您的代理

An issue no longer has to sit in a dashboard while someone copies a stack trace and pastes it into a prompt. Configure an automation once, and when an issue crosses an occurrence threshold or returns after a quiet period, Issues sends it straight to your agent through Automations. You can choose when the automation should run and where the issue should go.

问题不再需要停留在仪表板上等待某人复制堆栈跟踪并将其粘贴到提示中。只需配置一次自动化,当问题的发生次数超过阈值或在静默期后再次出现时,Issues 会通过 Automations 将其直接发送给您配置的代理。您可以选择自动化运行的时机以及问题发送的目标位置。

This can be via:

这可以通过以下方式实现:

  • Built-in coding agents: Connect Claude Code with a routine ID and token, Cursor with an automation webhook URL, or Devin with an API token and organization ID.
  • Generic webhooks: Send issue context to your own agent or HTTPS endpoint.
  • Chat and incident management: Notify your team through chat or an on-call workflow.
  • 内置编码代理:将 Claude Code 与常规 ID 和令牌连接,将 Cursor 与自动化 Webhook URL 连接,或将 Devin 与 API 令牌和组织 ID 连接。
  • 通用 Webhooks:将问题上下文发送给您自己的代理或 HTTPS 端点。
  • 聊天和事件管理:通过聊天或值班工作流程通知您的团队。

When the automation runs, Issues sends the failure summary and diagnostic context captured with the issue — the exception, error, source-mapped stack trace, leading and trailing logs and traces, Worker version, and the application context you added. For deeper investigation, you can connect the agent separately to Cloudflare MCP that lets the agent query the related logs and traces so that it can propose code and test changes and open a pull request.

当自动化运行时,Issues 会发送故障摘要以及与问题一起捕获的诊断上下文——包括异常、错误、源映射堆栈跟踪、前后日志和追踪、Worker 版本以及您添加的应用程序上下文。为了进行更深入调查,您可以单独将代理连接到 Cloudflare MCP,使代理能够查询相关日志和追踪,从而提出代码更改建议、测试更改并打开拉取请求。

You stay in control of what reaches production: review the pull request, deploy the fix, and mark the issue resolved.

您始终掌控发布到生产环境的内容:审查拉取请求,部署修复程序,并将问题标记为已解决。

How Issues uncovered and resolved two Workflows bugs in one day

Issues 如何在一天内发现并解决两个 Workflows 漏洞

Cloudflare Workflows, a primitive that powers long-running, multi-step applications, is built entirely on the Workers platform.

Cloudflare Workflows 是一个支持长期运行、多步骤应用程序的原语,完全构建在 Workers 平台之上。

Behind the scenes, its services keep track of steps, retries, and saved state. This makes Workflows a useful place to test Issues on our own production systems. Within a day of turning it on, the team found two unusual problems hidden inside a large volume of traffic.

在幕后,其服务会跟踪步骤、重试和保存的状态。这使得 Workflows 成为在我们自己的生产系统上测试 Issues 的理想场所。在开启该功能的一天内,团队就在大量流量中发现了一个隐藏的异常情况。

  • A migration stuck in a retry loop: A Workflows control plane migration repeatedly hit a SQLite foreign key error when attempting to apply migrations in an edge case. Issues allowed the Workflows team to identify the problem and fix it.
  • A deletion process that never completed: Workflows discovered that during deletion of Workflow instances, there was an edge case where they could exceed a Workers subrequest limit and not finish the deletion. Issues helped the Workflows team identify the issue and do a fix.
  • 陷入重试循环的迁移:Workflows 控制平面迁移在尝试应用迁移的边缘情况下反复遇到 SQLite 外键错误。Issues 帮助 Workflows 团队识别了该问题并进行了修复。
  • 一个从未完成的删除流程:Workflows 发现,在删除 Workflow 实例期间,存在一种边缘情况,即它们可能超出 Workers 子请求限制而无法完成删除。Issues 帮助 Workflows 团队识别了该问题并进行了修复。

Instead of leaving the team to connect thousands of separate pieces of telemetry and user reports, their automation setup sent these issues directly to Cloudflare OS, which followed the errors into the Workflows code and proposed a fix for both issues.

与其让团队去连接成千上万条分散的遥测数据和用户报告,他们的自动化设置会将这些问题直接发送到 Cloudflare OS,后者会追踪这些错误进入 Workflows 代码,并为这两个问题提出修复方案。

Get started

开始使用

Ready to see what Issues finds in your app? To get started:

准备好查看 Issues 在你的应用中发现了什么吗?要开始使用:

  • Set observability.issues.enabled to true in your wrangler.jsonc file
  • Set up your first automation in the Cloudflare dashboard to send issues to your destination of choice whether that’s an agent, a webhook, incident management tool or chat platform.
  • 在 wrangler.jsonc 文件中将 observability.issues.enabled 设置为 true
  • 在 Cloudflare 仪表板中设置你的第一个自动化,将问题发送到你选择的目的地,无论是智能体、Webhook、事件管理工具还是聊天平台。

If your agent is handling setup, it can also use the new cf CLI to inspect issues and create automations. Check out our documentation to learn more!

如果你的智能体负责处理设置,它还可以使用新的 cf CLI 来检查问题并创建自动化。查看我们的文档以了解更多!

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

关联信息,但可能不是同一事件