Skip to main content

hci-atrium

The Python SDK for the Atrium framework — a multimodal asset library with semantic + cross-modal search and capability routing.

Status: built, in active internal use — auth, library search, external-source search/import, embeddings, chat/streaming/tools, sessions/rooms, surveys, dashboards, and the CLI are all in place. The API may still evolve pre-1.0.

See the bundled GUIDE.md for a complete, task-oriented reference with runnable examples.

Install

uv add hci-atrium     # in a uv project

Or pip install hci-atrium.

For coding agents

atrium guide prints the complete, task-oriented SDK guide — pipe it into your agent's context (uv run atrium guide > atrium-guide.md, or just tell the agent to run it). The deployed instance serves the same docs at /llms.txt for agents that browse.

To make it automatic, add one line to your project's CLAUDE.md / AGENTS.md:

This project uses the hci-atrium SDK. Before writing Atrium code, run
`uv run atrium guide` and follow it — it is the authoritative API reference.

Use

Zero-config — the first call opens a browser to sign in, then later runs are silent:

from hci_atrium import Atrium

client = Atrium()                       # defaults to the institute instance

for hit in client.library.search("calm rainy afternoon", modality="audio"):
    print(round(hit.score, 3), hit.asset.title or hit.asset.filename)
    print("   ", hit.asset.content_url)

print(client.me().email)

Configuration

What Argument Environment Default
Instance URL Atrium(base_url=…) ATRIUM_BASE_URL the deployed instance
Credential Atrium(api_key="atr_…") ATRIUM_API_KEY cached OAuth → browser sign-in

An API key skips the browser entirely (CI / headless). Otherwise OAuth tokens are cached in ~/.atrium/credentials.json (mode 0600) and refreshed silently.

Projects & collections

Scope a client to a project or collection — either a reusable view or a per-call argument:

photos = client.collection("c_7Bq3Xk")   # a scoped view; every call below is scoped
photos.library.search("rain")
photos.assets.list()

client.library.search("rain", project="p_4mD2qX")   # or per-call
client = Atrium(project="p_4mD2qX")                  # or a default for the whole client

A project-scoped API key (atr_… bound to one project) scopes everything automatically.

Direct models

Register a model name that lives at an OpenAI-compatible endpoint (a local Ollama / LM Studio, or a remote server). Chat/agent calls naming it are sent directly to that endpoint, bypassing Atrium — while everything else (embeddings, library search, sessions, rooms) still goes to Atrium. The mental model is local brain, hosted context: the agent reasons on a local model, but its library.search tool still calls Atrium.

client = Atrium()
client.add_direct_model("gemma3", base_url="http://localhost:11434/v1")   # → local Ollama

client.chat("Write a haiku about rain.", model="gemma3")   # served locally, bypasses Atrium
client.chat("Write a haiku about rain.", model="gpt-oss")  # unregistered → goes to Atrium

# Everything non-LLM still hits Atrium — embeddings never route to a direct endpoint (a stored
# vector's model is a data contract with the library's vector space), even on a name collision.
client.embed("rain on a tin roof", model="clap-fusion")
Method Purpose
Atrium(direct_models={"gemma3": {"base_url": …, "api_key": None}}) register at construction
add_direct_model(name, *, base_url, api_key=None, timeout=None) register one name
add_direct_models(names, *, base_url, api_key=None, timeout=None) register a list sharing one endpoint
remove_direct_model(name) stop routing it directly (calls fall back to Atrium)
list_direct_models() audit — {name: DirectEndpoint}
discover_models(base_url, *, api_key=None) read-only GET /models; never registers
  • Explicit per name. Registration is never auto-enumerated — a registered name intentionally shadows an Atrium model of the same name. Use discover_models to see an endpoint's names, then register the ones you want.
  • Per-endpoint auth. api_key rides the endpoint, shared by every name on it; many local servers need none. The Atrium token is never sent to a direct endpoint.
  • Timeout. A direct endpoint defaults to the client's timeout=; raise it per endpoint with add_direct_model(…, timeout=120) (or a "timeout" in the construction dict) — local models can be slow to return a non-streamed completion.
  • No silent fallback. An unreachable direct endpoint raises (a connection error / APIError) — it never quietly falls back to Atrium, which would mask a misconfigured endpoint.
  • Tool-calling is the endpoint's job. agent(model=<direct>) works only if the endpoint implements OpenAI function-calling; one that doesn't just never emits tool_calls.

AsyncAtrium has the same surface (discover_models is async).

Playback & capabilities

Every Asset exposes three read-only views that discriminate on capability, not on a kind string — bytes and link capabilities are independent flags, and an asset can hold both:

asset = client.assets.get("a_123")

asset.capabilities        # {"bytes"} / {"link"} / {"bytes", "link"} / set()
asset.link                # AssetLink(provider, entity, uri) — present iff "link" ⊆ capabilities
asset.playback.as_signal()  # {"source": ..., "ref": ..., "mode": ...} — always present

asset.playback normalizes the asset into a play intent, preferring bytes when both capabilities hold; it mirrors the room play signal's {source, ref, mode?} shape 1:1, so a host can forward it as-is. A recognized streaming provider link (currently Spotify) resolves to its own source ("spotify") and a provider:entity:id ref; an unrecognized link falls back to source="link" with the raw URL — old SDKs degrade gracefully in front of a provider they don't know about yet.

Home Assistant bridge

hci_atrium.ha.HomeAssistantBridge runs near your Home Assistant instance, joins a room by connect code, and declaratively wires room signals to HA services (and HA state back into the room). websockets (its HA leg) rides along as a core dependency — nothing extra to install:

from hci_atrium import async_join_room
from hci_atrium.ha import HomeAssistantBridge

room = await async_join_room(code)
bridge = (
    HomeAssistantBridge(ha_url, ha_token)
    .media_sink("media_player.living_room")  # play `play` intents; also forwards their state
    .on_signal(                               # any other signal -> any other HA service
        "plate.pulse", domain="number", service="set_value",
        entity_id="number.plate_intensity", data=lambda p: {"value": p["strength"]},
    )
)
await bridge.run(room)

media_sink(...) forwards those entities' state back as media.state by default (forward_state=False opts out); call forward_state(...) yourself for entities outside the media sink, or to override the as_type/debounce. atrium ha-bridge wraps the zero-code standard case (media sink, state-forwarding included) as a CLI — see below.

CLI

Installing the package puts an atrium command on your PATH (or use python -m hci_atrium):

atrium login                       # sign in (opens a browser)
atrium whoami
atrium search "calm rainy afternoon" --modality audio
atrium assets --modality audio --limit 10
atrium enrich "rain on a tin roof" audio --preview
atrium chat "Write a haiku about rain" --model rwth/gpt-oss-120b
atrium ha-bridge --code ABC123 --ha-url ws://homeassistant.local:8123/api/websocket \
    --ha-token *** --media-player media_player.living_room
atrium logout                      # forget the cached session — sign in again next time

Other runtimes

Because the server is OpenAI-API-compatible, point any OpenAI-compatible client at this instance:

client.base_url   # the OpenAI-compatible endpoint
client.token()    # a live, auto-refreshed bearer token

Metadata

Release files for hci-atrium 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hci-atrium 0.2.0
File Size Uploaded Provenance Actions
hci_atrium-0.2.0.tar.gz 317.0 kB Without provenance Details for hci_atrium-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hci-atrium 0.2.0
File Interpreter ABI Platform Actions
hci_atrium-0.2.0-py3-none-any.whl Python 3 none any Details for hci_atrium-0.2.0-py3-none-any.whl

Total release size: 521.0 kB

Release files / hci_atrium-0.2.0.tar.gz

Download URL hci_atrium-0.2.0.tar.gz
Size 317.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1c8343d1cb16809f1d4bd7b5b1a8b373a9bb6f742eb16ead31be7df6a673cd5a
BLAKE2b-256 checksum
How to use checksums
43b49638d8d226316784798b549417fa3cbceaf4b91679ff0ab6fa7b82a5f111
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / hci_atrium-0.2.0-py3-none-any.whl

Download URL hci_atrium-0.2.0-py3-none-any.whl
Size 204.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4ec79984da443b7c3354467b74e0e7d135f675bdea92d22274583e95c2d1e6e
BLAKE2b-256 checksum
How to use checksums
40664efa539bf801d4f34a446c77520850dbc5345c7a49c364d9e51a70db1119
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for hci-atrium 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page