PeaqosClient via client.orchestration. Flat methods, sync, snake_case, frozen-slotted dataclasses.
Setup
client.orchestration without orchestration_url raises OrchestrationConfigError.
Configuration
Constructor kwargs
Env vars (via PeaqosClient.from_env())
Transport constants:
User-Agent: peaqos-sdk-py/<version>. Per-method timeout overrides are not exposed on public methods.
Envelopes
204 No Content returns None. validate_list_limit rejects limit < 1 or limit > 500 with OrchestrationValidationError.
Machines
Machine shape:
Machine agents
enroll_machine_agent returns ItemResponse[MachineAgent]. The server sends the one-time token as agentToken, and the Python SDK maps item.provisioning_token from a provisioning_token key that the server does not send, so it comes back None. To capture the token, call POST /machines/:machineId/agents/enrollment directly (see the orchestration API) and read item.agentToken. machine_agent_heartbeat uses no auth header: agent_token rides in the JSON body.
Machine identity challenges
did:peaq:0x... or peaqos:machine:<id> identity reference. The DID controller signs item.message with EIP-191 personal_sign and submits the resulting {challengeId, signature} as identity_proof when creating or updating the machine record.
Agent pairings
create_agent_pairing_challengereturns a server-issued challenge keyed toagent_address,agent_provider,agent_role, and optionalagent_did.- The
item.message(EIP-191) with the key behindagent_address. create_agent_pairingaccepts the proof inparams.agent_proofand returns the pairing with a signed HS256 session JWT inpairing_token. The token is returned once at create.create_agent_pairing_sessionrotates the session token before expiry with a fresh proof. Required after anyupdate_agent_pairingto the , since policy changes invalidate the current token’sdelegation_policy_hash.
pairing_token exactly once each. AgentPairing.__repr__ redacts the token to keep it out of logs.
CreateAgentPairingRequest requires agent_proof: AgentProofInput and accepts an optional agent_did. delegation_policy carries service-level allow/deny lists (allowed_service_ids, denied_service_ids) next to the skill-level ones.
Runtime endpoints
upsert_runtime_endpoint validates that endpoint_base_url parses as http/https with a non-empty host. auth_token is treated as a secret in error redaction.
Skills
Market services
Market search
search_market uses x-agent-pairing-token auth: the token rides as the second argument and is sent per call. get_market_search uses platform auth.
Market orders
list_market_orders and get_market_order use platform auth; the four mutating calls require the agent’s pairing_token.
execute_market_order returns execution.run and execution.outcome for a native run (execution.status_code == 200). When the order resolves to an external handoff the server answers 202, the order moves to handoff, and the call raises OrchestrationApiError with code INVALID_RESPONSE_SHAPE. Catch it and read the handoff from the order: once client.orchestration.get_market_order(order_id).item.status == "handoff", item.handoff carries label, url and notes.
For x402-rail services, sign_x402_payment signs the provider challenge from create_payment_intent locally, submit_x402_payment_proof records the signature, and the same signature goes on ExecuteMarketOrderRequest.payment (X402ExecutePayment).
Payment settlement
submit_payment_proof accepts both EVM and Solana proof shapes; verification_mode is "recorded" | "rpc". RPC verification cross-checks the ERC-20 Transfer log against expected token, payer_address, payee_address, and amount.
Pagination
Six sync auto-paginated iterators:*_all accepts the same filter kwargs as its non-iterator counterpart, minus cursor. limit controls page size; cursor is managed internally.
For manual pagination, the underlying list_* methods accept cursor and limit as keyword-only args:
MarketSearch:
Policies
Cross-cutting policy records above and beyond a pairing’s delegation policy. Platform auth.get_policy method. Fetch policies with list_policies.
Observability
check_health requests /api/v1/health, which returns 404 on the hosted orchestrator: the health route is GET /health at the host root, so call it over HTTP. list_audit_events sends machine_id, but the server ignores it and filters only on type, resourceType and resourceId; filter the returned events by machine yourself.
HTTP-only endpoints
These endpoints exist on the HTTP API (see Machine Markets API: Orchestration) and have no SDK method. Call them over HTTP:- Tasks: create, list, get, discover, resolve, execute
- Graph: read a machine graph, create/update/delete nodes and edges
- Policies: get a single policy
- Runs: list runs, get a run
Errors
All extendpeaq_os_sdk.exceptions.base.PeaqosError:
CommonErrorCode literal: AUTH_REQUIRED, AUTH_INVALID, AGENT_AUTH_REQUIRED, AGENT_AUTH_INVALID, AGENT_AUTH_EXPIRED, VALIDATION_ERROR, NOT_FOUND, MACHINE_NOT_ACTIVE, MACHINE_NOT_ACTIVATED, MACHINE_IDENTITY_EXISTS, MACHINE_IDENTITY_IMMUTABLE, MACHINE_IDENTITY_PROOF_REQUIRED, MACHINE_IDENTITY_PROOF_INVALID, MACHINE_IDENTITY_PROOF_EXPIRED, PEAQOS_IDENTITY_UNAVAILABLE, AGENT_PAIRING_PROOF_REQUIRED, AGENT_PAIRING_PROOF_INVALID, AGENT_PAIRING_PROOF_EXPIRED, AGENT_PAIRING_UNAVAILABLE, AGENT_PAIRING_REQUIRED, AGENT_PAIRING_INACTIVE, AGENT_POLICY_DENIED, AGENT_SPEND_LIMIT_EXCEEDED, AGENT_DAILY_LIMIT_EXCEEDED, QUOTE_EXPIRED, ORDER_CLOSED, ORDER_NOT_DELIVERED, EXECUTION_UNSUPPORTED, PAYMENT_REQUIRED, PAYMENT_RPC_REQUIRED, PAYMENT_RPC_ERROR, PAYMENT_NOT_MINED, PAYMENT_TX_FAILED, PAYMENT_TRANSFER_NOT_FOUND.
Proof and credential types:
MarketPaymentRailType literal: "not-required", "wallet", "xvv42", "x402", "vault-stripe", "escrow", "offchain-record", "external", "onchain-escrow", "wdk-usdt-transfer".
The transport synthesises BAD_RESPONSE (non-JSON body) and INVALID_RESPONSE_SHAPE (envelope mismatch) when the server response is malformed.
Sync vs async
Sync only. Every public function is plaindef over requests.Session. The transport reuses client.session, so you can wrap retries externally.
Credential handling
- Platform (
x-api-key): set once on the client viaapi_key, sent on every call by default. - Agent pairing (
x-agent-pairing-token): passed per call as the last argument tosearch_market, the order mutations, and the payment mutations. The SDK does not store or rotate it. - None: used only by
machine_agent_heartbeat(token rides in the body).
_sanitize_body redacts any field whose name contains token, key, secret, password, credential, or auth (case-insensitive) before attaching the body to an error.

