cd /news/ai-agents/why-working-workflows-still-fail-imp… · home › topics › ai-agents › article
[ARTICLE · art-164384] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=· neutral

Why 'Working' Workflows Still Fail: Implementing Liveness Checks for AI, MCP, and Automation

A developer published an approach to liveness checks for AI, human-in-the-loop (MCP), and automation workflows, arguing that traditional uptime and HTTP 200 health checks miss silent failures in multi-component pipelines. The method monitors model KPIs such as accuracy, F1 and precision/recall against baselines, validates feature-store data freshness and distribution, and tracks inference latency and default-prediction fallbacks to catch drift and degraded outputs.

by read14 min views1 publishedNov 5, 2026

Originally published on tamiz.pro.

In the complex landscape of modern software systems, a workflow can appear to be 'working' at a superficial level while silently failing to achieve its intended purpose. This insidious problem is particularly prevalent in systems integrating Artificial Intelligence (AI), Machine-in-the-Loop/Human-in-the-Loop processes (MCP), and complex automation pipelines. These systems often involve multiple asynchronous components, external dependencies, and non-deterministic elements, making traditional health checks insufficient. This article deep-dives into the critical role of liveness checks, extending beyond basic uptime monitoring, to ensure the actual functional integrity of these sophisticated workflows.

Liveness, in the context of distributed systems, refers to the ability of a component or system to make progress towards its intended goal. While a basic health check might confirm that a service's HTTP endpoint responds with a 200 OK, a liveness check goes deeper. It verifies that the service is not just up, but also functional and effective in performing its core responsibilities. For complex workflows involving AI, human intervention (MCP), or intricate automation, this distinction is paramount. A 'live' workflow ensures that data is flowing correctly, models are making accurate predictions, human approvals are timely, and automated steps are completing successfully and meaningfully.

Consider a system where a backend service is running, its database is accessible, and its APIs return valid responses. By all traditional metrics, it's 'working'. However, if this service is part of a larger workflow – say, one that processes customer orders – and an upstream data source is corrupted, or a downstream payment gateway is silently rejecting transactions without explicit errors, the workflow is failing. The system is consuming resources, reporting 'healthy', but producing incorrect or no useful output. These silent failures are particularly dangerous because they often go unnoticed until a significant business impact has occurred, leading to data inconsistencies, financial losses, or degraded user experience.

AI systems introduce unique challenges to liveness due to their data-driven and often probabilistic nature. Their 'correctness' isn't always binary.

An AI model can be deployed and serving predictions, making its inference endpoint 'live'. However, if the underlying data distribution changes (data drift) or the model's performance degrades over time (model drift), its predictions become less accurate or even detrimental. The service is live, but the AI workflow is failing to deliver value.

Liveness Check Strategy: Monitor key performance indicators (KPIs) of the model in production, such as prediction accuracy, F1 score, or precision/recall, against a baseline. Detect significant deviations. Also, monitor the freshness and statistical properties of input data compared to training data.

Many AI systems rely on a feature store to provide consistent, up-to-date features for training and inference. If the pipelines feeding the feature store fail, or if feature values become stale or corrupted, the AI model will receive incorrect inputs. The feature store service might be 'up', but its data liveness is compromised.

Liveness Check Strategy: Implement checks that periodically retrieve known-good feature sets and validate their values. Monitor the ingestion latency and volume into the feature store. Compare feature distributions in production to expected distributions.

An inference service might be up and responding, but if its latency spikes beyond acceptable thresholds or it starts returning generic/default predictions due to an internal issue (e.g., GPU memory exhaustion, silent dependency failure), the AI workflow is effectively broken.

Liveness Check Strategy: Beyond simple HTTP 200 checks, send synthetic requests with known inputs and assert that the predictions returned are within expected bounds and within acceptable latency. Monitor resource utilization (CPU, GPU, memory) of the inference service.

Many advanced AI systems incorporate feedback loops where model predictions influence real-world outcomes, and those outcomes are then used to retrain or fine-tune the model. If this feedback loop breaks – perhaps data isn't being logged, or the retraining pipeline fails silently – the model won't adapt, leading to eventual performance degradation.

Liveness Check Strategy: Monitor the volume and quality of feedback data being collected. Track the successful completion and artifact generation of retraining jobs. Ensure the updated models are being deployed as expected.

Workflows involving human decision-making or manual verification steps introduce unique liveness concerns related to human factors, tooling, and communication.

An MCP system might be perfectly functional from a technical standpoint – the UI is , the backend is responsive. However, if human operators are overwhelmed, absent, or simply taking too long to review and approve tasks, the workflow grinds to a halt. The system is 'live' but not 'making progress'.

Liveness Check Strategy: Monitor the average time taken for human approval steps. Set thresholds for backlog size in human queues. Alert if critical tasks are pending for an unusually long duration.

In some MCP scenarios, humans might override AI recommendations. If these overrides consistently diverge from the AI's intended behavior without explanation, it could indicate a problem with the AI model, the human understanding of the task, or the instructions provided. The system is processing, but the quality of the human-machine collaboration is failing.

Liveness Check Strategy: Track the rate of human overrides compared to AI recommendations. Analyze the patterns of divergence. Flag scenarios where human decisions consistently lead to worse outcomes than AI predictions (if measurable).

Humans often interact with MCP workflows through specific tools (e.g., custom dashboards, annotation tools). If these tools have subtle bugs, poor UX, or fail to integrate correctly with the backend, humans might be unable to perform their tasks effectively. The backend might be 'live', but the human interface is deadlocked.

Liveness Check Strategy: Implement synthetic user journeys that simulate human interaction with the tools and verify expected outcomes. Monitor API calls made by the human-facing tools for errors or unusual latency.

Even purely automated workflows, without AI or human elements, can suffer from silent failures due to complex dependencies and execution environments.

Most modern automation relies on external APIs (e.g., payment gateways, cloud provider APIs, third-party services). An automation script might successfully call an API, but if the API returns a malformed response, a subtle error code that's not explicitly handled, or experiences intermittent timeouts, the automation can proceed on a faulty path or stall indefinitely without crashing.

Liveness Check Strategy: Implement synthetic API calls to critical external dependencies and validate the content and structure of their responses, not just the HTTP status code. Monitor the latency and error rates of these external calls.

Automation pipelines often compete for shared resources (database connections, message queue capacity, file system locks). A pipeline might not explicitly fail, but if it's waiting indefinitely for a lock that's never released or for resources that are exhausted, it's effectively deadlocked. The process is 'running', but not 'progressing'.

Liveness Check Strategy: Monitor resource utilization (CPU, memory, I/O, network) for automation agents. Implement explicit timeouts for operations that acquire locks or wait for resources. Monitor queue depths and consumer lag for message queues.

Automation workflows often include retry mechanisms for transient failures. While beneficial, poorly designed retries or non-idempotent operations can lead to unintended side effects (e.g., duplicate resource creation, multiple billing charges). The workflow might complete eventually, but with incorrect state.

Liveness Check Strategy: Design workflows to be idempotent where possible. Monitor for patterns of excessive retries or failures after retries. Implement end-to-end checks that verify the final state of the system after a workflow run, especially after retries.

Moving beyond basic health checks requires a deliberate strategy to define and implement checks that truly reflect the functional liveness of a workflow.

It's crucial to distinguish between readiness and liveness. A readiness check (e.g., Kubernetes readinessProbe) determines if a service is ready to accept traffic. It might check database connectivity or external service availability. A liveness check (e.g., Kubernetes livenessProbe) determines if a service is still alive and capable of making progress. If a liveness check fails, the container is typically restarted. For complex workflows, we need to extend this concept to the entire chain of operations.

One of the most effective liveness checks is to perform synthetic transactions. These are automated tests that simulate a user or system interaction spanning the entire workflow. For example, in an e-commerce system:

Each step's success, latency, and correctness (e.g., correct product price, appropriate AI recommendation) are monitored. Any failure along this chain indicates a workflow liveness issue.

For data-intensive workflows, especially those involving AI, monitoring the integrity and freshness of data is a liveness check in itself. This includes:

Sometimes, a workflow executes without technical errors but produces outcomes that violate business rules. For example, an automated pricing engine might generate prices below cost due to a subtle bug. A liveness check should include validation against core business logic.

Example: After an AI-driven pricing workflow, run a check that verifies final_price >= cost_of_goods_sold * (1 + minimum_profit_margin).

Effective liveness checks are useless without robust observability and alerting. This involves:

Let's illustrate with concrete examples for different workflow types.

Consider an AI service that provides personalized recommendations.

Problem: The service is up, but the recommendations are static or completely irrelevant due to a data pipeline failure upstream, or the model serving infrastructure is silently returning default values.

Liveness Check:

recommendation_liveness_success_total, recommendation_liveness_latency_seconds). If validation fails, send an alert to PagerDuty/Slack.

import requests
import os
import time

RECOMMENDATION_SERVICE_URL = os.getenv("RECOMMENDATION_SERVICE_URL", "http://localhost:8000/recommend")

TEST_CASES = [
    {
        "user_id": "test_user_123",
        "item_id": "product_A",
        "expected_min_recs": 5,
        "expected_pattern_match": ["product_B", "product_C"], # At least one of these should appear
    },
    {
        "user_id": "test_user_456",
        "item_id": "product_D",
        "expected_min_recs": 3,
        "expected_pattern_match": ["product_E"], # Must contain this specific recommendation
    }
]

def run_liveness_check():
    print(f"Running recommendation service liveness check against {RECOMMENDATION_SERVICE_URL}")
    all_checks_passed = True

    for i, test_case in enumerate(TEST_CASES):
        user_id = test_case["user_id"]
        item_id = test_case["item_id"]
        expected_min_recs = test_case["expected_min_recs"]
        expected_pattern_match = test_case.get("expected_pattern_match", [])

        start_time = time.monotonic()
        try:
            response = requests.post(
                RECOMMENDATION_SERVICE_URL,
                json={"user_id": user_id, "item_id": item_id},
                timeout=5
            )
            response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx)

            latency = time.monotonic() - start_time
            print(f"Test Case {i+1} ({user_id}/{item_id}): Latency = {latency:.2f}s")

            recommendations = response.json().get("recommendations", [])

            if len(recommendations) < expected_min_recs:
                print(f"FAIL: Too few recommendations for {user_id}/{item_id}. Got {len(recommendations)}, expected >= {expected_min_recs}")
                all_checks_passed = False
                continue

            matched_patterns = [rec for rec in recommendations if rec in expected_pattern_match]
            if not matched_patterns:
                print(f"FAIL: No expected pattern recommendations found for {user_id}/{item_id}. Expected one of {expected_pattern_match}, got {recommendations}")
                all_checks_passed = False
                continue

            print(f"SUCCESS: Test Case {i+1} for {user_id}/{item_id} passed.")

        except requests.exceptions.RequestException as e:
            print(f"FAIL: Request to {RECOMMENDATION_SERVICE_URL} failed for {user_id}/{item_id}: {e}")
            all_checks_passed = False
        except Exception as e:
            print(f"FAIL: An unexpected error occurred for {user_id}/{item_id}: {e}")
            all_checks_passed = False

    if all_checks_passed:
        print("Overall Liveness Check: PASSED")
    else:
        print("Overall Liveness Check: FAILED")

if __name__ == "__main__":
    run_liveness_check()

Imagine a financial transaction approval system where high-value transactions require human review.

Problem: The human approvers' queue is backed up, or their UI is subtly broken, preventing them from approving transactions, leading to delays and customer dissatisfaction.

import requests
import os
import time

TRANSACTION_API_URL = os.getenv("TRANSACTION_API_URL", "http://localhost:8001/transactions")
APPROVAL_QUEUE_API_URL = os.getenv("APPROVAL_QUEUE_API_URL", "http://localhost:8002/queue")
APPROVER_API_URL = os.getenv("APPROVER_API_URL", "http://localhost:8003/approve")

TEST_AMOUNT = 10000.00 # An amount that triggers human review
EXPECTED_APPROVAL_TIME_SECONDS = 60 # Max time for human approval simulation

def run_mcp_liveness_check():
    print("Running MCP approval flow liveness check...")
    transaction_id = None
    all_checks_passed = True

    try:
        print("1. Creating test transaction...")
        response = requests.post(
            TRANSACTION_API_URL,
            json={
                "user_id": "mcp_test_user",
                "amount": TEST_AMOUNT,
                "currency": "USD",
                "description": "Liveness check transaction"
            },
            timeout=5
        )
        response.raise_for_status()
        transaction_id = response.json().get("transaction_id")
        if not transaction_id:
            raise ValueError("Could not get transaction_id from response")
        print(f"   Created transaction: {transaction_id}")

        print(f"2. Checking for transaction {transaction_id} in approval queue...")
        queue_found = False
        for _ in range(5): # Retry a few times for async processing
            queue_response = requests.get(APPROVAL_QUEUE_API_URL, timeout=5)
            queue_response.raise_for_status()
            pending_transactions = queue_response.json().get("pending", [])
            if any(tx.get("id") == transaction_id for tx in pending_transactions):
                queue_found = True
                break
            time.sleep(1)

        if not queue_found:
            print(f"FAIL: Transaction {transaction_id} not found in approval queue.")
            all_checks_passed = False
            return
        print(f"   Transaction {transaction_id} found in queue.")

        print(f"3. Simulating approval for transaction {transaction_id}...")
        approval_start_time = time.monotonic()
        approval_done = False
        try:
            approve_response = requests.post(
                APPROVER_API_URL,
                json={
                    "transaction_id": transaction_id,
                    "approver_id": "liveness_bot",
                    "action": "approve"
                },
                timeout=EXPECTED_APPROVAL_TIME_SECONDS # Set a long timeout for human simulation
            )
            approve_response.raise_for_status()
            approval_done = True
            print(f"   Transaction {transaction_id} approval simulated.")
        except requests.exceptions.Timeout:
            print(f"FAIL: Approval simulation timed out for {transaction_id} after {EXPECTED_APPROVAL_TIME_SECONDS}s.")
            all_checks_passed = False
            return

        print(f"4. Verifying final status of transaction {transaction_id}...")
        status_verified = False
        for _ in range(10): # Check for status update for a bit
            final_status_response = requests.get(f"{TRANSACTION_API_URL}/{transaction_id}", timeout=5)
            final_status_response.raise_for_status()
            current_status = final_status_response.json().get("status")
            if current_status == "approved":
                status_verified = True
                break
            time.sleep(2)

        if not status_verified:
            print(f"FAIL: Transaction {transaction_id} did not reach 'approved' status. Current: {current_status}")
            all_checks_passed = False
            return
        print(f"   Transaction {transaction_id} successfully approved.")

    except requests.exceptions.RequestException as e:
        print(f"FAIL: A request error occurred: {e}")
        all_checks_passed = False
    except Exception as e:
        print(f"FAIL: An unexpected error occurred: {e}")
        all_checks_passed = False
    finally:
        if transaction_id:
            print(f"Cleaning up test transaction {transaction_id}...")
            try:
                requests.delete(f"{TRANSACTION_API_URL}/{transaction_id}", timeout=5)
                print("   Cleanup successful.")
            except requests.exceptions.RequestException as e:
                print(f"   WARNING: Failed to clean up transaction {transaction_id}: {e}")

    if all_checks_passed:
        print("Overall MCP Approval Liveness Check: PASSED")
    else:
        print("Overall MCP Approval Liveness Check: FAILED")

if __name__ == "__main__":
    run_mcp_liveness_check()

Consider a CI/CD pipeline that deploys a microservice to a Kubernetes cluster.

Problem: The pipeline completes successfully, but the new deployment is actually stuck in a CrashLoopBackOff state, or the service is not reachable due to a misconfigured ingress, or the wrong version was deployed.

/version endpoint (if available) or check image tags in Kubernetes to ensure the correct version was deployed.

#!/bin/bash


SERVICE_NAME="my-microservice"
NAMESPACE="production"
EXPECTED_VERSION="v1.2.3" # This would typically be passed as an argument from CI/CD
SERVICE_URL="https://api.example.com/my-microservice/health"

echo "Running post-deployment liveness checks for ${SERVICE_NAME} in ${NAMESPACE}"

echo "Checking Kubernetes deployment status..."
if ! kubectl rollout status deployment/${SERVICE_NAME} -n ${NAMESPACE} --timeout=300s;
then
  echo "ERROR: Deployment ${SERVICE_NAME} failed to roll out successfully in Kubernetes."
  exit 1
fi
echo "Kubernetes deployment rollout successful."

echo "Verifying deployed version..."
ACTUAL_VERSION=$(curl -s ${SERVICE_URL}/version)
if [[ "$ACTUAL_VERSION" != "$EXPECTED_VERSION" ]]; then
  echo "ERROR: Version mismatch! Expected ${EXPECTED_VERSION}, got ${ACTUAL_VERSION}"
  exit 1
fi
echo "Version ${ACTUAL_VERSION} confirmed."

echo "Checking service reachability and basic health..."
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" ${SERVICE_URL})
if [[ "$RESPONSE_CODE" -ne 200 ]]; then
  echo "ERROR: Service at ${SERVICE_URL} returned HTTP ${RESPONSE_CODE}. Expected 200."
  exit 1
fi
echo "Service is reachable and returned 200 OK."

echo "Running functional smoke test..."
SMOKE_TEST_ENDPOINT="https://api.example.com/my-microservice/items/test-item"
ITEM_DATA=$(curl -s ${SMOKE_TEST_ENDPOINT})
if ! echo "$ITEM_DATA" | grep -q "expected_value"; then
  echo "ERROR: Functional smoke test failed. Expected 'expected_value' in response, got: ${ITEM_DATA}"
  exit 1
fi
echo "Functional smoke test passed."

echo "All post-deployment liveness checks passed for ${SERVICE_NAME}."
exit 0

By embracing a comprehensive approach to liveness monitoring, spanning synthetic transactions, data integrity, and business logic validation, engineering teams can proactively identify and mitigate the silent failures that plague AI, MCP, and complex automation workflows. This ensures not just uptime, but actual, meaningful system progress and reliability.

A: A basic health check (like an HTTP 200 response) confirms a service is running and accessible. A liveness check, as discussed here, goes deeper to verify that the service or workflow is actively performing its intended function correctly and making progress towards its goals, even if it appears 'up' superficially. For example, a database might be accessible (healthy), but if it's full and can't write new data, the write operation workflow is not live.

A: The frequency depends on the criticality and acceptable latency of detecting failure for a given workflow. For high-priority, real-time systems, checks might run every minute. For less critical batch processes, hourly or even daily might suffice. Synthetic transaction checks often run every 5-15 minutes. The trade-off is between detection speed, resource consumption, and potential false positives.

A: Yes, if not carefully designed. Overly sensitive thresholds, flaky external dependencies, or checks that don't account for transient issues can lead to false positives. To mitigate this, use realistic thresholds, incorporate retry logic within the check itself, and ensure your validation logic is robust. Continuously refine checks based on production observations and alert feedback to reduce noise and ensure alerts are truly actionable. Leveraging historical data to establish dynamic baselines can also help reduce false positives compared to static thresholds.

── more in #ai-agents 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/why-working-workflow…] indexed:0 read:14min 2026-11-05 · —