Tasks

Signal Tasks

Understanding signal tasks for inter-workflow communication and event-driven coordination in Compozy workflows

Overview

Signal tasks are the event broadcasters of Compozy's event-driven architecture. They enable workflows to send structured messages that coordinate between processes, trigger asynchronous actions, and implement sophisticated publish-subscribe patterns. When combined with wait tasks, signal tasks create powerful synchronization mechanisms that form the backbone of Compozy's event-driven signal system.

Core Capabilities

Signal tasks provide essential event-driven coordination features:

Event Broadcasting

Send structured signals to notify workflows and trigger downstream processes

Inter-Workflow Communication

Enable decoupled communication between independent workflow processes

Template-Driven Payloads

Dynamic signal IDs and data using Compozy's template engine

Immediate Execution

Fire-and-forget operation that completes immediately after signal dispatch

Task Structure

Signal tasks use a simple yet powerful configuration structure built on Compozy's task configuration system. Every signal task contains two essential components: the signal identification and payload data.

id: signal-task-name
type: signal
signal:
  id: "signal-identifier"
  payload:
    data: "{{ .workflow.input.value }}"
    timestamp: "{{ now }}"
outputs:
  signal_dispatched: "{{ .task.outputs.signal_dispatched }}"
  signal_id: "{{ .task.outputs.signal_id }}"

Task Type

Must be 'signal' to indicate this is a signal broadcasting task

Signal Block

Contains the id (signal identifier) and payload (data to send)

Template Support

All fields support template expressions for dynamic values
See more

Outputs

Standard task outputs plus signal-specific status information

Integration with Wait Tasks

Signal tasks enable robust, event-driven communication between independent workflows. One workflow can notify or trigger actions in another, allowing for decoupled orchestration and real-time coordination across complex business processes. This mechanism is essential for building scalable systems where workflows need to interact, synchronize, or respond to events generated elsewhere in the platform.

Loading diagram...
Workflow A: Order processing
id: complete-order-processing
type: signal
signal:
  id: "order-ready-for-fulfillment"
  payload:
    order_id: "{{ .workflow.input.order_id }}"
    customer_id: "{{ .workflow.input.customer_id }}"
    items: "{{ .task.output.processed_items }}"

    # Fulfillment instructions
    fulfillment_instructions:
      shipping_method: "{{ .workflow.input.shipping_method }}"
      priority: "{{ .workflow.input.priority }}"
      special_instructions: "{{ .workflow.input.special_instructions }}"

    # Order metadata
    order_metadata:
      total_amount: "{{ .task.output.total_amount }}"
      payment_confirmed: "{{ .task.output.payment_confirmed }}"
      processed_at: "{{ now }}"
Workflow B: Fulfillment processing
id: wait-for-order
type: wait
wait_for: "order-ready-for-fulfillment"
condition: 'signal.payload.order_metadata.payment_confirmed == true'
timeout: 3600s  # 1 hour

processor:
  type: basic
  agent:
    id: fulfillment-processor
    instructions: "Process order for fulfillment"
  with:
    order_data: "{{ .signal.payload }}"
    fulfillment_center: "{{ .workflow.input.fulfillment_center }}"

outputs:
  fulfillment_initiated: "{{ .processor.output.initiated }}"
  estimated_shipping: "{{ .processor.output.estimated_shipping }}"

Best Practices

Follow these established patterns to build reliable and maintainable signal-driven workflows. These practices ensure signal tasks integrate effectively with the broader event-driven architecture and support debugging, monitoring, and system reliability.

Descriptive Signal IDs

Use clear, descriptive identifiers that indicate purpose and scope: user-approved-{{id}} rather than signal-{{id}}

Consistent Payload Structure

Maintain consistent payload formats across similar events to simplify wait task processing
See more

Essential Context Only

Include necessary information for receivers without overwhelming payloads with excessive data

Reference Large Data

Use references (URLs, IDs, paths) for large data instead of embedding complete objects in payloads

Version Compatibility

Include version information in payloads to support compatibility across system updates

Debugging Metadata

Add workflow and execution IDs to enable tracing and debugging
See more

Summary

Signal tasks form the foundation of event-driven workflows in Compozy, enabling loose coupling, scalable coordination, and sophisticated inter-workflow communication patterns. Their immediate execution and flexible payload system make them ideal for creating responsive, event-driven applications.

References