Overview
Master Compozy's event-driven communication system for building reactive, scalable workflows with signal-based coordination patterns
Overview
Signals are lightweight messages that enable workflows to communicate asynchronously. Unlike direct task dependencies, signals provide a decoupled coordination mechanism where publishers and subscribers operate independently.
Event-Driven Architecture
Loose Coupling
Asynchronous Communication
Data Propagation
Signal Components
Signal Tasks
Wait Tasks
Event API
How Signals Work
Signal Flow Architecture
Signal Publication
Signals are published via signal tasks, Event API, or external systems with structured payloads
Temporal Routing
Temporal signal dispatcher routes signals through a dedicated Dispatcher Workflow that manages signal distribution to matching wait tasks and signal triggers based on signal IDs
Workflow Orchestration
Target workflows continue execution or start automatically with signal data accessible via template variables
Response & Cascading
Processing results can trigger additional signals, creating sophisticated event chains and coordination patterns
Basic Usage
# Send a signal when task completes
- id: notify-completion
type: signal
signal:
id: "order-processed"
payload:
order_id: "{{ .workflow.input.order_id }}"
status: "{{ .task.output.status }}"
total: "{{ .task.output.total }}"
Learn more in Signal Tasks.
Signal Architecture Patterns
Core Usage Scenarios
Human-in-the-Loop
Service Orchestration
Event-Driven Pipelines
External Integrations
- id: request-approval
type: signal
signal:
id: "approval-request"
payload:
request_id: "{{ .workflow.id }}"
type: "budget-increase"
amount: "{{ .workflow.input.amount }}"
requestor: "{{ .workflow.input.user }}"
- id: await-approval
type: wait
wait_for: "manager-approval"
on_timeout: escalate-request
Advanced Features
Signal Processing
Wait tasks can process signals using optional processors:
- id: priority-handler
type: wait
wait_for: "task-update"
processor:
type: basic
tool:
id: task-processor
with:
task_data: "{{ .signal.payload }}"
Signal Timeouts
Handle scenarios where signals might not arrive:
- id: wait-with-fallback
type: wait
wait_for: "external-webhook"
on_timeout: use-default-values
Multi-Signal Coordination
Use composite tasks to coordinate multiple signals:
- id: wait-all-approvals
type: composite
mode: parallel
wait_all: true
tasks:
- type: wait
wait_for: "manager-approval"
on_timeout: handle-manager-timeout
- type: wait
wait_for: "compliance-approval"
on_timeout: handle-compliance-timeout
- type: wait
wait_for: "finance-approval"
on_timeout: handle-finance-timeout
Best Practices & Guidelines
Semantic Naming
Timeout Strategy
Payload Optimization
Next Steps
Integration Patterns
MCP (Model Context Protocol) integration patterns provide proven approaches for connecting external tools and services with Compozy agents and workflows. This guide covers common patterns, best practices, and implementation strategies for building robust MCP integrations using Compozy's simple HTTP-based architecture.
Signal Tasks
Master event emission and workflow coordination with signal tasks. Learn how to send structured messages between workflows, implement event-driven architectures, and build decoupled communication patterns.