agenticmem 0.1.0__py3-none-any.whl → 0.1.2__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
@@ -1,5 +1,9 @@
1
+ __app_name__ = "agenticmem"
2
+ __version__ = "0.1.1"
3
+
4
+
1
5
  from agenticmem.client import AgenticMemClient
2
- from server.api_schema.service_schemas import (
6
+ from agenticmem_commons.api_schema.service_schemas import (
3
7
  UserActionType,
4
8
  ProfileTimeToLive,
5
9
  InteractionRequest,
@@ -12,18 +16,32 @@ from server.api_schema.service_schemas import (
12
16
  DeleteUserInteractionRequest,
13
17
  DeleteUserInteractionResponse,
14
18
  )
19
+ from agenticmem_commons.api_schema.retriever_schema import (
20
+ SearchInteractionRequest,
21
+ SearchUserProfileRequest,
22
+ SearchInteractionResponse,
23
+ SearchUserProfileResponse,
24
+ )
25
+
26
+ debug = False
27
+ log = None # Set to either 'debug' or 'info', controls console logging
28
+
15
29
 
16
30
  __all__ = [
17
- 'AgenticMemClient',
18
- 'UserActionType',
19
- 'ProfileTimeToLive',
20
- 'InteractionRequest',
21
- 'Interaction',
22
- 'UserProfile',
23
- 'PublishUserInteractionRequest',
24
- 'PublishUserInteractionResponse',
25
- 'DeleteUserProfileRequest',
26
- 'DeleteUserProfileResponse',
27
- 'DeleteUserInteractionRequest',
28
- 'DeleteUserInteractionResponse',
29
- ]
31
+ "AgenticMemClient",
32
+ "UserActionType",
33
+ "ProfileTimeToLive",
34
+ "InteractionRequest",
35
+ "Interaction",
36
+ "UserProfile",
37
+ "PublishUserInteractionRequest",
38
+ "PublishUserInteractionResponse",
39
+ "DeleteUserProfileRequest",
40
+ "DeleteUserProfileResponse",
41
+ "DeleteUserInteractionRequest",
42
+ "DeleteUserInteractionResponse",
43
+ "SearchInteractionRequest",
44
+ "SearchUserProfileRequest",
45
+ "SearchInteractionResponse",
46
+ "SearchUserProfileResponse",
47
+ ]
agenticmem/client.py CHANGED
@@ -1,12 +1,27 @@
1
- from typing import List, Optional
2
- from datetime import datetime
3
- import requests
1
+ import aiohttp
4
2
  from urllib.parse import urljoin
3
+ import os
4
+ import requests
5
+ from typing import Optional, Union
6
+ from agenticmem_commons.api_schema.retriever_schema import (
7
+ SearchInteractionRequest,
8
+ SearchInteractionResponse,
9
+ SearchUserProfileRequest,
10
+ SearchUserProfileResponse,
11
+ GetInteractionsRequest,
12
+ GetInteractionsResponse,
13
+ GetUserProfilesRequest,
14
+ GetUserProfilesResponse,
15
+ )
16
+
17
+ if os.environ.get("TEST_ENV", True):
18
+ BACKEND_URL = "http://127.0.0.1:8000" # Local server for testing
19
+ else:
20
+ BACKEND_URL = "http://agenticmem-test.us-west-2.elasticbeanstalk.com:8081" # Elastic Beanstalk server url
5
21
 
6
- from server.api_schema.service_schemas import (
7
- Interaction,
22
+ from agenticmem_commons.api_schema.service_schemas import (
8
23
  InteractionRequest,
9
- UserProfile,
24
+ ProfileChangeLogResponse,
10
25
  PublishUserInteractionRequest,
11
26
  PublishUserInteractionResponse,
12
27
  DeleteUserProfileRequest,
@@ -14,161 +29,174 @@ from server.api_schema.service_schemas import (
14
29
  DeleteUserInteractionRequest,
15
30
  DeleteUserInteractionResponse,
16
31
  )
17
- from server.api_schema.login_schema import Token
32
+ from agenticmem_commons.api_schema.login_schema import Token
18
33
 
19
34
 
20
35
  class AgenticMemClient:
21
36
  """Client for interacting with the AgenticMem API."""
22
37
 
23
- def __init__(self, api_key: str):
38
+ def __init__(self, api_key: str = "", url_endpoint: str = ""):
24
39
  """Initialize the AgenticMem client.
25
40
 
26
41
  Args:
27
42
  api_key (str): Your API key for authentication
28
43
  """
29
44
  self.api_key = api_key
30
- self.base_url = "https://api.agenticmem.com"
45
+ self.base_url = url_endpoint if url_endpoint else BACKEND_URL
31
46
  self.session = requests.Session()
32
- self.session.headers.update({
33
- "Authorization": f"Bearer {api_key}",
34
- "Content-Type": "application/json"
35
- })
36
47
 
37
- def _make_request(self, method: str, endpoint: str, **kwargs):
48
+ async def _make_async_request(
49
+ self, method: str, endpoint: str, headers: Optional[dict] = None, **kwargs
50
+ ):
51
+ """Make an async HTTP request to the API."""
52
+ url = urljoin(self.base_url, endpoint)
53
+
54
+ headers = headers or {}
55
+ if self.api_key:
56
+ headers.update(
57
+ {
58
+ "Authorization": f"Bearer {self.api_key}",
59
+ "Content-Type": "application/json",
60
+ }
61
+ )
62
+
63
+ async with aiohttp.ClientSession() as async_session:
64
+ response = await async_session.request(
65
+ method, url, headers=headers, **kwargs
66
+ )
67
+ response.raise_for_status()
68
+ return await response.json()
69
+
70
+ def _make_request(
71
+ self, method: str, endpoint: str, headers: Optional[dict] = None, **kwargs
72
+ ):
38
73
  """Make an HTTP request to the API.
39
74
 
40
75
  Args:
41
76
  method (str): HTTP method (GET, POST, DELETE)
42
77
  endpoint (str): API endpoint
78
+ headers (dict, optional): Additional headers to include in the request
43
79
  **kwargs: Additional arguments to pass to requests
44
80
 
45
81
  Returns:
46
82
  dict: API response
47
83
  """
48
84
  url = urljoin(self.base_url, endpoint)
85
+ if self.api_key:
86
+ self.session.headers.update(
87
+ {
88
+ "Authorization": f"Bearer {self.api_key}",
89
+ "Content-Type": "application/json",
90
+ }
91
+ )
92
+ if headers:
93
+ self.session.headers.update(headers)
49
94
  response = self.session.request(method, url, **kwargs)
50
95
  response.raise_for_status()
51
96
  return response.json()
52
97
 
53
- def login(self, email: str, password: str) -> Token:
54
- """Login to the AgenticMem API.
55
-
56
- Args:
57
- email (str): The user's email
58
- password (str): The user's password
59
-
60
- Returns:
61
- Token: Response containing success status and message
62
- """
63
- response = self._make_request("POST", "/api/login", json={"email": email, "password": password})
98
+ async def login(self, email: str, password: str) -> Token:
99
+ """Async login to the AgenticMem API."""
100
+ response = await self._make_async_request(
101
+ "POST",
102
+ "/token",
103
+ data={"username": email, "password": password},
104
+ headers={
105
+ "Content-Type": "application/x-www-form-urlencoded",
106
+ "accept": "application/json",
107
+ },
108
+ )
64
109
  return Token(**response)
65
110
 
66
- def publish_interaction(
111
+ async def publish_interaction(
67
112
  self,
68
- user_id: str,
69
113
  request_id: str,
70
- interaction_requests: List[InteractionRequest]
114
+ user_id: str,
115
+ interaction_requests: list[Union[InteractionRequest, dict]],
116
+ source: str = "",
117
+ agent_version: str = "",
71
118
  ) -> PublishUserInteractionResponse:
72
119
  """Publish user interactions.
73
120
 
74
121
  Args:
75
- user_id (str): The user ID
76
122
  request_id (str): The request ID
123
+ user_id (str): The user ID
77
124
  interaction_requests (List[InteractionRequest]): List of interaction requests
78
-
125
+ source (str, optional): The source of the interaction
79
126
  Returns:
80
127
  PublishUserInteractionResponse: Response containing success status and message
81
128
  """
129
+ interaction_requests = [
130
+ (
131
+ InteractionRequest(**interaction_request)
132
+ if isinstance(interaction_request, dict)
133
+ else interaction_request
134
+ )
135
+ for interaction_request in interaction_requests
136
+ ]
82
137
  request = PublishUserInteractionRequest(
83
- user_id=user_id,
84
138
  request_id=request_id,
85
- interaction_requests=interaction_requests
139
+ user_id=user_id,
140
+ interaction_requests=interaction_requests,
141
+ source=source,
142
+ agent_version=agent_version,
143
+ )
144
+ response = await self._make_async_request(
145
+ "POST",
146
+ "/api/publish_interaction",
147
+ json=request.model_dump(),
86
148
  )
87
- response = self._make_request("POST", "/api/interactions", json=request.model_dump())
88
149
  return PublishUserInteractionResponse(**response)
89
150
 
90
- def search_interactions(
151
+ async def search_interactions(
91
152
  self,
92
- user_id: str,
93
- request_id: Optional[str] = None,
94
- query: Optional[str] = None,
95
- start_time: Optional[datetime] = None,
96
- end_time: Optional[datetime] = None,
97
- most_recent_k: Optional[int] = None
98
- ) -> List[Interaction]:
153
+ request: Union[SearchInteractionRequest, dict],
154
+ ) -> SearchInteractionResponse:
99
155
  """Search for user interactions.
100
156
 
101
157
  Args:
102
- user_id (str): The user ID
103
- request_id (Optional[str], optional): Filter by request ID
104
- query (Optional[str], optional): Search query
105
- start_time (Optional[datetime], optional): Start time filter
106
- end_time (Optional[datetime], optional): End time filter
107
- most_recent_k (Optional[int], optional): Limit to most recent K results
158
+ request (SearchInteractionRequest): The search request
108
159
 
109
160
  Returns:
110
- List[Interaction]: List of matching interactions
161
+ SearchInteractionResponse: Response containing matching interactions
111
162
  """
112
- params = {
113
- "user_id": user_id,
114
- "request_id": request_id,
115
- "query": query,
116
- "start_time": start_time,
117
- "end_time": end_time,
118
- "most_recent_k": most_recent_k
119
- }
120
- # Remove None values
121
- params = {k: v for k, v in params.items() if v is not None}
122
- response = self._make_request("GET", "/api/interactions/search", params=params)
123
- return [Interaction(**interaction) for interaction in response.get("interactions", [])]
124
-
125
- def search_profiles(
163
+ if isinstance(request, dict):
164
+ request = SearchInteractionRequest(**request)
165
+ response = await self._make_async_request(
166
+ "POST",
167
+ "/api/search_interactions",
168
+ json=request.model_dump(),
169
+ )
170
+ return SearchInteractionResponse(**response)
171
+
172
+ async def search_profiles(
126
173
  self,
127
- user_id: str,
128
- genered_from_request_id: Optional[str] = None,
129
- query: Optional[str] = None,
130
- start_time: Optional[datetime] = None,
131
- end_time: Optional[datetime] = None,
132
- top_k: Optional[int] = None
133
- ) -> List[UserProfile]:
174
+ request: Union[SearchUserProfileRequest, dict],
175
+ ) -> SearchUserProfileResponse:
134
176
  """Search for user profiles.
135
177
 
136
178
  Args:
137
- user_id (str): The user ID
138
- genered_from_request_id (Optional[str], optional): Filter by request ID that generated the profile
139
- query (Optional[str], optional): Search query
140
- start_time (Optional[datetime], optional): Start time filter
141
- end_time (Optional[datetime], optional): End time filter
142
- top_k (Optional[int], optional): Limit to top K results
179
+ request (SearchUserProfileRequest): The search request
143
180
 
144
181
  Returns:
145
- List[UserProfile]: List of matching profiles
182
+ SearchUserProfileResponse: Response containing matching profiles
146
183
  """
147
- params = {
148
- "user_id": user_id,
149
- "genered_from_request_id": genered_from_request_id,
150
- "query": query,
151
- "start_time": start_time,
152
- "end_time": end_time,
153
- "top_k": top_k
154
- }
155
- # Remove None values
156
- params = {k: v for k, v in params.items() if v is not None}
157
- response = self._make_request("GET", "/api/profiles/search", params=params)
158
- return [UserProfile(**profile) for profile in response.get("user_profiles", [])]
159
-
160
- def delete_profile(
161
- self,
162
- user_id: str,
163
- profile_id: str = "",
164
- profile_search_query: str = ""
184
+ if isinstance(request, dict):
185
+ request = SearchUserProfileRequest(**request)
186
+ response = await self._make_async_request(
187
+ "POST", "/api/search_profiles", json=request.model_dump()
188
+ )
189
+ return SearchUserProfileResponse(**response)
190
+
191
+ async def delete_profile(
192
+ self, user_id: str, profile_id: str = "", search_query: str = ""
165
193
  ) -> DeleteUserProfileResponse:
166
194
  """Delete user profiles.
167
195
 
168
196
  Args:
169
197
  user_id (str): The user ID
170
198
  profile_id (str, optional): Specific profile ID to delete
171
- profile_search_query (str, optional): Query to match profiles for deletion
199
+ search_query (str, optional): Query to match profiles for deletion
172
200
 
173
201
  Returns:
174
202
  DeleteUserProfileResponse: Response containing success status and message
@@ -176,15 +204,15 @@ class AgenticMemClient:
176
204
  request = DeleteUserProfileRequest(
177
205
  user_id=user_id,
178
206
  profile_id=profile_id,
179
- profile_search_query=profile_search_query
207
+ search_query=search_query,
208
+ )
209
+ response = await self._make_async_request(
210
+ "DELETE", "/api/delete_profile", json=request.model_dump()
180
211
  )
181
- response = self._make_request("DELETE", "/api/profiles", json=request.model_dump())
182
212
  return DeleteUserProfileResponse(**response)
183
213
 
184
- def delete_interaction(
185
- self,
186
- user_id: str,
187
- interaction_id: str
214
+ async def delete_interaction(
215
+ self, user_id: str, interaction_id: str
188
216
  ) -> DeleteUserInteractionResponse:
189
217
  """Delete a user interaction.
190
218
 
@@ -196,8 +224,55 @@ class AgenticMemClient:
196
224
  DeleteUserInteractionResponse: Response containing success status and message
197
225
  """
198
226
  request = DeleteUserInteractionRequest(
199
- user_id=user_id,
200
- interaction_id=interaction_id
227
+ user_id=user_id, interaction_id=interaction_id
228
+ )
229
+ response = await self._make_async_request(
230
+ "DELETE", "/api/delete_interaction", json=request.model_dump()
231
+ )
232
+ return DeleteUserInteractionResponse(**response)
233
+
234
+ async def get_profile_change_log(self) -> ProfileChangeLogResponse:
235
+ response = await self._make_async_request("GET", "/api/profile_change_log")
236
+ return ProfileChangeLogResponse(**response)
237
+
238
+ async def get_interactions(
239
+ self,
240
+ request: Union[GetInteractionsRequest, dict],
241
+ ) -> GetInteractionsResponse:
242
+ """Get user interactions.
243
+
244
+ Args:
245
+ request (GetInteractionsRequest): The list request
246
+
247
+ Returns:
248
+ GetInteractionsResponse: Response containing list of interactions
249
+ """
250
+ if isinstance(request, dict):
251
+ request = GetInteractionsRequest(**request)
252
+ response = await self._make_async_request(
253
+ "POST",
254
+ "/api/get_interactions",
255
+ json=request.model_dump(),
256
+ )
257
+ return GetInteractionsResponse(**response)
258
+
259
+ async def get_profiles(
260
+ self,
261
+ request: Union[GetUserProfilesRequest, dict],
262
+ ) -> GetUserProfilesResponse:
263
+ """Get user profiles.
264
+
265
+ Args:
266
+ request (GetUserProfilesRequest): The list request
267
+
268
+ Returns:
269
+ GetUserProfilesResponse: Response containing list of profiles
270
+ """
271
+ if isinstance(request, dict):
272
+ request = GetUserProfilesRequest(**request)
273
+ response = await self._make_async_request(
274
+ "POST",
275
+ "/api/get_profiles",
276
+ json=request.model_dump(),
201
277
  )
202
- response = self._make_request("DELETE", "/api/interactions", json=request.model_dump())
203
- return DeleteUserInteractionResponse(**response)
278
+ return GetUserProfilesResponse(**response)
@@ -0,0 +1,12 @@
1
+ import json
2
+ from datetime import datetime
3
+ from enum import Enum
4
+
5
+
6
+ class CustomJSONEncoder(json.JSONEncoder):
7
+ def default(self, o):
8
+ if isinstance(o, datetime):
9
+ return o.isoformat()
10
+ if isinstance(o, Enum):
11
+ return o.value
12
+ return super().default(o)
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.3
2
+ Name: agenticmem
3
+ Version: 0.1.2
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.2)
15
+ Requires-Dist: griffe (==0.48.0)
16
+ Requires-Dist: mkdocstrings[python] (>=0.18.0)
17
+ Requires-Dist: pydantic (>=2.0.0,<3.0.0)
18
+ Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
19
+ Requires-Dist: requests (>=2.25.0,<3.0.0)
20
+ Description-Content-Type: text/markdown
21
+
22
+ # AgenticMem Python Client
23
+
24
+ A Python client library for interacting with the AgenticMem API. This client provides easy-to-use interfaces for managing user interactions and profiles.
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ pip install agenticmem
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ```python
35
+ from agenticmem import AgenticMemClient
36
+ from agenticmem_commons.api_schema.service_schemas import InteractionRequest
37
+ from agenticmem_commons.api_schema.retriever_schema import (
38
+ SearchInteractionRequest,
39
+ SearchUserProfileRequest,
40
+ GetInteractionsRequest,
41
+ GetUserProfilesRequest
42
+ )
43
+ from datetime import datetime
44
+
45
+ # Initialize the client
46
+ client = AgenticMemClient(api_key="your_api_key")
47
+
48
+ # Optional: Login with email/password
49
+ token = client.login(email="user@example.com", password="password123")
50
+
51
+ # Publish a user interaction
52
+ interaction = InteractionRequest(
53
+ created_at=int(datetime.utcnow().timestamp()),
54
+ content="User clicked on product X",
55
+ user_action="click",
56
+ user_action_description="Clicked on product details button"
57
+ )
58
+
59
+ response = client.publish_interaction(
60
+ user_id="user123",
61
+ request_id="req456",
62
+ interaction_requests=[interaction]
63
+ )
64
+ print(f"Published interaction: {response.success} - {response.message}")
65
+
66
+ # Search user profiles
67
+ profiles_request = SearchUserProfileRequest(
68
+ user_id="user123",
69
+ search_query="recent interactions",
70
+ top_k=5
71
+ )
72
+ profiles = client.search_profiles(profiles_request)
73
+ for profile in profiles.profiles:
74
+ print(f"Profile {profile.profile_id}: {profile.profile_content}")
75
+
76
+ # Get user profiles directly
77
+ profiles_request = GetUserProfilesRequest(
78
+ user_id="user123"
79
+ )
80
+ profiles = client.get_profiles(profiles_request)
81
+ for profile in profiles.profiles:
82
+ print(f"Profile: {profile}")
83
+
84
+ # Search interactions
85
+ interactions_request = SearchInteractionRequest(
86
+ user_id="user123",
87
+ start_time=int(datetime(2024, 1, 1).timestamp()),
88
+ end_time=int(datetime.utcnow().timestamp())
89
+ )
90
+ interactions = client.search_interactions(interactions_request)
91
+ for interaction in interactions.interactions:
92
+ print(f"Interaction {interaction.interaction_id}: {interaction.content}")
93
+
94
+ # Get interactions directly
95
+ interactions_request = GetInteractionsRequest(
96
+ user_id="user123"
97
+ )
98
+ interactions = client.get_interactions(interactions_request)
99
+ for interaction in interactions.interactions:
100
+ print(f"Interaction: {interaction}")
101
+
102
+ # Get profile change log
103
+ change_log = client.get_profile_change_log()
104
+ print(f"Profile changes: {change_log}")
105
+ ```
106
+
107
+ ## Features
108
+
109
+ - Authentication
110
+ - API key authentication
111
+ - Email/password login
112
+ - User interaction management
113
+ - Publish user interactions
114
+ - Delete specific interactions
115
+ - Search interactions with time range and filters
116
+ - Get direct list of interactions
117
+ - User profile management
118
+ - Search user profiles with customizable queries
119
+ - Get direct list of user profiles
120
+ - Delete specific profiles or profiles matching a search query
121
+ - View profile change log history
122
+
123
+ ## API Response Types
124
+
125
+ All API methods return strongly-typed responses:
126
+
127
+ - `login()` returns `Token`
128
+ - `publish_interaction()` returns `PublishUserInteractionResponse`
129
+ - `search_interactions()` returns `SearchInteractionResponse`
130
+ - `get_interactions()` returns `GetInteractionsResponse`
131
+ - `search_profiles()` returns `SearchUserProfileResponse`
132
+ - `get_profiles()` returns `GetUserProfilesResponse`
133
+ - `delete_profile()` returns `DeleteUserProfileResponse`
134
+ - `delete_interaction()` returns `DeleteUserInteractionResponse`
135
+ - `get_profile_change_log()` returns `ProfileChangeLogResponse`
136
+
137
+ ## Documentation
138
+
139
+ For detailed documentation, please visit [docs link].
140
+
141
+ ## License
142
+
143
+ MIT License
144
+
@@ -0,0 +1,6 @@
1
+ agenticmem/__init__.py,sha256=zjj8VIn65S5NzJZV64IUG8G1p0J-9SYBJJMSof8mDU8,1229
2
+ agenticmem/client.py,sha256=zTXWz3FeW68511r8mMt-kF-OhAYePLv02tswoL1oNpM,9412
3
+ agenticmem/client_utils.py,sha256=kWTWlyO7s768v38ef41nRDq87Qmb60NX2vmZTVlCB6g,297
4
+ agenticmem-0.1.2.dist-info/METADATA,sha256=t75D7SKbiMALg8uKY0HhxohZmu5roRKamq271-YyKUM,4416
5
+ agenticmem-0.1.2.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
6
+ agenticmem-0.1.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.7.0
2
+ Generator: poetry-core 2.1.2
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,102 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: agenticmem
3
- Version: 0.1.0
4
- Summary: A Python client for the AgenticMem API
5
- License: MIT
6
- Author: AgenticMem Team
7
- Requires-Python: >=3.7,<4.0
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.7
11
- Classifier: Programming Language :: Python :: 3.8
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
- Requires-Dist: pydantic (>=2.0.0,<3.0.0)
16
- Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
17
- Requires-Dist: requests (>=2.25.0,<3.0.0)
18
- Description-Content-Type: text/markdown
19
-
20
- # AgenticMem Python Client
21
-
22
- A Python client library for interacting with the AgenticMem API. This client provides easy-to-use interfaces for managing user interactions and profiles.
23
-
24
- ## Installation
25
-
26
- ```bash
27
- pip install agenticmem
28
- ```
29
-
30
- ## Quick Start
31
-
32
- ```python
33
- from agenticmem import AgenticMemClient
34
- from agenticmem import UserActionType, InteractionRequest
35
- from datetime import datetime
36
-
37
- # Initialize the client
38
- client = AgenticMemClient(
39
- api_key="your_api_key",
40
- )
41
-
42
- # Publish a user interaction
43
- interaction = InteractionRequest(
44
- timestamp=datetime.now(),
45
- text_interaction="User clicked on product X",
46
- user_action=UserActionType.CLICK,
47
- user_action_description="Clicked on product details button"
48
- )
49
-
50
- response = client.publish_interaction(
51
- user_id="user123",
52
- request_id="req456",
53
- interaction_requests=[interaction]
54
- )
55
- print(f"Published interaction: {response.success} - {response.message}")
56
-
57
- # Search user profiles
58
- profiles = client.search_profiles(
59
- user_id="user123",
60
- query="recent interactions",
61
- top_k=5
62
- )
63
- for profile in profiles:
64
- print(f"Profile {profile.profile_id}: {profile.profile_content}")
65
-
66
- # Search interactions
67
- interactions = client.search_interactions(
68
- user_id="user123",
69
- start_time=datetime(2024, 1, 1),
70
- end_time=datetime.now()
71
- )
72
- for interaction in interactions:
73
- print(f"Interaction {interaction.interaction_id}: {interaction.text_interaction}")
74
- ```
75
-
76
- ## Features
77
-
78
- - User interaction management
79
- - Publish user interactions
80
- - Delete user interactions
81
- - Search interactions
82
- - User profile management
83
- - Search user profiles
84
- - Delete user profiles
85
-
86
- ## API Response Types
87
-
88
- All API methods return strongly-typed responses:
89
-
90
- - `publish_interaction()` returns `PublishUserInteractionResponse`
91
- - `search_interactions()` returns `List[Interaction]`
92
- - `search_profiles()` returns `List[UserProfile]`
93
- - `delete_profile()` returns `DeleteUserProfileResponse`
94
- - `delete_interaction()` returns `DeleteUserInteractionResponse`
95
-
96
- ## Documentation
97
-
98
- For detailed documentation, please visit [docs link].
99
-
100
- ## License
101
-
102
- MIT License
@@ -1,5 +0,0 @@
1
- agenticmem/__init__.py,sha256=KkimFBXT7q5h1O2Slp4ypugkdbtBvdxX8BM_XRRUW6Q,762
2
- agenticmem/client.py,sha256=e702FttQmZoKcl_l6emEhVL1uOWzqs715fhNEbme-yA,7121
3
- agenticmem-0.1.0.dist-info/METADATA,sha256=nhLpyJt2w672ybU3oFRrpj9WJBwNW2219lI1Fqa1FJ8,2785
4
- agenticmem-0.1.0.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
5
- agenticmem-0.1.0.dist-info/RECORD,,