市值: $3.3104T -0.610%
成交额(24h): $180.7418B 40.450%
  • 市值: $3.3104T -0.610%
  • 成交额(24h): $180.7418B 40.450%
  • 恐惧与贪婪指数:
  • 市值: $3.3104T -0.610%
加密货币
话题
百科
资讯
加密话题
视频
热门新闻
加密货币
话题
百科
资讯
加密话题
视频
bitcoin
bitcoin

$101937.247657 USD

-1.92%

ethereum
ethereum

$2440.088811 USD

-3.10%

tether
tether

$1.000193 USD

0.01%

xrp
xrp

$2.459614 USD

3.05%

bnb
bnb

$645.663399 USD

-1.18%

solana
solana

$169.340061 USD

-2.43%

usd-coin
usd-coin

$1.000185 USD

0.04%

dogecoin
dogecoin

$0.221860 USD

-5.74%

cardano
cardano

$0.788860 USD

-2.57%

tron
tron

$0.263711 USD

-1.20%

sui
sui

$3.873057 USD

-2.82%

chainlink
chainlink

$16.315579 USD

-4.09%

avalanche
avalanche

$23.848565 USD

-4.36%

stellar
stellar

$0.301245 USD

-3.23%

shiba-inu
shiba-inu

$0.000015 USD

-6.14%

加密货币新闻

您是否曾经想暂停自动工作流程以等待人类的决定?

2025/05/13 07:17

也许您需要在提供云资源,将机器学习模型推广到生产或收取客户的信用卡之前需要批准。

Have you ever wanted to pause an automated workflow to wait for a human decision? Maybe you need approval before provisioning cloud resources, promoting a machine learning model to production, or charging a customer’s credit card.

您是否曾经想暂停自动工作流程以等待人类的决定?也许您需要在提供云资源,将机器学习模型推广到生产或收取客户的信用卡之前需要批准。

In many data science and machine learning workflows, automation gets you 90% of the way — but that critical last step often needs human judgment. Especially in production environments, model retraining, anomaly overrides, or large data movements require careful human review to avoid expensive mistakes.

在许多数据科学和机器学习工作流程中,自动化为您带来了90%的途径 - 但是关键的最后一步通常需要人类的判断。尤其是在生产环境中,模型再培训,异常覆盖或大型数据移动需要仔细的人类审查,以避免昂贵的错误。

In my case, I needed to manually review situations where my system flagged more than 6% of customer data for anomalies — often due to accidental pushes by customers. Before I implemented a proper workflow, this was handled informally: developers would directly update production databases (!) — risky, error-prone, and unscalable.

就我而言,我需要手动查看我的系统标记超过6%的客户数据异常数据的情况 - 通常是由于客户意外推动。在我实施适当的工作流程之前,这是非正式处理的:开发人员将直接更新生产数据库(!) - 风险,容易出错且不计。

To solve this, I built a scalable manual approval system using AWS Step Functions, Slack, Lambda, and SNS — a cloud-native, low-cost architecture that cleanly paused workflows for human approvals without spinning up idle compute.

为了解决这个问题,我使用AWS步骤功能,Slack,Lambda和SNS建立了一个可扩展的手动批准系统,这是一种云本地,低成本的体系结构,可干净地暂停人工批准的工作流,而无需旋转闲置计算。

In this post, I’ll walk you through the full design, the AWS resources involved, and how you can apply it to your critical workflows.

在这篇文章中,我将带您完成完整的设计,所涉及的AWS资源以及如何将其应用于关键工作流程。

Let’s get into it 👇

让我们来👇

The Solution

解决方案

My application is deployed in the AWS ecosystem, so we’ll use Aws Step Functions to build a state machine that:

我的应用程序已部署在AWS生态系统中,因此我们将使用AWS步骤函数来构建一台状态计算机:

Here is a youtube video showing the demo and actual application in action:

这是一个YouTube视频,显示了演示和实际应用程序:

I have also hosted the live demo app here →👉 https://v0-manual-review-app-fwtjca.vercel.app

我还在这里托管了实时演示应用→👉https://v0-manual-review-app-fwtjca.vercel.app

All code is hosted here with the right set of IAM permissions.

所有代码均在此处托管,其中包含正确的IAM权限。

Step-by-Step Implementation

分步实现

The flow above generates a dataset, uploads it to AWS S3 and if a review is required, then invokes the Manual Review lambda. On the manual review step, we’ll use a Task lambda with an invoke on WaitForTaskToken, which pauses execution until resumed. The lambda reads the token this way:

上面的流量生成数据集,将其上传到AWS S3,如果需要进行审查,请调用手动评论lambda。在手动审核步骤中,我们将使用一个任务lambda和WaitfortaskToken的Invoke,该任务停止执行直至恢复。 Lambda以这种方式读取令牌:

This Lambda sends a Slack message that includes the task token so the function knows what execution to resume.

此lambda发送了一个休闲消息,其中包含任务令牌,因此该函数知道要恢复执行什么。

2. Before the we send out the slack notification, we need to

2。在我们发送松弛通知之前,我们需要

I followed the youtube video here for my setup.

我在此处遵循YouTube视频进行设置。

3. Once the above is setup, setup the variables into the web-hook step of the slack workflow:

3。一旦设置了上述,将变量设置为Slack Workflow的Web-Hook步骤:

And use the variables with a helpful note in the following step:

并在以下步骤中使用有用的说明的变量:

The final workflow will look like this:

最终的工作流程看起来像这样:

4. Send a Slack Notification published to an SNS topic (you can alternately use slack-sdk as well) with job parameters. Here is what the message will look like:

4.将发布的Slack通知发送到SNS主题(您也可以使用Slack-SDK)与作业参数一起发送。这是消息的样子:

This Lambda sends a Slack message that includes the task token so the function knows what execution to resume.

此lambda发送了一个休闲消息,其中包含任务令牌,因此该函数知道要恢复执行什么。

5. Once a review notification is received in slack, the user can approve or reject it. The step function goes into a wait state until it receives a user response; however the task part is set to expire in 24 hours, so inactivity will timeout the step function.

5。一旦在Slack收到审核通知后,用户就可以批准或拒绝。步骤功能进入等待状态,直到它收到用户响应为止;但是,任务零件设置为24小时内到期,因此不活动将超时该步骤功能。

Based on whether the user approves or rejects the review request, the rawPath gets set and can be parsed here: code

根据用户是批准还是拒绝审核请求,将设置RAWPATH并可以在此处解析:代码

The receiving API Gateway + Lambda combo:

接收API网关 + lambda组合:

Example:

例子:

Note: Lambda configured with WaitForTaskToken must wait. If you don’t send the token, your workflow just stalls.

注意:用WaitfortaskToken配置的Lambda必须等待。如果您不发送令牌,那么您的工作流程只是失速。

Bonus: If you need email or SMS alerts, use SNS to notify a broader group.Just sns.publish() from within your Lambda or Step Function.

奖励:如果您需要电子邮件或SMS警报,请使用SNS通知更广泛的组。just sns.publish()从您的lambda或step函数中。

Testing

测试

Once the manual approval system was wired up, it was time to kick the tires. Here’s how I tested it:

手动批准系统连接起来后,就该踢轮胎了。这是我测试的方式:

I tested all major paths:

我测试了所有主要途径:

Behind the scenes, I also verified that :

在幕后,我还验证了:

I highly recommend testing not just happy paths, but also “what if nobody clicks?” and “what if Slack glitches?” — catching these edge cases early saved me headaches later.

我强烈建议您不仅要测试快乐的道路,还建议“如果没人点击怎么办?”和“如果松弛的故障怎么办?” - 尽早抓住这些边缘案件使我头痛。

Lessons Learned

经验教训

Wrapping Up

总结

Adding human-in-the-loop logic doesn’t have to mean duct tape and cron jobs. With Step Functions + Slack, you can build reviewable, traceable, and production-safe approval flows.

添加人类的逻辑并不一定意味着胶带和Cron工作。使用步骤功能 + Slack,您可以构建可审查,可追溯和生产安全的批准流。

If this helped, or you’re trying something similar, drop a note in the comments! Let’s build better workflows.

如果这有所帮助,或者您正在尝试类似的事情,请在评论中放下注释!让我们构建更好的工作流程。

Note: All images in this article were created by the author

注意:本文中的所有图像均由作者创建

免责声明:info@kdj.com

所提供的信息并非交易建议。根据本文提供的信息进行的任何投资,kdj.com不承担任何责任。加密货币具有高波动性,强烈建议您深入研究后,谨慎投资!

如您认为本网站上使用的内容侵犯了您的版权,请立即联系我们(info@kdj.com),我们将及时删除。

2025年05月13日 发表的其他文章