Set Output Node

Overview

The Set Output node defines the final output of a workflow. It specifies what data the workflow returns upon completion, making that data available to systems that triggered the workflow or to other workflows that call this one.

When to Use

Use a Set Output node when you need to:

  • Return specific data from the workflow
  • Define the workflow’s result structure
  • Make workflow data available to calling systems
  • Return processed results to another workflow
  • Provide a structured response to workflow triggers
  • Document what the workflow produces

Configuration

Output Fields

Define key-value pairs for the workflow output:

  • Field Name: The name of the output field
  • Field Value: The value, which can be:
    • A literal value (e.g., "success", 123, true)
    • A JSONPath expression (e.g., $.results.nodeId.field)
    • A mix of both for string templates

Add multiple fields to create a structured output object.

How It Works

  1. Collect Data: The Set Output node evaluates all configured fields
  2. Resolve JSONPath: Any JSONPath expressions are resolved to actual values
  3. Build Output: Creates an output object with all fields
  4. Set as Result: This becomes the workflow’s final output
  5. Return to Caller: Output is available to the triggering system

The workflow can have multiple Set Output nodes in different branches - whichever executes will define the final output.

Examples

Example: Simple Success Response

Node ID: setSuccess

Output Fields:

  • status: "success"
  • message: "Order processed successfully"
  • orderId: $.results.createOrder.id

Output:

{
  "status": "success",
  "message": "Order processed successfully",
  "orderId": "ORD-12345"
}

Example: Aggregated Results

Node ID: returnResults

Output Fields:

  • user: $.results.getUser.profile
  • orders: $.results.fetchOrders.items
  • totalSpent: $.results.calculateTotal.amount
  • memberSince: $.results.getUser.createdAt
  • status: "active"

Output:

{
  "user": {
    "id": "user_123",
    "name": "John Doe",
    "email": "john@example.com"
  },
  "orders": [...],
  "totalSpent": 1234.56,
  "memberSince": "2023-01-15",
  "status": "active"
}

Example: Conditional Outputs

Different branches can have different Set Output nodes:

Success Branch:

Set Output: success
- status: "approved"
- transactionId: $.results.processPayment.id
- amount: $.results.calculateTotal.total
- approvedBy: $.results.approval.approverId

Failure Branch:

Set Output: failure
- status: "rejected"
- reason: $.results.validation.errorMessage
- retryAllowed: true

Example: Processed Data Export

Node ID: exportResults

Output Fields:

  • processedCount: $.results.processItems.count
  • successCount: $.results.processItems.successful
  • failedCount: $.results.processItems.failed
  • items: $.results.processItems.results
  • timestamp: $.results.trigger.startTime
  • exportFormat: "json"

Output:

{
  "processedCount": 150,
  "successCount": 145,
  "failedCount": 5,
  "items": [...],
  "timestamp": "2025-12-22T10:00:00Z",
  "exportFormat": "json"
}

Example: Nested Object Output

Node ID: returnProfile

Output Fields:

  • user.name: $.results.getUser.fullName
  • user.email: $.results.getUser.email
  • user.phone: $.results.getUser.phoneNumber
  • subscription.plan: $.results.getSubscription.planName
  • subscription.status: $.results.getSubscription.status
  • subscription.renewsAt: $.results.getSubscription.renewalDate

Output:

{
  "user": {
    "name": "Jane Smith",
    "email": "jane@example.com",
    "phone": "+1234567890"
  },
  "subscription": {
    "plan": "Premium",
    "status": "active",
    "renewsAt": "2026-01-01"
  }
}

Accessing Workflow Output

From Workflow Execution

When executing a workflow manually or via API:

{
  "output": {
    "status": "success",
    "orderId": "ORD-12345",
    "total": 99.99
  }
}

From Execute Workflow Node

When calling this workflow from another workflow:

$.results.executeChildWorkflow.output.status
$.results.executeChildWorkflow.output.orderId
$.results.executeChildWorkflow.output.total

From Workflow Tool (Agent)

When an agent executes the workflow:

The workflow completed with status {{results.executeWorkflow.output.status}}
Order ID: {{results.executeWorkflow.output.orderId}}

Best Practices

  • Clear Structure: Design a clear, predictable output structure
  • Document Fields: Use descriptive field names
  • Consistent Format: Keep output format consistent across similar workflows
  • Include Status: Always include a status field (success/error/partial)
  • Error Information: Include error details in failure scenarios
  • Timestamps: Include timestamps for audit trails
  • IDs and References: Return IDs for created/modified resources
  • Nested Objects: Use nested objects for related data
  • Avoid Sensitive Data: Don’t expose sensitive information unnecessarily

Common Patterns

Status-Based Output

Set Output:
- status: "success"
- data: $.results.processData.output
- metadata:
  - executionTime: $.results.trigger.duration
  - processedAt: $.results.trigger.timestamp

Error Response

Set Output:
- status: "error"
- errorCode: $.results.handleError.code
- errorMessage: $.results.handleError.message
- retryable: true
- requestId: $.trigger.requestId

Paginated Results

Set Output:
- items: $.results.fetchItems.data
- pagination:
  - page: $.trigger.page
  - limit: $.trigger.limit
  - total: $.results.fetchItems.total
  - hasMore: $.results.fetchItems.hasMore

Summary with Details

Set Output:
- summary:
  - totalProcessed: $.results.process.count
  - successful: $.results.process.successCount
  - failed: $.results.process.failureCount
- details: $.results.process.itemDetails
- errors: $.results.process.errors

Multiple Set Output Nodes

A workflow can have multiple Set Output nodes in different branches:

Conditional: checkResult
├─ Success Path
│  └─ Set Output: successOutput
│     - status: "success"
│     - result: $.results.process.data
└─ Failure Path
   └─ Set Output: failureOutput
      - status: "failed"
      - error: $.results.error.message

Only the Set Output node that executes will define the final output.

Limitations

  • One Output: Only one Set Output node’s data becomes the final output
  • No Post-Processing: Cannot modify output after Set Output executes
  • Flat Structure Preference: Deeply nested objects may be harder to work with
  • JSONPath Only: Can only use JSONPath for dynamic values
  • Static Field Names: Field names must be defined at design time

Terminal Node

Set Output is typically a terminal node - it usually doesn’t have an onSuccess path since it defines the end result. However, you can chain additional nodes after it if needed:

Set Output: mainResult
└─ Function: logCompletion
   └─ End

Workflow Without Set Output

If a workflow doesn’t have a Set Output node:

  • The workflow completes without a structured output
  • Internal node results are still available in execution logs
  • Consider always using Set Output for clarity and reusability

Example Workflow Patterns

Data Processing Pipeline

fetchData
└─ validateData
   └─ transformData
      └─ enrichData
         └─ Set Output: finalData
            - processedItems: $.results.transformData.items
            - enrichments: $.results.enrichData.additions
            - quality: $.results.validateData.score

Conditional Response

processRequest
└─ Conditional: checkQuality
   ├─ High Quality → Set Output: highQualityResult
   │  - status: "approved"
   │  - confidence: "high"
   │  - data: $.results.processRequest.output
   └─ Low Quality → Set Output: lowQualityResult
      - status: "review_required"
      - confidence: "low"
      - data: $.results.processRequest.output

Multi-Step Aggregation

Parallel: gatherAllData
├─ Branch 1: fetchUserData
├─ Branch 2: fetchOrderData
└─ Branch 3: fetchAnalytics

└─ Function: mergeResults
   └─ Set Output: completeProfile
      - user: $.results.fetchUserData.profile
      - orders: $.results.fetchOrderData.list
      - analytics: $.results.fetchAnalytics.summary
      - generatedAt: $.results.trigger.timestamp