Skip to main content

Nexez Python Agent SDK

Dependency-free, typed Python client for buyer agents and agent builders that need to discover Nexez pages, read structured seller context, validate checkout, start an approved checkout handoff, or negotiate with a seller.

python -m pip install nexez-agent-sdk
from nexez_agent_sdk import create_client

nexez = create_client(buyer_agent="example-python-agent")

matches = nexez.search(
    "book a strategy session next week",
    location="Chicago, IL",
    limit=5,
)

first = matches["results"][0] if matches["results"] else None
if not first or not first.get("offer"):
    raise RuntimeError("No actionable Nexez offer was found.")

page = nexez.get_agent_page(first["page"]["slug"])
offer_key = first["offer"]["key"]
if not any(offer.get("key") == offer_key for offer in page.get("offers", [])):
    raise RuntimeError("The selected offer is no longer available.")

validation = nexez.validate_checkout(
    slug=first["page"]["slug"],
    offer=offer_key,
    query="Buyer wants a strategy session next week.",
)

Side-effecting calls require a separate, explicit approval flag. Forward the dry-run token and use one stable retry key for that exact action:

checkout = nexez.start_checkout(
    slug=first["page"]["slug"],
    offer=offer_key,
    query="Buyer wants a strategy session next week.",
    approval_token=validation.get("approvalToken"),
    user_approved=True,
    idempotency_key="buyer-order-1234567890",
)

API

  • create_client(base_url=..., buyer_agent=..., timeout=..., transport=...) - create a client. Defaults to https://nexez.app.
  • search_nexez(query, **options) - search published agent pages by buyer intent, category, industry, readiness/trust, verification, checkout/negotiation capability, price band, and text location. lat/lng are context only.
  • browse_directory(**options) - browse published pages by category, minimum readiness, query, and location.
  • get_agent_page(slug, **options) - fetch /{slug}/agent.json.
  • validate_checkout(payload=None, **kwargs) - dry-run checkout through /api/checkout.
  • start_checkout(payload=None, user_approved=True, **kwargs) - start checkout only after explicit buyer approval.
  • validate_negotiation(payload=None, **kwargs) - dry-run proposal validation through /api/negotiations.
  • submit_negotiation(payload=None, user_approved=True, **kwargs) - submit a buyer proposal after explicit user approval.
  • get_negotiation_status(negotiation_id, status_token, **options) - safely poll an asynchronous negotiation.
  • wait_for_negotiation_decision(negotiation_id, status_token, timeout=30, poll_interval=2, **options) - poll until decisionPending is false, with a hard five-minute maximum.

Client methods accept Pythonic snake_case aliases for API fields:

  • buyer_agent -> buyerAgent
  • buyer_email -> buyerEmail
  • buyer_name -> buyerName
  • buyer_reference -> buyerReference
  • requested_terms -> requestedTerms
  • negotiation_id -> negotiationId
  • status_token -> statusToken
  • approval_token -> approvalToken

user_approved is a local SDK safety gate. It is stripped before the request and is never sent to Nexez. The package also exports TypedDict contracts for checkout, negotiation, search, manifests, and status responses.

Custom base_url values may include a deployment path prefix, such as https://example.test/nexez; the SDK preserves that prefix for every request. Only http and https URLs without credentials, query strings, or fragments are accepted.

Safety

Use validate_checkout or validate_negotiation before side-effecting actions. start_checkout and submit_negotiation reject calls unless their keyword-only user_approved=True gate is present and always send dryRun: false. An approval-like value embedded in a payload does not satisfy this gate. Approval tokens bind validated commercial terms while allowing buyer identity to remain local until consent.

Treat statusToken as a bearer credential: never log it or show it in buyer-facing output. SDK-generated API, transport, and protocol errors redact the token from their public url attribute. wait_for_negotiation_decision raises TimeoutError when its bounded wait expires.

Errors

  • NexezApiError - the API returned a non-2xx status; inspect status and body.
  • NexezTransportError - DNS, connection, timeout, or custom-transport failure.
  • NexezProtocolError - a 2xx response was not a JSON object or violated the status contract.

Tests

python -m unittest discover -s sdk/python/tests

License

The SDK source in this package is licensed under the MIT License. Use of Nexez hosted APIs and services is governed separately by the Nexez Terms of Service. The MIT License does not grant rights to Nexez trademarks, logos, hosted services, or service data.

Release files for nexez-agent-sdk 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nexez-agent-sdk 0.3.1
File Size Uploaded
nexez_agent_sdk-0.3.1.tar.gz 16.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nexez-agent-sdk 0.3.1
File Interpreter ABI Platform
nexez_agent_sdk-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size:27.4 kB

Release files / nexez_agent_sdk-0.3.1.tar.gz

Download URL nexez_agent_sdk-0.3.1.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b77d04fba6e940c546b9b2c37c42995c7dc4969c11aa1e1abfa94f0f6481b7ef
BLAKE2b-256 checksum
How to use checksums
dec74e5bef39754f30c4d26524f1de07c869fc29bd785112aab5ce2b070f2181
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release files / nexez_agent_sdk-0.3.1-py3-none-any.whl

Download URL nexez_agent_sdk-0.3.1-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eec7b5938393eee037521e5d77e0eb0c0c46848c235cef26ace533304f169b65
BLAKE2b-256 checksum
How to use checksums
4080c5c4a5fdfea399077e994f0de674b9c259a84928b386021a7a08a848efa1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page