Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ntropii.com/llms.txt

Use this file to discover all available pages before exploring further.

The ntro SDK is the Python interface to Ntropii. It’s what runbooks import (when they run inside Ntropii Tenant) and what the CLI and MCP server import (to talk to Ntropii Workspace on your behalf).

Install

pip install ntro
Includes everything you need to call Ntropii Workspace: Client, all resource accessors, all Pydantic models, all exceptions.
In a runbook repo, pin ntro[workflow] in requirements.txt (worker installs this) and ntro[testing] in dev dependencies (CI / local iteration).

Quick start

from ntro.workspace import Client

# Reads ~/.ntro/config.toml — uses the default connection
client = Client.from_config()

# Or pick a named connection
client = Client.from_config(connection="staging")

# Or be explicit (scripting / testing)
client = Client(
    host="https://api.ntropii.com/v1",
    api_key="ntro_prod_xxx",
)
Confirm it works:
profile = client.identity.whoami_sync()
print(profile.email, profile.orgId)

Configuration

The SDK reads ~/.ntro/config.toml (or $NTRO_HOME/config.toml):
default_connection_name = "local"

[connections.local]
host = "http://localhost:3000/v1"
api_key = "ntro_dev_key"
default_tenant = "acme-fund-admin"

[connections.production]
host = "https://api.ntropii.com/v1"
api_key = "ntro_prod_xxx"
Run ntro auth login to populate this file interactively.

Resolution priority

When Client.from_config() runs, it resolves credentials in this order:
1

Explicit constructor args

Client(host=..., api_key=...) always wins. Useful in tests where you want zero environmental influence.
2

Environment variables

NTRO_HOST / NTRO_API_KEY. Useful in CI/CD where you don’t want a config.toml on disk.
3

Named connection

Client.from_config(connection="staging") reads [connections.staging] from the config file.
4

Default connection

Falls back to the connection named in default_connection_name.

Async vs sync

Every resource method is async-first with a _sync wrapper for scripts and notebooks:
# Sync — fine for scripts, notebooks, the CLI
tenants = client.tenants.list_sync()

# Async — for runbooks (Temporal workers run async), high-throughput scripts
import asyncio

async def main():
    client = Client.from_config()
    tenants, workflows = await asyncio.gather(
        client.tenants.list(),
        client.workflows.list(),
    )
    await client.close()

asyncio.run(main())
The _sync variants call asyncio.run() internally — don’t use them inside an async function or you’ll get nested event-loop errors.

What’s next

Ntropii client

The full surface of ntro.workspace.Client — every resource accessor and exception.

Workflow capability

NtroWorkflow + @ui_step — the SDK primitives runbooks compose.