---
title: "Developer SDK"
description: "Explore Aerospike Developer SDK with modern Java and Python APIs, AEL query support, and intelligent error handling."
---

# Developer SDK

> For the complete documentation index see: [llms.txt](https://aerospike.com/docs/llms.txt)
> 
> All documentation pages available in markdown.

The Aerospike Developer SDK is a modern, developer-friendly interface for Aerospike. It provides intuitive APIs that feel native to your language, with built-in Aerospike Expression Language (AEL) queries and intelligent error handling.

## Why use the Developer SDKs?

-   Fluent, chainable methods that feel natural in Java and Python. No more verbose configuration objects.
    
-   Filter queries with readable expressions like `"$.status == 'active' and $.age > 21"`. No more complex, hard-to-maintain filter expressions.
    
-   Actionable errors with recovery suggestions. Know exactly what went wrong and how to fix it.
    
-   Separate development from operational concerns. Focus on writing application logic, not database plumbing.
    
-   Mix reads, writes, deletes, and UDFs across different keys in a single heterogeneous batch round-trip.
    
-   Multi-record ACID transactions with automatic retry on transient failures.
    
-   Async and reactive support — `CompletableFuture` and `Flow.Publisher` in Java, `asyncio` in Python — alongside a blocking API for applications that do not run an event loop.
    

## Quick example

-   [Java](#tab-panel-4456)
-   [Python (async)](#tab-panel-4457)
-   [Python (sync)](#tab-panel-4458)

```java
import com.aerospike.client.sdk.policy.Behavior;

import com.aerospike.client.sdk.Cluster;

import com.aerospike.client.sdk.ClusterDefinition;

import com.aerospike.client.sdk.DataSet;

import com.aerospike.client.sdk.Record;

import com.aerospike.client.sdk.RecordResult;

import com.aerospike.client.sdk.RecordStream;

import com.aerospike.client.sdk.Session;

public class FluentQuickStart {

    public static void main(String[] args) {

        DataSet users = DataSet.of("test", "users");

        try (Cluster cluster = new ClusterDefinition("localhost", 3000).connect()) {

            Session session = cluster.createSession(Behavior.DEFAULT);

            // Create or update a record.

            session.upsert(users)

                .bins("name", "email", "status", "age")

                .id("user-1").values("Alice", "alice@example.com", "active", 28)

                .execute();

            // Query and print active users.

            RecordStream stream = session.query(users)

                .where("$.status == 'active'")

                .execute();

            stream.forEach(result -> {

                Record record = result.recordOrThrow();

                System.out.println(record);

            });

            // Cleanup for repeatable local runs.

            session.delete(users.id("user-1")).execute().close();

        }

    }

}
```

> 📖 **API reference**: [`ClusterDefinition(String,int)`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/ClusterDefinition.html#%3Cinit%3E%28java.lang.String%2Cint%29) | [`ClusterDefinition.connect()`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/ClusterDefinition.html#connect%28%29) | [`Cluster.createSession(Behavior)`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/Cluster.html#createSession%28com.aerospike.client.sdk.policy.Behavior%29) | [`Cluster.close()`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/Cluster.html#close%28%29) | [`DataSet.of(...)`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/DataSet.html#of%28java.lang.String%2Cjava.lang.String%29) | [`DataSet.id(...)`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/DataSet.html#id%28java.lang.String%29) | [`Session.upsert(DataSet)`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/Session.html#upsert%28com.aerospike.client.sdk.DataSet%29) | [`Session.delete(Key)`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/Session.html#delete%28com.aerospike.client.sdk.Key%29) | [`Session.query(DataSet)`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/Session.html#query%28com.aerospike.client.sdk.DataSet%29) | [`OperationObjectBuilder.bins(...)`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/OperationObjectBuilder.html#bins%28java.lang.String%2Cjava.lang.String...%29) | [`IdValuesBuilder.id(...)`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/IdValuesBuilder.html#id%28java.lang.String%29) | [`IdValuesRowBuilder.values(...)`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/IdValuesRowBuilder.html#values%28java.lang.Object...%29) | [`ChainableQueryBuilder.where(...)`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/ChainableQueryBuilder.html#where%28java.lang.String%2Cjava.lang.Object...%29) | [`ChainableQueryBuilder.execute()`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/ChainableQueryBuilder.html#execute%28%29) | [`ChainableNoBinsBuilder.execute()`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/ChainableNoBinsBuilder.html#execute%28%29) | [`RecordStream.forEach(...)`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/RecordStream.html#forEach%28java.util.function.Consumer%29) | [`RecordStream.close()`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/RecordStream.html#close%28%29) | [`RecordResult.recordOrThrow()`](https://javadoc.io/doc/com.aerospike/aerospike-client-sdk/latest/com/aerospike/client/sdk/RecordResult.html#recordOrThrow%28%29)

Use the async API when your application runs on `asyncio`, such as web servers, task workers, or other concurrent workloads. Connect with [`ClusterDefinition`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/cluster-definition.html#aerospike%5Fsdk.aio.cluster%5Fdefinition.ClusterDefinition), use `async with` for lifecycle management, `await` on `.execute()`, and `async for` to read query streams.

```python
import asyncio

from aerospike_sdk import Behavior, ClusterDefinition, DataSet

async def main() -> None:

    async with await ClusterDefinition("localhost", 3000).connect() as cluster:

        session = cluster.create_session(Behavior.DEFAULT)

        users = DataSet.of("test", "users")

        # Create or update a record.

        await session.upsert(users.id("user-1")).put(

            {"name": "Alice", "email": "alice@example.com", "status": "active", "age": 28}

        ).execute()

        # Query and print active users.

        results = await (

            session.query(users)

            .where("$.status == 'active'")

            .execute()

        )

        async for row in results:

            print(row.record_or_raise().bins)

        # Cleanup for repeatable local runs.

        await session.delete(users.id("user-1")).execute()

if __name__ == "__main__":

    asyncio.run(main())
```

> 📖 **API reference**: [`ClusterDefinition`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/cluster-definition.html#aerospike%5Fsdk.aio.cluster%5Fdefinition.ClusterDefinition) | [`Cluster.create_session()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/cluster.html#aerospike%5Fsdk.aio.cluster.Cluster.create%5Fsession) | [`DataSet.of()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/dataset.html#aerospike%5Fsdk.dataset.DataSet.of) | [`DataSet.id()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/dataset.html#aerospike%5Fsdk.dataset.DataSet.id) | [`Session.query()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/session.html#aerospike%5Fsdk.aio.session.Session.query) | [`Session.upsert()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/session.html#aerospike%5Fsdk.aio.session.Session.upsert) | [`Session.delete()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/session.html#aerospike%5Fsdk.aio.session.Session.delete) | [`QueryBuilder.where()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/query.html#aerospike%5Fsdk.aio.operations.query.QueryBuilder.where) | [`WriteSegmentBuilder.put()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/write-segment.html#aerospike%5Fsdk.aio.operations.query.WriteSegmentBuilder.put) | [`RecordResult.record_or_raise()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/record-result.html#aerospike%5Fsdk.record%5Fresult.RecordResult.record%5For%5Fraise) | [`RecordStream.close()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/record-stream.html#aerospike%5Fsdk.record%5Fstream.RecordStream.close) | [`QueryBuilder.execute()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/query.html#aerospike%5Fsdk.aio.operations.query.QueryBuilder.execute) | [`WriteSegmentBuilder.execute()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/write-segment.html#aerospike%5Fsdk.aio.operations.query.WriteSegmentBuilder.execute)

Use the sync API when your application does not run an event loop, such as scripts, batch jobs, or frameworks that call blocking code. It is the same surface without `async`/`await`: connect with the sync [`ClusterDefinition`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/sync/cluster-definition.html) and every builder chain reads the same.

```python
from aerospike_sdk import Behavior, DataSet

from aerospike_sdk.sync import ClusterDefinition

def main() -> None:

    with ClusterDefinition("localhost", 3000).connect() as cluster:

        session = cluster.create_session(Behavior.DEFAULT)

        users = DataSet.of("test", "users")

        # Create or update a record.

        session.upsert(users.id("user-1")).put(

            {"name": "Alice", "email": "alice@example.com", "status": "active", "age": 28}

        ).execute()

        # Query and print active users.

        results = (

            session.query(users)

            .where("$.status == 'active'")

            .execute()

        )

        for row in results:

            print(row.record_or_raise().bins)

        # Cleanup for repeatable local runs.

        session.delete(users.id("user-1")).execute()

if __name__ == "__main__":

    main()
```

> 📖 **API reference**: [`ClusterDefinition`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/sync/cluster-definition.html#aerospike%5Fsdk.sync.cluster%5Fdefinition.ClusterDefinition) | [`Cluster.create_session()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/sync/cluster.html#aerospike%5Fsdk.sync.cluster.Cluster.create%5Fsession) | [`DataSet.of()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/dataset.html#aerospike%5Fsdk.dataset.DataSet.of) | [`DataSet.id()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/dataset.html#aerospike%5Fsdk.dataset.DataSet.id) | [`Session.query()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/sync/session.html#aerospike%5Fsdk.sync.session.Session.query) | [`Session.upsert()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/sync/session.html#aerospike%5Fsdk.sync.session.Session.upsert) | [`Session.delete()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/sync/session.html#aerospike%5Fsdk.sync.session.Session.delete) | [`QueryBuilder.where()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/sync/query.html#aerospike%5Fsdk.sync.operations.query.QueryBuilder.where) | [`WriteSegmentBuilder.put()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/sync/write-segment.html#aerospike%5Fsdk.sync.operations.query.WriteSegmentBuilder.put) | [`RecordResult.record_or_raise()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/record-result.html#aerospike%5Fsdk.record%5Fresult.RecordResult.record%5For%5Fraise) | [`RecordStream.close()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/sync/record-stream.html#aerospike%5Fsdk.sync.record%5Fstream.RecordStream.close) | [`QueryBuilder.execute()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/sync/query.html#aerospike%5Fsdk.sync.operations.query.QueryBuilder.execute) | [`WriteSegmentBuilder.execute()`](https://aerospike-python-sdk.readthedocs.io/en/latest/api/sync/write-segment.html#aerospike%5Fsdk.sync.operations.query.WriteSegmentBuilder.execute)

## Choose your path

New to Aerospike?

Start with the Quickstart to build your first app in 5 minutes.

[Quickstart →](https://aerospike.com/docs/develop/client/sdk/quickstart)

Migrating from Legacy client?

See what’s different and how to migrate your code.

[Migration Guide →](https://aerospike.com/docs/develop/client/sdk/concepts/migration)

## Language support

| Language | Status | Package |
| --- | --- | --- |
| Java | ✅ Available | `com.aerospike:aerospike-client-sdk` |
| Python | ✅ Available | `aerospike-sdk` |
| Rust | Not yet available | — |

The Python SDK supports Python 3.11 and later. For best performance under high concurrency, use the **free-threaded build** of Python 3.14 or later. These builds have a `t` suffix in the executable name (such as `python3.14t`) and ABI tag (such as `cp314t`). The free-threaded build removes GIL contention and unlocks the SDK’s `AsyncPool` and multi-loop async modes. See the [Python 3.14 release notes](https://docs.python.org/3.14/whatsnew/3.14.html) (specifically the _Free-threaded CPython_ section; 3.14 is the release that stabilized this build mode) and [PEP 703](https://peps.python.org/pep-0703/) for background.

## Next steps

-   [Install the SDK](https://aerospike.com/docs/develop/client/sdk/install)
-   [Connect to Aerospike](https://aerospike.com/docs/develop/client/sdk/connect)
-   [Tune performance & reliability](https://aerospike.com/docs/develop/client/sdk/concepts/behaviors)
-   [Update records (including Java CDT examples)](https://aerospike.com/docs/develop/client/sdk/usage/update)
-   [Use transactions](https://aerospike.com/docs/develop/client/sdk/usage/transactions)