Skip to main content

Patchr Protocol infrastructure for agentic orchestration and settlement.

Project description

Patchr

Patchr is an SDK and hosted API for running agent workflows that need source-bound search, claim preparation, customer-service handoff, human calls, and settlement coordination.

Use it when your app needs to turn a user request such as "find a mechanic in Lekki", "prepare a damage claim", or "dispute this ticket" into a routed workflow with auditable JSON results and streaming status messages.

Install

pip install patchr
export PATCHR_API_BASE_URL="https://api.patchr.co"
export PATCHR_API_TOKEN="your_patchr_api_token"

Quick Start

from patchr.sdk import PatchrClient

patchr = PatchrClient.fromEnv()

run = patchr.runOrchestrator({
    "clientId": "support_ops_demo",
    "channel": "sdk",
    "conversationId": "conv_damage_claim_001",
    "request": "My newly purchased TV was damaged in transit and the merchant has not followed up.",
    "attachments": [
        {
            "name": "damaged-tv-photo.jpg",
            "mime": "image/jpeg",
            "text": "Cracked TV panel and damaged transport packaging."
        }
    ],
})

print(run["status"])
print(run["route"])

Typical response shape:

{
  "ok": true,
  "status": "ready",
  "route": ["resolve", "bridge"],
  "results": {
    "resolve": {
      "claimDraft": {
        "summary": "Damaged goods claim with attachment evidence"
      }
    },
    "bridge": {
      "contactPlan": {
        "primary": { "type": "merchantSupport" }
      }
    }
  }
}

Streaming Status

Use streaming when the workflow may take more than a few seconds. Patchr sends human-readable progress events during quiet periods and handoff events when work moves into a human-facing step.

for event in patchr.streamOrchestrator({
    "clientId": "local_services_demo",
    "channel": "sdk",
    "conversationId": "conv_lekki_mechanic_001",
    "request": "Find me a mechanic in Lekki, Lagos",
    "country": "NG",
    "stream": True,
}):
    if event.get("type") in {"progress", "handoff"}:
        print(event["message"])
    if event.get("type") == "final":
        print(event["result"]["status"])

Example stream events:

{"type":"progress","status":"running","elapsedSec":10.0,"message":"I am still checking source-bound options and marketplace or map evidence."}
{"type":"handoff","phase":"proxy","name":"mission.callAvailability","status":"calling","message":"Contacting the mechanic for availability."}

Common Scenarios

Shopping:

patchr.runOrchestrator({
    "clientId": "storefront_demo",
    "channel": "sdk",
    "conversationId": "conv_shopping_001",
    "request": "Buy used iPhone 12 in Sweden under 350 dollar",
    "country": "SE"
})

Local service with proxy call handoff:

patchr.runOrchestrator({
    "clientId": "local_services_demo",
    "channel": "sdk",
    "conversationId": "conv_mechanic_001",
    "request": "Find me a mechanic in Lekki, Lagos",
    "country": "NG"
})

Ticket dispute:

patchr.runOrchestrator({
    "clientId": "support_ops_demo",
    "channel": "sdk",
    "conversationId": "conv_ticket_dispute_001",
    "request": "Dispute ticket ZD-44291: airline charged me twice after cancellation and closed the refund case."
})

Property lead discovery:

patchr.runOrchestrator({
    "clientId": "property_demo",
    "channel": "sdk",
    "conversationId": "conv_property_001",
    "request": "Find abandoned properties to sell around Partille, Goteborg",
    "country": "SE"
})

Useful Methods

patchr.health()
patchr.manifest()
patchr.protocolMap()
patchr.runOrchestrator(payload)
patchr.streamOrchestrator(payload)
patchr.resumeOrchestrator(conversation_id, item_id, action, payload)
patchr.mapTool(payload)
patchr.nlpTool(payload)

Runtime Notes

  • Local-service searches such as mechanics, plumbers, clinics, and appointments route through map/place search and can trigger a PROXY handoff for availability calls.
  • Long-running workflows emit user-facing progress text so your client does not appear stuck.
  • Handoff events include plain messages such as "Contacting the mechanic for availability", "Calling the clinic to book your appointment", and "Preparing case documents".
  • Set PATCHR_API_TOKEN for hosted API calls. Local test transports can run in-process without network I/O.

More

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

patchr-0.1.1.tar.gz (366.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

patchr-0.1.1-py3-none-any.whl (316.0 kB view details)

Uploaded Python 3

File details

Details for the file patchr-0.1.1.tar.gz.

File metadata

  • Download URL: patchr-0.1.1.tar.gz
  • Upload date:
  • Size: 366.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for patchr-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0ee722c4a1e0f0725ec34e416f684c07325324cd4467838efc8a33befcbb3d41
MD5 fa073763e5a181bbf9dcabbb5d1f413e
BLAKE2b-256 22700c23db1600417e8f795a5280d8621995a3c82f47de997220e0c730d11d10

See more details on using hashes here.

File details

Details for the file patchr-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: patchr-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 316.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for patchr-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1e709a6f9a887ad61ad42703e09cc9c2dc5ef6978da9a89ec1693105bbf3885f
MD5 d4b9847ea7facfbde9d177c3d8aecb7e
BLAKE2b-256 924af605be1eb44333bd5845d2b94ccf39f648518414a822b403c5bfd2567316

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page