innernet (python)
a small client for the innernet api. no dependencies, just the standard library, python 3.9 or newer.
pip install innernet
quickstart
from innernet import Innernet
client = Innernet() # reads INNERNET_API_KEY; or Innernet(api_key="...")
bot = client.agent("support-bot") # a slug, an id, or "me" with that agent's own key
bot.remember("maya prefers email, and hates being called", user_id="u_123")
found = bot.recall("how to reach maya", user_id="u_123")
block = bot.context("maya wants a refund", user_id="u_123")["text"] # drop it into a system prompt
bot.forget_user("u_123") # every memory about that user, gone
what it is
memory for the agents you keep. an agent belongs to a person and has a memory of its own, which no other agent can read. what it learns about its owner is held for their yes (or filed straight away, if they said so), never quietly added.
an agent key is a server secret: it reaches every memory that agent keeps, its users' included, so call from your backend and never ship it to a browser or an app.
client.agents.create("support bot", kind="product", settings={"memory": {"instructions": "keep how people like to be contacted"}})
client.agents.update("support-bot", status="paused") # a paused agent keeps and recalls nothing
client.agents.create("deep search", parent="support-bot") # a sub-agent: the parent's kind and a copy of its settings
bot = client.agent("support-bot")
bot.remember(messages=[{"role": "user", "content": "call me on friday"}], user_id="u_123")
bot.recall("friday", user_id="u_123", include_person=True, limit=5)
bot.memories.list(user_id="u_123") # also get, update, delete, history
bot.forget(filters={"run_id": "run_9"}, dry_run=True) # count first
bot.export()
bot.events(limit=20)
- responses are the parsed json, exactly as the api sends it, so keys are snake_case.
innernet.typeshas typed dicts for your editor. - options use the api's own names (
user_id,include_person). a name the api does not have is aTypeError, so a mistypeduser_idcannot quietly keep a memory unscoped.Nonemeans "not given" (in anupdatecall it clears the field instead). settings,metadataandfiltersare sent exactly as you write them.- reads are retried once on a 429 or a 5xx. writes never are, because they may have landed. redirects are never followed, so your key only goes where you pointed it.
errors
every failure raises InnernetError(status, code, message, detail). code is the api's reason: not_found, forbidden, paused (423), invalid, conflict, rate_limited (with retry_after), unavailable, too_large. when there was never an answer, status is 0 and code is network_error or timeout.
from innernet import InnernetError
try:
bot.recall("x")
except InnernetError as err:
if err.code == "paused":
...
webhooks
an agent's webhook is signed with x-innernet-signature: t=<unix>,v1=<hmac>. check it against the raw body, before you parse it.
from innernet import verify_webhook
if not verify_webhook(secret, raw_body, headers.get("x-innernet-signature")):
... # reject it
it is constant-time, refuses a delivery older than five minutes (tolerance=300, or None to skip the check), and returns False instead of raising.
tests
python3 -m unittest discover -s tests -t .
Metadata
Release files for innernet 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 |
|---|---|---|---|---|
| innernet-0.1.0.tar.gz | 22.0 kB | Without provenance | Details for innernet-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| innernet-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for innernet-0.1.0-py3-none-any.whl |
Total release size: 38.2 kB
Release files / innernet-0.1.0.tar.gz
| Download URL | innernet-0.1.0.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ffb3467897d849ce6d06bce8a32f62e96634130c17c84fb2ea9c86ee98c2a62f
|
|
BLAKE2b-256 checksum How to use checksums |
ecd50c99f03f52b7ecc66340f18ba2cd61ee54a21627e02a83658bdd7542b747
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / innernet-0.1.0-py3-none-any.whl
| Download URL | innernet-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a861aa626011a063a403306e641ff4cd57638f7330a4724fabf633529d66425b
|
|
BLAKE2b-256 checksum How to use checksums |
c37fbda55d4781e0d5c89fb757ff95901f9cd38c3e6f011bfebb56b8d81ddfa1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for innernet 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.
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.