CALIBER
Quickstart

Cookbook 03 · Foundations

Policy-Safe Decision Tool

A deterministic refund policy hardened against 49 fixtures, then a refund that only a second person can release.

FoundationsCore15–30 min
What you build. A refund policy as a registered read tool (decide_refund: approve, deny or manual review, with a stable reason code) and a write tool (initiate_refund, registered with requires_approval). You run them in the sandbox, save a 49-case fixture suite, pin a baseline and catch one deliberate regression, then import the refund-decision workflow that decides, routes, and issues the refund only after a different person approves and the run is resumed. No model is involved: nothing here is simulated.
Surfaces: Tools Workflows Administration Audit Log Cookbooks
What you learn
  • Register a read tool and a write tool: Write locks Requires Approval on, and a write tool registered without it is refused with 400
  • Sandbox: the read tool runs live in a subprocess, the write tool is mocked (Success (mocked))
  • Save 49 fixtures, Run calibration (Pass rate 100% — 49/49 passed), pin the run as the baseline, then break R09 and read 1 regression (48/49)
  • Import the workflow and Run it: the run stops at Awaiting approval on the refund node; the initiator is refused with 403, approver1 approves, and the refund fires only after Resume
  • Reject (approval_rejected, no refund), deny (completes without approval), and read who approved what in the Audit Log
  • Where the sandbox stops being a boundary: a stalled tool is killed, a large write is refused, the environment is empty, and the network is still reachable

Implementation flow

flowchart LR
  A["Tools: register decide_refund and initiate_refund"] --> B["Sandbox: live read, mocked write"]
  B --> C["Fixtures: 49 cases"]
  C --> D["Hardening: run calibration, 49/49"]
  D --> E["Test Runs: Set as baseline"]
  E --> F["Break R09: 1 regression"]
  F --> G["Workflows: import refund-decision"]
  G --> H{"Router on decision"}
  H -->|deny| I["Output: denied, no approval"]
  H -->|other| J["initiate_refund: waiting_approval"]
  J -->|"approver1 approves, admin Resume"| K["Refund issued once"]
  K --> L["Audit Log: approver and initiator"]

Step-by-step UI only

Each step shows the exact navigation path, the fields to fill, the button to click, and a snapshot of the CALIBER screen you'll be on.

  1. Tools › Register Tool creates · tool: decide_refund (read) decide-refund.tool.json ↓
    Register the policy tool. The wizard has five steps: Identity, Implementation, Schema, Playground, Safety & Review. A registered tool must point at importable Python, so you give a Module Path and a Callable Name from the shipped demo module. On the Schema step use each schema's Raw JSON toggle and paste input_schema and output_schema from the asset.
    Fill in
    Namedecide_refund
    Version1.0
    Module Pathcaliber.workflows.demo_tools
    Callable Namedecide_refund
    Side effect levelRead (the default)
    Allow in Previewon, so the sandbox runs the real callable
    Click Register Tool
    You'll see: The tool opens in its workspace. Back in the Tools list its row has no Built-in or Unavailable label: those mark CALIBER's own tools. The address becomes /tools?tool=TL-…, so a reload keeps you there.
    Screen snapshot
    caliber · Tools › Register Tool
    ToolsRegister Tool
    Register Tool
  2. Tools › Register Tool creates · tool: initiate_refund (write) initiate-refund.tool.json ↓
    Register the write tool the same way. On the Safety & Review step click Write: Requires Approval switches on and is locked, because the registry refuses a write tool without it. (Through the API that refusal is an HTTP 400.)
    Fill in
    Nameinitiate_refund
    Version1.0
    Module Pathcaliber.workflows.demo_tools
    Callable Nameinitiate_refund
    Side effect levelWrite
    Click Register Tool
    You'll see: initiate_refund is registered with Requires Approval on and cannot be turned off.
    Screen snapshot
    caliber · Tools › Register Tool
    ToolsRegister Tool
    Register Tool
  3. Tools › decide_refund › Sandbox
    Open the tool from the Tools list, then the Sandbox tab. Run the policy with the first fixture's inputs. Then open initiate_refund and run it: a write tool is never called in the sandbox.
    Fill in
    Input JSON (decide_refund){"order_id": "ord_1007", "account_id": "acct_2013", "order_state": "delivered", "amount": 49.0, "days_since_order": 5, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}
    Input JSON (initiate_refund){"order_id": "ord_1007", "amount": 49.0}
    Click Test Run
    You'll see: Success with decision: approve, reason_code: ELIGIBLE_AUTO_APPROVE. For the write tool: Success (mocked) and the output {"_preview_mock": true}.
    Screen snapshot
    caliber · Tools › decide_refund › Sandbox
    ToolsSandbox
    Test Run
  4. Tools › decide_refund › Fixtures creates · tool fixtures: refund-fixtures refund-fixtures.jsonl ↓
    Load the 49 cases from the dataset file: Load cases from file, choose refund-fixtures.jsonl. Each line becomes a case named R01 small delivered order, with the line's inputs as the input JSON and an equals assertion on its expectations (key order and spacing do not matter). Loading only fills the editor; nothing is stored until you save. You can also add or edit single cases by hand with Add case.
    Click Save cases
    You'll see: Loaded 49 cases from refund-fixtures.jsonl. Save cases to keep them., then Saved after you save, and 49 case rows in the editor (still 49 after a reload).
    Screen snapshot
    caliber · Tools › decide_refund › Fixtures
    ToolsFixtures
    Save cases
  5. Tools › decide_refund › Hardening
    Run the saved suite. It scores inline, one subprocess per case, so 49 cases take about half a minute. A run is recorded under Test Runs automatically.
    Click Run calibration
    You'll see: Pass rate 100% — 49/49 passed and a green pass on every case.
    Screen snapshot
    caliber · Tools › decide_refund › Hardening
    ToolsHardening
    Run calibration
  6. Tools › decide_refund › Test Runs
    Open Test Runs and pin the latest run. Then go back to Hardening, change the expected value of case R09 (approve) to manual_review / AMOUNT_OVER_THRESHOLD / true, and run the suite again. Put the value back afterwards and run once more.
    Click Set as baseline then Run calibration
    You'll see: The pinned run carries a Baseline marker. The second run reads Pass rate 98% — 48/49 passed; under Test Runs the comparison shows 1 regression on R09 and Net score -2%.
    Screen snapshot
    caliber · Tools › decide_refund › Test Runs
    ToolsTest Runs
    Set as baselineRun calibration
  7. Workflows › Import creates · workflow: refund-decision refund-decision.workflow.yaml ↓
    Import the workflow asset. If you registered the tools under other names, replace decide_refund and initiate_refund in the file first. Validate dependencies checks that both tools resolve.
    Fill in
    New workflow namerefund-decision
    YAML/JSON manifestChoose file: refund-decision.workflow.yaml
    Click Validate dependencies then Import as new
    You'll see: Preflight passed, both tools resolved; then the editor opens on the new draft.
    Screen snapshot
    caliber · Workflows › Import
    WorkflowsImport
    Validate dependenciesImport as new
  8. Workflows › refund-decision › Run Monitor
    Run a case, then try to approve it yourself. In a second browser session sign in as approver1, pick the same workspace, open the workflow, Run Monitor, select the run in Recent runs and approve. Back in the first session, Resume. The gate is the refund tool's own approval flag.
    Fill in
    Run inputthe R01 inputs, as in the Sandbox step
    Click Run then Approve then Approve then Resume
    You'll see: The run stops at Awaiting approval on node refund. Your own Approve is refused (a second person must decide). After approver1 approves, Resume enables; after it the run is completed and the output shows refund_status: initiated, amount_usd: 49.0.
    Screen snapshot
    caliber · Workflows › refund-decision › Run Monitor
    WorkflowsRun Monitor
    RunApproveApproveResume
  9. Workflows › refund-decision › Run Monitor, then Audit Log
    Start two more runs: one with the R01 inputs that approver1 rejects, one with the R23 inputs (a cancelled order). Then open Audit Log.
    Click Run then Reject
    You'll see: The rejected run is failed and its output holds no refund. The R23 run completed with decision: deny and never asked for approval. Audit Log lists approve_workflow_run_runtime_approval and reject_workflow_run_runtime_approval by approver1, and resume_workflow_run by the initiator.
    Screen snapshot
    caliber · Workflows › refund-decision › Run Monitor, then Audit Log
    WorkflowsRun Monitor, then Audit Log
    RunReject
  10. Tools › decide_refund › Publish
    Open decide_refund, tab Publish, Version history, New version (admins). The wizard opens with the name fixed and the version 1.1; change the description and step through to Register. In the new workspace open Fixtures, Load cases from file (refund-fixtures.jsonl again), Save cases, then Hardening and Run calibration.
    Click Run calibration
    You'll see: Pass rate 100% — 49/49 passed on version 1.1. Publish lists 1.0 and 1.1 under Version history, and the Tools list shows both under the one name.
    Screen snapshot
    caliber · Tools › decide_refund › Publish
    ToolsPublish
    Run calibration

Assets (copy-paste)

The exact files this cookbook uses — copy each into the matching field. Source: docs-site/cookbooks/03-tool-hardening-contract-lab/assets/.

assets/tools/decide-refund.tool.json
{
  "name": "decide_refund",
  "version": "1.0",
  "description": "Deterministic refund policy: approve, deny or send to manual review, with a stable reason code.",
  "module_path": "caliber.workflows.demo_tools",
  "callable_name": "decide_refund",
  "side_effect_level": "read",
  "allow_in_preview": true,
  "input_schema": {
    "type": "object",
    "required": ["order_state", "amount", "days_since_order"],
    "properties": {
      "order_id": {"type": "string", "description": "Carried for traceability; the policy does not read it."},
      "account_id": {"type": "string", "description": "Carried for traceability; the policy does not read it."},
      "order_state": {"type": "string", "description": "delivered, shipped or returned can be refunded; anything else is denied; empty fails closed."},
      "amount": {"type": "number", "description": "Refund amount in USD."},
      "days_since_order": {"type": "integer", "minimum": 0, "description": "Whole days since the order."},
      "customer_tier": {"type": "string", "enum": ["standard", "plus", "premium"], "default": "standard"},
      "refunds_last_90d": {"type": "integer", "minimum": 0, "default": 0, "description": "Refunds already issued to this account in the last 90 days."},
      "risk_flags": {"type": "array", "items": {"type": "string"}, "description": "Fraud or risk signals. Omit or null when the risk lookup failed: the policy fails closed."}
    }
  },
  "output_schema": {
    "type": "object",
    "required": ["decision", "reason_code", "requires_approval"],
    "properties": {
      "decision": {"type": "string", "enum": ["approve", "deny", "manual_review"]},
      "reason_code": {"type": "string"},
      "requires_approval": {"type": "boolean", "description": "True exactly when the decision is manual_review."}
    }
  }
}
assets/tools/initiate-refund.tool.json
{
  "name": "initiate_refund",
  "version": "1.0",
  "description": "Issue the refund. A write: the registry requires approval for it, and the sandbox mocks it.",
  "module_path": "caliber.workflows.demo_tools",
  "callable_name": "initiate_refund",
  "side_effect_level": "write",
  "requires_approval": true,
  "input_schema": {
    "type": "object",
    "required": ["order_id"],
    "properties": {
      "order_id": {"type": "string", "description": "Order to refund."},
      "amount": {"type": "number", "description": "Refund amount in USD."}
    }
  },
  "output_schema": {
    "type": "object",
    "properties": {
      "order_id": {"type": "string"},
      "refund_status": {"type": "string"},
      "amount_usd": {"type": "number"}
    }
  }
}
assets/dataset/refund-fixtures.jsonl
{"id": "R01", "name": "small delivered order", "tags": ["golden", "approve"], "inputs": {"order_id": "ord_1007", "account_id": "acct_2013", "order_state": "delivered", "amount": 49.0, "days_since_order": 5, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "approve", "reason_code": "ELIGIBLE_AUTO_APPROVE", "requires_approval": false}}
{"id": "R02", "name": "shipped order inside the window", "tags": ["golden", "approve"], "inputs": {"order_id": "ord_1014", "account_id": "acct_2026", "order_state": "shipped", "amount": 25.0, "days_since_order": 12, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "approve", "reason_code": "ELIGIBLE_AUTO_APPROVE", "requires_approval": false}}
{"id": "R03", "name": "returned order, mid-size amount", "tags": ["golden", "approve"], "inputs": {"order_id": "ord_1021", "account_id": "acct_2039", "order_state": "returned", "amount": 120.0, "days_since_order": 20, "customer_tier": "standard", "refunds_last_90d": 1, "risk_flags": []}, "expectations": {"decision": "approve", "reason_code": "ELIGIBLE_AUTO_APPROVE", "requires_approval": false}}
{"id": "R04", "name": "one day inside the window, just under the limit", "tags": ["golden", "approve"], "inputs": {"order_id": "ord_1028", "account_id": "acct_2052", "order_state": "delivered", "amount": 199.99, "days_since_order": 29, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "approve", "reason_code": "ELIGIBLE_AUTO_APPROVE", "requires_approval": false}}
{"id": "R05", "name": "window boundary: day 30 is still eligible", "tags": ["boundary", "window", "approve"], "inputs": {"order_id": "ord_1035", "account_id": "acct_2065", "order_state": "delivered", "amount": 49.0, "days_since_order": 30, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "approve", "reason_code": "ELIGIBLE_AUTO_APPROVE", "requires_approval": false}}
{"id": "R06", "name": "window boundary: day 31 is outside", "tags": ["boundary", "window", "deny"], "inputs": {"order_id": "ord_1042", "account_id": "acct_2078", "order_state": "delivered", "amount": 49.0, "days_since_order": 31, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "deny", "reason_code": "OUTSIDE_WINDOW", "requires_approval": false}}
{"id": "R07", "name": "same-day refund", "tags": ["boundary", "window", "approve"], "inputs": {"order_id": "ord_1049", "account_id": "acct_2091", "order_state": "delivered", "amount": 49.0, "days_since_order": 0, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "approve", "reason_code": "ELIGIBLE_AUTO_APPROVE", "requires_approval": false}}
{"id": "R08", "name": "long past the window", "tags": ["golden", "deny"], "inputs": {"order_id": "ord_1056", "account_id": "acct_2104", "order_state": "delivered", "amount": 49.0, "days_since_order": 95, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "deny", "reason_code": "OUTSIDE_WINDOW", "requires_approval": false}}
{"id": "R09", "name": "amount boundary: exactly 200.00", "tags": ["boundary", "amount", "approve"], "inputs": {"order_id": "ord_1063", "account_id": "acct_2117", "order_state": "delivered", "amount": 200.0, "days_since_order": 10, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "approve", "reason_code": "ELIGIBLE_AUTO_APPROVE", "requires_approval": false}}
{"id": "R10", "name": "amount boundary: 200.01 needs review", "tags": ["boundary", "amount", "manual_review"], "inputs": {"order_id": "ord_1070", "account_id": "acct_2130", "order_state": "delivered", "amount": 200.01, "days_since_order": 10, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "manual_review", "reason_code": "AMOUNT_OVER_THRESHOLD", "requires_approval": true}}
{"id": "R11", "name": "large refund needs review", "tags": ["amount", "manual_review"], "inputs": {"order_id": "ord_1077", "account_id": "acct_2143", "order_state": "delivered", "amount": 250.0, "days_since_order": 10, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "manual_review", "reason_code": "AMOUNT_OVER_THRESHOLD", "requires_approval": true}}
{"id": "R12", "name": "laptop-sized refund needs review", "tags": ["amount", "manual_review"], "inputs": {"order_id": "ord_1084", "account_id": "acct_2156", "order_state": "delivered", "amount": 1299.0, "days_since_order": 3, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "manual_review", "reason_code": "AMOUNT_OVER_THRESHOLD", "requires_approval": true}}
{"id": "R13", "name": "plus tier: day 45 is eligible", "tags": ["tier", "plus", "boundary", "approve"], "inputs": {"order_id": "ord_1091", "account_id": "acct_2169", "order_state": "delivered", "amount": 100.0, "days_since_order": 45, "customer_tier": "plus", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "approve", "reason_code": "ELIGIBLE_AUTO_APPROVE", "requires_approval": false}}
{"id": "R14", "name": "plus tier: day 46 is outside", "tags": ["tier", "plus", "boundary", "deny"], "inputs": {"order_id": "ord_1098", "account_id": "acct_2182", "order_state": "delivered", "amount": 100.0, "days_since_order": 46, "customer_tier": "plus", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "deny", "reason_code": "OUTSIDE_WINDOW", "requires_approval": false}}
{"id": "R15", "name": "plus tier: exactly 350.00", "tags": ["tier", "plus", "boundary", "approve"], "inputs": {"order_id": "ord_1105", "account_id": "acct_2195", "order_state": "delivered", "amount": 350.0, "days_since_order": 10, "customer_tier": "plus", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "approve", "reason_code": "ELIGIBLE_AUTO_APPROVE", "requires_approval": false}}
{"id": "R16", "name": "plus tier: 350.01 needs review", "tags": ["tier", "plus", "boundary", "manual_review"], "inputs": {"order_id": "ord_1112", "account_id": "acct_2208", "order_state": "delivered", "amount": 350.01, "days_since_order": 10, "customer_tier": "plus", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "manual_review", "reason_code": "AMOUNT_OVER_THRESHOLD", "requires_approval": true}}
{"id": "R17", "name": "premium tier: day 60 is eligible", "tags": ["tier", "premium", "boundary", "approve"], "inputs": {"order_id": "ord_1119", "account_id": "acct_2221", "order_state": "delivered", "amount": 400.0, "days_since_order": 60, "customer_tier": "premium", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "approve", "reason_code": "ELIGIBLE_AUTO_APPROVE", "requires_approval": false}}
{"id": "R18", "name": "premium tier: day 61 is outside", "tags": ["tier", "premium", "boundary", "deny"], "inputs": {"order_id": "ord_1126", "account_id": "acct_2234", "order_state": "delivered", "amount": 400.0, "days_since_order": 61, "customer_tier": "premium", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "deny", "reason_code": "OUTSIDE_WINDOW", "requires_approval": false}}
{"id": "R19", "name": "premium tier: exactly 500.00", "tags": ["tier", "premium", "boundary", "approve"], "inputs": {"order_id": "ord_1133", "account_id": "acct_2247", "order_state": "delivered", "amount": 500.0, "days_since_order": 10, "customer_tier": "premium", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "approve", "reason_code": "ELIGIBLE_AUTO_APPROVE", "requires_approval": false}}
{"id": "R20", "name": "premium tier: 500.01 needs review", "tags": ["tier", "premium", "boundary", "manual_review"], "inputs": {"order_id": "ord_1140", "account_id": "acct_2260", "order_state": "delivered", "amount": 500.01, "days_since_order": 10, "customer_tier": "premium", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "manual_review", "reason_code": "AMOUNT_OVER_THRESHOLD", "requires_approval": true}}
{"id": "R21", "name": "day 40 is outside for a standard customer", "tags": ["tier", "standard", "deny"], "inputs": {"order_id": "ord_1147", "account_id": "acct_2273", "order_state": "delivered", "amount": 80.0, "days_since_order": 40, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "deny", "reason_code": "OUTSIDE_WINDOW", "requires_approval": false}}
{"id": "R22", "name": "250.00 is inside the plus limit", "tags": ["tier", "plus", "approve"], "inputs": {"order_id": "ord_1154", "account_id": "acct_2286", "order_state": "delivered", "amount": 250.0, "days_since_order": 10, "customer_tier": "plus", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "approve", "reason_code": "ELIGIBLE_AUTO_APPROVE", "requires_approval": false}}
{"id": "R23", "name": "cancelled order", "tags": ["golden", "state", "deny"], "inputs": {"order_id": "ord_1161", "account_id": "acct_2299", "order_state": "cancelled", "amount": 80.0, "days_since_order": 3, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "deny", "reason_code": "NOT_REFUNDABLE_STATE", "requires_approval": false}}
{"id": "R24", "name": "order not shipped yet", "tags": ["state", "deny"], "inputs": {"order_id": "ord_1168", "account_id": "acct_2312", "order_state": "pending", "amount": 80.0, "days_since_order": 1, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "deny", "reason_code": "NOT_REFUNDABLE_STATE", "requires_approval": false}}
{"id": "R25", "name": "order already refunded", "tags": ["state", "abuse", "deny"], "inputs": {"order_id": "ord_1175", "account_id": "acct_2325", "order_state": "refunded", "amount": 80.0, "days_since_order": 8, "customer_tier": "standard", "refunds_last_90d": 1, "risk_flags": []}, "expectations": {"decision": "deny", "reason_code": "NOT_REFUNDABLE_STATE", "requires_approval": false}}
{"id": "R26", "name": "state is trimmed and case-folded", "tags": ["edge", "state", "approve"], "inputs": {"order_id": "ord_1182", "account_id": "acct_2338", "order_state": "  Delivered ", "amount": 49.0, "days_since_order": 5, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "approve", "reason_code": "ELIGIBLE_AUTO_APPROVE", "requires_approval": false}}
{"id": "R27", "name": "order state unknown", "tags": ["fail_closed", "state", "manual_review"], "inputs": {"order_id": "ord_1189", "account_id": "acct_2351", "order_state": "", "amount": 49.0, "days_since_order": 5, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": []}, "expectations": {"decision": "manual_review", "reason_code": "UNKNOWN_ORDER_STATE", "requires_approval": true}}
{"id": "R28", "name": "fraud flag on the account", "tags": ["abuse", "risk", "manual_review"], "inputs": {"order_id": "ord_1196", "account_id": "acct_2364", "order_state": "delivered", "amount": 49.0, "days_since_order": 4, "customer_tier": "standard", "refunds_last_90d": 0, "risk_flags": ["fraud_suspected"]}, "expectations": {"decision": "manual_review", "reason_code": "RISK_FLAG_PRESENT", "requires_approval": true}}
{"id": "R29", "name": "chargeback history", "tags": ["abuse", "risk", "manual_review"], "inputs": {"order_id": "ord_1203", "account_id": "acct_2377", "order_state": "delivered", "amount": 30.0, "days_since_order": 9, "customer_tier": "plus", "refunds_last_90d": 1, "risk_flags": ["chargeback_history"]}, "expectations": {"decision": "manual_review", "reason_code": "RISK_FLAG_PRESENT", "requires_approval": true}}
{"id": "R30", "name": "risk lookup failed (flags missing)", "tags": ["fail_closed", "risk", "manual_review"], "inputs": {"order_id": "ord_1210", "account_id": "acct_2390", "order_state": "delivered", "amount": 49.0, "days_since_order": 4, "customer_ti
… truncated — open the file in the repo for the full content.
assets/workflow/refund-decision.workflow.yaml
schema_version: 1
workflow_id: refund-decision
name: refund-decision
description: Decide a refund with the deterministic policy tool, then issue it only after a person approves.
runtime:
  sdk: openai-agents-python
  sdk_version_policy: runtime-pinned
  compiler_version: caliber-workflow-compiler-v1
  default_model_ref: CALIBER_WORKFLOW_DEFAULT_MODEL
  session:
    type: none
nodes:
  start:
    id: start
    type: start
    outputs:
      user_message:
        type: string
  policy:
    id: policy
    type: tool
    tool_name: decide_refund
    inputs:
      input:
        type: string
      arguments:
        type: structured
    outputs:
      text:
        type: string
      result:
        type: structured
      metadata:
        type: structured
  route:
    id: route
    type: router
    inputs:
      input:
        type: string
    outputs:
      route:
        type: string
    branches:
      - condition:
          field: input
          op: contains
          value: '"decision": "deny"'
        to: denied
      - condition: null
        to: refund
  denied:
    id: denied
    type: output
    inputs:
      response:
        type: string
  refund_request:
    id: refund_request
    type: data_transform
    operation: mapping
    config:
      fields:
        order_id: order_id
        amount: amount
    inputs:
      value:
        type: structured
      text:
        type: string
    outputs:
      text:
        type: string
      result:
        type: structured
      valid:
        type: boolean
      metadata:
        type: structured
  refund:
    id: refund
    type: tool
    tool_name: initiate_refund
    inputs:
      input:
        type: string
      arguments:
        type: structured
    outputs:
      text:
        type: string
      result:
        type: structured
      metadata:
        type: structured
  issued:
    id: issued
    type: output
    inputs:
      response:
        type: string
edges:
  - id: e_start_policy
    from: start
    to: policy
    map:
      user_message: input
  - id: e_start_request
    from: start
    to: refund_request
    map:
      user_message: text
  - id: e_policy_route
    from: policy
    to: route
    map:
      text: input
  - id: e_route_denied
    from: route
    to: denied
    map:
      route: response
  - id: e_route_refund
    from: route
    to: refund
    map:
      route: input
  - id: e_request_refund
    from: refund_request
    to: refund
    map:
      result: arguments
  - id: e_refund_issued
    from: refund
    to: issued
    map:
      text: response
tools:
  decide_refund:
    registry_ref: tool.decide_refund.v1
    version_constraint: ">=1,<2"
  initiate_refund:
    registry_ref: tool.initiate_refund.v1
    version_constraint: ">=1,<2"

Evaluation & quality gates

Quality gateTarget
Fixture pass rate1.0 over 49 cases (tool_fixture_pass_rate_min 1.0); recorded as a suite run and pinned as the baseline
Regression is visibleone wrong fixture (R09) scores 48/49 with exactly 1 regression against the baseline
Approval enforcedrun waits at waiting_approval on refund; initiator 403; approver1 approves; refund fires only after Resume
Reject and deny pathsrejected run fails with approval_rejected and issues no refund; a denied decision finishes with no approval
Audit trail and rolesapprover1 and the initiator named in the audit log; a viewer cannot run, calibrate or approve (403)
Developer notes & gotchas
  • Feature flag. CALIBER_FEATURE_COOKBOOKS=true only opens the Cookbooks gallery starter (the last step); the rest of the lab needs no flag. No Aria, integrations or release-candidate flag.
  • Nothing is simulated. No model and no judge are involved, so the fake LLM provider is irrelevant here.
  • Runtime settings. Needs runtime approvals, the workflow run queue, checkpointing and a worker (scripts/cookbook-env.sh turns them on). Without CALIBER_WORKFLOW_RUN_RUNTIME_APPROVALS_ENABLED=true a run does not pause. CALIBER_APPROVER_USERS must list approver1; leave CALIBER_APPROVAL_ALLOW_SELF_APPROVAL unset or the second-person rule does not bite.
  • Split of duties. Run, calibrate and Resume need caliber.operator; deciding needs caliber.approver; only an admin registers a tool. approver1 deliberately cannot Resume.
  • Tools are importable Python. A registered tool needs a module_path and callable_name in the server's environment (the shipped caliber.workflows.demo_tools provides both); there is no inline tool editor. Set CALIBER_REGISTERED_TOOL_MODULE_ALLOWLIST beyond a trial.
  • Limits. The sandbox is a process boundary, not isolation (the child keeps network and filesystem access), and the memory limit is not enforced on macOS. The effect ledger covers webhook and API-request nodes, not registered tools, so make a payments tool idempotent itself.
  • Calibration is slow. 49 cases take about 35 s synchronously, longer than the SDK default 30 s timeout. Run it with sdk/caliber-sdk/examples/cookbooks/cookbook_03_policy_safe_decision_tool.py (python -m examples.cookbooks.cookbook_03_policy_safe_decision_tool) or the Playwright spec e2e/cookbooks/labs/03-tool-hardening.spec.ts.

CALIBER : Contextual Adaptive Lifecycle for Intelligent Build, Evaluation, and Refinement — Cookbooks — every recipe is UI-implementable on the shipped platform. Source + assets under docs-site/cookbooks/<nn>-…/. Regenerate with python3 docs-site/cookbooks/training/build.py.