Skip to content

Called by an automation

Starts when another automation runs this one, and returns values to it when the run ends.

@lainstack/automation/called-trigger · Triggers

Key @lainstack/automation/called-trigger (“Called by an automation”). Makes this automation callable. It is started only by a @lainstack/automation/run block in another automation of the same workspace. It has no URL, schedule or form. Choose it for a procedure that several automations reuse.

References use the type key @lainstack/automation/called-trigger as the source blockId, never the block instance id.

The contract is declared on the trigger:

  • inputValueSchema: the inputs a caller must give. They appear as payload.data.<input>.
  • outputValueSchema and return: the fields handed back. Map each return entry to a block that runs after the trigger.
  • returnAttachments: files handed back.

Other payload leaves: payload.attachments (copies of the caller’s files), payload.system.callerRunId, payload.system.callerAutomationId, payload.system.receivedAt.

Traps:

  • A required return field that no run branch resolves fails the call (return_unresolved). Make a field optional if some branches skip it.
  • Callers keep a snapshot of the contract. A breaking change (removed or retyped output, new required input) fails their next call (callee_contract_changed) until they refresh.
  • The automation must be published to be callable. automation.callable.list lists callable automations with their contracts.
  • Calls cannot loop, nest deeper than 3 levels, or exceed 100 per run.
  • A test run of a caller needs a pinned sample on the @lainstack/automation/run block. Test-run the called automation itself with sample inputs.
Setting Key Type Details
Inputs (required) inputValueSchema Value The values a calling automation must provide.
Returns return Value The values handed back to the calling automation, taken from blocks that run after this trigger.
Returned files returnAttachments Value Files handed back to the calling automation, from blocks that run after this trigger.
Output Path Type
Attachments payload.attachments Value
Calling run ID payload.system.callerRunId Text
Calling automation ID payload.system.callerAutomationId Text
Received At payload.system.receivedAt Text