agenticmem 0.1.2.3__py3-none-any.whl → 0.1.3.7__py3-none-any.whl

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.

Potentially problematic release.


This version of agenticmem might be problematic. Click here for more details.

agenticmem/__init__.py CHANGED
@@ -22,6 +22,19 @@ from agenticmem_commons.api_schema.retriever_schema import (
22
22
  SearchInteractionResponse,
23
23
  SearchUserProfileResponse,
24
24
  )
25
+ from agenticmem_commons.config_schema import (
26
+ StorageConfigTest,
27
+ StorageConfigLocal,
28
+ StorageConfigS3,
29
+ StorageConfigSupabase,
30
+ StorageConfig,
31
+ ProfileExtractorConfig,
32
+ FeedbackAggregatorConfig,
33
+ AgentFeedbackConfig,
34
+ AgentSuccessConfig,
35
+ ToolUseConfig,
36
+ Config,
37
+ )
25
38
 
26
39
  debug = False
27
40
  log = None # Set to either 'debug' or 'info', controls console logging
@@ -44,4 +57,15 @@ __all__ = [
44
57
  "SearchUserProfileRequest",
45
58
  "SearchInteractionResponse",
46
59
  "SearchUserProfileResponse",
60
+ "StorageConfigTest",
61
+ "StorageConfigLocal",
62
+ "StorageConfigS3",
63
+ "StorageConfigSupabase",
64
+ "StorageConfig",
65
+ "ProfileExtractorConfig",
66
+ "FeedbackAggregatorConfig",
67
+ "AgentFeedbackConfig",
68
+ "AgentSuccessConfig",
69
+ "ToolUseConfig",
70
+ "Config",
47
71
  ]
agenticmem/client.py CHANGED
@@ -1,4 +1,4 @@
1
- from agenticmem_commons import IS_TEST_ENV
1
+ import os
2
2
  import aiohttp
3
3
  from urllib.parse import urljoin
4
4
  import requests
@@ -12,8 +12,19 @@ from agenticmem_commons.api_schema.retriever_schema import (
12
12
  GetInteractionsResponse,
13
13
  GetUserProfilesRequest,
14
14
  GetUserProfilesResponse,
15
+ GetRawFeedbacksRequest,
16
+ GetRawFeedbacksResponse,
17
+ GetFeedbacksRequest,
18
+ GetFeedbacksResponse,
15
19
  )
16
20
 
21
+ from dotenv import load_dotenv
22
+
23
+ # Load environment variables from .env file
24
+ load_dotenv()
25
+
26
+ IS_TEST_ENV = os.environ.get("IS_TEST_ENV", "false").strip() == "true"
27
+
17
28
  if IS_TEST_ENV:
18
29
  BACKEND_URL = "http://127.0.0.1:8000" # Local server for testing
19
30
  else:
@@ -30,6 +41,7 @@ from agenticmem_commons.api_schema.service_schemas import (
30
41
  DeleteUserInteractionResponse,
31
42
  )
32
43
  from agenticmem_commons.api_schema.login_schema import Token
44
+ from agenticmem_commons.config_schema import Config
33
45
 
34
46
 
35
47
  class AgenticMemClient:
@@ -276,3 +288,79 @@ class AgenticMemClient:
276
288
  json=request.model_dump(),
277
289
  )
278
290
  return GetUserProfilesResponse(**response)
291
+
292
+ async def set_config(self, config: Union[Config, dict]) -> dict:
293
+ """Set configuration for the organization.
294
+
295
+ Args:
296
+ config (Union[Config, dict]): The configuration to set
297
+
298
+ Returns:
299
+ dict: Response containing success status and message
300
+ """
301
+ if isinstance(config, dict):
302
+ config = Config(**config)
303
+ response = await self._make_async_request(
304
+ "POST",
305
+ "/api/set_config",
306
+ json=config.model_dump(),
307
+ )
308
+ return response
309
+
310
+ async def get_config(self) -> Config:
311
+ """Get configuration for the organization.
312
+
313
+ Returns:
314
+ Config: The current configuration
315
+ """
316
+ response = await self._make_async_request(
317
+ "GET",
318
+ "/api/get_config",
319
+ )
320
+ return Config(**response)
321
+
322
+ async def get_raw_feedbacks(
323
+ self,
324
+ request: Optional[Union[GetRawFeedbacksRequest, dict]] = None,
325
+ ) -> GetRawFeedbacksResponse:
326
+ """Get raw feedbacks.
327
+
328
+ Args:
329
+ request (Optional[Union[GetRawFeedbacksRequest, dict]]): The get request, defaults to empty request if None
330
+
331
+ Returns:
332
+ GetRawFeedbacksResponse: Response containing raw feedbacks
333
+ """
334
+ if request is None:
335
+ request = GetRawFeedbacksRequest()
336
+ elif isinstance(request, dict):
337
+ request = GetRawFeedbacksRequest(**request)
338
+ response = await self._make_async_request(
339
+ "POST",
340
+ "/api/get_raw_feedbacks",
341
+ json=request.model_dump(),
342
+ )
343
+ return GetRawFeedbacksResponse(**response)
344
+
345
+ async def get_feedbacks(
346
+ self,
347
+ request: Optional[Union[GetFeedbacksRequest, dict]] = None,
348
+ ) -> GetFeedbacksResponse:
349
+ """Get feedbacks.
350
+
351
+ Args:
352
+ request (Optional[Union[GetFeedbacksRequest, dict]]): The get request, defaults to empty request if None
353
+
354
+ Returns:
355
+ GetFeedbacksResponse: Response containing feedbacks
356
+ """
357
+ if request is None:
358
+ request = GetFeedbacksRequest()
359
+ elif isinstance(request, dict):
360
+ request = GetFeedbacksRequest(**request)
361
+ response = await self._make_async_request(
362
+ "POST",
363
+ "/api/get_feedbacks",
364
+ json=request.model_dump(),
365
+ )
366
+ return GetFeedbacksResponse(**response)
@@ -0,0 +1,245 @@
1
+ Metadata-Version: 2.3
2
+ Name: agenticmem
3
+ Version: 0.1.3.7
4
+ Summary: A Python client for the AgenticMem API
5
+ License: MIT
6
+ Author: AgenticMem Team
7
+ Requires-Python: >=3.10,<4.0
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Requires-Dist: agenticmem-commons (==0.1.3.7)
15
+ Requires-Dist: aiohttp (>=3.12.9,<4.0.0)
16
+ Requires-Dist: griffe (==0.48.0)
17
+ Requires-Dist: mkdocs-with-pdf (>=0.9.3,<0.10.0)
18
+ Requires-Dist: mkdocstrings[python] (>=0.18.0)
19
+ Requires-Dist: pydantic (>=2.0.0,<3.0.0)
20
+ Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
21
+ Requires-Dist: requests (>=2.25.0,<3.0.0)
22
+ Description-Content-Type: text/markdown
23
+
24
+ # AgenticMem Python Client
25
+
26
+ A Python client library for interacting with the AgenticMem API. This client provides easy-to-use interfaces for managing user interactions, profiles, configuration, and agent feedback.
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ pip install agenticmem
32
+ ```
33
+
34
+ ## Quick Start
35
+
36
+ ```python
37
+ import agenticmem
38
+ from agenticmem import (
39
+ InteractionRequest,
40
+ SearchUserProfileRequest,
41
+ SearchInteractionRequest,
42
+ UserActionType
43
+ )
44
+ from datetime import datetime
45
+
46
+ # Initialize the client
47
+ client = agenticmem.AgenticMemClient(url_endpoint="http://127.0.0.1:8081/")
48
+
49
+ # Login with email/password (async)
50
+ token = await client.login("user@example.com", "password")
51
+ client.api_key = token.api_key
52
+
53
+ # Publish a user interaction (async)
54
+ response = await client.publish_interaction(
55
+ request_id="your_request_id",
56
+ user_id="your_user_id",
57
+ interaction_requests=[
58
+ InteractionRequest(
59
+ role="User",
60
+ content="Hey, this is John. How can I help you today?",
61
+ user_action=UserActionType.NONE,
62
+ user_action_description="",
63
+ interacted_image_url=""
64
+ )
65
+ ],
66
+ source="conversation"
67
+ )
68
+ print(f"Published interaction: {response.success} - {response.message}")
69
+
70
+ # Search user profiles (async)
71
+ profiles = await client.search_profiles(
72
+ request=SearchUserProfileRequest(
73
+ user_id="your_user_id",
74
+ query="john",
75
+ threshold=0.7
76
+ )
77
+ )
78
+ for profile in profiles.user_profiles:
79
+ print(f"Profile {profile.profile_id}: {profile.profile_content}")
80
+
81
+ # Search interactions (async)
82
+ interactions = await client.search_interactions(
83
+ request=SearchInteractionRequest(
84
+ user_id="your_user_id",
85
+ query="name is john"
86
+ )
87
+ )
88
+ for interaction in interactions.interactions:
89
+ print(f"Interaction {interaction.interaction_id}: {interaction.content}")
90
+
91
+ # Get all interactions (async)
92
+ all_interactions = await client.get_interactions(
93
+ request={"user_id": "your_user_id", "top_k": 10}
94
+ )
95
+ for interaction in all_interactions.interactions:
96
+ print(f"Interaction: {interaction.content}")
97
+
98
+ # Get all profiles (async)
99
+ all_profiles = await client.get_profiles(
100
+ request={"user_id": "your_user_id", "top_k": 10}
101
+ )
102
+ for profile in all_profiles.user_profiles:
103
+ print(f"Profile: {profile.profile_content}")
104
+
105
+ # Get profile change log (async)
106
+ change_log = await client.get_profile_change_log()
107
+ print(f"Profile changes: {len(change_log.profile_change_logs)} logs")
108
+ ```
109
+
110
+ ## Features
111
+
112
+ ### Authentication
113
+ - Email/password login (async)
114
+ - API key authentication
115
+ - Custom endpoint configuration
116
+
117
+ ### User Interaction Management
118
+ - Publish user interactions (text, images, actions)
119
+ - Search interactions with semantic queries
120
+ - Get direct list of interactions
121
+ - Delete specific interactions
122
+ - Support for various interaction types (text, visual, click events)
123
+
124
+ ### User Profile Management
125
+ - Search user profiles with semantic queries
126
+ - Get direct list of user profiles
127
+ - Delete specific profiles or profiles matching search queries
128
+ - View profile change log history
129
+ - Filter by source and custom features
130
+
131
+ ### Configuration Management
132
+ - Get and set AgenticMem configuration
133
+ - Configure profile extractors
134
+ - Configure agent feedback systems
135
+ - Storage configuration (Supabase, S3, Local)
136
+
137
+ ### Agent Feedback System
138
+ - Get raw feedbacks from user interactions
139
+ - Get aggregated feedbacks
140
+ - Automatic feedback generation based on conversations
141
+ - Configurable feedback thresholds
142
+
143
+ ## API Response Types
144
+
145
+ All API methods return strongly-typed responses:
146
+
147
+ ### Authentication
148
+ - `login()` returns `Token`
149
+
150
+ ### Interaction Management
151
+ - `publish_interaction()` returns `PublishUserInteractionResponse`
152
+ - `search_interactions()` returns `SearchInteractionResponse`
153
+ - `get_interactions()` returns `GetInteractionsResponse`
154
+ - `delete_interaction()` returns `DeleteUserInteractionResponse`
155
+
156
+ ### Profile Management
157
+ - `search_profiles()` returns `SearchUserProfileResponse`
158
+ - `get_profiles()` returns `GetUserProfilesResponse`
159
+ - `delete_profile()` returns `DeleteUserProfileResponse`
160
+ - `get_profile_change_log()` returns `ProfileChangeLogResponse`
161
+
162
+ ### Configuration Management
163
+ - `get_config()` returns `Config`
164
+ - `set_config()` returns `dict`
165
+
166
+ ### Feedback Management
167
+ - `get_raw_feedbacks()` returns `GetRawFeedbacksResponse`
168
+ - `get_feedbacks()` returns `GetFeedbacksResponse`
169
+
170
+ ## Advanced Usage Examples
171
+
172
+ ### Visual Interactions with Images
173
+
174
+ ```python
175
+ import base64
176
+
177
+ # Function to encode the image
178
+ def encode_image(image_path):
179
+ with open(image_path, "rb") as image_file:
180
+ return base64.b64encode(image_file.read()).decode("utf-8")
181
+
182
+ # Publish image interaction
183
+ base64_image = encode_image("./path/to/image.png")
184
+ await client.publish_interaction(
185
+ request_id="your_request_id",
186
+ user_id="your_user_id",
187
+ interaction_requests=[
188
+ InteractionRequest(
189
+ content="I like this",
190
+ image_encoding=base64_image,
191
+ )
192
+ ]
193
+ )
194
+ ```
195
+
196
+ ### Configuration Management
197
+
198
+ ```python
199
+ from agenticmem import ProfileExtractorConfig, AgentFeedbackConfig, FeedbackAggregatorConfig
200
+
201
+ # Get current configuration
202
+ config = await client.get_config()
203
+ print(f"Current config: {config}")
204
+
205
+ # Update configuration
206
+ feedback_config = AgentFeedbackConfig(
207
+ feedback_name="sales_feedback",
208
+ feedback_definition_prompt="Extract actionable feedback for sales representatives",
209
+ feedback_aggregator_config=FeedbackAggregatorConfig()
210
+ )
211
+
212
+ config.agent_feedback_configs = [feedback_config]
213
+ await client.set_config(config)
214
+ ```
215
+
216
+ ### Feedback Management
217
+
218
+ ```python
219
+ # Get raw feedbacks
220
+ raw_feedbacks = await client.get_raw_feedbacks()
221
+ for feedback in raw_feedbacks.raw_feedbacks:
222
+ print(f"Feedback: {feedback.feedback_content}")
223
+
224
+ # Get aggregated feedbacks
225
+ feedbacks = await client.get_feedbacks()
226
+ for feedback in feedbacks.feedbacks:
227
+ print(f"Aggregated feedback: {feedback}")
228
+ ```
229
+
230
+ ## Documentation
231
+
232
+ For detailed documentation, please visit the `docs/` directory in this repository.
233
+
234
+ ## Important Notes
235
+
236
+ - All client methods are **async** and require `await`
237
+ - Image interactions support base64 encoded images
238
+ - The client supports flexible request types (dict or typed objects)
239
+ - Configuration changes affect the entire organization
240
+ - Feedback generation is automatic based on configured prompts
241
+
242
+ ## License
243
+
244
+ MIT License
245
+
@@ -0,0 +1,6 @@
1
+ agenticmem/__init__.py,sha256=2AOIWHjfEbGNBa8QAlfqWoMbKzK4T_ixXv9-EyRfbnE,1804
2
+ agenticmem/client.py,sha256=Rpmz_4UTXcO3ckOsLQZBBSkXrX0YO5YKjepUNnkheOE,12137
3
+ agenticmem/client_utils.py,sha256=kWTWlyO7s768v38ef41nRDq87Qmb60NX2vmZTVlCB6g,297
4
+ agenticmem-0.1.3.7.dist-info/METADATA,sha256=epRBEcQ-7msg7y-SfPQMIDTASJrDZJbn4aAqg8nRng0,7165
5
+ agenticmem-0.1.3.7.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
6
+ agenticmem-0.1.3.7.dist-info/RECORD,,
@@ -1,145 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: agenticmem
3
- Version: 0.1.2.3
4
- Summary: A Python client for the AgenticMem API
5
- License: MIT
6
- Author: AgenticMem Team
7
- Requires-Python: >=3.10,<4.0
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.10
11
- Classifier: Programming Language :: Python :: 3.11
12
- Classifier: Programming Language :: Python :: 3.12
13
- Classifier: Programming Language :: Python :: 3.13
14
- Requires-Dist: agenticmem-commons (==0.1.3.4)
15
- Requires-Dist: aiohttp (>=3.12.9,<4.0.0)
16
- Requires-Dist: griffe (==0.48.0)
17
- Requires-Dist: mkdocstrings[python] (>=0.18.0)
18
- Requires-Dist: pydantic (>=2.0.0,<3.0.0)
19
- Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
20
- Requires-Dist: requests (>=2.25.0,<3.0.0)
21
- Description-Content-Type: text/markdown
22
-
23
- # AgenticMem Python Client
24
-
25
- A Python client library for interacting with the AgenticMem API. This client provides easy-to-use interfaces for managing user interactions and profiles.
26
-
27
- ## Installation
28
-
29
- ```bash
30
- pip install agenticmem
31
- ```
32
-
33
- ## Quick Start
34
-
35
- ```python
36
- from agenticmem import AgenticMemClient
37
- from agenticmem_commons.api_schema.service_schemas import InteractionRequest
38
- from agenticmem_commons.api_schema.retriever_schema import (
39
- SearchInteractionRequest,
40
- SearchUserProfileRequest,
41
- GetInteractionsRequest,
42
- GetUserProfilesRequest
43
- )
44
- from datetime import datetime
45
-
46
- # Initialize the client
47
- client = AgenticMemClient(api_key="your_api_key")
48
-
49
- # Optional: Login with email/password
50
- token = client.login(email="user@example.com", password="password123")
51
-
52
- # Publish a user interaction
53
- interaction = InteractionRequest(
54
- created_at=int(datetime.utcnow().timestamp()),
55
- content="User clicked on product X",
56
- user_action="click",
57
- user_action_description="Clicked on product details button"
58
- )
59
-
60
- response = client.publish_interaction(
61
- user_id="user123",
62
- request_id="req456",
63
- interaction_requests=[interaction]
64
- )
65
- print(f"Published interaction: {response.success} - {response.message}")
66
-
67
- # Search user profiles
68
- profiles_request = SearchUserProfileRequest(
69
- user_id="user123",
70
- search_query="recent interactions",
71
- top_k=5
72
- )
73
- profiles = client.search_profiles(profiles_request)
74
- for profile in profiles.profiles:
75
- print(f"Profile {profile.profile_id}: {profile.profile_content}")
76
-
77
- # Get user profiles directly
78
- profiles_request = GetUserProfilesRequest(
79
- user_id="user123"
80
- )
81
- profiles = client.get_profiles(profiles_request)
82
- for profile in profiles.profiles:
83
- print(f"Profile: {profile}")
84
-
85
- # Search interactions
86
- interactions_request = SearchInteractionRequest(
87
- user_id="user123",
88
- start_time=int(datetime(2024, 1, 1).timestamp()),
89
- end_time=int(datetime.utcnow().timestamp())
90
- )
91
- interactions = client.search_interactions(interactions_request)
92
- for interaction in interactions.interactions:
93
- print(f"Interaction {interaction.interaction_id}: {interaction.content}")
94
-
95
- # Get interactions directly
96
- interactions_request = GetInteractionsRequest(
97
- user_id="user123"
98
- )
99
- interactions = client.get_interactions(interactions_request)
100
- for interaction in interactions.interactions:
101
- print(f"Interaction: {interaction}")
102
-
103
- # Get profile change log
104
- change_log = client.get_profile_change_log()
105
- print(f"Profile changes: {change_log}")
106
- ```
107
-
108
- ## Features
109
-
110
- - Authentication
111
- - API key authentication
112
- - Email/password login
113
- - User interaction management
114
- - Publish user interactions
115
- - Delete specific interactions
116
- - Search interactions with time range and filters
117
- - Get direct list of interactions
118
- - User profile management
119
- - Search user profiles with customizable queries
120
- - Get direct list of user profiles
121
- - Delete specific profiles or profiles matching a search query
122
- - View profile change log history
123
-
124
- ## API Response Types
125
-
126
- All API methods return strongly-typed responses:
127
-
128
- - `login()` returns `Token`
129
- - `publish_interaction()` returns `PublishUserInteractionResponse`
130
- - `search_interactions()` returns `SearchInteractionResponse`
131
- - `get_interactions()` returns `GetInteractionsResponse`
132
- - `search_profiles()` returns `SearchUserProfileResponse`
133
- - `get_profiles()` returns `GetUserProfilesResponse`
134
- - `delete_profile()` returns `DeleteUserProfileResponse`
135
- - `delete_interaction()` returns `DeleteUserInteractionResponse`
136
- - `get_profile_change_log()` returns `ProfileChangeLogResponse`
137
-
138
- ## Documentation
139
-
140
- For detailed documentation, please visit [docs link].
141
-
142
- ## License
143
-
144
- MIT License
145
-
@@ -1,6 +0,0 @@
1
- agenticmem/__init__.py,sha256=zjj8VIn65S5NzJZV64IUG8G1p0J-9SYBJJMSof8mDU8,1229
2
- agenticmem/client.py,sha256=lCRxsRZYfz29Kz44n-ebaFigq7pWhSS5LTI48_c_-vM,9424
3
- agenticmem/client_utils.py,sha256=kWTWlyO7s768v38ef41nRDq87Qmb60NX2vmZTVlCB6g,297
4
- agenticmem-0.1.2.3.dist-info/METADATA,sha256=WMXUX_uTYEJfJX30LyOmVptfmy8_2DV-TJ0vMoOHD3c,4461
5
- agenticmem-0.1.2.3.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
6
- agenticmem-0.1.2.3.dist-info/RECORD,,