All docs
Docs
Core Concepts

External actions and outbox

Record Stripe, Zendesk, email, Slack, or other external side-effect intents durably before a trusted worker executes them.

Overview

Synapsor never pretends an outside API call can be rolled back by a database transaction. External actions use a transactional outbox pattern: the database validates and records the side-effect intent, then a trusted worker claims it, calls the provider with an idempotency key, and confirms the result back to Synapsor.

Use this for actions such as issuing a refund, sending an email, updating a ticket, changing a CRM deal, or posting a message. The app or worker performs the network call; Synapsor records the durable intent, idempotency key, queue state, run graph link, and audit trail.

The action contract can declare caller-supplied ARG values and HIDDEN session bindings. Hidden values such as tenant_id, principal, and current_customer_id are copied from trusted session context; caller JSON cannot override them.

Approval-required actions move from proposed to queued only after APPROVE EXTERNAL ACTION or the approve external-action API records the reviewer note. Retrying the same approval is idempotent once the action is already queued.

External action events can be part of an agent workflow run. EXPLAIN AGENT RUN shows the step, while synapsor_external_action_events shows the worker-facing queue/status details. A worker must claim an action before confirmation, and the same worker principal must confirm that active, unexpired claim; duplicate terminal confirmations are idempotent only when they match the stored terminal state.

Transactional outbox boundary

The DB commits the intent. The worker performs the side effect and confirms the provider result.

Synapsor
  • Validates action contract
  • Computes/stores idempotency key
  • Queues durable action intent
  • Links result to run graph
Trusted worker
  • Claims one queued action
  • Calls Stripe/Zendesk/etc.
  • Uses the Synapsor idempotency key
  • Confirms success or failure

Developer notes

  • Do not call external providers from the DB engine. Use a trusted worker that claims outbox tasks.
  • Declare required ARG fields and HIDDEN session bindings so worker payloads have a reviewed shape.
  • Use idempotency keys for provider calls so worker retries do not duplicate side effects.
  • Do not pass hidden fields in caller JSON. Synapsor rejects attempts to override hidden session bindings.
  • Confirm only after an active claim. Synapsor rejects premature confirmations, confirmations after claim expiry, confirmations from another worker principal, and conflicting terminal retries.
  • Record both success and failure confirmations so EXPLAIN AGENT RUN and system views show the final outcome.
  • Use approval-required action contracts for side effects that need human review before queueing.