Skip to main content

Overview

Edges define how execution flows between nodes in your agent graph. Unlike traditional frameworks that hardcode workflows, Aden’s edges are dynamically generated based on your goals.

Edge Types

TypeTriggerUse Case
on_successNode completes successfullyNormal flow progression
on_failureNode throws an errorError handling, retries
conditionalOutput matches a conditionBranching logic

Basic Syntax

{
  "edges": [
    {"from": "node_a", "to": "node_b", "type": "on_success"},
    {"from": "node_a", "to": "error_handler", "type": "on_failure"},
    {"from": "router", "to": "path_a", "when": "category == 'A'"},
    {"from": "router", "to": "path_b", "when": "category == 'B'"}
  ]
}

Success Edges

Execute the next node when the current node completes without errors.
{
  "from": "classify_request",
  "to": "generate_response",
  "type": "on_success"
}

Passing Data

Output from the source node becomes input for the target:

Failure Edges

Execute when a node throws an error or times out.
{
  "from": "api_call",
  "to": "retry_handler",
  "type": "on_failure"
}

Error Context

Failed nodes pass error information:
{
  "error": {
    "type": "TimeoutError",
    "message": "Request timed out after 30s",
    "node_id": "api_call",
    "attempt": 1
  },
  "original_input": {...}
}

Retry Pattern

{
  "nodes": [
    {
      "id": "api_call",
      "type": "function",
      "handler": "tools.external_api"
    },
    {
      "id": "retry_handler",
      "type": "function",
      "handler": "tools.retry_with_backoff",
      "config": {"max_attempts": 3, "backoff": "exponential"}
    }
  ],
  "edges": [
    {"from": "api_call", "to": "next_step", "type": "on_success"},
    {"from": "api_call", "to": "retry_handler", "type": "on_failure"},
    {"from": "retry_handler", "to": "api_call", "type": "on_success"},
    {"from": "retry_handler", "to": "fallback", "type": "on_failure"}
  ]
}

Conditional Edges

Route based on output values using expressions.
{
  "from": "sentiment_analysis",
  "to": "escalate",
  "when": "sentiment == 'negative' && confidence > 0.8"
}

Expression Syntax

OperatorDescriptionExample
==Equalsstatus == 'approved'
NOT_EQUALNot equalstype NOT_EQUAL 'spam'
>, <, >=, <=Comparisonscore >= 0.7
&&Logical ANDtype == 'urgent' && priority > 5
||Logical ORstatus == 'error' OR retries > 3
inContainscategory in ['billing', 'sales']

Accessing Nested Values

{
  "when": "response.metadata.confidence > 0.9"
}

Multiple Outgoing Edges

A node can have multiple outgoing edges:
{
  "edges": [
    {"from": "analyze", "to": "approve", "when": "risk == 'low'"},
    {"from": "analyze", "to": "review", "when": "risk == 'medium'"},
    {"from": "analyze", "to": "reject", "when": "risk == 'high'"},
    {"from": "analyze", "to": "error_handler", "type": "on_failure"}
  ]
}

Default Path

Use a default edge when no conditions match:
{
  "edges": [
    {"from": "router", "to": "path_a", "when": "type == 'A'"},
    {"from": "router", "to": "path_b", "when": "type == 'B'"},
    {"from": "router", "to": "default_handler", "default": true}
  ]
}

Parallel Execution

Execute multiple nodes in parallel by having multiple success edges:
{
  "edges": [
    {"from": "start", "to": "task_a", "type": "on_success", "parallel": true},
    {"from": "start", "to": "task_b", "type": "on_success", "parallel": true},
    {"from": "start", "to": "task_c", "type": "on_success", "parallel": true},
    {"from": ["task_a", "task_b", "task_c"], "to": "aggregate", "type": "on_all_success"}
  ]
}

Join Strategies

StrategyDescription
on_all_successWait for all parallel nodes to succeed
on_any_successContinue when first node succeeds
on_all_completeWait for all to complete (success or failure)

Edge Transformation

Transform data between nodes:
{
  "from": "extract_entities",
  "to": "validate_entities",
  "type": "on_success",
  "transform": {
    "entities": "$.output.entities",
    "source_document": "$.input.document_id"
  }
}

Visualization

Your agent graph can be visualized:

Next Steps