Skip to main content
This guide covers common ways to integrate MeshQu into your application.

Key principle: you own enforcement

MeshQu evaluates and returns a decision. Your application decides what to do with it. MeshQu does not block, allow, or modify operations — it provides the verdict and your code acts on it.

Pattern 1: Synchronous pre-execution check

The most common pattern. Call MeshQu before the decision boundary and gate on the verdict.
When to use: Any operation where you want a governance check before proceeding.

Pattern 2: Record for audit

When you need a persisted audit trail of every decision, use record instead of evaluate. This stores the evaluation result with an idempotency key.
When to use: Compliance-sensitive workflows where you must prove what was checked and when.

Pattern 3: Asynchronous monitoring

If you do not want to block the hot path, evaluate asynchronously after the operation completes. This is useful for monitoring and alerting rather than gating.
When to use: Low-latency paths where governance is advisory, or when ramping up MeshQu (advisory mode) before enforcing.

Pattern 4: Advisory mode rollout

When introducing a new policy, start in advisory mode. Advisory policies are evaluated but their DENY decisions are downgraded to ALERT. This lets you observe what the policy would do without affecting production.
  1. Create the policy with shadow_mode: true.
  2. Monitor decisions and alerts.
  3. When confident, switch to shadow_mode: false.

Handling decisions: summary

The mapping from decision to action is entirely up to you. MeshQu provides the signal; your application provides the behaviour.

Resilience considerations

  • Timeouts: Configure the SDK timeout to match your SLA. If MeshQu is unreachable, decide whether to fail open (allow) or fail closed (block).
  • Retries: The SDK supports automatic retries on transient errors (5xx, network failures). Configure retries in the client constructor.
  • Idempotency: Always supply an idempotency_key when recording decisions. This makes retries safe.

Fail-open vs. fail-closed

Choose a failure strategy before going live. For compliance-critical workflows, default to fail-closed.

Anti-patterns to avoid

  • Calling MeshQu after irreversible execution when auditability is required.
  • Treating MeshQu decisions as implicit enforcement. Your application must act on the verdict explicitly.
  • Sending sensitive personal data when opaque identifiers are sufficient.