Dispute Resolution
From user complaint to sealed proof card
Your support queue receives a complaint. Currently a human reads it, emails back for screenshots, and manually decides whether to refund. Wrap the intake with Patchr: it builds an evidence map, identifies contradictions, packages a proof card, and returns a recommended action — all before the ticket reaches a human.
Agent route
Manual process, no audit trail, inconsistent outcomes.
// Before: manual, no audit trail
async function handleComplaint(ticket) {
const messages = await fetchTicketMessages(ticket.id);
// ❌ No evidence map — agent reads and decides manually
// ❌ No contradiction check
// ❌ No tamper-evident proof card
if (messages.some(m => m.text.includes("mismatch"))) {
await escalateToHuman(ticket.id);
}
}One SDK call. Evidence map, proof card, and recommended action returned.
import { PatchrClient } from "@patchr-core/sdk";
const patchr = PatchrClient.fromEnv();
async function handleComplaint(ticket) {
const run = await patchr.runOrchestrator({
clientId: "support-ops",
channel: "api",
conversationId: `conv_${ticket.id}`,
request: ticket.summary,
attachments: ticket.screenshots.map(url => ({
name: "evidence.jpg",
mime: "image/jpeg",
url,
})),
});
// ✅ Evidence map built, contradictions flagged
// ✅ Proof card sealed with confidence + open questions
// ✅ Recommended restraint: "escalateBeforeActing" | "proceedSafely"
console.log(run.status); // "ready" | "NEEDS_INPUT"
console.log(run.proofCard?.recommendedRestraint);
console.log(run.proofCard?.cite); // portable cite ref
}Same integration using the raw HTTP API with the httpx client.
import os, httpx
PATCHR_API = os.environ["PATCHR_API_BASE_URL"]
PATCHR_TOKEN = os.environ["PATCHR_API_TOKEN"]
def handle_complaint(ticket):
resp = httpx.post(
f"{PATCHR_API}/v1/orchestrator/run",
headers={"Authorization": f"Bearer {PATCHR_TOKEN}"},
json={
"clientId": "support-ops",
"channel": "api",
"conversationId": f"conv_{ticket['id']}",
"request": ticket["summary"],
"attachments": [
{"name": "evidence.jpg", "mime": "image/jpeg", "url": url}
for url in ticket.get("screenshots", [])
],
},
)
run = resp.json()
# ✅ Evidence map built, contradictions flagged
# ✅ Proof card sealed — cite ref portable across systems
print(run["status"])
print(run.get("proofCard", {}).get("recommendedRestraint"))
print(run.get("proofCard", {}).get("cite"))Output shape
A consistent proof card — every run.
Whether you run a dispute audit or an agent governance check, the output shape is identical. External systems — dashboards, decision ledgers, compliance tools — consume the same format regardless of which workflow produced it.
evidenceStatus — sourceBound | verified | partial
confidence — 0–1 score from the evidence map
recommendedRestraint — proceedSafely | proceedWithCaution | escalateBeforeActing
cite — portable proof ref for cross-system ledgers
Sample output
{
"status": "ready",
"route": ["resolve"],
"proofCard": {
"title": "Audit this disputed claim",
"evidenceStatus": "sourceBound",
"confidence": 0.74,
"openQuestions": ["contradictionsRequireReview"],
"recommendedRestraint": "escalateBeforeActing",
"cite": "patchr:proofCard:card_...#v1"
}
}Ready to run it?
Audit disputed claim ZD-44291: the seller name and payment instructions on the invoice do not match. Evidence includes a transaction screenshot and the policy document.