call runs one function or effect and waits for its result. It is the step that runs your
code, reads or writes an outside system, or calls an Effective API operation. To run another
published procedure as a step, use invoke instead. To
build a value from data you already have, without running code, use
value.
Syntax
call id=read-policy
id.
Fields
Names in
output use lowercase letters, digits and underscores, and start with a letter. Each
name can be produced only once in a procedure, and must not reuse an input or output name.
Operands are named, never positional. Secrets and credentials are never operands: an effect reads
them through its declared secret slots.
Example
A pure function cleans up the policy number, then an effect reads the policy from the policy administration system:policy-status.procedure.md
The policy administration host, its path and the
pas-token secret are illustrative. Use your own
system’s API.fetch-policy runs @local.read-policy.
On retry and resume
- Inputs are checked before the code runs. The run resolves every reference in
inputinto one object and validates it against the callable’s input schema before dispatch. - Each call has a stable identity. The run fixes one operation identity for the call before it
runs. Every attempt of the same call sees the same
operation.idempotencyKey, which an effect sends to the system it writes to. - Failed attempts retry under a policy. Local functions and effects get three attempts by
default. A
retrypolicy on the declaration replaces that. An effect error is retried; a pure-function error is not, because running it again gives the same answer. See writes to your systems. - A finished call doesn’t run again. A successful result is validated, recorded, and bound to
outputonce. A run that resumes uses the recorded result and does not call your code again. - Not exactly once. A write can reach your system and its answer still be lost, and a retry can then send it again. Use your system’s idempotency key or a natural business key, or allow only one attempt. Put each write that must recover on its own in its own call.
- Callables are pinned. Publishing a procedure pins each callable it resolves, including your local code. A run never picks up a different implementation part way through.
failure.code is operation_failed; its failure.message, which is for
people to read, names the step and the step’s code. The codes are never turned into a business
result or a choice value:
The message doesn’t include what your code threw. A thrown message could hold a secret value, so
Effective doesn’t show it, for
FatalError or any other error.
Expected business outcomes, such as “policy not found, so skip”, belong in the result schema as
values a later choice can route on. So do refusals you
need to see: return them as typed results, and log the detail in your own system.
A call of an @effective.api.* operation has no failure routing: if the API refuses it, the run
stops with the API’s reason. To branch on a refusal, make the request inside a ts effect and use
effective.apiError, as described on the
function and effect page.
Common errors
See also
- Function and effect declarations
retrypolicyinvokenodevaluenodewaitnode, whose polling form runs an effect repeatedly- Writes to your systems