engram-client 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: engram-client
3
+ Version: 0.1.0
4
+ Summary: Python client for Engram Cloud - AI memory infrastructure
5
+ Author: Ronaldo Lima
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/limaronaldo/engram
8
+ Project-URL: Repository, https://github.com/limaronaldo/engram
9
+ Keywords: engram,ai,memory,mcp,agents
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Software Development :: Libraries
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ Requires-Dist: httpx>=0.25.0
18
+
19
+ # engram-client
20
+
21
+ [![PyPI](https://img.shields.io/pypi/v/engram-client)](https://pypi.org/project/engram-client/)
22
+ [![Python](https://img.shields.io/pypi/pyversions/engram-client)](https://pypi.org/project/engram-client/)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
24
+
25
+ Python client for [Engram Cloud](https://github.com/limaronaldo/engram-cloud) - AI memory infrastructure for agents.
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ pip install engram-client
31
+ ```
32
+
33
+ ## Quick Start
34
+
35
+ ```python
36
+ from engram_client import EngramClient
37
+
38
+ client = EngramClient(
39
+ base_url="https://engram-cloud-gateway.fly.dev",
40
+ api_key="ek_...",
41
+ tenant="my-tenant",
42
+ )
43
+
44
+ # Create a memory
45
+ memory = client.create(
46
+ "User prefers dark mode",
47
+ tags=["preferences", "ui"],
48
+ workspace="my-project",
49
+ )
50
+
51
+ # Search (hybrid: BM25 + vector + fuzzy)
52
+ results = client.search("user preferences")
53
+
54
+ # List with filters
55
+ memories = client.list(limit=20, workspace="my-project")
56
+
57
+ # Get by ID
58
+ memory = client.get(42)
59
+
60
+ # Update
61
+ client.update(42, content="User prefers light mode", tags=["preferences"])
62
+
63
+ # Delete
64
+ client.delete(42)
65
+
66
+ # Stats
67
+ stats = client.stats()
68
+ ```
69
+
70
+ ## Context Manager
71
+
72
+ ```python
73
+ with EngramClient(base_url="...", api_key="...", tenant="...") as client:
74
+ client.create("Hello from Python SDK")
75
+ ```
76
+
77
+ ## API Reference
78
+
79
+ ### `EngramClient(base_url, api_key, tenant)`
80
+
81
+ | Method | Description |
82
+ |--------|-------------|
83
+ | `create(content, **kwargs)` | Create a memory |
84
+ | `get(id)` | Get memory by ID |
85
+ | `update(id, **kwargs)` | Update a memory |
86
+ | `delete(id)` | Delete a memory |
87
+ | `list(**kwargs)` | List memories with filters |
88
+ | `search(query, **kwargs)` | Hybrid search |
89
+ | `stats()` | Storage statistics |
90
+
91
+ ### Parameters
92
+
93
+ **create / update kwargs:** `tags`, `workspace`, `memory_type`, `importance`, `metadata`, `tier`
94
+
95
+ **list kwargs:** `limit`, `offset`, `workspace`, `memory_type`, `tags`, `sort_by`, `sort_order`
96
+
97
+ **search kwargs:** `limit`, `workspace`, `tags`, `memory_type`, `include_archived`
98
+
99
+ ## Requirements
100
+
101
+ - Python >= 3.9
102
+ - httpx >= 0.25.0
103
+
104
+ ## Related
105
+
106
+ - [Engram](https://github.com/limaronaldo/engram) - Core memory engine (Rust)
107
+ - [Engram Cloud](https://github.com/limaronaldo/engram-cloud) - Multi-tenant SaaS gateway
108
+ - [@engram/client](https://www.npmjs.com/package/@engram/client) - TypeScript client
109
+
110
+ ## License
111
+
112
+ MIT
@@ -0,0 +1,94 @@
1
+ # engram-client
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/engram-client)](https://pypi.org/project/engram-client/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/engram-client)](https://pypi.org/project/engram-client/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
+
7
+ Python client for [Engram Cloud](https://github.com/limaronaldo/engram-cloud) - AI memory infrastructure for agents.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install engram-client
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```python
18
+ from engram_client import EngramClient
19
+
20
+ client = EngramClient(
21
+ base_url="https://engram-cloud-gateway.fly.dev",
22
+ api_key="ek_...",
23
+ tenant="my-tenant",
24
+ )
25
+
26
+ # Create a memory
27
+ memory = client.create(
28
+ "User prefers dark mode",
29
+ tags=["preferences", "ui"],
30
+ workspace="my-project",
31
+ )
32
+
33
+ # Search (hybrid: BM25 + vector + fuzzy)
34
+ results = client.search("user preferences")
35
+
36
+ # List with filters
37
+ memories = client.list(limit=20, workspace="my-project")
38
+
39
+ # Get by ID
40
+ memory = client.get(42)
41
+
42
+ # Update
43
+ client.update(42, content="User prefers light mode", tags=["preferences"])
44
+
45
+ # Delete
46
+ client.delete(42)
47
+
48
+ # Stats
49
+ stats = client.stats()
50
+ ```
51
+
52
+ ## Context Manager
53
+
54
+ ```python
55
+ with EngramClient(base_url="...", api_key="...", tenant="...") as client:
56
+ client.create("Hello from Python SDK")
57
+ ```
58
+
59
+ ## API Reference
60
+
61
+ ### `EngramClient(base_url, api_key, tenant)`
62
+
63
+ | Method | Description |
64
+ |--------|-------------|
65
+ | `create(content, **kwargs)` | Create a memory |
66
+ | `get(id)` | Get memory by ID |
67
+ | `update(id, **kwargs)` | Update a memory |
68
+ | `delete(id)` | Delete a memory |
69
+ | `list(**kwargs)` | List memories with filters |
70
+ | `search(query, **kwargs)` | Hybrid search |
71
+ | `stats()` | Storage statistics |
72
+
73
+ ### Parameters
74
+
75
+ **create / update kwargs:** `tags`, `workspace`, `memory_type`, `importance`, `metadata`, `tier`
76
+
77
+ **list kwargs:** `limit`, `offset`, `workspace`, `memory_type`, `tags`, `sort_by`, `sort_order`
78
+
79
+ **search kwargs:** `limit`, `workspace`, `tags`, `memory_type`, `include_archived`
80
+
81
+ ## Requirements
82
+
83
+ - Python >= 3.9
84
+ - httpx >= 0.25.0
85
+
86
+ ## Related
87
+
88
+ - [Engram](https://github.com/limaronaldo/engram) - Core memory engine (Rust)
89
+ - [Engram Cloud](https://github.com/limaronaldo/engram-cloud) - Multi-tenant SaaS gateway
90
+ - [@engram/client](https://www.npmjs.com/package/@engram/client) - TypeScript client
91
+
92
+ ## License
93
+
94
+ MIT
@@ -0,0 +1,6 @@
1
+ """Engram Cloud Python SDK - AI memory infrastructure client."""
2
+
3
+ from engram_client.client import EngramClient
4
+
5
+ __version__ = "0.1.0"
6
+ __all__ = ["EngramClient"]
@@ -0,0 +1,194 @@
1
+ """Engram Cloud HTTP client."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Optional
6
+
7
+ import httpx
8
+
9
+
10
+ class EngramClient:
11
+ """Client for the Engram Cloud REST API.
12
+
13
+ Usage:
14
+ client = EngramClient(
15
+ base_url="https://your-engram-cloud.fly.dev",
16
+ api_key="ek_...",
17
+ tenant="my-tenant",
18
+ )
19
+
20
+ # Create a memory
21
+ memory = client.create("User prefers dark mode", tags=["prefs"])
22
+
23
+ # Search
24
+ results = client.search("user preferences")
25
+
26
+ # List
27
+ memories = client.list(limit=10)
28
+ """
29
+
30
+ def __init__(
31
+ self,
32
+ base_url: str,
33
+ api_key: str,
34
+ tenant: str,
35
+ timeout: float = 30.0,
36
+ ):
37
+ self.base_url = base_url.rstrip("/")
38
+ self.tenant = tenant
39
+ self._client = httpx.Client(
40
+ base_url=self.base_url,
41
+ headers={
42
+ "Authorization": f"Bearer {api_key}",
43
+ "X-Tenant-Slug": tenant,
44
+ "Content-Type": "application/json",
45
+ },
46
+ timeout=timeout,
47
+ )
48
+
49
+ def close(self) -> None:
50
+ self._client.close()
51
+
52
+ def __enter__(self) -> "EngramClient":
53
+ return self
54
+
55
+ def __exit__(self, *args: Any) -> None:
56
+ self.close()
57
+
58
+ # -- MCP-over-HTTP helpers --
59
+
60
+ def _mcp_call(self, method: str, params: dict[str, Any] | None = None) -> Any:
61
+ """Execute an MCP tool call over HTTP."""
62
+ payload = {
63
+ "jsonrpc": "2.0",
64
+ "id": 1,
65
+ "method": "tools/call",
66
+ "params": {
67
+ "name": method,
68
+ "arguments": params or {},
69
+ },
70
+ }
71
+ resp = self._client.post("/v1/mcp", json=payload)
72
+ resp.raise_for_status()
73
+ result = resp.json()
74
+ if "error" in result:
75
+ raise EngramError(result["error"].get("message", "Unknown error"))
76
+ return result.get("result", {})
77
+
78
+ # -- Memory CRUD --
79
+
80
+ def create(
81
+ self,
82
+ content: str,
83
+ *,
84
+ memory_type: str = "note",
85
+ tags: list[str] | None = None,
86
+ workspace: str | None = None,
87
+ metadata: dict[str, Any] | None = None,
88
+ importance: float | None = None,
89
+ ) -> dict[str, Any]:
90
+ """Create a new memory."""
91
+ params: dict[str, Any] = {
92
+ "content": content,
93
+ "memory_type": memory_type,
94
+ }
95
+ if tags:
96
+ params["tags"] = tags
97
+ if workspace:
98
+ params["workspace"] = workspace
99
+ if metadata:
100
+ params["metadata"] = metadata
101
+ if importance is not None:
102
+ params["importance"] = importance
103
+ return self._mcp_call("memory_create", params)
104
+
105
+ def get(self, memory_id: int) -> dict[str, Any]:
106
+ """Get a memory by ID."""
107
+ return self._mcp_call("memory_get", {"id": memory_id})
108
+
109
+ def update(
110
+ self,
111
+ memory_id: int,
112
+ *,
113
+ content: str | None = None,
114
+ tags: list[str] | None = None,
115
+ metadata: dict[str, Any] | None = None,
116
+ importance: float | None = None,
117
+ ) -> dict[str, Any]:
118
+ """Update an existing memory."""
119
+ params: dict[str, Any] = {"id": memory_id}
120
+ if content is not None:
121
+ params["content"] = content
122
+ if tags is not None:
123
+ params["tags"] = tags
124
+ if metadata is not None:
125
+ params["metadata"] = metadata
126
+ if importance is not None:
127
+ params["importance"] = importance
128
+ return self._mcp_call("memory_update", params)
129
+
130
+ def delete(self, memory_id: int) -> dict[str, Any]:
131
+ """Delete a memory."""
132
+ return self._mcp_call("memory_delete", {"id": memory_id})
133
+
134
+ def list(
135
+ self,
136
+ *,
137
+ limit: int = 50,
138
+ offset: int = 0,
139
+ workspace: str | None = None,
140
+ memory_type: str | None = None,
141
+ tags: list[str] | None = None,
142
+ ) -> dict[str, Any]:
143
+ """List memories with optional filters."""
144
+ params: dict[str, Any] = {"limit": limit, "offset": offset}
145
+ if workspace:
146
+ params["workspace"] = workspace
147
+ if memory_type:
148
+ params["memory_type"] = memory_type
149
+ if tags:
150
+ params["tags"] = tags
151
+ return self._mcp_call("memory_list", params)
152
+
153
+ # -- Search --
154
+
155
+ def search(
156
+ self,
157
+ query: str,
158
+ *,
159
+ limit: int = 10,
160
+ workspace: str | None = None,
161
+ ) -> dict[str, Any]:
162
+ """Hybrid search (BM25 + vector + fuzzy)."""
163
+ params: dict[str, Any] = {"query": query, "limit": limit}
164
+ if workspace:
165
+ params["workspace"] = workspace
166
+ return self._mcp_call("memory_search", params)
167
+
168
+ # -- Graph --
169
+
170
+ def related(self, memory_id: int) -> dict[str, Any]:
171
+ """Get related memories via knowledge graph."""
172
+ return self._mcp_call("memory_related", {"id": memory_id})
173
+
174
+ def link(
175
+ self,
176
+ from_id: int,
177
+ to_id: int,
178
+ edge_type: str = "related_to",
179
+ ) -> dict[str, Any]:
180
+ """Create a link between two memories."""
181
+ return self._mcp_call(
182
+ "memory_link",
183
+ {"from_id": from_id, "to_id": to_id, "edge_type": edge_type},
184
+ )
185
+
186
+ # -- Stats --
187
+
188
+ def stats(self) -> dict[str, Any]:
189
+ """Get memory statistics."""
190
+ return self._mcp_call("memory_stats", {})
191
+
192
+
193
+ class EngramError(Exception):
194
+ """Error from the Engram API."""
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: engram-client
3
+ Version: 0.1.0
4
+ Summary: Python client for Engram Cloud - AI memory infrastructure
5
+ Author: Ronaldo Lima
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/limaronaldo/engram
8
+ Project-URL: Repository, https://github.com/limaronaldo/engram
9
+ Keywords: engram,ai,memory,mcp,agents
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Software Development :: Libraries
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ Requires-Dist: httpx>=0.25.0
18
+
19
+ # engram-client
20
+
21
+ [![PyPI](https://img.shields.io/pypi/v/engram-client)](https://pypi.org/project/engram-client/)
22
+ [![Python](https://img.shields.io/pypi/pyversions/engram-client)](https://pypi.org/project/engram-client/)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
24
+
25
+ Python client for [Engram Cloud](https://github.com/limaronaldo/engram-cloud) - AI memory infrastructure for agents.
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ pip install engram-client
31
+ ```
32
+
33
+ ## Quick Start
34
+
35
+ ```python
36
+ from engram_client import EngramClient
37
+
38
+ client = EngramClient(
39
+ base_url="https://engram-cloud-gateway.fly.dev",
40
+ api_key="ek_...",
41
+ tenant="my-tenant",
42
+ )
43
+
44
+ # Create a memory
45
+ memory = client.create(
46
+ "User prefers dark mode",
47
+ tags=["preferences", "ui"],
48
+ workspace="my-project",
49
+ )
50
+
51
+ # Search (hybrid: BM25 + vector + fuzzy)
52
+ results = client.search("user preferences")
53
+
54
+ # List with filters
55
+ memories = client.list(limit=20, workspace="my-project")
56
+
57
+ # Get by ID
58
+ memory = client.get(42)
59
+
60
+ # Update
61
+ client.update(42, content="User prefers light mode", tags=["preferences"])
62
+
63
+ # Delete
64
+ client.delete(42)
65
+
66
+ # Stats
67
+ stats = client.stats()
68
+ ```
69
+
70
+ ## Context Manager
71
+
72
+ ```python
73
+ with EngramClient(base_url="...", api_key="...", tenant="...") as client:
74
+ client.create("Hello from Python SDK")
75
+ ```
76
+
77
+ ## API Reference
78
+
79
+ ### `EngramClient(base_url, api_key, tenant)`
80
+
81
+ | Method | Description |
82
+ |--------|-------------|
83
+ | `create(content, **kwargs)` | Create a memory |
84
+ | `get(id)` | Get memory by ID |
85
+ | `update(id, **kwargs)` | Update a memory |
86
+ | `delete(id)` | Delete a memory |
87
+ | `list(**kwargs)` | List memories with filters |
88
+ | `search(query, **kwargs)` | Hybrid search |
89
+ | `stats()` | Storage statistics |
90
+
91
+ ### Parameters
92
+
93
+ **create / update kwargs:** `tags`, `workspace`, `memory_type`, `importance`, `metadata`, `tier`
94
+
95
+ **list kwargs:** `limit`, `offset`, `workspace`, `memory_type`, `tags`, `sort_by`, `sort_order`
96
+
97
+ **search kwargs:** `limit`, `workspace`, `tags`, `memory_type`, `include_archived`
98
+
99
+ ## Requirements
100
+
101
+ - Python >= 3.9
102
+ - httpx >= 0.25.0
103
+
104
+ ## Related
105
+
106
+ - [Engram](https://github.com/limaronaldo/engram) - Core memory engine (Rust)
107
+ - [Engram Cloud](https://github.com/limaronaldo/engram-cloud) - Multi-tenant SaaS gateway
108
+ - [@engram/client](https://www.npmjs.com/package/@engram/client) - TypeScript client
109
+
110
+ ## License
111
+
112
+ MIT
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ engram_client/__init__.py
4
+ engram_client/client.py
5
+ engram_client.egg-info/PKG-INFO
6
+ engram_client.egg-info/SOURCES.txt
7
+ engram_client.egg-info/dependency_links.txt
8
+ engram_client.egg-info/requires.txt
9
+ engram_client.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ httpx>=0.25.0
@@ -0,0 +1 @@
1
+ engram_client
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "engram-client"
7
+ version = "0.1.0"
8
+ description = "Python client for Engram Cloud - AI memory infrastructure"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.9"
12
+ authors = [{name = "Ronaldo Lima"}]
13
+ keywords = ["engram", "ai", "memory", "mcp", "agents"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Topic :: Software Development :: Libraries",
20
+ ]
21
+ dependencies = [
22
+ "httpx>=0.25.0",
23
+ ]
24
+
25
+ [project.urls]
26
+ Homepage = "https://github.com/limaronaldo/engram"
27
+ Repository = "https://github.com/limaronaldo/engram"
28
+
29
+ [tool.setuptools.packages.find]
30
+ include = ["engram_client*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+