himring
The Python SDK of the Himring API, which lets AI agents answer from what a business knows.
pip install himring
The package needs Python 3.10 or later, and its only dependency is httpx.
Calling the API
Himring is the synchronous client, and AsyncHimring is the asyncio client. Each operation of the API is a method that takes keyword arguments. A method returns the JSON answer as a typed dictionary, or a streamed Download when the operation answers with a file.
from himring import Himring
with Himring(api_key="hk_live_...") as himring:
found = himring.search_knowledge_base(
project_id="prj_...",
knowledge_base_id="kb_...",
question="When does the store open on Sunday?",
)
for passage in found["passages"]:
print(passage["file_path"], passage["text"])
The client sends the API key, or a session token passed as session_token, in the Authorization header. It never follows redirects, and it stops waiting after timeout_seconds, which is 30 seconds unless you set another value on the client or on one call. A call that sends a file stops only when the upload makes no progress for upload_idle_timeout_seconds, which is 120 seconds by default.
Errors
Every refusal raises HimringApiError. Its kind is refused when the API answered with an error, invalid_input when the client refused the call before sending it, invalid_response when the answer was not JSON or carried an error of the wrong shape, and network or timeout when the API did not answer. A refusal carries the status, the documented code, the message, the issues of each refused field, the missing_permission of an API key, retry_after_seconds, and the request_id of the call.
from himring import HimringApiError
try:
himring.get_database(project_id="prj_...", database_id="db_...")
except HimringApiError as error:
if error.kind == "refused" and error.code == "database_not_found":
print("The database is gone.")
else:
raise
Files
add_file sends a file to a knowledge base. It sends a large file in parts, at most four at a time, straight to storage, and it never sends your API key to storage. After each part arrives, the client calls on_progress with the number of bytes in that part. download_file reads a version of a file from storage.
from pathlib import Path
from himring import safe_download_name
with Path("refunds.pdf").open("rb") as file:
added = himring.add_file(
project_id="prj_...",
knowledge_base_id="kb_...",
path="policies/refunds.pdf",
content=file,
on_progress=lambda part_bytes: print(f"Storage took {part_bytes} more bytes."),
)
print(added["outcome"], added["file"]["id"])
with himring.download_file(
project_id="prj_...", knowledge_base_id="kb_...", file_id=added["file"]["id"], version=1
) as download:
Path(safe_download_name(download.file_name, "file.pdf")).write_bytes(download.read())
Memory webhooks
verify_memory_webhook checks the himring-signature header of a Memory webhook against its signing secret. It returns the event only when the signature matches the body and Himring signed the request no more than 5 minutes away from the current time.
from himring import MemoryWebhookRejected, verify_memory_webhook
try:
event = verify_memory_webhook(
body=request_body,
signature=request_headers.get("himring-signature"),
secret=signing_secret,
)
except MemoryWebhookRejected as rejection:
print(rejection.reason)
License
MIT
Metadata
Release files for himring 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| himring-0.1.0.tar.gz | 112.4 kB | With provenance | Details for himring-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| himring-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for himring-0.1.0-py3-none-any.whl |
Total release size: 235.8 kB
Release files / himring-0.1.0.tar.gz
| Download URL | himring-0.1.0.tar.gz |
|---|---|
| Size | 112.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eca9e035e520d4710240e408d5a59f1cf4ef6ff97318b2a2f6a2c8351ffc343f
|
|
BLAKE2b-256 checksum How to use checksums |
5c5d2de2c3a768435268285ad5c1cd2ab72e14625decbb1c9fbecbdff525258a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logRelease files / himring-0.1.0-py3-none-any.whl
| Download URL | himring-0.1.0-py3-none-any.whl |
|---|---|
| Size | 123.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ed3c7bfc6b246072aeb7f558889d15318a2140f25c8e659f7174b8080590b5b
|
|
BLAKE2b-256 checksum How to use checksums |
6da4ee859b1432a47b788cd253070220f1e296d8d541a5ff7bc14a00733d62e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logSecurity for himring 0.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for himring-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logA 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.