worker.md SPEC
Menu

API Breaking Change Detector

API Breaking Change Detector is a reference AI Worker specification designed for reliable, bounded task execution.

Reference worker specification for comparing OpenAPI 3.x specifications and detecting breaking endpoint or schema mutations.

Pricing & Service Level Agreement (SLA)#

Specification Value Target Policy
Invocation Price $0.02 / run (Proposed) Billed per successful schema-validated output.
Payment Methods Stripe Metered • USDC (Base L2) Dual-rail support for teams and autonomous AI agents.
Execution Latency SLA < 12s (Target) Target deadline enforced by runtime deadline timer.
Max Token Budget $0.025 (Ceiling) Hardware token ceiling prevents runaway billing loops.
Benchmark Pass Rate Target: 100% Breaking Change Recall Target evaluation benchmark pass rate on test fixtures.
Web3 Wallet Address 0x89D24A6b4CcB1B6fAA2625fE562bDD9a23260359 Direct on-chain recipient for autonomous HTTP 402 micro-txs.

worker.md Contract#

The formal execution contract defining inputs, outputs, limits, and runtime instructions:

---
name: api-breaking-change-detector
version: 1.0.0
description: Compares old and new OpenAPI (Swagger) or JSON schemas to detect breaking API changes, removed endpoints, stricter constraints, or mutated data types.
category: developer-tooling
author: worker.md community
license: MIT
pricing:
  model: per-invocation
  rate_usd: 0.02
  payment_methods:
    - type: stripe_metered
      plan_id: "price_api_diff_metered_002"
    - type: crypto_micropayment
      network: base
      token: USDC
      wallet: "0x89D24A6b4CcB1B6fAA2625fE562bDD9a23260359"
      http_status_protocol: 402
sla:
  timeout_seconds: 12
  max_cost_usd: 0.025
  concurrency: 80
  eval_accuracy: 100.0%
inputs:
  old_spec:
    type: string
    required: true
    description: Baseline OpenAPI specification (JSON or YAML).
  new_spec:
    type: string
    required: true
    description: Proposed new OpenAPI specification (JSON or YAML).
  allow_deprecated:
    type: boolean
    required: false
    default: true
    description: Whether deprecating a field without removing it is treated as non-breaking.
outputs:
  has_breaking_changes:
    type: boolean
    description: True if any breaking changes were identified.
  summary:
    type: string
    description: Markdown changelog summary suitable for PR description.
  breaking_changes:
    type: array
    description: List of breaking alterations with HTTP path, method, and violation type.
  non_breaking_changes:
    type: array
    description: Additive or backward-compatible improvements.
constraints:
  timeout_ms: 12000
  max_cost_usd: 0.025
  allowed_tools: [openapi-diff]
  temperature: 0.0
---

# API Breaking Change Detector Worker

You are an API contract verification worker. You evaluate proposed schema changes against semantic versioning and client compatibility rules.

## Breaking Change Rules
1. **Endpoint Removal:** Deleting any previously available path or HTTP method.
2. **Required Request Fields:** Adding a new required parameter or request body field without a default.
3. **Response Schema Mutation:** Removing a field from an HTTP 200 response, or changing its type (e.g. integer to string).
4. **Enum Restriction:** Removing allowed values from an enum in request bodies.
5. **Stricter Validation:** Decreasing maxLength, maxItems, or increasing minimum values on inputs.

Integration Code Examples#

Test and run this worker with schema-compliant payloads:

1. CLI Runner (Local Execution)

npx worker-md run workers/api-breaking-change-detector/WORKER.md \
  --input '{"old_spec":"{\"openapi\":\"3.0.0\",\"paths\":{\"/users\":{\"get\":{\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"user_id\":{\"type\":\"string\"}}}}}}}}}}","new_spec":"{\"openapi\":\"3.0.0\",\"paths\":{\"/users\":{\"get\":{\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{}}}}}}}}}}","allow_deprecated":true}'

2. HTTP Gateway (Stripe API Key)

curl -X POST https://gateway.worker.md/v1/workers/api-breaking-change-detector/invoke \
  -H "Authorization: Bearer wk_live_testkey123" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "old_spec": "{\"openapi\":\"3.0.0\",\"paths\":{\"/users\":{\"get\":{\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"user_id\":{\"type\":\"string\"}}}}}}}}}}",
    "new_spec": "{\"openapi\":\"3.0.0\",\"paths\":{\"/users\":{\"get\":{\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{}}}}}}}}}}",
    "allow_deprecated": true
  }
}'

3. Autonomous Agent (HTTP 402 with Base USDC)

curl -X POST https://gateway.worker.md/v1/workers/api-breaking-change-detector/invoke \
  -H "Authorization: X402-Tx 0x4a8f9c2d1e0b5a...txhash" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "old_spec": "{\"openapi\":\"3.0.0\",\"paths\":{\"/users\":{\"get\":{\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"user_id\":{\"type\":\"string\"}}}}}}}}}}",
    "new_spec": "{\"openapi\":\"3.0.0\",\"paths\":{\"/users\":{\"get\":{\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{}}}}}}}}}}",
    "allow_deprecated": true
  }
}'

4. Python (FastAPI / LangGraph)

import httpx

async def invoke_api_breaking_change_detector() -> dict:
    payload = {
    "old_spec": "{\"openapi\":\"3.0.0\",\"paths\":{\"/users\":{\"get\":{\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"user_id\":{\"type\":\"string\"}}}}}}}}}}",
    "new_spec": "{\"openapi\":\"3.0.0\",\"paths\":{\"/users\":{\"get\":{\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{}}}}}}}}}}",
    "allow_deprecated": true
}
    async with httpx.AsyncClient() as client:
        response = await client.post(
            "https://gateway.worker.md/v1/workers/api-breaking-change-detector/invoke",
            headers={"Authorization": "Bearer wk_live_testkey123"},
            json={"inputs": payload},
            timeout=25.0
        )
        response.raise_for_status()
        return response.json()["outputs"]

Evaluation Fixtures & Benchmark Data#

Audit fixtures used to evaluate this worker specification:

{
  "suite": "api-breaking-change-benchmark",
  "version": "1.0.0",
  "target_accuracy": 1.0,
  "fixtures": [
    {
      "id": "removed-response-field",
      "description": "Removing user_id field from response payload",
      "input": {
        "old_spec": "{\"paths\": {\"/users\": {\"get\": {\"responses\": {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"type\": \"object\", \"properties\": {\"user_id\": {\"type\": \"string\"}, \"email\": {\"type\": \"string\"}}}}}}}}}}}",
        "new_spec": "{\"paths\": {\"/users\": {\"get\": {\"responses\": {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"type\": \"object\", \"properties\": {\"email\": {\"type\": \"string\"}}}}}}}}}}}"
      },
      "expected": {
        "has_breaking_changes": true,
        "breaking_changes_count": 1,
        "change_type": "REMOVED_RESPONSE_PROPERTY"
      }
    }
  ]
}

See also#

FAQ#

How do I invoke API Breaking Change Detector in my own pipeline?

You can invoke the worker package directly using the local CLI ('npx worker-md run workers/api-breaking-change-detector/WORKER.md --input ...') or deploy it to a private container gateway.

How does an autonomous agent pay via crypto?

An autonomous agent receives an HTTP 402 Payment Required response from the gateway, transfers 0.02 USDC to 0x89D24A6b4CcB1B6fAA2625fE562bDD9a23260359 on Base, and provides the transaction authorization header to execute.

How are timeout and cost constraints enforced?

The WORKER.md file declares the target limits (< 12s (Target), $0.025 (Ceiling)). The runtime execution harness enforces them with active process timers and token quotas.