![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
也許您需要在提供雲資源,將機器學習模型推廣到生產或收取客戶的信用卡之前需要批准。
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 12:25:13
- 謠言已經在加密貨幣領域迅速傳播,聲稱由唐納德·特朗普(Donald Trump)支持的社交媒體平台Truth Social正準備推出模因硬幣。
-
-
- Web3 AI:為什麼這款$ 0.000331令牌可能是購買的最佳新加密貨幣
- 2025-05-13 12:20:13
- Web3 AI迅速成為加密型領域中最有前途的AI驅動平台之一,並且以不同的方式進行。
-
-
- XRP收回其作為第三大數字資產的地位
- 2025-05-13 12:15:13
- 在數字貨幣動蕩的舞蹈中,XRP以驚人的上升為加密世界充滿了電氣
-
- popcat展示了聰明的錢如何在牛市上購買蘸醬
- 2025-05-13 12:15:13
- 根據分析師Altcoin Sherpa的說法,在強大的牛市中等待教科書50%的貿易商可能缺少這艘船。
-
-
-