Agara
SDKs

SDKs

Client libraries for TypeScript, Python and Rust, how to choose between them, and when to call the API directly instead.

Three client libraries cover the trading API. They are thin conveniences over the same HTTP and WebSocket surface, so anything a library does you can also do with a direct request. Pick a library to skip the wire details, or call the API directly for full control over every byte you send.

Install from source for now

None of the three is on npm, PyPI or crates.io yet. Each page installs from the public agara-sdks repository, which works today. Once the packages are published the install step becomes one ordinary command and the rest of each page is unchanged.

Compare the libraries

They are not interchangeable. They cover different parts of the API and take amounts in different forms, so choose on the rows that matter to you rather than on language preference alone.

TypeScriptPythonRust
Package@agara/sdkagara-sdkagara-sdk
RuntimeNode 22 or newer, ESM onlyPython 3.10 or newerasync, on tokio
Amounts you passinteger micro units onlydollars and shares, converted for youexact decimals
Concurrencypromise-basedsync, with an async client in an extraasync only
Trading and portfolioyesyesyes
Market and event discoveryyes, with calendars, securities and searchnono
LP rewards and rebatesnonoyes
Order signingorders and account batchesordersorders, behind a feature
Streamingmarket, account and both price feedsmarket and account, in an extramarket and account, behind a feature
Breadth38 documented operationsabout 20 trading methodsabout 20 trading methods

Two rows deserve a note.

Amounts is the row most likely to surprise you. Python lets you write price=0.60; TypeScript requires price_micro: "600000" and refuses a value that would round. Neither is more correct, but the same mistake is converted in one and rejected in the other. Conventions has what the wire format actually requires.

Breadth is about surface, not quality. TypeScript wraps every documented operation including discovery, so it can carry a whole integration. Python and Rust concentrate on placing orders and reading positions, which is what most trading bots need.

Rules a library does not change

Picking a library changes how you call the API, not what it does. These pages are the single source for each rule, whichever language you choose:

Point a client at this deployment

The API origin here is https://app.agara.xyz and its WebSocket origin is wss://app.agara.xyz. Every snippet in these pages reads both from the environment rather than hardcoding them, so the same code works wherever you point it. Export them once:

export AGARA_BASE_URL="https://app.agara.xyz"
export AGARA_WS_URL="wss://app.agara.xyz"
export AGARA_CHAIN_ID="8453"
export AGARA_COLLATERAL_ADDRESS="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
export AGARA_CONDITIONAL_TOKENS_ADDRESS="0xe12D566cE5Dd8d817488E85a81386878649e3A18"
export AGARA_CTF_EXCHANGE_ADDRESS="0xD06f3fA925D35077A11dB42c6614D684f10B2aD6"

This deployment uses real funds

Confirm your client points at https://app.agara.xyz before sending an authenticated request.

If none of the three libraries fits, the OpenAPI document at /trade/v1/openapi.json on https://app.agara.xyz describes the whole REST surface. Generate against the deployment you intend to call, so the server URL in the generated client matches the environment you are pointing at.