STELE Python SDK and local bootstrap helpers (HTTP client + optional local steled launcher).
Project description
stele (Python)
Dependency-free Python SDK for STELE (stdlib urllib, Python 3.9+).
This package contains:
stele_sdk: the HTTP client (in-repo module)stele: thin wrapper module + optional local bootstrap helpers (intended forpip install stele)
If you want a deeper dive, see the repo docs at docs/sdk/python.md.
Install
pip install stele
from stele import SteleClient, APIError
Client Configuration
client = SteleClient(
base_url="http://127.0.0.1:8080",
api_version="v1",
agent_id="agent-1",
session_id="session-1",
client_id="my-app",
embedder_override="", # optional
ops_auth_token="", # optional; also read from STELE_OPS_AUTH_TOKEN / STELE_MCP_AUTH_TOKEN
timeout=15,
)
Environment defaults (when not passed explicitly):
STELE_BASE_URLSTELE_API_VERSIONSTELE_AGENT_IDSTELE_SESSION_IDSTELE_CLIENT_IDSTELE_EMBEDDER_OVERRIDESTELE_OPS_AUTH_TOKEN(ops endpoints)STELE_MCP_AUTH_TOKEN(ops endpoints; convenience fallback)
Minimal Example: Write + Query
import time
from stele import SteleClient
client = SteleClient(
base_url="http://127.0.0.1:8080",
agent_id="agent-1",
session_id="session-1",
)
write = client.write(
{
"memory": {
"content": "We should attach provenance.source_refs to all writes.",
"type": "MEMORY_TYPE_PROCEDURAL",
"scope": "SCOPE_AGENT",
"provenance": {
"source_refs": ["run:sdk/python/README.md#minimal-example"],
"citations": [],
"origin_turn_id": "",
},
"timestamp_ms": int(time.time() * 1000),
}
}
)
print("wrote:", (write.get("memory") or {}).get("id"))
query = client.query(
{
"query_text": "What provenance should we attach?",
"budget_tokens": 250,
"scope_order": ["SCOPE_AGENT", "SCOPE_TEAM", "SCOPE_PROJECT", "SCOPE_GLOBAL"],
}
)
print("recall:", len(query.get("memories") or []))
Optional: Local Bootstrap (No Go Toolchain)
If you have GitHub Release assets published for this repo, you can bootstrap a local steled before creating the client:
from stele.local import ensure_running
from stele import SteleClient
ensure_running()
client = SteleClient(agent_id="agent-1", session_id="session-1")
print(client.query({"query_text": "sanity check"}))
Error Handling
Non-2xx responses raise APIError:
from stele import APIError
try:
client.reindex({})
except APIError as exc:
print("status:", exc.status_code, "code:", exc.code, "request:", exc.request_id, "msg:", exc.message)
Graph Example: Add Edge + List
import time
client.edge_add(
{
"edge": {
"from_id": "mem-aaa",
"to_id": "mem-bbb",
"type": "EDGE_TYPE_RELATES_TO",
"weight": 1,
"created_at_ms": int(time.time() * 1000),
}
}
)
edges = client.edge_list({"node_id": "mem-aaa"})
print(edges.get("edges"))
Ops Endpoints (Bearer Token)
Ops endpoints require ops_auth_token (or env STELE_OPS_AUTH_TOKEN / STELE_MCP_AUTH_TOKEN):
bulk_forgetexport_ndjson/export_to_fileimport_memoriesmaintenancereindexdecay
Export to File (Convenience)
import os
from stele import SteleClient
ops = SteleClient(
base_url="http://127.0.0.1:8080",
agent_id="agent-1",
session_id="session-1",
ops_auth_token=os.environ.get("STELE_OPS_AUTH_TOKEN", ""),
)
ops.export_to_file("stele-export.jsonl")
Import
from stele import SteleClient
with open("stele-export.jsonl", "r", encoding="utf-8") as f:
ndjson = f.read()
ops.import_memories({"data": ndjson, "strict": False})
API Coverage (Method Map)
Methods map closely to steled routes:
- Core:
write,query,feedback,protect,supersede,forget - Retrieval utils:
list_memories,get_memory,search_memories,update_memory,verify,extract - Bulk:
bulk_write,bulk_forget(ops) - Ops:
export_ndjson/export_to_file,import_memories,schema,metrics,maintenance,reindex,decay - Graph:
edge_add,edge_delete,edge_list,edge_traverse,edge_suggest - Sharing:
learn_share(mistake-only) - Agent/system:
agent_get,agent_upsert,access_mark_used,events,membership_add/remove/list,health,stats
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stele_sdk-0.1.2.tar.gz.
File metadata
- Download URL: stele_sdk-0.1.2.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01e7065f3b110eacc6fb6140d78b3bc3066d25690c8792f50fdf0ece3bf020a4
|
|
| MD5 |
57f3b892c8612203fad8c517158895b5
|
|
| BLAKE2b-256 |
c18d3ab3573735f3190dc362b82d4077c2592fe32149a12c2ca928d4d3ee5a19
|
Provenance
The following attestation bundles were made for stele_sdk-0.1.2.tar.gz:
Publisher:
pypi-publish.yml on sincover/stele-dev
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stele_sdk-0.1.2.tar.gz -
Subject digest:
01e7065f3b110eacc6fb6140d78b3bc3066d25690c8792f50fdf0ece3bf020a4 - Sigstore transparency entry: 937703667
- Sigstore integration time:
-
Permalink:
sincover/stele-dev@eaa3a5e9c01b6f183e2519dbe8ff3ec10c39bf3c -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/sincover
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@eaa3a5e9c01b6f183e2519dbe8ff3ec10c39bf3c -
Trigger Event:
push
-
Statement type:
File details
Details for the file stele_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: stele_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92eba5a3f0f8e05ac078a130891fa679a1463f4a7000a68f93e56579b67e666f
|
|
| MD5 |
564906cda94659606dffe658e5c3a3e2
|
|
| BLAKE2b-256 |
937c484481b511f7a6396eeb16461dc9594b1551b562191f23351d5589f01c5b
|
Provenance
The following attestation bundles were made for stele_sdk-0.1.2-py3-none-any.whl:
Publisher:
pypi-publish.yml on sincover/stele-dev
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stele_sdk-0.1.2-py3-none-any.whl -
Subject digest:
92eba5a3f0f8e05ac078a130891fa679a1463f4a7000a68f93e56579b67e666f - Sigstore transparency entry: 937703672
- Sigstore integration time:
-
Permalink:
sincover/stele-dev@eaa3a5e9c01b6f183e2519dbe8ff3ec10c39bf3c -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/sincover
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@eaa3a5e9c01b6f183e2519dbe8ff3ec10c39bf3c -
Trigger Event:
push
-
Statement type: