Agent SDK quickstart
Register an agent and submit a signed payment intent. Three ways: TypeScript, Python, or curl + openssl.
SDKs not published yet
@sorenpay/agent-sdk and sorenpay-agent-sdk aren't on npm or PyPI yet, so
the install commands below don't work today. Use curl + openssl, or ask
support@sorenpay.com for a copy. The SDK clients also default to a base URL
that doesn't resolve: pass https://sorenpay.com as the base URL.
TypeScript
Installbash
npm install @sorenpay/agent-sdkquickstart.tstypescript
import { SorenAgent } from "@sorenpay/agent-sdk";
const soren = new SorenAgent({
apiKey: process.env.SOREN_API_KEY!, // apk_…
baseUrl: "https://sorenpay.com",
});
// 1. Register (generates Ed25519 keypair locally; returns the private key ONCE)
const { agent, privateKeyPem } = await soren.register({
agentName: "research-assistant",
protocols: ["TAP", "MPP", "ACP"],
});
// → persist privateKeyPem to your secret store
// 2. Sign + submit a payment intent
const result = await soren.submitIntent({
agentId: agent.id,
privateKeyPem,
merchant: { name: "OpenAI API", mcc: "5734" },
amount: { currency: "USD", cents: 1500 },
protocol: "TAP",
ttlSeconds: 300,
});
console.log(result);
// → { accepted: true, log_id: "…", intent_id: "…", next: { message: "…" } }Python
Installbash
pip install sorenpay-agent-sdkquickstart.pypython
import os
from sorenpay_agent import SorenAgent
soren = SorenAgent(api_key=os.environ["SOREN_API_KEY"], base_url="https://sorenpay.com")
# 1. Register (generates Ed25519 locally)
register = soren.register(
agent_name="research-assistant",
protocols=["TAP", "MPP", "ACP"],
)
# → persist register.private_key_pem to your secret store
# 2. Sign + submit
result = soren.submit_intent(
agent_id=register.agent.id,
private_key_pem=register.private_key_pem,
merchant={"name": "OpenAI API", "mcc": "5734"},
amount={"currency": "USD", "cents": 1500},
protocol="TAP",
ttl_seconds=300,
)
print(result)curl and openssl (no SDK)
Generate Ed25519 keypairbash
openssl genpkey -algorithm Ed25519 -out agent.key
openssl pkey -in agent.key -pubout -out agent.pubRegister the agentbash
PUBKEY=$(cat agent.pub | tr -d '\n')
curl -X POST https://sorenpay.com/api/agents \
-H "Authorization: Bearer $SOREN_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"agentName\": \"research-assistant\",
\"protocols\": [\"TAP\", \"MPP\", \"ACP\"],
\"publicKeyPem\": \"$PUBKEY\"
}"Signing the canonical JSON is the fiddly part — use one of the SDKs unless you have to. The signing step requires:
- Sort all keys recursively
- Strip whitespace
- Sign with Ed25519 one-shot (
crypto.sign(null, …)in Node) - Base64url-encode the signature
Error codes
| HTTP | Code | What |
|---|---|---|
| 401 | signature_invalid | The signature doesn't check out. reason says why: bad_signature, kid_mismatch, intent_expired or intent_iat_future |
| 422 | intent_replay | Duplicate intent_id |
| 403 | kyb_required | Registering an agent while the request is live and the workspace's business verification isn't approved |
| 429 | rate_limited | More than 100 requests a minute on one key. Wait for Retry-After |
Next
- Protocols — TAP / MPP / ACP wire format
- API reference — every payload field
- Use case: AI agents pay for APIs — end-to-end production setup