{
  "$schema": "runback.audit/v2",
  "manifest": {
    "run_id": "sbx-billing-66e9193a1ed8",
    "generated_at": "2026-11-07T07:36:10.259Z",
    "event_count": 6,
    "algorithm": "sha256-chain",
    "content_digest": "5abde1b347d06affb8effd545853e360dabb2a2b9346404978bfeaaf8609413a",
    "replay": {
      "cassette_digest": "311435e0efa492b1f0c06c85deb0852eeef9bc432b9e63e1e61ed59f9beb19a7",
      "entry_count": 4,
      "algorithm": "oracle-chain/sha256",
      "note": "The run's oracle stream — every model response and tool output, hash-chained. Re-execute the agent against `events` with @runback/replay and the cassette digest must reproduce. This is proof the recording IS the deterministic input stream of the run — an audit you can re-run, not just read."
    },
    "signed": true,
    "signature": {
      "alg": "Ed25519",
      "value": "a8f7cfec409429336181c565c03efb6cf060f59bbd8c8d1f13ea0f6a4085fd7982025a22afff0afa21c94975803e8e75607f698c06a17e9998c50fe91e70b201",
      "pubkey": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEArDPmR+Gvu1HawnSvM6xjZao7BVPPQ80Qq3sa1hAYvDU=\n-----END PUBLIC KEY-----\n"
    },
    "verify": "Recompute the event chain h_i = SHA-256(h_{i-1} + canonical(event_i)) over `events` → must equal content_digest. Recompute the oracle-stream digest from `events` → must equal replay.cassette_digest. The signature covers `${content_digest}:${cassette_digest}`. Ed25519: verify with the public key embedded in manifest.signature.pubkey (no server key needed — fully offline-verifiable). HMAC-SHA256 (legacy): requires AUDIT_SIGNING_KEY. POST this record to /api/audit/verify.",
    "spec_url": "https://runback.dev/spec",
    "verifier_url": "https://runback.dev/verify"
  },
  "run": {
    "run_id": "sbx-billing-66e9193a1ed8",
    "name": "billing-agent",
    "status": "error",
    "input": "Invoice INV-75251 for customer #4559 is 23 days overdue. Collect it.",
    "output": {
      "awaiting_approval": "949f2e27-61ee-4f5e-be82-ba877036d37d"
    },
    "error": {
      "name": "ApprovalRequired",
      "message": "charge_card is waiting for a person to approve it; the sandbox agent stopped here."
    },
    "metadata": {
      "agent": {
        "description": "Charges overdue invoices. Runback demo agent: real model calls and real policy decisions; its tools act on a sandbox of synthetic customers, orders and accounts.",
        "systemOfRecord": "Runback demo sandbox (synthetic data)"
      },
      "model": "gpt-4o-mini",
      "demo_agent": true,
      "est_cost_usd": 0.00014,
      "sandbox_tools": true,
      "scenario_seed": "billing-agent:2026-11-05:113"
    },
    "step_count": 2,
    "total_tokens": 778,
    "started_at": "2026-11-05T21:11:07.358+00:00",
    "ended_at": "2026-11-05T21:11:09.72+00:00",
    "actor_type": null,
    "actor_id": null
  },
  "events": [
    {
      "seq": 0,
      "name": "billing-agent",
      "type": "run",
      "error": null,
      "input": "Invoice INV-75251 for customer #4559 is 23 days overdue. Collect it.",
      "phase": "start",
      "output": null,
      "run_id": "sbx-billing-66e9193a1ed8",
      "status": "running",
      "ts_end": "2026-11-05T21:11:09.720Z",
      "span_id": "r",
      "metadata": {
        "agent": {
          "description": "Charges overdue invoices. Runback demo agent: real model calls and real policy decisions; its tools act on a sandbox of synthetic customers, orders and accounts.",
          "systemOfRecord": "Runback demo sandbox (synthetic data)"
        },
        "model": "gpt-4o-mini",
        "demo_agent": true,
        "est_cost_usd": 0.00014,
        "sandbox_tools": true,
        "scenario_seed": "billing-agent:2026-11-05:113"
      },
      "ts_start": "2026-11-05T21:11:07.358Z",
      "parent_span_id": null,
      "schema_version": 1,
      "_hash": "500be47409d2a7d051ce232aafc123e46a37c1f0d7520721c77142f0504a0bb4"
    },
    {
      "seq": 1,
      "type": "llm",
      "error": null,
      "model": {
        "model_id": "gpt-4o-mini",
        "provider": "openai"
      },
      "usage": {
        "input_tokens": 333,
        "total_tokens": 352,
        "output_tokens": 19
      },
      "run_id": "sbx-billing-66e9193a1ed8",
      "ts_end": "2026-11-05T21:11:08.557Z",
      "request": {
        "tools": [
          {
            "name": "get_invoice",
            "parameters": {
              "type": "object",
              "required": [
                "invoice_id"
              ],
              "properties": {
                "invoice_id": {
                  "type": "string",
                  "description": "Invoice id, e.g. INV-12345"
                }
              },
              "additionalProperties": false
            },
            "description": "Fetch an invoice and the customer's card status."
          },
          {
            "name": "charge_card",
            "parameters": {
              "type": "object",
              "required": [
                "customer_id",
                "invoice_id",
                "amount"
              ],
              "properties": {
                "amount": {
                  "type": "number",
                  "description": "Amount in AUD"
                },
                "invoice_id": {
                  "type": "string",
                  "description": "Invoice id"
                },
                "customer_id": {
                  "type": "number",
                  "description": "Customer id"
                }
              },
              "additionalProperties": false
            },
            "description": "Charge the card on file for an invoice, in AUD."
          },
          {
            "name": "send_payment_reminder",
            "parameters": {
              "type": "object",
              "required": [
                "customer_id",
                "invoice_id"
              ],
              "properties": {
                "invoice_id": {
                  "type": "string",
                  "description": "Invoice id"
                },
                "customer_id": {
                  "type": "number",
                  "description": "Customer id"
                }
              },
              "additionalProperties": false
            },
            "description": "Email the customer a reminder to update their payment details."
          },
          {
            "name": "handoff_notify_customer",
            "parameters": {
              "type": "object",
              "required": [
                "customer_id",
                "message"
              ],
              "properties": {
                "message": {
                  "type": "string",
                  "description": "What the customer needs to be told"
                },
                "customer_id": {
                  "type": "number",
                  "description": "Customer id"
                }
              },
              "additionalProperties": false
            },
            "description": "Hand the customer message to the notification agent, which runs as its own agent and picks SMS or email from the customer's contact preferences."
          }
        ],
        "params": {
          "temperature": 0,
          "max_output_tokens": 500
        },
        "system": "You are Acme's billing agent. You are running in Runback's public demo sandbox: every customer, order, invoice and account is synthetic, and your tools act on test data only. Collect overdue invoices: check the invoice, charge the card on file when it is valid, and when it is not, make sure the customer is told — a payment reminder email, or the notification agent, which knows their SMS and email preferences. Use the tools to act; when you are done, reply with a one-sentence summary of what you did.",
        "messages": [
          {
            "role": "user",
            "content": "Invoice INV-75251 for customer #4559 is 23 days overdue. Collect it."
          }
        ]
      },
      "span_id": "l1",
      "response": {
        "text": null,
        "reasoning": null,
        "tool_calls": [
          {
            "input": {
              "invoice_id": "INV-75251"
            },
            "tool_name": "get_invoice",
            "tool_call_id": "call_oLJkl75mhmi1gfkwgWYj6fdv"
          }
        ],
        "finish_reason": "tool-calls"
      },
      "ts_start": "2026-11-05T21:11:07.358Z",
      "latency_ms": 1199,
      "parent_span_id": "r",
      "schema_version": 1,
      "_hash": "d1aa2170ea7cbb94e2a851b8715e685a6dda451ba4a1c256e5a31025e70020af"
    },
    {
      "seq": 2,
      "type": "tool",
      "error": null,
      "input": {
        "invoice_id": "INV-75251"
      },
      "output": {
        "amount_aud": 3094.09,
        "invoice_id": "INV-75251",
        "customer_id": 4559,
        "card_on_file": "valid",
        "days_overdue": 23
      },
      "run_id": "sbx-billing-66e9193a1ed8",
      "ts_end": "2026-11-05T21:11:08.578Z",
      "span_id": "t1",
      "ts_start": "2026-11-05T21:11:08.557Z",
      "tool_name": "get_invoice",
      "latency_ms": 21,
      "tool_call_id": "call_oLJkl75mhmi1gfkwgWYj6fdv",
      "parent_span_id": "l1",
      "schema_version": 1,
      "policy_evaluated": {
        "passed": true
      },
      "_hash": "7879c13a10a02d2f88497bf423af6f8170ec3434dd4fe45dd11bae4c84b0fcfc"
    },
    {
      "seq": 3,
      "type": "llm",
      "error": null,
      "model": {
        "model_id": "gpt-4o-mini",
        "provider": "openai"
      },
      "usage": {
        "input_tokens": 393,
        "total_tokens": 426,
        "output_tokens": 33
      },
      "run_id": "sbx-billing-66e9193a1ed8",
      "ts_end": "2026-11-05T21:11:09.624Z",
      "request": {
        "tools": [
          {
            "name": "get_invoice",
            "parameters": {
              "type": "object",
              "required": [
                "invoice_id"
              ],
              "properties": {
                "invoice_id": {
                  "type": "string",
                  "description": "Invoice id, e.g. INV-12345"
                }
              },
              "additionalProperties": false
            },
            "description": "Fetch an invoice and the customer's card status."
          },
          {
            "name": "charge_card",
            "parameters": {
              "type": "object",
              "required": [
                "customer_id",
                "invoice_id",
                "amount"
              ],
              "properties": {
                "amount": {
                  "type": "number",
                  "description": "Amount in AUD"
                },
                "invoice_id": {
                  "type": "string",
                  "description": "Invoice id"
                },
                "customer_id": {
                  "type": "number",
                  "description": "Customer id"
                }
              },
              "additionalProperties": false
            },
            "description": "Charge the card on file for an invoice, in AUD."
          },
          {
            "name": "send_payment_reminder",
            "parameters": {
              "type": "object",
              "required": [
                "customer_id",
                "invoice_id"
              ],
              "properties": {
                "invoice_id": {
                  "type": "string",
                  "description": "Invoice id"
                },
                "customer_id": {
                  "type": "number",
                  "description": "Customer id"
                }
              },
              "additionalProperties": false
            },
            "description": "Email the customer a reminder to update their payment details."
          },
          {
            "name": "handoff_notify_customer",
            "parameters": {
              "type": "object",
              "required": [
                "customer_id",
                "message"
              ],
              "properties": {
                "message": {
                  "type": "string",
                  "description": "What the customer needs to be told"
                },
                "customer_id": {
                  "type": "number",
                  "description": "Customer id"
                }
              },
              "additionalProperties": false
            },
            "description": "Hand the customer message to the notification agent, which runs as its own agent and picks SMS or email from the customer's contact preferences."
          }
        ],
        "params": {
          "temperature": 0,
          "max_output_tokens": 500
        },
        "system": "You are Acme's billing agent. You are running in Runback's public demo sandbox: every customer, order, invoice and account is synthetic, and your tools act on test data only. Collect overdue invoices: check the invoice, charge the card on file when it is valid, and when it is not, make sure the customer is told — a payment reminder email, or the notification agent, which knows their SMS and email preferences. Use the tools to act; when you are done, reply with a one-sentence summary of what you did.",
        "messages": [
          {
            "role": "user",
            "content": "Invoice INV-75251 for customer #4559 is 23 days overdue. Collect it."
          },
          {
            "role": "assistant",
            "content": [
              {
                "type": "tool-call",
                "input": {
                  "invoice_id": "INV-75251"
                },
                "toolName": "get_invoice",
                "toolCallId": "call_oLJkl75mhmi1gfkwgWYj6fdv"
              }
            ]
          },
          {
            "role": "tool",
            "content": [
              {
                "type": "tool-result",
                "output": {
                  "type": "json",
                  "value": {
                    "amount_aud": 3094.09,
                    "invoice_id": "INV-75251",
                    "customer_id": 4559,
                    "card_on_file": "valid",
                    "days_overdue": 23
                  }
                },
                "toolName": "get_invoice",
                "toolCallId": "call_oLJkl75mhmi1gfkwgWYj6fdv"
              }
            ]
          }
        ]
      },
      "span_id": "l2",
      "response": {
        "text": null,
        "reasoning": null,
        "tool_calls": [
          {
            "input": {
              "amount": 3094.09,
              "invoice_id": "INV-75251",
              "customer_id": 4559
            },
            "tool_name": "charge_card",
            "tool_call_id": "call_l83pdup34I8OG8O3OICEehYp"
          }
        ],
        "finish_reason": "tool-calls"
      },
      "ts_start": "2026-11-05T21:11:08.578Z",
      "latency_ms": 1046,
      "parent_span_id": "r",
      "schema_version": 1,
      "_hash": "7756c6c1ea74c2e4ca3bbd9c942573fd4d4e3a294ab0c5068aea6b341daeaed2"
    },
    {
      "seq": 4,
      "type": "tool",
      "error": {
        "name": "ApprovalRequired",
        "message": "must not (charge_card.amount gt 2000) — violated — held for approval 949f2e27-61ee-4f5e-be82-ba877036d37d"
      },
      "input": {
        "amount": 3094.09,
        "invoice_id": "INV-75251",
        "customer_id": 4559
      },
      "output": null,
      "run_id": "sbx-billing-66e9193a1ed8",
      "ts_end": "2026-11-05T21:11:09.719Z",
      "span_id": "t2",
      "metadata": {
        "approval_id": "949f2e27-61ee-4f5e-be82-ba877036d37d"
      },
      "ts_start": "2026-11-05T21:11:09.624Z",
      "tool_name": "charge_card",
      "latency_ms": 95,
      "policy_block": {
        "rule": "charge-over-a2000-needs-approval",
        "detail": "must not (charge_card.amount gt 2000) — violated — held for approval 949f2e27-61ee-4f5e-be82-ba877036d37d"
      },
      "tool_call_id": "call_l83pdup34I8OG8O3OICEehYp",
      "parent_span_id": "l2",
      "schema_version": 1,
      "policy_evaluated": {
        "passed": false
      },
      "_hash": "7399aef7de1976730e3aa135448f001d6ed0339b8bf7da22aeba587718d02a8e"
    },
    {
      "seq": 5,
      "name": "billing-agent",
      "type": "run",
      "error": {
        "name": "ApprovalRequired",
        "message": "charge_card is waiting for a person to approve it; the sandbox agent stopped here."
      },
      "input": null,
      "phase": "end",
      "output": {
        "awaiting_approval": "949f2e27-61ee-4f5e-be82-ba877036d37d"
      },
      "run_id": "sbx-billing-66e9193a1ed8",
      "status": "error",
      "ts_end": "2026-11-05T21:11:09.720Z",
      "span_id": "re",
      "metadata": {
        "demo_agent": true,
        "sandbox_tools": true
      },
      "ts_start": "2026-11-05T21:11:09.720Z",
      "parent_span_id": null,
      "schema_version": 1,
      "_hash": "5abde1b347d06affb8effd545853e360dabb2a2b9346404978bfeaaf8609413a"
    }
  ]
}