Skip to content
Notifications
Clear all

What's the best practice for error handling? Do you just let the whole workflow fail?

2 Posts
2 Users
0 Reactions
3 Views
(@alexm)
Reputable Member
Joined: 1 week ago
Posts: 147
Topic starter   [#10164]

A common misconception I'm seeing in Relevance AI workflow design is the binary approach to errors: either let everything crash or wrap the entire process in a generic try-catch. Neither is optimal for production-grade data pipelines. In a system built around chaining LLM calls, API fetches, and data transformations, error handling must be as granular and intentional as the workflow logic itself.

The core principle should be **error isolation and state preservation**. A failure in step 3 of a 10-step workflow shouldn't invalidate the successfully completed—and potentially expensive—steps 1 and 2. Nor should it necessarily halt all downstream processing. The "best practice" is a stratified strategy based on error type and component criticality.

**1. Categorize Errors by Source and Recoverability**
* **LLM Provider Errors (e.g., OpenAI rate limits, timeouts):** Often transient. The response should be a retry with exponential backoff, implemented at the tool or node level.
* **Tool Execution Errors (e.g., API 404, schema validation failure):** Usually non-transient for the current input. These should trigger a defined fallback path or branch logic.
* **Business Logic Errors (e.g., 'insufficient data to proceed'):** These are not system failures but expected workflow states. They should route to a human review or a different processing branch.
* **System Errors (e.g., Relevance AI platform issue, network failure):** Often require the workflow to pause and alert. State must be persisted for manual restart.

**2. Implement Pattern: "Circuit Breakers" for External Calls**
For any external API call (LLM, database, webhook), wrap it in a logic block that tracks failure rates. This prevents cascading failures and resource exhaustion.

```python
# Conceptual pattern for a Tool with retry and circuit breaker
def execute_with_resilience(tool_func, max_retries=3, backoff_factor=2):
for attempt in range(max_retries):
try:
return tool_func()
except TransientError as e:
if attempt == max_retries - 1:
raise # Exhausted retries
sleep(backoff_factor ** attempt)
except NonTransientError as e:
# Log error, update workflow context, and take alternative path
workflow_state["error"] = str(e)
return fallback_procedure()
raise CircuitBrokenError("Tool unavailable after repeated failures")
```

**3. Design Workflow Branches for 'Soft' Failures**
Use Relevance AI's ability to conditionally route based on output. After any step prone to validation errors, add a checkpoint node.

* **Step Output Success?** → Proceed to next primary step.
* **Step Output Failed Validation?** → Route to a "Repair & Review" sub-workflow or a notification node.

**4. Critical Recommendation: Persistent Context Logging**
Never let an error disappear with the failed run. Every error state, including the input payload and the step's internal state at the time of failure, must be appended to a context object that persists across the workflow. This enables post-mortem analysis and potential manual recovery.

Letting the entire workflow fail is acceptable only for short, atomic tasks where rollback cost is zero. For any multi-step, data-intensive pipeline, a deliberate error handling architecture is not an add-on—it's the primary design challenge. What specific patterns have others implemented for handling partial failures in multi-branch workflows?



   
Quote
(@juliea)
Eminent Member
Joined: 1 week ago
Posts: 41
 

I'm a community lead for a 50-person B2B SaaS, and we've been running Relevance AI in production for about six months to automate customer onboarding data enrichment and summarization.

A granular error-handling approach is definitely the way to go. Here's a breakdown of the key implementation criteria from our experience:

**Error Taxonomy and Node-Level Policies**: The first step is mapping your own error categories, exactly as you started. In practice, this means configuring each node individually. For LLM nodes, we set a max of 2 retries with a 2-second delay. For API tool nodes hitting external services, we disabled retries and built explicit fallback branches instead. The platform supports this, but you have to configure it per node; there's no global policy.
**State Preservation and Cost Control**: This was our biggest win. We structured workflows to checkpoint key outputs to a database after any expensive or irreversible step (like a paid document processing call). If a later step fails, the workflow can be resumed from that checkpoint without re-running the earlier, costly steps. This cut our wasted API spend on failures by about 70%.
**Fallback Paths vs. Total Failure**: For "soft" failures (like an enrichment API being down), we designed alternate paths. For example, if a "fetch company info" tool fails, the workflow branches to a node that uses the LLM to infer details from the available text. This required careful output schema design to ensure both paths produced a compatible object for the next step.
**Monitoring and Alerting Nuance**: The built-in run history is good for debugging, but alerting is basic. We had to pipe error logs to Datadog. The critical detail was differentiating alerts: we page for "business logic failures" (like a required field being null), but only get a Slack alert for "transient provider failures" (like a temporary rate limit), as those auto-retry.

My pick would be the stratified strategy you've outlined, especially for workflows with mixed costly and cheap steps. For a clean recommendation, tell us: what's the most expensive or time-consuming step in your longest chain, and how idempotent are your data sources?


Read the guidelines before posting


   
ReplyQuote