pyagent-context 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,18 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .venv/
10
+ venv/
11
+ .mypy_cache/
12
+ .ruff_cache/
13
+ .pytest_cache/
14
+ .coverage
15
+ htmlcov/
16
+ site/
17
+ .env
18
+ *.log
@@ -0,0 +1,286 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyagent-context
3
+ Version: 0.1.0
4
+ Summary: Three-tier memory with trust-aware context ledger for multi-agent LLM systems
5
+ Project-URL: Homepage, https://pyagent.org
6
+ Project-URL: Repository, https://github.com/pyagent-core/pyagent
7
+ Project-URL: Documentation, https://pyagent.org
8
+ Author-email: PyAgent Team <team@pyagent.org>
9
+ License: MIT
10
+ Keywords: LLM,agents,context,memory,retrieval,trust
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: pyagent-patterns>=0.1.0
21
+ Provides-Extra: chromadb
22
+ Requires-Dist: chromadb>=0.5; extra == 'chromadb'
23
+ Provides-Extra: compress
24
+ Requires-Dist: pyagent-compress>=0.1.0; extra == 'compress'
25
+ Provides-Extra: dev
26
+ Requires-Dist: mypy>=1.10; extra == 'dev'
27
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
28
+ Requires-Dist: pytest>=8.0; extra == 'dev'
29
+ Requires-Dist: ruff>=0.5; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # pyagent-context
33
+
34
+ **Three-tier memory with trust-aware context ledger** for multi-agent LLM systems. Structured context management with trust levels, sensitivity classification, compression policies, and lifecycle management.
35
+
36
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](../../LICENSE)
37
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
38
+
39
+ ## Install
40
+
41
+ ```bash
42
+ pip install pyagent-context # Core (working + session + semantic memory)
43
+ pip install pyagent-context[compress] # + ContextCompressor with pyagent-compress
44
+ pip install pyagent-context[chromadb] # + ChromaDB semantic memory backend
45
+ ```
46
+
47
+ Depends on: `pyagent-patterns`.
48
+
49
+ ## Why Structured Context?
50
+
51
+ Without `pyagent-context`, multi-agent workflows pass a flat `list[Message]` that grows unbounded. You lose track of *who* said *what*, *when*, and *how much to trust it*. This package adds trust levels, sensitivity tiers, expiry, compression, and three memory tiers — so your agents always work with the right context.
52
+
53
+ ## ContextItem — Everything Has Metadata
54
+
55
+ ```python
56
+ import time
57
+ from pyagent_context import ContextItem, TrustLevel, Sensitivity
58
+
59
+ item = ContextItem(
60
+ content="Revenue grew 15% YoY to $25.2B",
61
+ source="analyst",
62
+ trust_level=TrustLevel.VERIFIED, # verified | inferred | user | external
63
+ sensitivity=Sensitivity.INTERNAL, # public | internal | confidential | restricted
64
+ expires_at=time.time() + 3600, # auto-expire in 1 hour
65
+ derived_from="abc123", # parent item ID
66
+ )
67
+
68
+ print(item.id) # unique 12-char hex
69
+ print(item.token_estimate) # auto-calculated: len(content) // 4
70
+ print(item.is_expired) # False (still within TTL)
71
+ print(item.age_seconds) # seconds since creation
72
+
73
+ # Serialize / deserialize
74
+ data = item.to_dict()
75
+ restored = ContextItem.from_dict(data)
76
+ ```
77
+
78
+ ## ContextLedger — Append-Only Context Log
79
+
80
+ ```python
81
+ from pyagent_context import ContextLedger, TrustLevel
82
+
83
+ ledger = ContextLedger()
84
+
85
+ # Add items
86
+ ledger.add("User asked about Q3 earnings", "user", TrustLevel.USER_PROVIDED)
87
+ ledger.add("Revenue: $25.2B (+8% YoY)", "analyst", TrustLevel.VERIFIED)
88
+ ledger.add("I think margins will improve", "forecaster", TrustLevel.INFERRED)
89
+
90
+ # Query by trust
91
+ verified = ledger.query(min_trust=TrustLevel.VERIFIED)
92
+ print(len(verified)) # 1
93
+
94
+ # Query by age (last 5 minutes)
95
+ recent = ledger.query(max_age_seconds=300)
96
+
97
+ # Query by source
98
+ from_analyst = ledger.query(source="analyst")
99
+
100
+ # Convert to Messages for pattern consumption
101
+ messages = ledger.to_messages() # all items
102
+ messages = ledger.to_messages(max_tokens=500) # budget-constrained (most recent first)
103
+
104
+ # Snapshot for persistence
105
+ snap = ledger.snapshot() # JSON-serializable dict
106
+ restored = ContextLedger.from_snapshot(snap)
107
+ ```
108
+
109
+ ## Three-Tier Memory
110
+
111
+ ### WorkingMemory — Bounded In-Flight Context
112
+
113
+ ```python
114
+ from pyagent_context import WorkingMemory, ContextItem
115
+
116
+ wm = WorkingMemory(max_items=50, max_tokens=10_000)
117
+
118
+ item = ContextItem(content="New observation", source="agent_1")
119
+ evicted = wm.add(item) # returns list of evicted items if capacity exceeded
120
+
121
+ print(len(wm)) # current item count
122
+ print(wm.total_tokens) # current token usage
123
+ print(f"{wm.utilization:.0%}") # e.g. "42%"
124
+ ```
125
+
126
+ ### SessionMemory — Persist Across Turns
127
+
128
+ ```python
129
+ from pyagent_context import SessionMemory, ContextItem
130
+
131
+ # JSON backend (simple, human-readable)
132
+ session = SessionMemory("user-123-session", backend="json", storage_path=".sessions")
133
+ session.add(ContextItem(content="User prefers concise answers", source="user"))
134
+ session.save()
135
+
136
+ # Later: reload
137
+ session2 = SessionMemory("user-123-session", backend="json", storage_path=".sessions")
138
+ session2.load()
139
+ items = session2.get_all()
140
+
141
+ # SQLite backend (concurrent-safe)
142
+ session = SessionMemory("user-123-session", backend="sqlite", storage_path=".sessions")
143
+ session.add(ContextItem(content="Important context", source="system"))
144
+ session.save()
145
+ ```
146
+
147
+ ### SemanticMemory — Vector-Indexed Long-Term Store
148
+
149
+ ```python
150
+ from pyagent_context import InMemorySemanticStore, ContextItem
151
+
152
+ store = InMemorySemanticStore()
153
+
154
+ # Index items
155
+ store.add(ContextItem(content="Python asyncio event loop concurrency patterns", source="docs"))
156
+ store.add(ContextItem(content="JavaScript React component lifecycle hooks", source="docs"))
157
+ store.add(ContextItem(content="Python FastAPI async web framework REST API design", source="docs"))
158
+
159
+ # Semantic search (TF-IDF cosine similarity)
160
+ results = store.search("Python async web", top_k=3)
161
+ for r in results:
162
+ print(f" [{r.score:.2f}] {r.item.content[:60]}...")
163
+
164
+ # Remove / clear
165
+ store.remove(item_id)
166
+ store.clear()
167
+ ```
168
+
169
+ ## ContextCompressor — Manage Token Growth
170
+
171
+ Four policies: `NONE`, `FIFO`, `SEMANTIC_LOSSLESS`, `SAWTOOTH`.
172
+
173
+ ```python
174
+ from pyagent_context import ContextCompressor, CompressionPolicy, ContextLedger
175
+
176
+ # FIFO: drop oldest items until under floor
177
+ compressor = ContextCompressor(
178
+ policy=CompressionPolicy.FIFO,
179
+ threshold_tokens=10_000, # trigger compression at 10k tokens
180
+ floor_tokens=5_000, # compress down to 5k
181
+ )
182
+
183
+ if compressor.should_compress(ledger):
184
+ compressed = compressor.compress(ledger)
185
+ print(f"Compressed: {ledger.total_tokens} → {compressed.total_tokens} tokens")
186
+
187
+ # SAWTOOTH: compress to floor, then allow growth again
188
+ compressor = ContextCompressor(
189
+ policy=CompressionPolicy.SAWTOOTH,
190
+ threshold_tokens=10_000,
191
+ floor_tokens=3_000,
192
+ )
193
+
194
+ # SEMANTIC_LOSSLESS: compress text but preserve verified items unchanged
195
+ compressor = ContextCompressor(
196
+ policy=CompressionPolicy.SEMANTIC_LOSSLESS,
197
+ threshold_tokens=8_000,
198
+ floor_tokens=4_000,
199
+ )
200
+ ```
201
+
202
+ ## TrustAwareRetriever — Smart Context Selection
203
+
204
+ Scores items by `trust × recency × relevance`:
205
+
206
+ ```python
207
+ from pyagent_context import TrustAwareRetriever
208
+
209
+ retriever = TrustAwareRetriever(
210
+ weight_trust=0.3,
211
+ weight_recency=0.3,
212
+ weight_relevance=0.4,
213
+ recency_half_life=3600.0, # 1 hour half-life
214
+ )
215
+
216
+ results = retriever.retrieve(ledger, "Q3 earnings revenue growth", top_k=5)
217
+ for r in results:
218
+ print(f" [{r.score:.2f}] trust={r.trust_score:.2f} "
219
+ f"recency={r.recency_score:.2f} relevance={r.relevance_score:.2f}")
220
+ print(f" {r.item.content[:80]}...")
221
+ ```
222
+
223
+ ## ContextLifecycle — Expiry, Decay, Consolidation
224
+
225
+ ```python
226
+ from pyagent_context import ContextLifecycle
227
+
228
+ lifecycle = ContextLifecycle(consolidation_threshold=0.6)
229
+
230
+ # Remove expired items
231
+ new_ledger, expired = lifecycle.sweep_expired(ledger)
232
+ print(f"Removed {len(expired)} expired items")
233
+
234
+ # Apply freshness decay (old items get smaller token budgets)
235
+ decayed = lifecycle.apply_freshness_decay(ledger, half_life_seconds=3600)
236
+
237
+ # Merge similar items from the same source
238
+ consolidated = lifecycle.consolidate(ledger)
239
+ print(f"Consolidated: {len(ledger)} → {len(consolidated)} items")
240
+ ```
241
+
242
+ ## ContextRedactor — Sensitivity-Based Redaction
243
+
244
+ ```python
245
+ from pyagent_context import ContextRedactor
246
+ from pyagent_context.item import Sensitivity
247
+
248
+ # Redact items above INTERNAL sensitivity
249
+ redactor = ContextRedactor(
250
+ max_sensitivity=Sensitivity.INTERNAL,
251
+ redaction_text="[REDACTED — CONFIDENTIAL]",
252
+ )
253
+
254
+ redacted_ledger = redactor.redact_ledger(ledger)
255
+
256
+ # Or exclude entirely instead of redacting
257
+ redactor = ContextRedactor(
258
+ max_sensitivity=Sensitivity.INTERNAL,
259
+ exclude_above=True,
260
+ )
261
+ filtered_ledger = redactor.redact_ledger(ledger)
262
+ ```
263
+
264
+ ## Integration with pyagent-patterns
265
+
266
+ ```python
267
+ from pyagent_patterns.base import Agent, MockLLM
268
+ from pyagent_patterns.orchestration import Pipeline
269
+ from pyagent_context import ContextLedger, TrustLevel, WorkingMemory
270
+
271
+ ledger = ContextLedger()
272
+
273
+ # Before pattern run: seed with trusted context
274
+ ledger.add("User is asking about Q3 2025 earnings", "user", TrustLevel.USER_PROVIDED)
275
+ ledger.add("Tesla Q3 revenue was $25.2B", "database", TrustLevel.VERIFIED)
276
+
277
+ # Convert to messages and prepend to pattern input
278
+ context_messages = ledger.to_messages(max_tokens=2000)
279
+
280
+ # After pattern run: store results
281
+ ledger.add(result.output, "pipeline", TrustLevel.INFERRED)
282
+ ```
283
+
284
+ ## Full Documentation
285
+
286
+ See [pyagent.dev](https://pyagent.dev) for full API reference and integration guides.
@@ -0,0 +1,255 @@
1
+ # pyagent-context
2
+
3
+ **Three-tier memory with trust-aware context ledger** for multi-agent LLM systems. Structured context management with trust levels, sensitivity classification, compression policies, and lifecycle management.
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](../../LICENSE)
6
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ pip install pyagent-context # Core (working + session + semantic memory)
12
+ pip install pyagent-context[compress] # + ContextCompressor with pyagent-compress
13
+ pip install pyagent-context[chromadb] # + ChromaDB semantic memory backend
14
+ ```
15
+
16
+ Depends on: `pyagent-patterns`.
17
+
18
+ ## Why Structured Context?
19
+
20
+ Without `pyagent-context`, multi-agent workflows pass a flat `list[Message]` that grows unbounded. You lose track of *who* said *what*, *when*, and *how much to trust it*. This package adds trust levels, sensitivity tiers, expiry, compression, and three memory tiers — so your agents always work with the right context.
21
+
22
+ ## ContextItem — Everything Has Metadata
23
+
24
+ ```python
25
+ import time
26
+ from pyagent_context import ContextItem, TrustLevel, Sensitivity
27
+
28
+ item = ContextItem(
29
+ content="Revenue grew 15% YoY to $25.2B",
30
+ source="analyst",
31
+ trust_level=TrustLevel.VERIFIED, # verified | inferred | user | external
32
+ sensitivity=Sensitivity.INTERNAL, # public | internal | confidential | restricted
33
+ expires_at=time.time() + 3600, # auto-expire in 1 hour
34
+ derived_from="abc123", # parent item ID
35
+ )
36
+
37
+ print(item.id) # unique 12-char hex
38
+ print(item.token_estimate) # auto-calculated: len(content) // 4
39
+ print(item.is_expired) # False (still within TTL)
40
+ print(item.age_seconds) # seconds since creation
41
+
42
+ # Serialize / deserialize
43
+ data = item.to_dict()
44
+ restored = ContextItem.from_dict(data)
45
+ ```
46
+
47
+ ## ContextLedger — Append-Only Context Log
48
+
49
+ ```python
50
+ from pyagent_context import ContextLedger, TrustLevel
51
+
52
+ ledger = ContextLedger()
53
+
54
+ # Add items
55
+ ledger.add("User asked about Q3 earnings", "user", TrustLevel.USER_PROVIDED)
56
+ ledger.add("Revenue: $25.2B (+8% YoY)", "analyst", TrustLevel.VERIFIED)
57
+ ledger.add("I think margins will improve", "forecaster", TrustLevel.INFERRED)
58
+
59
+ # Query by trust
60
+ verified = ledger.query(min_trust=TrustLevel.VERIFIED)
61
+ print(len(verified)) # 1
62
+
63
+ # Query by age (last 5 minutes)
64
+ recent = ledger.query(max_age_seconds=300)
65
+
66
+ # Query by source
67
+ from_analyst = ledger.query(source="analyst")
68
+
69
+ # Convert to Messages for pattern consumption
70
+ messages = ledger.to_messages() # all items
71
+ messages = ledger.to_messages(max_tokens=500) # budget-constrained (most recent first)
72
+
73
+ # Snapshot for persistence
74
+ snap = ledger.snapshot() # JSON-serializable dict
75
+ restored = ContextLedger.from_snapshot(snap)
76
+ ```
77
+
78
+ ## Three-Tier Memory
79
+
80
+ ### WorkingMemory — Bounded In-Flight Context
81
+
82
+ ```python
83
+ from pyagent_context import WorkingMemory, ContextItem
84
+
85
+ wm = WorkingMemory(max_items=50, max_tokens=10_000)
86
+
87
+ item = ContextItem(content="New observation", source="agent_1")
88
+ evicted = wm.add(item) # returns list of evicted items if capacity exceeded
89
+
90
+ print(len(wm)) # current item count
91
+ print(wm.total_tokens) # current token usage
92
+ print(f"{wm.utilization:.0%}") # e.g. "42%"
93
+ ```
94
+
95
+ ### SessionMemory — Persist Across Turns
96
+
97
+ ```python
98
+ from pyagent_context import SessionMemory, ContextItem
99
+
100
+ # JSON backend (simple, human-readable)
101
+ session = SessionMemory("user-123-session", backend="json", storage_path=".sessions")
102
+ session.add(ContextItem(content="User prefers concise answers", source="user"))
103
+ session.save()
104
+
105
+ # Later: reload
106
+ session2 = SessionMemory("user-123-session", backend="json", storage_path=".sessions")
107
+ session2.load()
108
+ items = session2.get_all()
109
+
110
+ # SQLite backend (concurrent-safe)
111
+ session = SessionMemory("user-123-session", backend="sqlite", storage_path=".sessions")
112
+ session.add(ContextItem(content="Important context", source="system"))
113
+ session.save()
114
+ ```
115
+
116
+ ### SemanticMemory — Vector-Indexed Long-Term Store
117
+
118
+ ```python
119
+ from pyagent_context import InMemorySemanticStore, ContextItem
120
+
121
+ store = InMemorySemanticStore()
122
+
123
+ # Index items
124
+ store.add(ContextItem(content="Python asyncio event loop concurrency patterns", source="docs"))
125
+ store.add(ContextItem(content="JavaScript React component lifecycle hooks", source="docs"))
126
+ store.add(ContextItem(content="Python FastAPI async web framework REST API design", source="docs"))
127
+
128
+ # Semantic search (TF-IDF cosine similarity)
129
+ results = store.search("Python async web", top_k=3)
130
+ for r in results:
131
+ print(f" [{r.score:.2f}] {r.item.content[:60]}...")
132
+
133
+ # Remove / clear
134
+ store.remove(item_id)
135
+ store.clear()
136
+ ```
137
+
138
+ ## ContextCompressor — Manage Token Growth
139
+
140
+ Four policies: `NONE`, `FIFO`, `SEMANTIC_LOSSLESS`, `SAWTOOTH`.
141
+
142
+ ```python
143
+ from pyagent_context import ContextCompressor, CompressionPolicy, ContextLedger
144
+
145
+ # FIFO: drop oldest items until under floor
146
+ compressor = ContextCompressor(
147
+ policy=CompressionPolicy.FIFO,
148
+ threshold_tokens=10_000, # trigger compression at 10k tokens
149
+ floor_tokens=5_000, # compress down to 5k
150
+ )
151
+
152
+ if compressor.should_compress(ledger):
153
+ compressed = compressor.compress(ledger)
154
+ print(f"Compressed: {ledger.total_tokens} → {compressed.total_tokens} tokens")
155
+
156
+ # SAWTOOTH: compress to floor, then allow growth again
157
+ compressor = ContextCompressor(
158
+ policy=CompressionPolicy.SAWTOOTH,
159
+ threshold_tokens=10_000,
160
+ floor_tokens=3_000,
161
+ )
162
+
163
+ # SEMANTIC_LOSSLESS: compress text but preserve verified items unchanged
164
+ compressor = ContextCompressor(
165
+ policy=CompressionPolicy.SEMANTIC_LOSSLESS,
166
+ threshold_tokens=8_000,
167
+ floor_tokens=4_000,
168
+ )
169
+ ```
170
+
171
+ ## TrustAwareRetriever — Smart Context Selection
172
+
173
+ Scores items by `trust × recency × relevance`:
174
+
175
+ ```python
176
+ from pyagent_context import TrustAwareRetriever
177
+
178
+ retriever = TrustAwareRetriever(
179
+ weight_trust=0.3,
180
+ weight_recency=0.3,
181
+ weight_relevance=0.4,
182
+ recency_half_life=3600.0, # 1 hour half-life
183
+ )
184
+
185
+ results = retriever.retrieve(ledger, "Q3 earnings revenue growth", top_k=5)
186
+ for r in results:
187
+ print(f" [{r.score:.2f}] trust={r.trust_score:.2f} "
188
+ f"recency={r.recency_score:.2f} relevance={r.relevance_score:.2f}")
189
+ print(f" {r.item.content[:80]}...")
190
+ ```
191
+
192
+ ## ContextLifecycle — Expiry, Decay, Consolidation
193
+
194
+ ```python
195
+ from pyagent_context import ContextLifecycle
196
+
197
+ lifecycle = ContextLifecycle(consolidation_threshold=0.6)
198
+
199
+ # Remove expired items
200
+ new_ledger, expired = lifecycle.sweep_expired(ledger)
201
+ print(f"Removed {len(expired)} expired items")
202
+
203
+ # Apply freshness decay (old items get smaller token budgets)
204
+ decayed = lifecycle.apply_freshness_decay(ledger, half_life_seconds=3600)
205
+
206
+ # Merge similar items from the same source
207
+ consolidated = lifecycle.consolidate(ledger)
208
+ print(f"Consolidated: {len(ledger)} → {len(consolidated)} items")
209
+ ```
210
+
211
+ ## ContextRedactor — Sensitivity-Based Redaction
212
+
213
+ ```python
214
+ from pyagent_context import ContextRedactor
215
+ from pyagent_context.item import Sensitivity
216
+
217
+ # Redact items above INTERNAL sensitivity
218
+ redactor = ContextRedactor(
219
+ max_sensitivity=Sensitivity.INTERNAL,
220
+ redaction_text="[REDACTED — CONFIDENTIAL]",
221
+ )
222
+
223
+ redacted_ledger = redactor.redact_ledger(ledger)
224
+
225
+ # Or exclude entirely instead of redacting
226
+ redactor = ContextRedactor(
227
+ max_sensitivity=Sensitivity.INTERNAL,
228
+ exclude_above=True,
229
+ )
230
+ filtered_ledger = redactor.redact_ledger(ledger)
231
+ ```
232
+
233
+ ## Integration with pyagent-patterns
234
+
235
+ ```python
236
+ from pyagent_patterns.base import Agent, MockLLM
237
+ from pyagent_patterns.orchestration import Pipeline
238
+ from pyagent_context import ContextLedger, TrustLevel, WorkingMemory
239
+
240
+ ledger = ContextLedger()
241
+
242
+ # Before pattern run: seed with trusted context
243
+ ledger.add("User is asking about Q3 2025 earnings", "user", TrustLevel.USER_PROVIDED)
244
+ ledger.add("Tesla Q3 revenue was $25.2B", "database", TrustLevel.VERIFIED)
245
+
246
+ # Convert to messages and prepend to pattern input
247
+ context_messages = ledger.to_messages(max_tokens=2000)
248
+
249
+ # After pattern run: store results
250
+ ledger.add(result.output, "pipeline", TrustLevel.INFERRED)
251
+ ```
252
+
253
+ ## Full Documentation
254
+
255
+ See [pyagent.dev](https://pyagent.dev) for full API reference and integration guides.
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "pyagent-context"
7
+ version = "0.1.0"
8
+ description = "Three-tier memory with trust-aware context ledger for multi-agent LLM systems"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = {text = "MIT"}
12
+ authors = [{name = "PyAgent Team", email = "team@pyagent.org"}]
13
+ keywords = ["agents", "context", "memory", "LLM", "trust", "retrieval"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
22
+ "Typing :: Typed",
23
+ ]
24
+ dependencies = ["pyagent-patterns>=0.1.0"]
25
+
26
+ [project.urls]
27
+ Homepage = "https://pyagent.org"
28
+ Repository = "https://github.com/pyagent-core/pyagent"
29
+ Documentation = "https://pyagent.org"
30
+
31
+ [project.optional-dependencies]
32
+ compress = ["pyagent-compress>=0.1.0"]
33
+ chromadb = ["chromadb>=0.5"]
34
+ dev = ["pytest>=8.0", "pytest-asyncio>=0.23", "ruff>=0.5", "mypy>=1.10"]
35
+
36
+ [tool.hatch.build.targets.wheel]
37
+ packages = ["src/pyagent_context"]
@@ -0,0 +1,29 @@
1
+ """PyAgent Context — three-tier memory with trust-aware context ledger."""
2
+
3
+ from pyagent_context.compression import CompressionPolicy, ContextCompressor
4
+ from pyagent_context.item import ContextItem, Sensitivity, TrustLevel
5
+ from pyagent_context.ledger import ContextLedger
6
+ from pyagent_context.lifecycle import ContextLifecycle
7
+ from pyagent_context.memory.semantic import InMemorySemanticStore, SemanticMemoryProtocol
8
+ from pyagent_context.memory.session import SessionMemory
9
+ from pyagent_context.memory.working import WorkingMemory
10
+ from pyagent_context.redaction import ContextRedactor
11
+ from pyagent_context.retrieval import ScoredItem, TrustAwareRetriever
12
+
13
+ __all__ = [
14
+ "CompressionPolicy",
15
+ "ContextCompressor",
16
+ "ContextItem",
17
+ "ContextLedger",
18
+ "ContextLifecycle",
19
+ "ContextRedactor",
20
+ "InMemorySemanticStore",
21
+ "ScoredItem",
22
+ "SemanticMemoryProtocol",
23
+ "Sensitivity",
24
+ "SessionMemory",
25
+ "TrustAwareRetriever",
26
+ "TrustLevel",
27
+ "WorkingMemory",
28
+ ]
29
+ __version__ = "0.1.0"