> ## Documentation Index
> Fetch the complete documentation index at: https://docs.manthan.systems/llms.txt
> Use this file to discover all available pages before exploring further.

# Basic Execution

> Executing a Business Transaction end to end, and where the bundled examples diverge from the real domain model

This walks through the same path [REST API → Execute](/docs/api/execute) documents at the endpoint level, plus what happens underneath it.

## The call

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST http://localhost:3000/execute \
    -H "Content-Type: application/json" \
    -d '{ ... full BusinessTransaction ... }'
  ```

  ```ts TypeScript SDK theme={null}
  const trustRecord = await client.execute(transaction);
  ```

  ```python Python SDK theme={null}
  trust_record = client.execution.execute(transaction)
  ```
</CodeGroup>

## What happens, in order

`ExecutionTrustApplication.execute()` (`packages/runtime/src/ExecutionTrustApplication.ts`) runs four steps sequentially, not as a single pipeline object:

1. **Accept** — `BusinessTransactionService.accept()` persists the transaction as submitted.
2. **Execute** — `Runtime.execute()` runs it through `RuntimeEngine`, which routes to the referenced [Policy](/docs/concepts/policy), evaluates it deterministically, and records a [Decision](/docs/concepts/decision) and [Execution](/docs/concepts/execution).
3. **Verify** — `VerificationService.verify()` computes and checks the trust record's hash (see [Packages → crypto](/docs/packages/crypto)), producing a [Verification](/docs/concepts/verification).
4. **Receipt** — `ReceiptService.generate()` produces a signed [Receipt](/docs/concepts/receipt), but only because step 3 succeeded.

The response is the resulting [Execution Trust Record](/docs/concepts/execution-trust-record), already carrying one execution, one verification, and one receipt.

<Note>
  A `businessTransactionId` must be a well-formed UUID — see the [Execute](/docs/api/execute) reference for the exact regex and the `400` you get otherwise.
</Note>

## Signals must be deterministic

The `signals` your policy evaluates (e.g. `amount`, `riskScore`) must be pre-computed, static values by the time you call `execute()` — [`PolicyEngine.evaluate()`](/docs/packages/policy) is a pure function over `(policy, signals)`, with no notion of re-fetching or recomputing a signal mid-evaluation. If your signal is itself the output of a model or an external call, resolve it before constructing the transaction, not inside the request.

## What the bundled examples actually show

`examples/01-hello-world` and `examples/03-runtime-execution` are the only two of the ten numbered examples with real, runnable code (see [Examples Overview](/docs/examples/overview) for the rest).

<Warning>
  Both examples construct their `BusinessTransaction`-like object by hand with only a handful of fields (`authority: { authorityId: "authority-1" }`, `intent: { intentId: "intent-1", action: "vendor-payment" }`, etc.) and cast it with `as any` before passing it to the Runtime. This does **not** match the full canonical shape documented in [Concepts → Business Transaction](/docs/concepts/business-transaction) — real fields like `authority.authorityType`, `authority.principalId`, `authority.issuedAt`, `intent.authorizationId`, `intent.target`, `intent.parameters`, and `intent.createdAt` are simply absent. Treat these two examples as illustrating the shape of a call, not as a template to copy field-for-field.
</Warning>

`examples/03-runtime-execution` also calls `RuntimeEngine` directly with an empty `RuntimePipeline([])`, bypassing `RuntimeFactory`/`ExecutionTrustApplication` entirely — it demonstrates the lower-level `RuntimeEngine` API from [`runtime`](/docs/packages/runtime), not the `POST /execute` path described above.

## Related

<CardGroup cols={2}>
  <Card title="Execute (REST API)" href="/docs/api/execute">The endpoint reference.</Card>
  <Card title="Execution Lifecycle" href="/docs/runtime/execution-lifecycle">The domain-level version of the same four steps.</Card>
  <Card title="runtime package" href="/docs/packages/runtime">`ExecutionTrustApplication` and its services.</Card>
  <Card title="Receipt Verification" href="/docs/guides/receipt-verification">What happens after execution.</Card>
</CardGroup>
