Skip to content
ndStill is in development. These docs describe the v2 API as designed; the SDKs and the hosted MCP server are previews and not generally available.
Docs

Python SDK

Reference for the ndstill package: sync and async clients, pay(), approvals, simulate, x402 and Verify for FastAPI.

Preview, not generally available

ndstill is the designed Python client for the v2 API, with a synchronous client, an asyncio client, typed models (Pydantic), the x402 transport for httpx, AI proxy helpers and Verify for FastAPI. Python 3.10 or later.

Install#

Terminal
pip install ndstill

Create a client#

Python
import os
from ndstill import NdStill, AsyncNdStill

ndstill = NdStill(api_key=os.environ["NDSTILL_API_KEY"])
# or, in async code:
async_client = AsyncNdStill(api_key=os.environ["NDSTILL_API_KEY"])
Client arguments
ArgumentDefaultNotes
api_keyNDSTILL_API_KEYOrg key, agent-scoped key or test key.
access_tokennoneAn OAuth 2.1 token instead of a key.
base_urlhttps://api.ndstill.com/v2A regional cell or a local mock.
version2026-11-01Sent as Ndstill-Version.
timeout30.0Seconds per request.
max_retries2Network errors, 429, 502, 504; same idempotency key.
http_clienta new httpx.ClientBring your own (proxies, mTLS, test transports).

Pay#

Python
payment = ndstill.pay(
    agent="agt_01JD8Q3W6Z",
    amount={"amount": 4200, "asset": "USD"},  # $42.00 in cents
    counterparty="Delta Air Lines",
    purpose="Flight SFO to JFK for the offsite",
)

if payment.status == "held":
    # A person approves first. Wait here, or listen for approval.decided.
    ndstill.approvals.wait(payment.approval_id, timeout=600)
elif payment.status == "declined":
    print([r.message for r in payment.reasons])

pay() is payments.create(). It accepts rail_preference, mandate_id, dims ({"customer": …, "task": …}) and idempotency_key=; without one, the SDK generates a key and reuses it on retries.

Resources#

Main methods
MethodEndpoint
payments.create(...) / pay(...)POST /payment-intents
payments.get(id), payments.list(**filters)GET /payment-intents…
payments.request_refund(id, reason=…)POST /payment-intents/{id}/refund
simulate(...)POST /decisions/simulate
approvals.get(id), approvals.wait(id, timeout=…)GET /approvals/{id}
budgets.check(agent=…, amount=…)GET /budgets for the agent's scopes
mandates.create(...), mandates.parse(...)POST /mandates…
agents.*, freezes.create(...)/agents…, POST /freezes
policies.validate(...), policies.replay(...)/policies/{id}/…
webhooks.verify(raw_body, headers, secret)Local Standard Webhooks check

The async client has the same methods as coroutines: await async_client.pay(...).

Simulate in tests#

Python
# In CI, with a test key: fail the build if the policy would block a normal purchase.
sim = ndstill.simulate(
    agent="agt_01JD8Q3W6Z",
    amount={"amount": 4200, "asset": "USD"},
    counterparty="Delta Air Lines",
)

assert sim.would_outcome == "approve", sim.reasons

Pagination#

Python
for payment in ndstill.payments.list(status="held"):
    ...  # iterates every page, following next_cursor

page = ndstill.payments.list(status="held", limit=50).page  # one page: .data, .has_more, .next_cursor

Errors#

Non-2xx responses raise subclasses of ndstill.NdStillError with type, code, message, request_id and, where present, fields and decline_reasons:

Python
from ndstill import DeclinedError, StepUpRequiredError

try:
    ndstill.pay(agent=agent_id, amount={"amount": 90000, "asset": "USD"}, counterparty="Hilton", purpose="Hotel for the offsite")
except DeclinedError as e:
    print(e.decline_reasons[0].message, e.request_id)
except StepUpRequiredError:
    ...  # a person has to confirm with a passkey

InvalidRequestError (400), AuthenticationError (401), DeclinedError (402), PermissionError (403), NotFoundError (404), ConflictError (409), RateLimitError (429, with retry_after), UpstreamError, TimeoutError and InternalError. A held payment returns normally with status == "held".

x402 transport#

ndstill.x402.Transport wraps an httpx transport. On a 402 Payment Required it asks ndStill for a decision first, and signs with your wallet only against an approved payment approval token:

Python
import httpx
from ndstill.x402 import Transport

client = httpx.Client(transport=Transport(ndstill, agent="agt_01JD8Q3W6Z", wallet=wallet, max_amount={"amount": 100000, "asset": "USDC"}))
r = client.get("https://api.northwind.example/v1/search", params={"q": "agents"})

AI proxy helpers#

Python
openai = ndstill.ai.openai(agent="agt_01JD8Q3W6Z", task="weekly-report")   # openai.OpenAI pointed at the proxy
anthropic = ndstill.ai.anthropic(agent="agt_01JD8Q3W6Z")                     # anthropic.Anthropic pointed at the proxy

Verify for FastAPI#

Python
from fastapi import Depends, FastAPI
from ndstill.verify import VerifiedAgent, verify

app = FastAPI()

@app.post("/v1/search")
async def search(body: dict, agent: VerifiedAgent = Depends(verify(require="passport"))):
    return run_search(body, agent_id=agent.id)

See Verify for sellers. Framework plugins for LangChain and LangGraph, CrewAI and the OpenAI Agents SDK wrap this client as tools; they mirror the MCP tools.