1. Create a signing keypair
Generate an RSA (or EC) keypair. The private key signs tokens and never leaves your servers. The public key is what Patchwork uses to verify — it is not a secret.RS256, RS384, RS512, ES256, ES384, ES512, PS256, PS384, PS512. Symmetric (HS*) is rejected.
2. Publish your public key
Serve the public key as a JWKS document at a stable URL. Patchwork fetches and caches it, matching each token to a key bykid. Rotation is adding a new key alongside the old one.
name + base_url) and set workspace ingress: JWKS URI, allowed origins, request secret, mint URL. Allowed origins are required so the browser can call Patchwork — no wildcards.
3. Mint a session token
Add one endpoint to your backend, authenticated by your existing user session. It returns a short-lived JWT signed with your private key. Full claim reference: Session tokens.string
required
Your API key public id (
key_…), not the secret.string[]
required
Must include
patchwork. Include your own API audience as well so the same token can pass your tool middleware.string
required
The subject this token acts as. Opaque to Patchwork — compose it server-side from ids that never change.
uuid
Connection id this token may call. A UUID — not a name, not a URL. Required when the agent has unpinned customer tools.
integer
required
Unix timestamp. Keep it short — about 120 seconds. The browser remints as needed.
string
required
JWT header. Names the signing key so we match it in your JWKS.
4. Call Loom from the browser
202 with a run_id. Poll GET /v1/loom/runs/:id or subscribe to the thread channel — see Realtime.
5. Verify tool calls you host
Every call we make to your backend carries aPatchwork-Signature over your request secret, and — on a minted connection — a short-lived token for the subject. Verifying both is the same work in either integration mode, so it lives on its own page.
Signing and verification →
6. Confirm your setup
Press Test on the connection. We post a signed nonce to/patchwork/up and check for a proof only computable with the shared secret. Only verified means the trust is wired correctly — see the health endpoint.
React
@usepatchwork/react wraps the browser side. You provide url and a mint function that returns the session token. Optional connection pins the host.
useAgent gives you messages, threads, send, openThread, and newChat. See @usepatchwork/react for the full surface.