SDK installation
The UniteLabs SDK provides Python access to connected devices and Platform APIs. This guide creates a project, installs the SDK packages, configures client credentials, and sends a first API request. It assumes you have completed Set up your development machine. For endpoint details, see the REST API reference.
Prerequisites
UniteLabs requires Python 3.10 or newer. It is platform independent and works equally on Linux, macOS and Windows.
Some steps require authentication, therefore you need:
- UniteLabs Artifactory Access
A username and password to install UniteLabs Python packages. UniteLabs packages are not published to PyPI — they are hosted in a private GitLab package registry. This is separate from GroundControl and the Platform; it is simply where the Python packages live.
- Username: 32 characters separated by dashes.
Example:56ae938f-484c-41cc-ae54-e4f9b8814fb7 - Password: 22 characters separated by dashes.
Example:ahjt-Lk-e1swOPZcWYYGh-mKJ
- Username: 32 characters separated by dashes.
- UniteLabs Client Credentials
Client ID and secret to authenticate connections made from your local SDK installation (your code/client) to the UniteLabs API (the Platform).
- Client ID: A custom username with variable length.
- Client Secret: 32 characters without separators.
Example:YT1a2HFEoi8tiAwl6bv127Tqp0ZXDSru - Tenant Base URL: the web address of your tenant's API.
Example:https://api.<your-tenant>.unitelabs.io/ - Tenant Auth URL: the sign-in endpoint of your tenant, including the realm ID.
Example:https://auth.<your-tenant>.unitelabs.io/realms/<tenant-id>/protocol/openid-connect/
All of these come from UniteLabs. If you are missing one, the Get access page lists who to ask.
For local development you can skip the client ID and secret and log in with your own UniteLabs account through the UniteLabs CLI instead. You still need the Tenant Base URL. See Log in with the UniteLabs CLI.
Install Packages
We recommend installing the UniteLabs SDK using a Python virtual environment manager such as uv, Poetry, or venv. All packages are provided in a private package registry which requires configuration and authentication.
The examples below install unitelabs-liquid-handling. This package includes the Liquid Handling SDK, while the labware library unitelabs-labware and core UniteLabs SDK (unitelabs-sdk) typically need to be installed as well. See the parts of the system for the full breakdown.
Uv is a tool that manages dependencies, maintains a lockfile for reproducible installations, manages your virtual environment and can build packages for distribution.
If you have not used uv before, you can follow any of the options for installation in the official uv installation instructions.
1. Prepare uv
Uv reads the UniteLabs Artifactory Access from a user's .netrc file. Set it up as described in Set up registry access. See the
official uv documentation for alternatives.
2. Setup Project
uv init --package my-app
cd my-app
3. Install UniteLabs
uv add unitelabs-liquid-handling \
--index unitelabs=https://gitlab.com/api/v4/groups/1009252/-/packages/pypi/simple
The example below also uses python-dotenv. It lives on public PyPI, so it must not go through the private index:
uv add python-dotenv
Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. Poetry offers a lockfile to ensure repeatable installs, and can build your project for distribution.
If you have not used poetry before, you can follow any of the options in the
official Poetry installation instructions.
1. Prepare Poetry
When poetry is available (try poetry -V in your terminal), you need to provide the UniteLabs Artifactory Access for poetry to be able to install the required dependencies. Optionally, we suggest to configure poetry to create the Python virtual environment within your project folder.
poetry config http-basic.unitelabs <username> <password>
poetry config virtualenvs.in-project true
2. Setup Project
poetry new my-app --src
cd my-app
3. Install UniteLabs
poetry source add --priority=supplemental unitelabs \
https://gitlab.com/api/v4/groups/1009252/-/packages/pypi/simple
poetry add --source unitelabs unitelabs-liquid-handling
The example below also uses python-dotenv. It lives on public PyPI, so it must not go through the private index:
poetry add python-dotenv
Venv allows you to manage separate package installations for different projects. It creates a "virtual" isolated Python installation.
1. Prepare pip
Pip reads the UniteLabs Artifactory Access from a user's .netrc file. Set it up as described in
Set up registry access. See the
official pip documentation for alternatives.
2. Setup Project
mkdir my-app
cd my-app
python -m venv .venv
.venv/bin/pip install -U pip
3. Install UniteLabs
.venv/bin/pip install unitelabs-liquid-handling \
--index-url https://gitlab.com/api/v4/groups/1009252/-/packages/pypi/simple
The example below also uses python-dotenv. It lives on public PyPI, so it must not go through the private index:
.venv/bin/pip install python-dotenv
Authenticate Client
You need to authenticate your UniteLabs client to access the UniteLabs API on your behalf. There are two ways to do this:
- Client credentials: a client ID and secret issued by UniteLabs. Use these for anything that runs unattended, such as deployed workflows, CI jobs and servers.
- UniteLabs CLI login: log in once in your browser with your own UniteLabs account. Use this for local development on your own machine.
The SDK picks the method from the configuration it finds. If CLIENT_ID or CLIENT_SECRET is set, it uses client credentials. Otherwise it uses the token stored by the UniteLabs CLI.
Client credentials
We suggest to use
python-dotenv to load the UniteLabs Client Credentials from a .env file in
the root of your project.
BASE_URL=https://api.<your-tenant>.unitelabs.io/
AUTH_URL=https://auth.<your-tenant>.unitelabs.io/realms/<tenant-id>/protocol/openid-connect/
CLIENT_ID=<client-id>
CLIENT_SECRET=<client-secret>
UniteLabs sometimes sends these four values as a filled env.txt. Move that file into your project root and rename it to .env. On Windows, enable file name extensions first, so no hidden .txt survives the rename (see Windows specifics). From PowerShell inside your project you can do both in one step:
Move-Item "$env:USERPROFILE\Downloads\env.txt" ".\.env"
BASE_URL contains neither the tenant UUID nor a /v1 suffix; the SDK appends /v1 itself. A 404 on /v1/secrets or /v1/workflows means the path is doubled.Security note:
When using version control, make sure to exclude the .env file by e.g. adding it to the .gitignore file.
Log in with the UniteLabs CLI
The UniteLabs CLI (uctl) logs you in through your browser and stores the token in ~/.unitelabs/cache/ in your home folder (%USERPROFILE%\.unitelabs\cache\ on Windows). The SDK reads the token from there, so no client secret is saved in your project.
~/.unitelabs/cache/ folder, and run uctl auth logout when you're done on a shared computer.1. Install the CLI
Download the binary for your Platform from the UniteLabs CLI releases, make it executable and put it on your PATH:
# macOS / Linux, adjust the file name for your OS and architecture
chmod +x uctl-darwin-arm64
sudo mv uctl-darwin-arm64 /usr/local/bin/uctl
uctl --version
On Windows, download uctl-windows-amd64.exe, rename it to uctl.exe and move it to a folder on your PATH.
2. Log in
uctl configure # create the "default" profile, enter your tenant's issuer URL and API base URL
uctl auth login # opens your browser to log in
uctl auth status # confirm you are logged in
uctl configure asks for:
- Issuer URL: your Tenant Auth URL up to the realm ID, e.g.
https://auth.<your-platform>.unitelabs.io/realms/<tenant-id>. - API base URL: the API address of your tenant, e.g.
https://api.<tenant-id>.unitelabs.io, without the tenant UUID or a/v1suffix.uctl auth loginstores it next to your token, where the SDK finds it.
(<your-platform> should be a human-readable string like "academic" or "company-name", <tenant-id> is the 36-character UUID. You can see both of them when accessing your Platform: UUID in the top left and Platform in the url.)
3. Use the SDK
If you entered the API base URL in uctl configure, there is nothing else to set up and you don't need a .env file. Do not set CLIENT_ID or CLIENT_SECRET, otherwise the SDK uses client credentials instead.
A BASE_URL environment variable, or base_url passed to the client, takes precedence over the profile:
BASE_URL=https://api.<your-tenant>.unitelabs.io/
If you skipped the API base URL, or change it later in ~/.unitelabs/uctl.yaml, run uctl auth login again so the SDK picks it up.
The SDK uses the CLI profile named default. To use a different profile, set UNITELABS_PROFILE to its name, e.g. UNITELABS_PROFILE=staging after uctl configure --profile staging and uctl auth login --profile staging.
uctl auth login and restart your script.Send Your First Request
The SDK provides both asynchronous and synchronous clients. Choose based on your application's needs and personal preference:
- AsyncApiClient (recommended): For modern async/await code, better performance with concurrent operations
- SyncApiClient: For simple scripts or blocking code where async is not needed
import asyncio
from unitelabs.sdk import AsyncApiClient
from dotenv import load_dotenv
async def main():
# Async example (recommended)
client = AsyncApiClient()
connectors = await client.list_services()
for connector in connectors:
print(connector.name)
if __name__ == "__main__":
load_dotenv()
asyncio.run(main())
from unitelabs.sdk import SyncApiClient
from dotenv import load_dotenv
def main():
# Synchronous example
client = SyncApiClient()
connectors = client.list_services()
for connector in connectors:
print(connector.name)
if __name__ == "__main__":
load_dotenv()
main()
Run the script to verify your credentials and confirm the SDK can reach the Platform. It should print the names of your connected instruments. This is just a smoke test; in real projects your entry point will vary.
Run the package's __main__.py file with:
uv run python -m my_app
poetry run python -m my_app
.venv/bin/python -m my_app
Troubleshooting
- Packages download from public PyPI instead of the private registry, or the install fails with 302 or 401: the
.netrcfile is not being picked up. Check the file permissions (chmod 600), the file location, and that it has no Windows line endings. - 404 on
/v1/secretsor/v1/workflows: theBASE_URLcontains the tenant UUID or a/v1suffix. Remove both; the SDK appends/v1itself. - 401 when running the first request:
CLIENT_IDorCLIENT_SECRETis wrong, or theAUTH_URLmisses the realm part. No token found for profile '<name>': you have not logged in with that profile yet, or you logged in with an earlieructlversion that stored the token in the OS keychain. Runuctl configureanductl auth login(add--profile <name>for a profile other thandefault).Token for profile '<name>' has expired: runuctl auth loginagain.Failed to read the token for profile '<name>': the token file in~/.unitelabs/cache/exists but cannot be read. Check that your user account owns it, or runuctl auth loginagain.- Warning that
unitelabs-sdkhas nocli-authextra when installing: the SDK no longer needs it. Remove[cli-auth]from your dependency. - Error about missing
AUTH_URLorCLIENT_IDalthough you wanted to use the CLI login: one ofCLIENT_IDorCLIENT_SECRETis still set in your.envor environment. Remove both.
Versions
The installation defaults to the latest version. Updates on versions and the corresponding changelogs are posted in the Python SDK changelog. If a defined version is required or needs to be locked, it must be explicitly defined using the Version Specifiers(==, !=, <, >, <=, >, >=) in the pyproject.toml.
[project]
requires-python = ">=3.10,<4.0"
dependencies = [
"unitelabs-liquid-handling~=0.11.0",
"python-dotenv",
]
Before you upgrade to a new version, read Migrate the UniteLabs SDK and Migrate the Liquid Handling SDK. It gives the changes that make it necessary to change your code.
Transitive dependencies
A package like unitelabs-liquid-handling itself depends on other UniteLabs packages, specifically unitelabs-sdk and unitelabs-labware. Those dependencies are pinned with compatible-release specifiers (~=) rather than exact versions. This is a deliberate choice: if every package pinned its dependencies to an exact version, a bug fix or compatibility update released for one package could only reach you once every package that depends on it had, in turn, published a new release pointing at it. A compatible-release specifier lets a fix in a dependency reach installations right away, without waiting on a coordinated release across the whole chain.
The specifier's granularity depends on how tightly a dependency's changes are coupled to the depending package's own code. unitelabs-sdk is pinned as ~=0.X, allowing any 0.Y release from 0.X onwards, since changes there rarely affect how unitelabs-liquid-handling uses it. unitelabs-labware is pinned more narrowly, as ~=0.Z.0, only allowing patch releases within 0.Z, since labware releases are more tightly coupled to liquid handling behavior and a minor release there is more likely to require a matching unitelabs-liquid-handling release to stay compatible.
~=, the exact set of versions you get can change between installs, even with the top-level package version unchanged. If your workflow needs a fully reproducible, exact set of versions, e.g. because it has already been validated against a specific combination and shouldn't drift, pin those transitive dependencies explicitly in your own pyproject.toml. An explicit pin always takes precedence over the compatible-release specifier the dependency was declared with.[project]
dependencies = [
"unitelabs-liquid-handling~=0.37.1",
"unitelabs-sdk==0.17.0",
"unitelabs-labware==0.36.1",
]
The installed versions can be checked using __version__:
from unitelabs import labware, liquid_handling, sdk
if __name__ == "__main__":
print(sdk.__version__)
print(labware.__version__)
print(liquid_handling.__version__)
Run the file as explained above.
Note on client types:
Clientfromunitelabs.sdkis deprecated- Use
AsyncApiClient(recommended) for async/await patterns - Use
SyncApiClientfor synchronous/blocking code - Both clients provide the same methods - the only difference is async vs sync execution
Connector versions
unitelabs-liquid-handling can sometimes rely on commands that only newer versions of liquid handler connectors provide. Compatible connector versions are stored within the SDK. Since unitelabs-liquid-handling version 0.40.0, the SDK automatically compares them against the version your connector reports the first time it connects, which is usually when your script sends its first command.
Print the requirements of your installed SDK with connector_compatibility:
from unitelabs import liquid_handling
if __name__ == "__main__":
print(liquid_handling.connector_compatibility)
{'microlab_star': '>=0.5.0', 'microlab_vantage': '>=0.7.0', 'biomek_i_series': '>=0.2.0', 'agilent_bravo': '>=0.9.0', 'tecan_freedom_evo': '>=0.6.0'}
If the connector is older than the required version, the SDK raises IncompatibleConnectorError and does not connect. No command reaches the instrument:
unitelabs.liquid_handling.liquid_handler_protocol.IncompatibleConnectorError: Connector 'STAR' reports version 0.4.2, but unitelabs-liquid-handling 0.40.0 requires >=0.5.0. Update the connector or install a compatible SDK version.
Resolve the error by updating the connector (recommended), or by pinning unitelabs-liquid-handling to an older release whose requirement the connector meets.
The check runs every time the SDK reconnects. If the SDK cannot read the connector's version, it logs a warning to the console (stderr) instead of raising, connects anyway, and tries again on the next connection.
MicrolabSTAR(name="STAR"), do not connect, so they never raise this error. The first call that reaches the connector does, which in a typical workflow is await lh.configure(). Call configure() at the start of your workflow, before steps such as moving plates or starting other instruments, so an incompatible connector stops the run before anything has happened.IDE Integration
VSCode
{
"recommendations": ["ms-python.python"]
}
{
"python.defaultInterpreterPath": ".venv/bin/python",
"python.terminal.activateEnvironment": false
}
On Windows, set python.defaultInterpreterPath to .venv/Scripts/python.exe instead, with forward slashes so the JSON stays valid. Or skip the setting and pick the interpreter through the Command Palette with Python: Select Interpreter.
Jupyter Notebooks
ipykernel as a dev dependency and run SDK calls interactively in notebook cells — all async methods work via await in Jupyter without an explicit asyncio.run() wrapper.uv add --dev ipykernel
Next steps
Your first request already listed the connected instruments. Control a device shows how to inspect one and call its actions.
Last updated
Set up your development machine
Prepare the computer you write automation code on, with an editor, Git, uv, Python, and access to the UniteLabs package registry.
Connect an AI assistant to the docs
Give Claude, Cursor, VS Code or any MCP client direct access to these docs and the API reference of the UniteLabs Python libraries.