Tessra
Menu

Paste these commands into Snowflake to run your first governed action.

Cortex first run

Minimal Cortex-side worksheet: propose an action from SQL, poll until terminal, read the receipt.

Prerequisites

  • APP.DURABLE_ORG has ACTION_SERVICE_BASE_URL (and harness secret if required).
  • Executor for customer.credit_issue is configured.
  • Same starter policy bands you use from Quickstart (allow / approval / deny).

Step 1 — Simulated reasoning (optional)

In Cortex, keep the model rationale in your prompt or a SQL comment so the worksheet matches what the agent would pass as the reason string.

-- Simulated reasoning (document alongside the call in your runbook):
-- "Customer at churn risk; propose small goodwill credit within policy band."

Step 2 — Submit from Cortex

Native procedure returns structured VARIANT. Read intent_id from the returned object.

CALL APP.REQUEST_ACTION_FROM_CORTEX(
  'customer.credit_issue',
  OBJECT_CONSTRUCT('customer_id', 'c_demo_1', 'amount', 50, 'currency', 'USD'),
  'Cortex worksheet — goodwill credit'
);

Step 3 — Capture intent_id

Copy the UUID from the step 2 result. In a Snowflake worksheet you can bind it with SET and reference $intent_id in subsequent statements, or paste the literal into steps 4–5.

-- Optional session binding (Snowflake worksheet):
-- SET intent_id = '<paste_intent_uuid_from_step_2>';

Step 4 — Poll until terminal

CALL APP.GET_ACTION_STATUS_FOR_CORTEX('<intent_id>');

Repeat until terminal is true; branch on next_step for WAIT_FOR_APPROVAL vs completion.

Step 5 — Receipt

SELECT intent_id, status, next_step, terminal, policy_decision, created_at
FROM APP.RECEIPTS_VIEW
WHERE intent_id = '<intent_id>';

See also