TyrPay Seller Skill
Use this skill when an agent needs to act as the seller in a TyrPay payment flow.
It assumes the runtime already has a configured SellerAgent, a readable settlement
contract, and access to the @tyrpay/seller-skill tool set.
Quick Start
- Install
@tyrpay/seller-skill,@tyrpay/seller-sdk, a storage adapter, and a zkTLS adapter. - Construct
SellerAgentwith a signer, settlement address, chain ID, storage adapter, and zkTLS adapter. - Register
createSellerTools({ agent, contract, verifierSignerAddress })with your tool-calling runtime. - Call
tyrpay_readybefore the first task workflow. - For 0G TeeTLS/TeeML work, call
tyrpay_discover_model_endpointwith the target model. - Use
tyrpay_accept_taskwhen you receive ataskIdfrom a buyer.
When To Use
- The agent is responsible for accepting and executing TyrPay tasks as a seller.
- The agent must produce zkTLS-backed proofs of upstream API calls.
- The agent needs structured task state that is safe to show to an end user.
- The seller workflow must remain non-blocking and recoverable after network interruptions.
- When using 0G TeeTLS, the seller can only commit to the actual endpoint and model resolved by the 0G TeeTLS adapter/service metadata. Do not commit to a generic upstream endpoint or different model name.
- When only the model is known, use
tyrpay_discover_model_endpointto find a reachable TeeTLS/TeeML endpoint before committing.
Workflow
- Run
tyrpay_readyto verify signer access and storage adapter connectivity. - For 0G TeeTLS/TeeML, call
tyrpay_discover_model_endpointand keep the recommended endpoint. - When a buyer shares a
taskId, calltyrpay_accept_taskwith your execution terms. - Wait for the buyer to fund the task (poll with
tyrpay_check_settlement). - Once funded, call
tyrpay_execute_taskfor each required upstream API call. - Collect the returned receipts and call
tyrpay_submit_proofwith the full set. - Use
tyrpay_check_settlementto monitor whether verification released payment.
Tooling Notes
- All tools reject malformed inputs with structured
SellerSkillToolErrorerrors. tyrpay_accept_taskreads the on-chain task to derive buyer and verifier addresses.verifierSignerAddressis the registry-authorized verifier signer embedded intoExecutionCommitment.verifier; it is not a settlement contract, verifier registry, service URL, or verifier service contract address.- The readable settlement contract must expose
getTask(bytes32)with the currentTyrPaySettlement.Taskfield order:taskId,taskNonce,buyer,seller,token,amount,deadlineMs,requiredMinUsage,requiredModelsHash,commitmentHash,commitmentURI,fundedAtMs,proofBundleHash,proofBundleURI,proofSubmittedAtMs,reportHash,settledAtMs,refundedAtMs,status. tyrpay_execute_taskrequires thecommitmentobject returned bytyrpay_accept_task.tyrpay_submit_proofrequires all receipts collected fromtyrpay_execute_taskcalls.- For provider
"0g-teetls",commitment.target.host/pathmust match the resolved 0G endpoint,methodmust bePOST, andallowedModelsmust include the model returned by 0G service metadata. Forward the recommendedproviderOptionsfromtyrpay_discover_model_endpointtotyrpay_execute_task. - Seller-facing statuses include
PAIDon successful settlement andNOT_PAID_REFUNDEDon refund.
Failure Diagnosis
- If the task exists, seller address matches, and buyer has funded but status or
commitment fields look wrong, first inspect the ABI used for
getTask(). A stale ABI or positional mapping can shift fields and make seller-skill parsecommitmentHash, timestamps, orstatusfrom the wrong slot. - Do not use
MemoryStorageAdapterfor a real multi-party flow. It returnsmemory://URIs that only the same JavaScript process can read. Buyer and verifier processes need persistent shared storage such as 0G, IPFS, or HTTP. - A commitment hash mismatch means the full canonical
ExecutionCommitmentobject is different from the object originally submitted. Chain data alone is insufficient to reconstruct it; fetch it fromcommitmentURIor ask the creator for the exact object. ReclaimZkTlsAdapterneeds@reclaimprotocol/zk-fetch,@reclaimprotocol/js-sdk, credentials, and downloaded zk resources. Install those optional peer dependencies in the runtime that constructs the adapter. Windows runtimes must keep Reclaim TEE mode disabled.
Resources
references/tool-reference.mdfor the tool contract and status model.
