> For the complete documentation index, see [llms.txt](https://docs.native.org/native-dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.native.org/native-dev/build-with-native/native-core/python-sdk.md).

# Python SDK

`native-core-python-sdk` is a thin, typed, synchronous Python client over Native Core. It wraps the two REST endpoints — reads through `POST /info`, writes through `POST /trade` — as two classes that return the API's JSON as plain, `TypedDict`-annotated dicts. Import name `native_core`; requires Python 3.10+; runtime deps are `requests`, `eth-account`, and `eth-utils`.

```bash
pip install native-core-python-sdk
```

## What it is

Two classes, split by direction. `Info` handles reads (market data, balances, order status); `Exchange` handles writes (place, cancel, modify, batch) and owns an internal `Info` as `exchange.info`. Both build from a connection bundle you create once in the web app:

```python
from native_core import Exchange, is_accepted, order_state

exchange = Exchange.from_bundle("bundle.json")   # dict, JSON string, or file path
info = exchange.info                             # reads share the same client
```

* **`Info` + `Exchange`.** One reads, one writes. Construct with `Info.from_bundle(...)` / `Exchange.from_bundle(...)`, or `Info(base_url)` / `Exchange(wallet, base_url, owner=...)` by hand.
* **Synchronous.** Calls block for the result. `exchange.place(...)` submits, then reads the matching `orderStatus`; `info.wait_for_open`, `info.wait_for_order`, and `info.reconcile_by_cloid` resolve an order by its `cloid`.
* **Decision-ready fields.** A business rejection is data on the response body, not an exception. Helpers such as `is_accepted`, `is_rejected`, `is_timeout`, `next_action`, and `order_state` collapse a response into one field to branch on, so you never parse prose.

## What it is NOT

* **Not async or concurrent.** Calls block. Wrap them in your own executor if you need concurrency, and share **one** `Exchange` per API wallet across threads (the nonce is a per-instance, lock-guarded, monotonic counter; two instances on one key collide nonces).
* **It cannot move funds.** The SDK signs with an API wallet, a protocol-level agent key scoped only to placing and cancelling orders. Deposits, withdrawals, and approving or revoking the API wallet happen in the Native web app with your main wallet — never in the SDK.
* **Mainnet and testnet.** It trades on whichever network your connection bundle names.

## In this section

{% content-ref url="/pages/hClJqCZjoNcYEZn9FqHG" %}
[Getting Started](/native-dev/build-with-native/native-core/python-sdk/getting-started.md)
{% endcontent-ref %}

{% content-ref url="/pages/FBkCFw4G98KJuVGWMXcb" %}
[Core Concepts](/native-dev/build-with-native/native-core/python-sdk/core-concepts.md)
{% endcontent-ref %}

{% content-ref url="/pages/zku3wh4z4QMCCrFhqDZy" %}
[API Reference](/native-dev/build-with-native/native-core/python-sdk/api-reference.md)
{% endcontent-ref %}

{% content-ref url="/pages/6kHsrZpcJHFJoLRpIpSW" %}
[AI Agents & MCP](/native-dev/build-with-native/native-core/python-sdk/ai-agents-and-mcp.md)
{% endcontent-ref %}

{% content-ref url="/pages/UNsFfF8hVBzkP9fjMtRS" %}
[Examples](/native-dev/build-with-native/native-core/python-sdk/examples.md)
{% endcontent-ref %}

{% content-ref url="/pages/8CKDwbICqxVxylfVUUrJ" %}
[Troubleshooting](/native-dev/build-with-native/native-core/python-sdk/troubleshooting.md)
{% endcontent-ref %}

## See also

* [../api-access.md](/native-dev/build-with-native/native-core/reference/api-access.md) — calling the raw API directly, without the SDK.
* [../post-trade.md](/native-dev/build-with-native/native-core/reference/post-trade.md) and [../post-info.md](/native-dev/build-with-native/native-core/reference/post-info.md) — the wire reference for the two endpoints the SDK wraps.
