Python client for Nexez agent discovery, checkout validation, and negotiation handoff.
Project description
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 tohttps://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/lngare 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 untildecisionPendingis false, with a hard five-minute maximum.
Client methods accept Pythonic snake_case aliases for API fields:
buyer_agent->buyerAgentbuyer_email->buyerEmailbuyer_name->buyerNamebuyer_reference->buyerReferencerequested_terms->requestedTermsnegotiation_id->negotiationIdstatus_token->statusTokenapproval_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; inspectstatusandbody.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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nexez_agent_sdk-0.3.0.tar.gz.
File metadata
- Download URL: nexez_agent_sdk-0.3.0.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e747e0ba6ab3722917b5936131c02bfb74d336bf2a41c33fb868fb9d825ec42
|
|
| MD5 |
5d39dde5810cd5aaa9df71cd22c90838
|
|
| BLAKE2b-256 |
bb75c28c0927129bdde91687c3236820974ea97e23a5a4ddb46e5016221f2c9d
|
File details
Details for the file nexez_agent_sdk-0.3.0-py3-none-any.whl.
File metadata
- Download URL: nexez_agent_sdk-0.3.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dd1d543f4d660e265fb5cb88e9f307db1ecced481a439da55d4d59ff0872edf
|
|
| MD5 |
c867705f7983abcab402ce40ce1c4d76
|
|
| BLAKE2b-256 |
49b17b84793756604d14d53b3fc3897fe48d70ba819a1c1ec854f0790ace34bf
|