Python client for the MindGraph Cloud API
Project description
mindgraph
Python client for the MindGraph Cloud API — a structured semantic memory graph for AI agents.
Install
pip install mindgraph
Quick Start
from mindgraph import MindGraph
with MindGraph("https://api.mindgraph.cloud", api_key="mg_...") as graph:
# Add a node
node = graph.add_node(
label="User prefers dark mode",
node_type="Preference",
)
# Search
results = graph.search("what does the user prefer?")
# Connect knowledge
graph.add_link(
from_uid=node["uid"],
to_uid="user_abc",
edge_type="BelongsTo",
)
API Reference
Constructor
MindGraph(base_url, *, api_key=None, jwt=None, timeout=30.0)
Supports context manager protocol (with statement) for automatic cleanup.
Reality Layer
| Method | Description |
|---|---|
ingest(**kwargs) |
Ingest a source, snippet, or observation |
entity(**kwargs) |
Create, alias, resolve, or merge entities |
find_or_create_entity(label, entity_type?, agent_id?) |
Convenience: create or find an entity by label |
Epistemic Layer
| Method | Description |
|---|---|
argue(**kwargs) |
Construct a full argument: claim + evidence + warrant + edges |
inquire(**kwargs) |
Add hypothesis, theory, paradigm, anomaly, assumption, or question |
structure(**kwargs) |
Add concept, pattern, mechanism, model, analogy, theorem, etc. |
Intent Layer
| Method | Description |
|---|---|
commit(**kwargs) |
Create a goal, project, or milestone |
deliberate(**kwargs) |
Open decisions, add options/constraints, resolve decisions |
Action Layer
| Method | Description |
|---|---|
procedure(**kwargs) |
Build flows, add steps, affordances, and controls |
risk(**kwargs) |
Assess risk or retrieve existing assessments |
Memory Layer
| Method | Description |
|---|---|
session(**kwargs) |
Open a session, record traces, or close a session |
distill(**kwargs) |
Create a summary that distills multiple source nodes |
memory_config(**kwargs) |
Set/get preferences and memory policies |
Agent Layer
| Method | Description |
|---|---|
plan(**kwargs) |
Create tasks, plans, plan steps, update status |
governance(**kwargs) |
Create policies, set safety budgets, request/resolve approvals |
execution(**kwargs) |
Track execution lifecycle and register agents |
CRUD
| Method | Description |
|---|---|
get_node(uid) |
Get a node by UID |
add_node(label, node_type?, props?, agent_id?) |
Add a generic node |
update_node(uid, **kwargs) |
Update node fields |
delete_node(uid) |
Tombstone a node and all connected edges |
add_link(from_uid, to_uid, edge_type, agent_id?) |
Add a typed edge |
get_edges(from_uid?, to_uid?) |
Get edges by source or target |
Search
| Method | Description |
|---|---|
search(query, node_type?, layer?, limit?) |
Full-text search |
hybrid_search(query, k?, node_types?, layer?) |
BM25 + vector search with rank fusion |
Traversal
| Method | Description |
|---|---|
reasoning_chain(uid, max_depth=5) |
Follow epistemic edges from a node |
neighborhood(uid, max_depth=1) |
Get all nodes within N hops |
Cross-cutting
| Method | Description |
|---|---|
retrieve(**kwargs) |
Unified retrieval: text search, active goals, open questions, weak claims |
traverse(**kwargs) |
Graph traversal: chain, neighborhood, path, or subgraph |
evolve(**kwargs) |
Lifecycle mutations: update, tombstone, restore, decay, history |
Health & Stats
| Method | Description |
|---|---|
health() |
Health check |
stats() |
Graph-wide statistics |
Error Handling
All methods raise MindGraphError on HTTP errors:
from mindgraph import MindGraphError
try:
graph.get_node("nonexistent")
except MindGraphError as e:
print(e.status, e.body)
License
MIT
Project details
Release history Release notifications | RSS feed
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 mindgraph_sdk-0.1.1.tar.gz.
File metadata
- Download URL: mindgraph_sdk-0.1.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f13abaf30546da7b4effc1efeab459d06a3515a97f74f44212d93d87911c5d76
|
|
| MD5 |
0d4796dccef901582fb9405b1896becf
|
|
| BLAKE2b-256 |
b79e8d2bf85652d5b4057475cae2bc9a1efc44fa2ce092a4179e6407ae14117d
|
Provenance
The following attestation bundles were made for mindgraph_sdk-0.1.1.tar.gz:
Publisher:
publish.yml on shuruheel/mindgraph-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mindgraph_sdk-0.1.1.tar.gz -
Subject digest:
f13abaf30546da7b4effc1efeab459d06a3515a97f74f44212d93d87911c5d76 - Sigstore transparency entry: 1053002869
- Sigstore integration time:
-
Permalink:
shuruheel/mindgraph-python@76f1db37a31fc0b1b43f22639c991bfd5799e04a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/shuruheel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@76f1db37a31fc0b1b43f22639c991bfd5799e04a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file mindgraph_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mindgraph_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.0 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 |
d0b2ffaafe7cfd84056f91a36018bb5ce5e810ef21dc9f1d488fcf2c1960e289
|
|
| MD5 |
36872d7a38d40f077290b625000369b0
|
|
| BLAKE2b-256 |
0b2c1aa79039b9a7a0abf09a574eaf6995f82f1c26ffe3b8495c46ec575dfc64
|
Provenance
The following attestation bundles were made for mindgraph_sdk-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on shuruheel/mindgraph-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mindgraph_sdk-0.1.1-py3-none-any.whl -
Subject digest:
d0b2ffaafe7cfd84056f91a36018bb5ce5e810ef21dc9f1d488fcf2c1960e289 - Sigstore transparency entry: 1053002872
- Sigstore integration time:
-
Permalink:
shuruheel/mindgraph-python@76f1db37a31fc0b1b43f22639c991bfd5799e04a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/shuruheel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@76f1db37a31fc0b1b43f22639c991bfd5799e04a -
Trigger Event:
workflow_dispatch
-
Statement type: