hebbrix 2.1.0__tar.gz → 2.2.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.
hebbrix-2.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Hebbrix
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,5 +1,4 @@
1
1
  include README.md
2
2
  include LICENSE
3
3
  include pyproject.toml
4
- recursive-include hebbrix_sdk *.py
5
-
4
+ recursive-include hebbrix *.py
@@ -1,12 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hebbrix
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: Advanced Memory API for AI Agents with Reinforcement Learning - 3-line integration
5
- Home-page: https://github.com/hebbrix/hebbrix-python
6
- Author: Hebbrix Team
7
5
  Author-email: Hebbrix Team <support@hebbrix.com>
8
6
  Maintainer-email: Hebbrix Team <support@hebbrix.com>
9
- License: MIT
7
+ License-Expression: MIT
10
8
  Project-URL: Homepage, https://hebbrix.com
11
9
  Project-URL: Documentation, https://docs.hebbrix.com
12
10
  Project-URL: Repository, https://github.com/hebbrix/hebbrix-python
@@ -18,7 +16,6 @@ Classifier: Intended Audience :: Developers
18
16
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
17
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
18
  Classifier: Topic :: Database
21
- Classifier: License :: OSI Approved :: MIT License
22
19
  Classifier: Programming Language :: Python :: 3
23
20
  Classifier: Programming Language :: Python :: 3.8
24
21
  Classifier: Programming Language :: Python :: 3.9
@@ -29,6 +26,7 @@ Classifier: Operating System :: OS Independent
29
26
  Classifier: Framework :: AsyncIO
30
27
  Requires-Python: >=3.8
31
28
  Description-Content-Type: text/markdown
29
+ License-File: LICENSE
32
30
  Requires-Dist: httpx>=0.25.0
33
31
  Requires-Dist: requests>=2.31.0
34
32
  Provides-Extra: dev
@@ -37,9 +35,7 @@ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
37
35
  Requires-Dist: black>=23.0.0; extra == "dev"
38
36
  Requires-Dist: flake8>=6.0.0; extra == "dev"
39
37
  Requires-Dist: mypy>=1.0.0; extra == "dev"
40
- Dynamic: author
41
- Dynamic: home-page
42
- Dynamic: requires-python
38
+ Dynamic: license-file
43
39
 
44
40
  # Hebbrix Python SDK
45
41
 
@@ -57,6 +53,7 @@ Official Python SDK for the Hebbrix api - **the only memory API with Reinforceme
57
53
  - ✅ **Procedural Memory** - Store and execute learned skills
58
54
  - ✅ **Working Memory** - Short-term context buffer for conversations
59
55
  - ✅ **Memory Consolidation** - Automatic compression of episodic memories
56
+ - ✅ **ProofLoop** - Learn from outcomes with automatic, verifiable evidence receipts
60
57
  - ✅ **Async/Await** - Full async support with httpx
61
58
  - ✅ **Type Hints** - Complete type annotations
62
59
  - ✅ **Clean API** - Pythonic, intuitive interface
@@ -105,6 +102,27 @@ async def main():
105
102
  asyncio.run(main())
106
103
  ```
107
104
 
105
+ ## ProofLoop: search → decision → outcome → proof
106
+
107
+ ```python
108
+ search = await client.search_with_proof(
109
+ "What should the agent do next?",
110
+ collection_id="collection-42",
111
+ user_id="customer-7",
112
+ )
113
+ decision = await client.proofloop.decide(
114
+ policy_key="agent.next_action",
115
+ candidates=[{"action_key": "act"}, {"action_key": "ask"}],
116
+ collection_id="collection-42",
117
+ user_id="customer-7",
118
+ proof_context=search["proof_context"],
119
+ )
120
+ await client.proofloop.record_outcome(
121
+ decision["decision_id"], success=True, idempotency_key="run-123-result"
122
+ )
123
+ proof = await client.proofloop.proof(decision["decision_id"])
124
+ ```
125
+
108
126
  ## 📚 Complete Documentation
109
127
 
110
128
  Visit https://docs.hebbrix.com for full documentation.
@@ -14,6 +14,7 @@ Official Python SDK for the Hebbrix api - **the only memory API with Reinforceme
14
14
  - ✅ **Procedural Memory** - Store and execute learned skills
15
15
  - ✅ **Working Memory** - Short-term context buffer for conversations
16
16
  - ✅ **Memory Consolidation** - Automatic compression of episodic memories
17
+ - ✅ **ProofLoop** - Learn from outcomes with automatic, verifiable evidence receipts
17
18
  - ✅ **Async/Await** - Full async support with httpx
18
19
  - ✅ **Type Hints** - Complete type annotations
19
20
  - ✅ **Clean API** - Pythonic, intuitive interface
@@ -62,6 +63,27 @@ async def main():
62
63
  asyncio.run(main())
63
64
  ```
64
65
 
66
+ ## ProofLoop: search → decision → outcome → proof
67
+
68
+ ```python
69
+ search = await client.search_with_proof(
70
+ "What should the agent do next?",
71
+ collection_id="collection-42",
72
+ user_id="customer-7",
73
+ )
74
+ decision = await client.proofloop.decide(
75
+ policy_key="agent.next_action",
76
+ candidates=[{"action_key": "act"}, {"action_key": "ask"}],
77
+ collection_id="collection-42",
78
+ user_id="customer-7",
79
+ proof_context=search["proof_context"],
80
+ )
81
+ await client.proofloop.record_outcome(
82
+ decision["decision_id"], success=True, idempotency_key="run-123-result"
83
+ )
84
+ proof = await client.proofloop.proof(decision["decision_id"])
85
+ ```
86
+
65
87
  ## 📚 Complete Documentation
66
88
 
67
89
  Visit https://docs.hebbrix.com for full documentation.
@@ -41,7 +41,7 @@ Features:
41
41
  - ✅ Type hints throughout
42
42
  """
43
43
 
44
- __version__ = "2.1.0"
44
+ __version__ = "2.2.0"
45
45
  __author__ = "Hebbrix Team"
46
46
  __license__ = "MIT"
47
47
 
@@ -8,14 +8,28 @@ import os
8
8
  from typing import Any, Dict, List, Optional
9
9
 
10
10
  import httpx
11
- from hebbrix.exceptions import (AuthenticationError, HebbrixError,
12
- NotFoundError, RateLimitError, ServerError,
13
- ValidationError)
14
- from hebbrix.resources import (AuthResource, CollectionsResource,
15
- ConsolidationResource, MemoriesResource,
16
- MemoryToolsResource, ProceduralResource,
17
- RLResource, SearchResource, TemporalResource,
18
- WorkingMemoryResource, WorldModelResource)
11
+ from hebbrix.exceptions import (
12
+ AuthenticationError,
13
+ HebbrixError,
14
+ NotFoundError,
15
+ RateLimitError,
16
+ ServerError,
17
+ ValidationError,
18
+ )
19
+ from hebbrix.resources import (
20
+ AuthResource,
21
+ CollectionsResource,
22
+ ConsolidationResource,
23
+ MemoriesResource,
24
+ MemoryToolsResource,
25
+ ProceduralResource,
26
+ ProofLoopResource,
27
+ RLResource,
28
+ SearchResource,
29
+ TemporalResource,
30
+ WorkingMemoryResource,
31
+ WorldModelResource,
32
+ )
19
33
 
20
34
 
21
35
  class MemoryClient:
@@ -60,6 +74,7 @@ class MemoryClient:
60
74
  self.collections = CollectionsResource(self)
61
75
  self.memories = MemoriesResource(self)
62
76
  self.search_resource = SearchResource(self)
77
+ self.proofloop = ProofLoopResource(self)
63
78
  self.rl = RLResource(self)
64
79
  self.procedural = ProceduralResource(self)
65
80
  self.temporal = TemporalResource(self)
@@ -72,7 +87,7 @@ class MemoryClient:
72
87
  """Get request headers."""
73
88
  headers = {
74
89
  "Content-Type": "application/json",
75
- "User-Agent": "hebbrix-python/2.0.0",
90
+ "User-Agent": "hebbrix-python/2.2.0",
76
91
  }
77
92
 
78
93
  if self.api_key:
@@ -182,6 +197,26 @@ class MemoryClient:
182
197
  filters=filters or {},
183
198
  )
184
199
 
200
+ async def search_with_proof(
201
+ self,
202
+ query: str,
203
+ collection_id: Optional[str] = None,
204
+ limit: int = 10,
205
+ search_type: str = "hybrid",
206
+ filters: Optional[Dict[str, Any]] = None,
207
+ user_id: Optional[str] = None,
208
+ ) -> Dict[str, Any]:
209
+ """Search and return both results and the automatic ProofLoop context."""
210
+
211
+ return await self.search_resource.search_with_proof(
212
+ query=query,
213
+ collection_id=collection_id,
214
+ limit=limit,
215
+ search_type=search_type,
216
+ filters=filters or {},
217
+ user_id=user_id,
218
+ )
219
+
185
220
  async def reason(
186
221
  self,
187
222
  query: str,
@@ -3,7 +3,8 @@ API Resource classes
3
3
 
4
4
  Each resource class wraps a specific set of API endpoints.
5
5
  """
6
- from typing import Optional, Dict, Any, List, AsyncIterator, TYPE_CHECKING
6
+
7
+ from typing import TYPE_CHECKING, Any, AsyncIterator, Dict, List, Optional
7
8
 
8
9
  if TYPE_CHECKING:
9
10
  from hebbrix.client import MemoryClient
@@ -196,7 +197,7 @@ class MemoriesResource(BaseResource):
196
197
  self,
197
198
  collection_id: str,
198
199
  content: str,
199
- importance: float = 0.5,
200
+ importance: Optional[float] = None,
200
201
  source_type: str = "text",
201
202
  source_reference: Optional[str] = None,
202
203
  metadata: Optional[Dict[str, Any]] = None,
@@ -225,7 +226,9 @@ class MemoriesResource(BaseResource):
225
226
  Args:
226
227
  collection_id: Collection ID
227
228
  content: Memory content
228
- importance: Importance hint (0-1)
229
+ importance: Importance (0-1). When set, the direct-store path
230
+ (``infer=False``) uses this EXACT value. Leave as ``None`` to let
231
+ the server auto-score. Ignored when ``infer=True``.
229
232
  source_type: Type of source
230
233
  source_reference: Reference to source
231
234
  metadata: Optional metadata
@@ -236,17 +239,21 @@ class MemoriesResource(BaseResource):
236
239
  Created memory (MemoryAddResponse). With ``infer=False`` (default),
237
240
  ``results[0].id`` is the real, get-able memory id.
238
241
  """
242
+ payload: Dict[str, Any] = {
243
+ "collection_id": collection_id,
244
+ "content": content,
245
+ "source_type": source_type,
246
+ "source_reference": source_reference,
247
+ "metadata": metadata or {},
248
+ "infer": infer,
249
+ }
250
+ # Send importance ONLY when the caller set it, so an unspecified
251
+ # importance keeps the server's auto-scoring instead of pinning a value.
252
+ if importance is not None:
253
+ payload["importance"] = importance
239
254
  return await self.client.post(
240
255
  "/v1/memories",
241
- json={
242
- "collection_id": collection_id,
243
- "content": content,
244
- "importance": importance,
245
- "source_type": source_type,
246
- "source_reference": source_reference,
247
- "metadata": metadata or {},
248
- "infer": infer,
249
- },
256
+ json=payload,
250
257
  )
251
258
 
252
259
  async def list_page(
@@ -425,6 +432,33 @@ class SearchResource(BaseResource):
425
432
 
426
433
  return response.get("results", [])
427
434
 
435
+ async def search_with_proof(
436
+ self,
437
+ query: str,
438
+ collection_id: Optional[str] = None,
439
+ limit: int = 10,
440
+ search_type: str = "hybrid",
441
+ filters: Optional[Dict[str, Any]] = None,
442
+ user_id: Optional[str] = None,
443
+ ) -> Dict[str, Any]:
444
+ """Search and preserve the automatic ProofLoop context.
445
+
446
+ The legacy ``search`` method still returns only the result list. Use
447
+ this method when the selected evidence will feed a learned decision.
448
+ """
449
+
450
+ return await self.client.post(
451
+ "/v1/search",
452
+ json={
453
+ "query": query,
454
+ "collection_id": collection_id,
455
+ "user_id": user_id,
456
+ "limit": limit,
457
+ "search_type": search_type,
458
+ "filters": filters or {},
459
+ },
460
+ )
461
+
428
462
  async def similar(
429
463
  self,
430
464
  memory_id: str,
@@ -477,6 +511,61 @@ class SearchResource(BaseResource):
477
511
  )
478
512
 
479
513
 
514
+ class ProofLoopResource(BaseResource):
515
+ """Outcome Memory decisions with automatic evidence and verifiable proofs."""
516
+
517
+ async def decide(
518
+ self,
519
+ *,
520
+ policy_key: str,
521
+ candidates: List[Dict[str, Any]],
522
+ proof_context: Optional[Any] = None,
523
+ collection_id: Optional[str] = None,
524
+ user_id: Optional[str] = None,
525
+ **kwargs,
526
+ ) -> Dict[str, Any]:
527
+ token = (
528
+ proof_context.get("token")
529
+ if isinstance(proof_context, dict)
530
+ else proof_context
531
+ )
532
+ body = {
533
+ "policy_key": policy_key,
534
+ "candidates": candidates,
535
+ "collection_id": collection_id,
536
+ "user_id": user_id,
537
+ **kwargs,
538
+ }
539
+ if token:
540
+ body["proof_context_token"] = token
541
+ return await self.client.post("/v1/learning/decisions", json=body)
542
+
543
+ async def record_outcome(
544
+ self,
545
+ decision_id: str,
546
+ *,
547
+ observations: Optional[List[Dict[str, Any]]] = None,
548
+ reward: Optional[float] = None,
549
+ success: Optional[bool] = None,
550
+ idempotency_key: Optional[str] = None,
551
+ ) -> Dict[str, Any]:
552
+ return await self.client.post(
553
+ f"/v1/learning/decisions/{decision_id}/outcomes",
554
+ json={
555
+ "observations": observations or [],
556
+ "reward": reward,
557
+ "success": success,
558
+ "idempotency_key": idempotency_key,
559
+ },
560
+ )
561
+
562
+ async def proof(self, decision_id: str) -> Dict[str, Any]:
563
+ return await self.client.get(f"/v1/learning/decisions/{decision_id}/proof")
564
+
565
+ async def public_key(self) -> Dict[str, Any]:
566
+ return await self.client.get("/v1/learning/proof-key")
567
+
568
+
480
569
  class RLResource(BaseResource):
481
570
  """Reinforcement Learning training endpoints."""
482
571
 
@@ -1,12 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hebbrix
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: Advanced Memory API for AI Agents with Reinforcement Learning - 3-line integration
5
- Home-page: https://github.com/hebbrix/hebbrix-python
6
- Author: Hebbrix Team
7
5
  Author-email: Hebbrix Team <support@hebbrix.com>
8
6
  Maintainer-email: Hebbrix Team <support@hebbrix.com>
9
- License: MIT
7
+ License-Expression: MIT
10
8
  Project-URL: Homepage, https://hebbrix.com
11
9
  Project-URL: Documentation, https://docs.hebbrix.com
12
10
  Project-URL: Repository, https://github.com/hebbrix/hebbrix-python
@@ -18,7 +16,6 @@ Classifier: Intended Audience :: Developers
18
16
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
17
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
18
  Classifier: Topic :: Database
21
- Classifier: License :: OSI Approved :: MIT License
22
19
  Classifier: Programming Language :: Python :: 3
23
20
  Classifier: Programming Language :: Python :: 3.8
24
21
  Classifier: Programming Language :: Python :: 3.9
@@ -29,6 +26,7 @@ Classifier: Operating System :: OS Independent
29
26
  Classifier: Framework :: AsyncIO
30
27
  Requires-Python: >=3.8
31
28
  Description-Content-Type: text/markdown
29
+ License-File: LICENSE
32
30
  Requires-Dist: httpx>=0.25.0
33
31
  Requires-Dist: requests>=2.31.0
34
32
  Provides-Extra: dev
@@ -37,9 +35,7 @@ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
37
35
  Requires-Dist: black>=23.0.0; extra == "dev"
38
36
  Requires-Dist: flake8>=6.0.0; extra == "dev"
39
37
  Requires-Dist: mypy>=1.0.0; extra == "dev"
40
- Dynamic: author
41
- Dynamic: home-page
42
- Dynamic: requires-python
38
+ Dynamic: license-file
43
39
 
44
40
  # Hebbrix Python SDK
45
41
 
@@ -57,6 +53,7 @@ Official Python SDK for the Hebbrix api - **the only memory API with Reinforceme
57
53
  - ✅ **Procedural Memory** - Store and execute learned skills
58
54
  - ✅ **Working Memory** - Short-term context buffer for conversations
59
55
  - ✅ **Memory Consolidation** - Automatic compression of episodic memories
56
+ - ✅ **ProofLoop** - Learn from outcomes with automatic, verifiable evidence receipts
60
57
  - ✅ **Async/Await** - Full async support with httpx
61
58
  - ✅ **Type Hints** - Complete type annotations
62
59
  - ✅ **Clean API** - Pythonic, intuitive interface
@@ -105,6 +102,27 @@ async def main():
105
102
  asyncio.run(main())
106
103
  ```
107
104
 
105
+ ## ProofLoop: search → decision → outcome → proof
106
+
107
+ ```python
108
+ search = await client.search_with_proof(
109
+ "What should the agent do next?",
110
+ collection_id="collection-42",
111
+ user_id="customer-7",
112
+ )
113
+ decision = await client.proofloop.decide(
114
+ policy_key="agent.next_action",
115
+ candidates=[{"action_key": "act"}, {"action_key": "ask"}],
116
+ collection_id="collection-42",
117
+ user_id="customer-7",
118
+ proof_context=search["proof_context"],
119
+ )
120
+ await client.proofloop.record_outcome(
121
+ decision["decision_id"], success=True, idempotency_key="run-123-result"
122
+ )
123
+ proof = await client.proofloop.proof(decision["decision_id"])
124
+ ```
125
+
108
126
  ## 📚 Complete Documentation
109
127
 
110
128
  Visit https://docs.hebbrix.com for full documentation.
@@ -1,7 +1,7 @@
1
+ LICENSE
1
2
  MANIFEST.in
2
3
  README.md
3
4
  pyproject.toml
4
- setup.py
5
5
  hebbrix/__init__.py
6
6
  hebbrix/chat.py
7
7
  hebbrix/client.py
@@ -1,14 +1,15 @@
1
1
  [build-system]
2
- requires = ["setuptools>=61.0", "wheel"]
2
+ requires = ["setuptools>=77.0", "wheel"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hebbrix"
7
- version = "2.1.0"
7
+ version = "2.2.0"
8
8
  description = "Advanced Memory API for AI Agents with Reinforcement Learning - 3-line integration"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
11
- license = {text = "MIT"}
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
12
13
  authors = [
13
14
  {name = "Hebbrix Team", email = "support@hebbrix.com"}
14
15
  ]
@@ -37,7 +38,6 @@ classifiers = [
37
38
  "Topic :: Software Development :: Libraries :: Python Modules",
38
39
  "Topic :: Scientific/Engineering :: Artificial Intelligence",
39
40
  "Topic :: Database",
40
- "License :: OSI Approved :: MIT License",
41
41
  "Programming Language :: Python :: 3",
42
42
  "Programming Language :: Python :: 3.8",
43
43
  "Programming Language :: Python :: 3.9",
@@ -72,4 +72,3 @@ Repository = "https://github.com/hebbrix/hebbrix-python"
72
72
  where = ["."]
73
73
  include = ["hebbrix*"]
74
74
  exclude = ["tests*", "memory_ai*", "memory_ai_sdk*"]
75
-
hebbrix-2.1.0/setup.py DELETED
@@ -1,57 +0,0 @@
1
- """
2
- Hebbrix Python SDK Setup
3
- Official Python SDK for the Hebbrix Memory API
4
- """
5
- from setuptools import setup, find_packages
6
-
7
- with open("README.md", "r", encoding="utf-8") as fh:
8
- long_description = fh.read()
9
-
10
- setup(
11
- name="hebbrix",
12
- version="2.1.0",
13
- author="Hebbrix Team",
14
- author_email="support@hebbrix.com",
15
- description="Advanced Memory API for AI Agents with Reinforcement Learning - 3-line integration",
16
- long_description=long_description,
17
- long_description_content_type="text/markdown",
18
- url="https://github.com/hebbrix/hebbrix-python",
19
- project_urls={
20
- "Documentation": "https://docs.hebbrix.com",
21
- "Bug Tracker": "https://github.com/hebbrix/hebbrix-python/issues",
22
- "Source": "https://github.com/hebbrix/hebbrix-python",
23
- "API Reference": "https://api.hebbrix.com/docs",
24
- },
25
- packages=find_packages(include=["hebbrix", "hebbrix.*"]),
26
- classifiers=[
27
- "Development Status :: 5 - Production/Stable",
28
- "Intended Audience :: Developers",
29
- "License :: OSI Approved :: MIT License",
30
- "Operating System :: OS Independent",
31
- "Programming Language :: Python :: 3",
32
- "Programming Language :: Python :: 3.8",
33
- "Programming Language :: Python :: 3.9",
34
- "Programming Language :: Python :: 3.10",
35
- "Programming Language :: Python :: 3.11",
36
- "Programming Language :: Python :: 3.12",
37
- "Topic :: Software Development :: Libraries :: Python Modules",
38
- "Topic :: Scientific/Engineering :: Artificial Intelligence",
39
- "Topic :: Database",
40
- "Framework :: AsyncIO",
41
- ],
42
- keywords="ai memory agents llm chatbot rag vector-search knowledge-graph reinforcement-learning",
43
- python_requires=">=3.8",
44
- install_requires=[
45
- "httpx>=0.25.0",
46
- "requests>=2.31.0",
47
- ],
48
- extras_require={
49
- "dev": [
50
- "pytest>=7.0.0",
51
- "pytest-asyncio>=0.21.0",
52
- "pytest-cov>=4.0.0",
53
- "black>=23.0.0",
54
- "mypy>=1.0.0",
55
- ],
56
- },
57
- )
File without changes
File without changes
File without changes