Skip to main content

Python SDK quick reference for agents

Baseline: ekodb-client 0.37.0, imported as ekodb_client. Install with python -m pip install ekodb-client==0.37.0. Checked against the Python binding, query builder and CRUD example.

Runnable Examples (Check Before Guessing)​

Before writing SDK code, consult the matching runnable example below for exact imports, method signatures and error handling. These links follow the SDK's main branch; compare them with the version installed in your application. Follow the language directory's run instructions and use a disposable deployment when executing examples that write data.

TaskRunnable example
CRUDclient_simple_crud.py
QueryBuilderclient_query_builder.py
Joinsclient_joins.py
Schemasclient_schema.py
TTLclient_document_ttl.py
Transactionsclient_transactions.py
Stored Functionsclient_functions.py
Concurrency / Locks / RateLimitsclient_concurrency_stages.py
Chat / RAGclient_chat_basic.py, rag_conversation_system.py
Searchclient_search.py
WebSocketsclient_websocket_subscribe.py
Admin / Permissionsclient_admin.py

Initialize and query​

The application supplies runtime credentials. Client.new constructs the client synchronously; network operations are awaited:

from ekodb_client import Client, QueryBuilder, extract_record


async def list_active(base_url: str, api_key: str):
client = Client.new(base_url, api_key)
query = QueryBuilder().eq("active", True).limit(25).build()
records = await client.find("agent_tasks", query)
return [extract_record(record) for record in records]

The Rust-backed binding handles token exchange and refresh. Run the coroutine within the application's async lifecycle. Do not add await to Client.new or invent an init() requirement.

Method map​

TaskCall shape
Insertawait client.insert(collection, record)
Findawait client.find(collection, query_dict)
Point readawait client.find_by_id(collection, id)
Merge updateawait client.update(collection, id, fields)
Deleteawait client.delete(collection, id)
Batch insertawait client.batch_insert(collection, records)
Read / change schemaget_schema(collection) / update_schema_constraints(collection, constraints)
Save / call a functionsave_user_function(definition) / call_function(id_or_label, params)
Transactionsbegin_transaction(isolation_level=None), commit_transaction(id), rollback_transaction(id)

All network calls in the table are async. Optional keywords use snake_case, including transaction_id, bypass_ripple, select_fields and exclude_fields, where supported by the method. find takes a query dictionary: keep filter, sort, limit and skip in that dictionary. The older separate limit= argument is deprecated; do not mix it with a query dict.

Values, TTL and failures​

  • Records are dictionaries; query results are lists of dictionaries. Write dict, list and bool values directly for native objects, arrays and booleans.
  • A response field can be a typed envelope. Use get_value(record["field"]), get_object_value, get_array_value or extract_record; the returned ID is an opaque string.
  • Record ttl belongs in the insert/update dictionary or each batch-insert record. Omitting it on update preserves expiry. Insert may return only id; use a point read if the stored fields are needed.
  • call_function returns a dictionary with records and metadata. Count replaces the working set, so read result["records"][0]["count"] for an output named count.
  • Preserve exceptions. Version 0.37.0 exposes transaction status in errors such as Transaction error (409) and does not automatically retry commit operations. Retry a complete transaction only after classifying the failure. Never use a broad except to turn errors into empty lists.

Read canonical semantics before choosing a type, paging strategy or retry policy. The versioned examples directory covers joins, functions, schemas, TTL and transactions.