CALIBER
Quickstart

Cookbook 19 · Build

Governed OpenAPI Tool

Import an OpenAPI spec, curate a read-only tool pack and a governed write draft, publish both, and gate the write behind a second person.

BuildCore20–40 min
What you build. A three-operation Ticket API (assets/server/ticket_api.py), imported by URL over CALIBER's guarded egress path. CALIBER normalizes and classifies the operations, auto-wires one dependency from an explicit OpenAPI link, and leaves a same-tag dependency for a human to confirm. A read-only tool pack binds two operations into one callable; a write draft defaults to requiring approval and cannot be previewed until an operator opts in. Both drafts publish into the ordinary tool registry, and the write tool's approval gate holds in a workflow until a second person decides. Reimporting the upstream's changed spec afterward shows the diff catching one breaking change and missing another, real one.
Surfaces: OpenAPI Integrations Tools Workflows Audit Log
What you learn
  • Create an integration and import a spec by URL (Integrations > OpenAPI Integrations > Import); see it normalize and classify every operation as read, write or external action automatically
  • Review Dependencies: an explicit OpenAPI link auto-wires at high confidence and cannot be reviewed (409); a weaker, same-tag match can be confirmed or rejected
  • Generate a tool pack from two selected operations (Operations > bind as one tool pack) and a separate write draft; meet the write draft's preview refusal (409) until allow in preview is set
  • Publish both drafts (Tool Drafts > Publish) into the standard tool registry, then bind the write tool in a workflow and watch a second person's approval hold it at waiting_approval
  • Change the upstream's spec and Reimport & diff: one breaking change (an operation marked deprecated) is caught; a new required request-body field is not, because the diff tracks a fixed set of fields

Implementation flow

flowchart LR
  IM["Import spec by URL"] --> CL["Classify: 2 read, 1 write"]
  CL --> DEP["Auto-wire the explicit link"]
  CL --> PACK["Generate a read-only tool pack"]
  CL --> WRITE["Generate the write draft"]
  WRITE --> GATE["Preview refused: 409"]
  GATE --> OPTIN["allow_in_preview opt-in (break-glass)"]
  PACK --> PUB["Publish into the tool registry"]
  OPTIN --> PUB
  PUB --> WF["Workflow: waiting_approval"]
  WF --> APR["Second person approves + Resume"]
  APR --> RI["Reimport after a spec change"]
  RI --> DIFF["Diff: 1 breaking, 1 change undetected"]

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. Integrations › OpenAPI Integrations creates · the upstream Ticket API ticket_api.py ↓
    Before you start: start CALIBER with CALIBER_FEATURE_INTEGRATIONS=true, the lab's upstream (assets/server/ticket_api.py) running and its host on CALIBER_EGRESS_ALLOWED_HOSTS, and OPENAPI_TICKET_TOKEN set in both. Click + New Integration, name it Ticketing, Create.
    Click + New Integration
    You'll see: The new integration's detail view opens, status draft.
    Screen snapshot
    caliber · Integrations › OpenAPI Integrations
    OpenAPI Integrations
    + New Integration
  2. Integrations › OpenAPI Integrations › Import creates · the spec the upstream serves ticket-api-v1.yaml ↓
    Click URL, paste the upstream's own /openapi.yaml address, click Check (reachable and allowed), then submit the import.
    Click Import
    You'll see: Imported OAIV-1; the integration moves to review.
    Screen snapshot
    caliber · Integrations › OpenAPI Integrations › Import
    Import
    Import
  3. Integrations › OpenAPI Integrations › Operations
    Select both GET /tickets and GET /tickets/{ticket_id}, check bind as one tool pack, and click Generate tool draft(s).
    Click Generate tool draft(s)
    You'll see: Generated 1 tool draft: a pack binding both read operations.
    Screen snapshot
    caliber · Integrations › OpenAPI Integrations › Operations
    Operations
    Generate tool draft(s)
  4. Integrations › OpenAPI Integrations › Dependencies
    The row from createTicket to getTicket shows Auto-wired (an explicit OpenAPI link) with no action available. Filter to Awaiting Review and click Confirm on the same-tag advisory row.
    Click Confirm
    You'll see: The auto-wired row carries no Confirm/Reject action; the advisory row's status becomes confirmed.
    Screen snapshot
    caliber · Integrations › OpenAPI Integrations › Dependencies
    Dependencies
    Confirm
  5. Integrations › OpenAPI Integrations › Tool Drafts creates · the dependency the detector auto-wires the upstream's three operations ↓
    Open the pack draft, set Auth kind to Bearer token and the secret reference to env://OPENAPI_TICKET_TOKEN, Save, then Publish.
    Click Publish
    You'll see: Tool published successfully, naming the tool id and openapi_http; Open in Tool Registry links to it.
    Screen snapshot
    caliber · Integrations › OpenAPI Integrations › Tool Drafts
    Tool Drafts
    Publish
  6. Integrations › OpenAPI Integrations › Operations
    Select POST /tickets alone and Generate tool draft(s) (no pack this time). Open the new draft, set the same bearer auth, and click Publish without checking anything else.
    Click Generate tool draft(s)
    You'll see: The draft's side-effect level is write and it already requires approval -- a write defaults to it.
    Screen snapshot
    caliber · Integrations › OpenAPI Integrations › Operations
    Operations
    Generate tool draft(s)
  7. Integrations › OpenAPI Integrations › Tool Drafts
    Try Preview on the write draft before touching allow in preview.
    Click Preview
    You'll see: Refused: set 'allow_in_preview' before running a live upstream call. Toggle allow in preview on, Preview again, confirm it ran against the upstream, then toggle it back off.
    Screen snapshot
    caliber · Integrations › OpenAPI Integrations › Tool Drafts
    Tool Drafts
    Preview
  8. Integrations › OpenAPI Integrations › Tool Drafts
    With allow in preview off again, click Publish.
    Click Publish
    You'll see: Tool published successfully; the published tool still carries requires approval.
    Screen snapshot
    caliber · Integrations › OpenAPI Integrations › Tool Drafts
    Tool Drafts
    Publish
  9. Agent resources › Workflows creates · the one-tool workflow file-ticket.workflow.yaml ↓
    Fill __TOOL_NAME__ in a copy of file-ticket.workflow.yaml with the published write tool's name. Import, Run with a ticket title as input. Approve yourself (refused), approve as the reviewer account in a second session, then Resume.
    Click Run
    You'll see: Awaiting approval at call_tool; the account that triggered this run cannot approve it; a second person must decide; after the reviewer approves and you Resume, completed.
    Screen snapshot
    caliber · Agent resources › Workflows
    WorkflowsWorkflows
    Run
  10. Integrations › OpenAPI Integrations creates · the changed spec ticket-api-v2.yaml ↓
    Bump the upstream's served spec to v2 (POST /admin/bump-spec on the upstream itself), then click Reimport & diff.
    Click Reimport & diff
    You'll see: Re-imported OAIV-2: +0 -0 changed 2 (1 breaking) -- the deprecation is caught; the new required priority field on createTicket is not.
    Screen snapshot
    caliber · Integrations › OpenAPI Integrations
    OpenAPI Integrations
    Reimport & diff

Assets (copy-paste)

The exact files this cookbook uses — copy each into the matching field. Source: docs-site/cookbooks/19-openapi-integration-governance-lab/assets/.

assets/server/ticket_api.py
#!/usr/bin/env python3
"""A stand-in Ticket API for the OpenAPI Integration Governance lab. It is NOT a real system.

CALIBER's OpenAPI Integrations feature imports a spec and then calls a *real* upstream server —
nothing about preview or publish is simulated. This 100-line server is that upstream: it serves its
own OpenAPI document (so the lab can import it by URL, reimport it, and diff two versions) and the
three ticket operations the document describes, behind the same bearer token CALIBER is configured
to send.

    python3 ticket_api.py [PORT]   # default 8781, listens on 127.0.0.1 only

Environment:
    OPENAPI_TICKET_TOKEN   the bearer token every call must present (default "ticket-api-token")
    TICKET_API_LEDGER  path to a JSONL file this server appends one line to per call it executes

Routes:
    GET  /health                    200, no auth
    GET  /openapi.yaml              200, no auth -- the document at its current version (see below)
    POST /admin/bump-spec           200 {"spec_version": 2} -- switches the served document (and the
                                     server's own validation) from v1 to v2. Lab-only: a real upstream
                                     would publish a new document at its own pace, not on a command.
    GET  /tickets                   200 {"total_count", "items": [...]}; v2 accepts ?status=
    POST /tickets                   201 {"ticket_id", "title", "priority", "status"}; v1 requires only
                                     "title"; v2 also requires "priority" (the breaking change the lab's
                                     reimport-and-diff step finds)
    GET  /tickets/{ticket_id}       200, or 404 {"error": "unknown ticket"}

Every route but /health and /openapi.yaml requires ``Authorization: Bearer <OPENAPI_TICKET_TOKEN>``;
anything else is a 401. The server keeps tickets in memory (gone on restart) and appends
``{"method", "path", "ok"}`` to the ledger for every call it actually executes -- refused and
unauthenticated calls never execute, so they never appear there. That is the proof the lab uses that
a draft CALIBER refuses to preview (or a workflow run that is still waiting on approval) never reached
this server.
"""

from __future__ import annotations

import json
import os
import sys
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from urllib.parse import parse_qs, urlparse

SPEC_V1 = """
openapi: 3.0.3
info:
  title: Ticket API
  version: "2026-08-11"
  description: Manage tickets.
servers:
  - url: https://tickets.example.com
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
security:
  - bearerAuth: []
paths:
  /tickets:
    get:
      operationId: listTickets
      summary: List tickets
      tags: [tickets]
      responses:
        "200":
          description: ok
    post:
      operationId: createTicket
      summary: Create ticket
      tags: [tickets]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
              required: [title]
      responses:
        "201":
          description: created
          content:
            application/json:
              schema:
                type: object
                properties:
                  ticket_id:
                    type: string
          links:
            GetCreatedTicket:
              operationId: getTicket
              parameters:
                ticket_id: "$response.body#/ticket_id"
  /tickets/{ticket_id}:
    get:
      operationId: getTicket
      summary: Get one ticket
      tags: [tickets]
      parameters:
        - in: path
          name: ticket_id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: ok
"""

# v2 makes three changes, deliberately of three different kinds the lab's reimport-and-diff step
# tells apart:
#   1. listTickets gains an optional `status` filter and a reworded summary. CALIBER's diff compares
#      a fixed set of normalized fields (summary, side_effect_level, deprecated, auth_schemes,
#      request_body_required, request_content_types, response_statuses, tags) -- a new query
#      PARAMETER is not one of them, so only the summary edit shows up, as a non-breaking "changed".
#   2. getTicket is marked deprecated: true -- a tracked field, and the one change `_breaking_reason`
#      (caliber/src/caliber/integrations/openapi/diff.py) flags on its own: "operation was deprecated".
#   3. createTicket's body gains a *required* `priority` field. `request_body_required` (whether a
#      body is required at all) is tracked; which fields *within* it are required is not. The diff
#      reports zero changes for createTicket even though the lab's own write draft now fails at
#      runtime without `priority` -- the real behavioral break the diff does not catch. See the
#      README's "The trust boundary, honestly".
SPEC_V2 = """
openapi: 3.0.3
info:
  title: Ticket API
  version: "2026-09-02"
  description: Manage tickets.
servers:
  - url: https://tickets.example.com
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
security:
  - bearerAuth: []
paths:
  /tickets:
    get:
      operationId: listTickets
      summary: List all tickets
      tags: [tickets]
      parameters:
        - in: query
          name: status
          required: false
          schema:
            type: string
            enum: [open, closed]
      responses:
        "200":
          description: ok
    post:
      operationId: createTicket
      summary: Create ticket
      tags: [tickets]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                priority:
                  type: string
                  enum: [low, normal, high]
              required: [title, priority]
      responses:
        "201":
          description: created
          content:
            application/json:
              schema:
                type: object
                properties:
                  ticket_id:
                    type: string
          links:
            GetCreatedTicket:
              operationId: getTicket
              parameters:
                ticket_id: "$response.body#/ticket_id"
  /tickets/{ticket_id}:
    get:
      operationId: getTicket
      summary: Get one ticket
      deprecated: true
      tags: [tickets]
      parameters:
        - in: path
          name: ticket_id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: ok
"""

TOKEN = os.environ.get("OPENAPI_TICKET_TOKEN", "ticket-api-token")
_spec_version = 1
_tickets: list[dict] = []
_next_id = 1


def _ledger_path() -> str | None:
    return os.environ.get("TICKET_API_LEDGER")


def _ledger(method: str, path: str, ok: bool) -> None:
    ledger = _ledger_path()
    if not ledger:
        return
    with open(ledger, "a", encoding="utf-8") as handle:
        handle.write(json.dumps({"method": method, "path": path, "ok": ok}) + "\n")


class Handler(BaseHTTPRequestHandler):
    def _send(self, status: int, body: dict) -> None:
        payload = json.dumps(body).encode()
        self.send_response(status)
        self.send_header("content-type", "application/json")
        self.send_header("content-length", str(len(payload)))
        self.end_headers()
        self.wfile.write(payload)

    def _send_text(
        self, status: int, body: str, content_type: str = "application/yaml"
    ) -> None:
        payload = body.encode("utf-8")
        self.send_response(status)
        self.send_header("content-type", content_type)
        self.send_header("content-length", str(len(payload)))
        self.end_headers()
        self.wfile.write(payload)

    def _authorized(self) -> bool:
        return self.headers.get("Authorization") == f"Bearer {TOKEN}"

    def _body(self) -> dict:
        length = int(self.headers.get("Content-Length", "0"))
        raw = self.rfile.read(length) if length else b""
        return json.loads(raw) if raw else {}

    def do_GET(self) -> None:
        url = urlparse(self.path)
        if url.path == "/health":
            self._send(200, {"ok": True})
            return
        if url.path == "/openapi.yaml":
            self._send_text(200, SPEC_V2 if _spec_version == 2 else SPEC_V1)
            return
        if not self._authorized():
            self._send(401, {"error": "missing or wrong bearer token"})
            return
        if url.path == "/tickets":
            status = (parse_qs(url.query).get("status") or [None])[0]
            items = [t for t in _tickets if status is None or t["status"] == status]
            # Logged before the response is sent: a client must never be able to observe "success"
            # before the upstream's own record of it exists -- that record is this lab's proof.
            _ledger("GET", "/tickets", True)
            self._send(200, {"total_count": len(items), "items": items})
            return
        if url.path.startswith("/tickets/"):
            ticket_id = url.path.removeprefix("/tickets/")
            found = next((t for t in _tickets if t["ticket_id"] == ticket_id), None)
            if found is None:
                _ledger("GET", url.path, False)
                self._send(404, {"error": "unknown ticket"})
                return
            _ledger("GET", url.path, True)
            self._send(200, found)
            return
        self._send(404, {"error": "not found"})

    def do_POST(self) -> None:
        global _spec_version, _next_id
        url = urlparse(self.path)
        if url.path == "/admin/bump-spec":
            _spec_version = 2
            self._send(200, {"spec_version": _spec_version})
            return
        if url.path == "/admin/reset":
            # Back to a pristine v1 upstream. bump-spec is permanent for the process, so anything
            # that runs the lab twice against the same server (cookbook-run-all runs the SDK path
            # and then the UI path) resets here instead of restarting the process.
            _spec_version = 1
            _tickets.clear()
            _next_id = 1
            self._send(200, {"spec_version": _spec_version, "tickets": 0})
            return
        if not self._authorized():
            self._send(401, {"error": "missing or wrong bearer token"})
            return
        if url.path == "/tickets":
            body = self._body()
            title = body.get("title")
            priority = body.get("priority")
            if not title:
                _ledger("POST", "/tickets", False)
                self._send(400, {"error": "title is required"})
                return
            if _spec_version == 2 and not priority:
                _ledger("POST", "/tickets", False)
                self._send(400, {"error": "priority is required"})
                return
            ticket = {
                "ticket_id": f"TCK-{_next_id}",
                "title": title,
                "priority": priority or "normal",
                "status": "open",
            }
            _next_id += 1
            _tickets.append(ticket)
            _ledger("POST", "/tickets", True)
            self._send(201, ticket)
            return
        self._send(404, {"error": "not found"})

    def log_message(self, format: str, *args: object) -> None:
        pass


if __name__ == "__main__":
    port = int(sys.argv[1]) if len(sys.argv) > 1 else 8781
    ThreadingHTTPServer(("127.0.0.1", port), Handler).serve_forever()
assets/dataset/ticket-api-v1.yaml
openapi: 3.0.3
info:
  title: Ticket API
  version: "2026-08-11"
  description: Manage tickets.
servers:
  - url: https://tickets.example.com
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
security:
  - bearerAuth: []
paths:
  /tickets:
    get:
      operationId: listTickets
      summary: List tickets
      tags: [tickets]
      responses:
        "200":
          description: ok
    post:
      operationId: createTicket
      summary: Create ticket
      tags: [tickets]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
              required: [title]
      responses:
        "201":
          description: created
          content:
            application/json:
              schema:
                type: object
                properties:
                  ticket_id:
                    type: string
          links:
            GetCreatedTicket:
              operationId: getTicket
              parameters:
                ticket_id: "$response.body#/ticket_id"
  /tickets/{ticket_id}:
    get:
      operationId: getTicket
      summary: Get one ticket
      tags: [tickets]
      parameters:
        - in: path
          name: ticket_id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: ok
assets/README.md
# SCN-19 assets

Everything the lab runs, from the [README](../README.md). There is nothing to author beyond the
upstream itself: you import the lab's own spec and curate the operations it discovers.

| Folder | Files | Used for |
| --- | --- | --- |
| [`server/`](server/) | `ticket_api.py` | the upstream API CALIBER calls over real loopback HTTP: serves its own OpenAPI document and the three ticket operations it describes, behind a bearer token; `POST /admin/bump-spec` switches it to v2, `POST /admin/reset` puts it back to a pristine v1 |
| [`dataset/`](dataset/) | `ticket-api-v1.yaml`, `ticket-api-v2.yaml` | the two spec versions the upstream serves at `/openapi.yaml`, before and after `POST /admin/bump-spec`; identical copies of the strings embedded in `ticket_api.py` |
| [`workflow/`](workflow/) | `file-ticket.workflow.yaml` | a one-tool workflow binding the published write tool; fill `__TOOL_NAME__` (the script does) |

## The upstream's three operations

| Operation | Side effect (derived automatically) | What it does |
| --- | --- | --- |
| `GET /tickets` (`listTickets`) | read | list tickets; v2 adds an optional `status` filter |
| `GET /tickets/{ticket_id}` (`getTicket`) | read | one ticket by id, or 404; v2 marks it `deprecated` |
| `POST /tickets` (`createTicket`) | write | create a ticket; v1 requires only `title`, v2 also requires `priority` at runtime |

`createTicket`'s 201 response carries an OpenAPI `links` entry naming `getTicket` and mapping its
`ticket_id` field to that operation's path parameter -- the one **explicit** dependency source
CALIBER's detector auto-wires at high confidence and never offers for review. The same three
operations also share one tag (`tickets`), which the detector's weakest signal (same-tag grouping)
turns into one or more low-confidence, advisory dependencies that an operator can confirm or reject.

## v1 -> v2, and what the diff does and does not catch

CALIBER's reimport diff compares a fixed set of normalized fields (summary, side-effect level,
`deprecated`, auth, whether a body is required, content types, response statuses, tags) -- not every
field. v2 makes three changes, deliberately of three kinds:

| Change | Tracked field? | Diff reports it as |
| --- | --- | --- |
| `getTicket` marked `deprecated: true` | yes (`deprecated`) | **breaking** ("operation was deprecated") |
| `listTickets`'s summary reworded | yes (`summary`) | changed, not breaking |
| `createTicket`'s body gains a *required* `priority` field | no -- only *whether* a body is required is tracked, not which fields within it are | **nothing**. The diff reports zero changes for `createTicket`, even though the published write tool now fails at runtime without `priority` |

That third row is the lab's point: the diff is a real, useful signal, and it is not a substitute for
re-running a published tool's calibration after a reimport.

## The upstream's own request log

`ticket_api.py` keeps no database -- tickets live in memory and are gone on restart -- but it does
append one JSON line (`{"method", "path", "ok"}`) to `TICKET_API_LEDGER` for every call it actually
executes. A call CALIBER refuses (an unready draft, a blocked preview, an egress refusal) never
reaches the process at all, so it never appears here. That is the same "the ledger is the proof, not
CALIBER's own answer" pattern cookbook 05 uses for its MCP server's call ledger.
assets/workflow/file-ticket.workflow.yaml
# A one-tool workflow that calls the published, OpenAPI-derived write tool. Published tools are
# ordinary CaliberToolRegistry rows: this binds one exactly like docs-site/cookbooks/03's
# registered-tool workflow does (a `tool` node plus a `registry_ref` in `tools:`), not a special
# OpenAPI node type. __TOOL_NAME__ is filled in by the lab script (or by hand, see the README) with
# the name the draft was published under. Whether the run pauses for approval is a property of the
# published tool itself (carried over from the draft's requires_approval), not of this binding.
schema_version: 1
workflow_id: file-ticket
name: file-ticket
description: Call the published create-ticket tool from a workflow; a write that requires approval waits for a second person.
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
  call_tool:
    id: call_tool
    type: tool
    tool_name: __TOOL_NAME__
    inputs:
      input:
        type: string
      arguments:
        type: structured
    outputs:
      text:
        type: string
      result:
        type: structured
      metadata:
        type: structured
  done:
    id: done
    type: output
    inputs:
      response:
        type: string
edges:
  - id: e_start_call
    from: start
    to: call_tool
    map:
      user_message: input
  - id: e_call_done
    from: call_tool
    to: done
    map:
      text: response
tools:
  __TOOL_NAME__:
    registry_ref: tool.__TOOL_NAME__.v1
    version_constraint: ">=1,<2"
assets/dataset/ticket-api-v2.yaml
openapi: 3.0.3
info:
  title: Ticket API
  version: "2026-09-02"
  description: Manage tickets.
servers:
  - url: https://tickets.example.com
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
security:
  - bearerAuth: []
paths:
  /tickets:
    get:
      operationId: listTickets
      summary: List all tickets
      tags: [tickets]
      parameters:
        - in: query
          name: status
          required: false
          schema:
            type: string
            enum: [open, closed]
      responses:
        "200":
          description: ok
    post:
      operationId: createTicket
      summary: Create ticket
      tags: [tickets]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                priority:
                  type: string
                  enum: [low, normal, high]
              required: [title, priority]
      responses:
        "201":
          description: created
          content:
            application/json:
              schema:
                type: object
                properties:
                  ticket_id:
                    type: string
          links:
            GetCreatedTicket:
              operationId: getTicket
              parameters:
                ticket_id: "$response.body#/ticket_id"
  /tickets/{ticket_id}:
    get:
      operationId: getTicket
      summary: Get one ticket
      deprecated: true
      tags: [tickets]
      parameters:
        - in: path
          name: ticket_id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: ok

Evaluation & quality gates

Quality gateTarget
Classification3 operations normalized: GET /tickets and GET /tickets/{ticket_id} read, POST /tickets write
Dependency detectionexactly 1 auto-wired (high-confidence) dependency, from the explicit OpenAPI link; it cannot be reviewed (409)
Preview gatethe write draft is refused at preview (409) until allow_in_preview is set; the upstream's own request log shows no call for a refused preview
Role floorsa reviewer can preview (403 on publish); an editor can publish (403 on approve); only the reviewer role plus the platform approver scope can approve
Approval gatethe published write tool's workflow run pauses at waiting_approval and completes only after a second person approves and Resume is called
Reimport diffchanged_count 2, breaking_count 1 after the upstream's spec changes; the operation whose request body gained a required field is absent from "changed"
Developer notes & gotchas
  • Flags. CALIBER_FEATURE_INTEGRATIONS=true opens the OpenAPI Integrations page and API, shared with cookbook 05's MCP governance; CALIBER_FEATURE_COOKBOOKS=true is needed for the script's last (gallery) stage. Start with scripts/cookbook-env.sh up lab19 --flags integrations,cookbooks (the lab README has the full list of exports to make first).
  • Egress and the secret. The upstream runs on loopback, so CALIBER_EGRESS_ALLOWED_HOSTS=127.0.0.1 is required for import, preview and reimport to reach it. OPENAPI_TICKET_TOKEN must be the same literal value in both the upstream's environment and CALIBER's (the auth binding reads it as env://OPENAPI_TICKET_TOKEN).
  • Preview is not simulated. result is {status_code, text, json, headers} from a real outbound call; a non-2xx upstream response comes back as data, not as a thrown error.
  • Four different gates, easy to conflate. resource.execute gates preview; the strictly narrower resource.publish gates publish; resource.approve plus the platform approver scope (independent of either) gates approving a workflow run.
  • The trust boundary, honestly. The diff compares a fixed field set (summary, side-effect level, deprecated, auth, whether a body is required, content types, response statuses, tags) -- not which fields inside a body are required. A real breaking change can reimport clean; re-run a published tool's calibration after every reimport, not just the diff.
  • Run it. Start the upstream first: python3 docs-site/cookbooks/19-openapi-integration-governance-lab/assets/server/ticket_api.py 8781 &, then cd sdk/caliber-sdk && ../../caliber/.venv/bin/python -m examples.cookbooks.cookbook_19_openapi_integration_governance (about a minute; --cleanup archives what it created).

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.