Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.

HiveMind Python SDK

Persistent memory and a working-context compiler for your agent, in three lines inside your own loop. Your model, your key — HiveMind never calls an LLM.

pip install hivemind-sdk

Python ≥ 3.10. The import name is hivemind. Docs: https://hivemind.militant.ai/docs

Async

Agent systems run on the event loop; so does this SDK. AsyncHiveMind mirrors the sync facade — same three-liner, nothing blocks, pooled connections underneath:

from hivemind import AsyncHiveMind

async with AsyncHiveMind(base_url="...", api_key="...") as mind:
    session = mind.session(budget_total=8192)
    result = await session.turn(user_input)
    reply = await call_your_llm(result.messages)
    await session.record(reply)

AsyncHivemindClient underneath mirrors the engine's native HivemindOperations surface name-for-name (compile_working_context, store_conversation_exchange, recall_memory_with_metadata, …) — code written against the ops layer speaks to the hosted service with the same vocabulary. The sync client remains pure standard library.

from hivemind import HiveMind

mind = HiveMind(base_url="...", api_key="...", tenant_id="...")
session = mind.session(budget_total=8192)

result = session.turn(user_input)       # store -> recall -> compile
reply = call_your_llm(result.messages)  # your model, your key
session.record(reply)                   # completes the exchange

What one turn() does

One HTTP request (POST /turn) — the service composes, in order:

  1. Stores the user message (receipted).
  2. Semantically recalls relevant memories and past conversation.
  3. Compiles local history + recalled records + active holds + your operator briefing into a token-budgeted bundle.

With record(), the whole exchange is two calls — your model runs between them.

result.messages is the entire prompt payload — send it as-is, splice nothing in. result.bundle["decisions"] explains every admission under the budget; result.receipt is the audit record. Empty recall on a young tenant is normal, not an error.

session.record(reply) stores your model's reply as the other half of the exchange, so the next turn — and every future session — remembers it.

Beyond the loop

  • mind.remember(content, metadata) — deliberately store a durable lesson, decision, fact, or outcome.
  • mind.recall(query) / mind.recall_filtered(query, metadata) — explicit recall, [] when nothing matches.
  • session.hold_set(key, content) / hold_clear(key) — pin operational state ("stop-order", "API is down") into every compile until cleared.
  • mind.receipts(session_id=...) — the audit trail: what ran, what it consumed, what it produced, with lineage.
  • mind.delete_by_metadata(metadata) — destructive, audited deletion.
  • mind.client — the raw HTTP client for anything not wrapped.

Configuration

Constructor arguments override environment:

Env var Meaning
HIVEMIND_BASE_URL Service root (hosted or local — same API)
HIVEMIND_API_KEY Sent as Authorization: Bearer <key>
HIVEMIND_TENANT_ID Your tenant (X-Tenant-ID)
HIVEMIND_TIMEOUT Request timeout, seconds (default 30)
HIVEMIND_BUDGET_TOTAL Default compile token budget (default 4096)

Development note (this repo)

The import name hivemind collides with the service package at the repo root, so run SDK tests as their own invocation:

python -m pytest sdk/python/tests

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hivemind_sdk-0.2.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hivemind_sdk-0.2.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file hivemind_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: hivemind_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for hivemind_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8eee00d662e1c2a36f5886c843882fcba1e7c01069462f382ed537a873564013
MD5 889501c082468796648faf3ba9a03b22
BLAKE2b-256 10552b035856d6514368379869638216cbf83686cc503e2526c17ecec152e32d

See more details on using hashes here.

File details

Details for the file hivemind_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: hivemind_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for hivemind_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a3cc1666973a355ba359a76d8fa2969f116cfc921fb1cd574aec7def4b7814a
MD5 0b40f738768e833b550f73a5101de1f2
BLAKE2b-256 dede1ab302d2b71bba386e0644cded04b858999f560a931d1f50f582ec53f66b

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.0

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

This release

0.2.0 This release

2 files

0.1.0

2 files

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