Skip to main content

Patchr - the infrastructure for autonomous agents that need contracts, evidence trails, and human-safe handoffs.

Project description

Patchr

Patchr - the infrastructure for autonomous agents that need contracts, evidence trails, and human-safe handoffs.

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.2.tar.gz (366.6 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.2-py3-none-any.whl (316.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: patchr-0.1.2.tar.gz
  • Upload date:
  • Size: 366.6 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.2.tar.gz
Algorithm Hash digest
SHA256 a0f829af8023e6ec1d6a8acceaf74237eccec02a060574c71cfbb6c40a43ec10
MD5 95970bd5e6ff37302f241aaab543e9df
BLAKE2b-256 edaec4cbe69e81c2d41ed66015339c0eb5d9aee63b66b60535e587011a9bf4e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: patchr-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 316.1 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fa2deb2bf5da0ace444a67c2f8e8c4bd04a5ad756a5da07d5dfaaa7adf5b8cb0
MD5 119ee6439732f9c9a29b85c9ae41ba43
BLAKE2b-256 c62f6fc5eb456b4fdc5803284a9888316bcca91e226d9a60ec3a2ed7f2b384ed

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