Skip to main content
The Python exposes the Machine Markets API on the existing PeaqosClient via client.orchestration. Flat methods, sync, snake_case, frozen-slotted dataclasses.

Setup

Functional form for tree-shaking or testing:
Accessing 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 yet.

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] whose item.provisioning_token is populated once at enrollment. machine_agent_heartbeat uses no auth header — agent_token rides in the JSON body.

Machine identity challenges

Requests a server-issued challenge tied to a 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

Pairing is challenge-based end to end:
  1. create_agent_pairing_challenge returns a server-issued challenge keyed to agent_address, agent_provider, agent_role, and optional agent_did.
  2. The item.message (EIP-191) with the key behind agent_address.
  3. create_agent_pairing accepts the proof in params.agent_proof and returns the pairing with a signed HS256 session JWT in pairing_token. The token is returned once at create.
  4. create_agent_pairing_session rotates the session token before expiry with a fresh proof. Required after any update_agent_pairing to the , since policy changes invalidate the current token’s delegation_policy_hash.
Both create methods set pairing_token exactly once each. AgentPairing.__repr__ redacts the token to keep it out of logs. CreateAgentPairingRequest now requires agent_proof: AgentPairingProof and accepts optional agent_did. delegation_policy.allowed_service_ids and delegation_policy.denied_service_ids join the existing skill-level allow/deny lists.

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

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 a union narrowed by execution.status_code: 200 for a native run (with run + outcome), 202 for an external handoff (with handoff: { label, url, notes }).

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 ship in this release:
Each *_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 now 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 is not wired yet — fetch via list_policies until it ships.

Observability

Coming next

These endpoints ship on the HTTP API (see Machine Markets API: Orchestration). SDK method bindings follow shortly:
  • Tasks: create_task, discover_task, resolve_task, execute_task, get_task, list_tasks
  • Graph: get_machine_graph, create_graph_node, update_graph_node, delete_graph_node, create_graph_edge, update_graph_edge, delete_graph_edge
  • Policies: get_policy
  • Runs: list_runs, get_run
  • Order family extras: cancel_market_order, retry_market_order
Types for the remaining order-family operations already ship in peaq_os_sdk so application code can prepare for the methods landing.

Errors

All extend peaq_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, PAYMENT_REQUIRED, PAYMENT_RPC_REQUIRED, PAYMENT_RPC_ERROR, PAYMENT_TX_FAILED, EXECUTION_UNSUPPORTED, ENDPOINT_UNREACHABLE. New types exported in 0.3.0:
MarketPaymentRailType adds "wdk-usdt-transfer" alongside the existing "x402" | "mpp" | "wallet" | "vault-stripe" | "escrow" | "onchain-escrow" | "offchain-record" | "external" | "not-required" set. 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 on this branch. Every public function is plain def over requests.Session. The transport reuses client.session, so users can wrap retries externally. First-class async support is on the roadmap.

Credential handling

  • Platform (x-api-key) — set once on the client via api_key, sent on every call by default.
  • Agent pairing (x-agent-pairing-token) — passed per call to search_market as the second argument. 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.