Skip to Content
Getting startedQuickstart

Govern your first action

Use this scenario to check a test payment action. An amount of 100 or less should proceed; a larger amount should be stopped before the receipt is written. Inspect both the policy evidence and the receipt output to confirm those results.

Who can use this
Available to
DeveloperAdministrator
Not available to
Governance EngineerCompliance OfficerBusiness OwnerAuditor

Developers run the integration. Administrators provide Development application access. A Governance Engineer creates the test rule by default.

Install the approved packages

Open Tools and SDKs. It is an organization-wide item: Developers see it in the main navigation, and other roles find it under More tools. It is not part of an application workspace.

Choose Application SDKs, select Python, and install the listed version of veriproof-sdk in a Python 3.11, 3.12, or 3.13 environment. Choose the SDK bundle or run the Package registry commands in order. See Install packages with Tools and SDKs for both paths.

This tutorial uses Python Core. To adapt the test to a framework you already use, see Govern a local tool with Rig or .NET framework adapters.

Configure application authentication

Open the application, select its Set up SDK tab, and create or copy the complete API key. The key identifies the application, so you don’t need a separate application ID. Store the key in your secret manager.

export VERIPROOF_API_KEY="your-complete-api-key"

Hosted VeriProof uses https://ingest.veriproof.app. VeriProof Private uses the ingest base URL supplied by your administrator in VERIPROOF_ENDPOINT.

A remote endpoint must use HTTPS. If you point VERIPROOF_ENDPOINT at a local http:// address, the SDK rejects it until you allow loopback HTTP as well. Python and .NET take this as a client option: Veriproof.from_env(allow_loopback_http=True) and AllowLoopbackHttp = true. TypeScript, Go, Java, and Rust read VERIPROOF_ALLOW_LOOPBACK_HTTP=true. See SDK configuration.

Create the test rule

Creating and activating the rule needs the Governance Engineer role by default. If you hold several roles, switch to Governance Engineer for these steps. See who can author and approve rules.

The rule reads the payment_amount fact that the sample sends with facts=. VeriProof places application facts at input.snapshot.facts.<name>. Save the sample below and run python quickstart.py 40 once so VeriProof records the fact and offers it in the rule builder.

  1. Open the application’s Policy tab, select Create policy rule, then Create blank policy rule. Name it Quickstart payment limit.

  2. Under When the rule runs, choose Before action. Under When the rule matches, choose Deny (stop the action).

  3. In Review logic, set Apply “Deny” when activity to Meets these conditions. Add the condition Payment Amount is greater than 100. Payment Amount appears under Sent by the application, not yet confirmed.

  4. In Confirm inputs, select Request application data. The Developer confirms the field from the application’s Policy tab, under Application data. If you hold the Developer role yourself, switch to it and confirm the field there.

  5. In Test, add two cases with this application data, changing only the amount:

    { "snapshot": { "facts": { "payment_amount": 140 } } }

    Expect Deny for 140 and Allow for 40.

  6. Save the tested version. In Activate, choose Shadow under Deployment step, select Check readiness, then Activate in Shadow. Run the sample with both amounts and compare the proposed results. Then choose Enforced, check readiness again, and select Enforce policy. Development deployment does not use the Production approval path.

Advanced Rego shows the policy the builder generates, if you want to review it.

Run the governed action

Keep the payment write inside the operation that VeriProof evaluates before execution. Writing the receipt elsewhere would bypass that check, even if the session still records a policy decision.

Save the sample as quickstart.py. Pass the receipt function to govern and supply the payment amount as an application fact. The sample writes to a temporary local directory.

import argparse import asyncio from pathlib import Path from tempfile import TemporaryDirectory from veriproof_sdk import Veriproof async def main(amount: int): payment = {"reference": f"QS-{amount}", "amount": amount} with TemporaryDirectory() as directory: receipt = Path(directory) / "receipt.txt" async def write_test_receipt(context): receipt_id = f"rcpt-{context.input['reference']}" context.throw_if_stopped() receipt.write_text(receipt_id, encoding="utf-8") return {"receipt_id": receipt_id} vp = Veriproof.from_env() try: result = await vp.govern( "payment.create", payment, write_test_receipt, facts={"payment_amount": amount}, ) finally: await vp.shutdown() print("Status:", result.status.value) print("Session ID:", result.session_id) if result.decision: print("Decision correlation ID:", result.decision.decision_correlation_id) print("Receipt written:", receipt.exists()) if result.completed: print("Result:", result.value) else: print("Reason:", result.reason_code, result.message) parser = argparse.ArgumentParser() parser.add_argument("amount", type=int, choices=[40, 140]) asyncio.run(main(parser.parse_args().amount))

After you enforce the rule, run python quickstart.py 40 and python quickstart.py 140. The first run should print completed and Receipt written: True. The second should print blocked and Receipt written: False. The sample removes the temporary directory when each run ends.

shutdown() attempts to send buffered evidence before it closes the client. If it reports a delivery failure after the callback ran, check the application effect before retrying.

Record the identifiers from the result

Every core SDK returns the same result shape. There is no top-level decision ID. The decision ID lives on the optional decision object, and evidenceReference is a separate opaque string you can record but should not parse.

LanguageSessionDecision IDEvidence reference
Pythonresult.session_idresult.decision.decision_id if result.decision else Noneresult.evidence_reference
TypeScriptresult.sessionIdresult.decision?.decisionIdresult.evidenceReference
.NETresult.SessionIdresult.Decision?.DecisionIdresult.EvidenceReference
Javaresult.sessionId()result.decision() == null ? null : result.decision().decisionId()result.evidenceReference()
Goresult.SessionIDresult.Decision.DecisionID after checking result.Decision != nilresult.EvidenceReference
Rustresult.session_idresult.decision.as_ref().map(|d| d.decision_id.clone())result.evidence_reference

Check that decision exists before reading its ID. It’s absent when no rule decided the outcome, including transport failures.

Check the recorded decision ID before using it. The quickstart prints the decision correlation ID, which selects the matching event in the portal. A review_required result also includes identifiers on its review checkpoint.

The evidence reference is an opaque string. Hosted Server Ingest can return policy-evaluation-event:<uuid>; a receipt from the VeriProof Agent Gateway’s Edge API can return edge:<id>. Other results can return decision:<id>, a correlation ID, or unavailable. Record the value as returned. Do not parse it to make a policy decision.

Prove the result

Use the statuses and receipt checks printed by the sample to confirm the result of each run.

Open the session and decision from the identifiers you recorded:

/applications/{applicationId}/sessions/{sessionId}?tab=decision&decisionId={decisionId}

For decisionId, use the decision correlation ID. If a hosted result includes a policy-evaluation-event: reference, the UUID after that prefix is the decision event ID shown under Evidence details.

The highlighted decision card under Enforcement events during this session shows:

  • the outcome: Allowed for amount 40, and Stopped by policy for amount 140;
  • the rule name and its version;
  • which check ran, such as Before tool call or Input policy check;
  • the time of the decision; and
  • Why, the reason the rule recorded.

Select Evidence details on that card for the event ID and prompt hash.

The card reports what the rule decided, not how the rule is deployed. To confirm the rule was enforcing rather than observing, use Control coverage in the next step.

Confirm the operation is enforced

Open the application’s Control coverage tab and confirm payment.create appears under Enforce. If it appears under Observe, VeriProof recorded the action but nothing stopped it, so the result above was not enforcement.

Clean up

Remove the test rule and revoke any temporary API key. Remove the sample’s API key from the test environment.

Diagnose a failed run

  • For a 401 or 403, check the returned error, key status, application permissions, and endpoint. The status alone does not identify the cause.
  • A missing decision usually means the protected action ran outside the governed path or no inline rule matched.
  • Observe or Not supported in Control coverage means the SDK path does not control that operation.
  • An unsupported stream must remain buffered or unreleased until a supported boundary decides it.

Use Troubleshoot the SDK for detailed checks.

Last updated on