Skip to content
StatusContactDeveloper previewSign in

Quickstart

Execute an approved effect

An approved command runs as a simulated effect in the test environment and produces a receipt.

preview20 minintermediateEnvironment: testContract >=0.8 <1.0

What you will build

An external effect, gated by workflow, authority, and policy, run as a simulated effect in the test environment. Every effect produces a receipt.

Architecture preview

In a test environment effects are simulated or allowlisted; in production they run for real. Irreversible effects are never shown complete before their receipt is recorded.

Prerequisites

  • A resolved approval decision (see the previous quickstart)

Steps

  1. Confirm the command is legal

    Read the legal actions for the artifact in its current state. The command must be listed before you issue it.

    bash
    curl --url "$CRESCEVO_BASE_URL/v1/artifacts/a_123/legal-actions" \
      --header "Authorization: Bearer $CRESCEVO_API_KEY"
    Expected response
    { "legal_actions": ["artifact.deliver"] }
  2. Issue the command

    Issue the approved command with an idempotency key so a retry applies at most once. In test, the effect targets a simulated destination.

    bashwrites data
    curl --request POST \
      --url "$CRESCEVO_BASE_URL/v1/commands" \
      --header "Authorization: Bearer $CRESCEVO_API_KEY" \
      --header "Content-Type: application/json" \
      --header "Idempotency-Key: quickstart-deliver-001" \
      --data '{ "command": "artifact.deliver", "target": { "type": "artifact", "id": "a_123" }, "arguments": { "destination": "mock://inbox" } }'
    Expected response
    { "command_id": "cmd_1", "effect_id": "eff_1", "status": "running" }
  3. Observe the effect and receipt

    Poll the effect until it completes, then read its receipt.

    bash
    curl --url "$CRESCEVO_BASE_URL/v1/effects/eff_1" \
      --header "Authorization: Bearer $CRESCEVO_API_KEY"
    Expected response
    { "effect_id": "eff_1", "status": "succeeded", "receipt_id": "rcpt_1" }

Verify success

  • The command was accepted because it was a legal action.
  • A simulated effect ran and reached the mock destination.
  • A receipt was produced with the idempotency key.

Clean up

Simulated effects touch only the mock target. Test-tenant resources expire automatically.

Next: Inspect a receipt →

Start building on Crescevo.