langchain-trigger-server 0.1.3__tar.gz → 0.1.6__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.
Potentially problematic release.
This version of langchain-trigger-server might be problematic. Click here for more details.
- {langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/PKG-INFO +1 -1
- {langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/langchain_triggers/app.py +23 -9
- {langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/langchain_triggers/database/interface.py +1 -21
- {langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/langchain_triggers/database/supabase.py +0 -62
- {langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/pyproject.toml +1 -1
- {langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/.github/workflows/release.yml +0 -0
- {langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/README.md +0 -0
- {langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/langchain_triggers/__init__.py +0 -0
- {langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/langchain_triggers/core.py +0 -0
- {langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/langchain_triggers/database/__init__.py +0 -0
- {langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/langchain_triggers/decorators.py +0 -0
- {langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/test_framework.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langchain-trigger-server
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: Generic event-driven triggers framework
|
|
5
5
|
Project-URL: Homepage, https://github.com/langchain-ai/open-agent-platform
|
|
6
6
|
Project-URL: Repository, https://github.com/langchain-ai/open-agent-platform
|
|
@@ -527,12 +527,13 @@ class TriggerServer:
|
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
try:
|
|
530
|
-
await self._invoke_agent(
|
|
530
|
+
success = await self._invoke_agent(
|
|
531
531
|
agent_id=agent_id,
|
|
532
532
|
user_id=registration["user_id"],
|
|
533
533
|
input_data=agent_input,
|
|
534
534
|
)
|
|
535
|
-
|
|
535
|
+
if success:
|
|
536
|
+
agents_invoked += 1
|
|
536
537
|
except Exception as e:
|
|
537
538
|
logger.error(f"Error invoking agent {agent_id}: {e}", exc_info=True)
|
|
538
539
|
|
|
@@ -558,7 +559,7 @@ class TriggerServer:
|
|
|
558
559
|
agent_id: str,
|
|
559
560
|
user_id: str,
|
|
560
561
|
input_data: Dict[str, Any],
|
|
561
|
-
) ->
|
|
562
|
+
) -> bool:
|
|
562
563
|
"""Invoke LangGraph agent using the SDK."""
|
|
563
564
|
logger.info(f"Invoking LangGraph agent {agent_id} for user {user_id}")
|
|
564
565
|
|
|
@@ -570,9 +571,17 @@ class TriggerServer:
|
|
|
570
571
|
agent_id=agent_id
|
|
571
572
|
)
|
|
572
573
|
|
|
573
|
-
|
|
574
|
+
thread = await self.langgraph_client.threads.create(
|
|
575
|
+
metadata={
|
|
576
|
+
"triggered_by": "langchain-triggers",
|
|
577
|
+
"user_id": user_id,
|
|
578
|
+
},
|
|
579
|
+
headers=headers,
|
|
580
|
+
)
|
|
581
|
+
logger.info(f"Created thread {thread['thread_id']} for agent {agent_id}")
|
|
582
|
+
|
|
574
583
|
run = await self.langgraph_client.runs.create(
|
|
575
|
-
thread_id=
|
|
584
|
+
thread_id=thread['thread_id'],
|
|
576
585
|
assistant_id=agent_id,
|
|
577
586
|
input=input_data,
|
|
578
587
|
metadata={
|
|
@@ -582,12 +591,17 @@ class TriggerServer:
|
|
|
582
591
|
headers=headers,
|
|
583
592
|
)
|
|
584
593
|
|
|
585
|
-
logger.info(f"Successfully invoked agent {agent_id}, run_id: {run['run_id']}")
|
|
586
|
-
return
|
|
594
|
+
logger.info(f"Successfully invoked agent {agent_id}, run_id: {run['run_id']}, thread_id: {run['thread_id']}")
|
|
595
|
+
return True
|
|
587
596
|
|
|
588
597
|
except Exception as e:
|
|
589
|
-
|
|
590
|
-
|
|
598
|
+
# Handle 404s (agent not found) as warnings, not errors
|
|
599
|
+
if hasattr(e, 'response') and getattr(e.response, 'status_code', None) == 404:
|
|
600
|
+
logger.warning(f"Agent {agent_id} not found (404) - agent may have been deleted or moved")
|
|
601
|
+
return False
|
|
602
|
+
else:
|
|
603
|
+
logger.error(f"Error invoking agent {agent_id}: {e}")
|
|
604
|
+
raise
|
|
591
605
|
|
|
592
606
|
async def _get_authenticated_user(self, trigger: TriggerTemplate, user_id: str) -> UserAuthInfo:
|
|
593
607
|
"""Get authenticated user with OAuth tokens for the trigger's required providers."""
|
|
@@ -116,27 +116,7 @@ class TriggerDatabaseInterface(ABC):
|
|
|
116
116
|
async def get_triggers_for_agent(self, agent_id: str) -> List[Dict[str, Any]]:
|
|
117
117
|
"""Get all trigger registrations linked to an agent."""
|
|
118
118
|
pass
|
|
119
|
-
|
|
120
|
-
@abstractmethod
|
|
121
|
-
async def set_agent_trigger_links(
|
|
122
|
-
self,
|
|
123
|
-
agent_id: str,
|
|
124
|
-
registration_ids: List[str],
|
|
125
|
-
created_by: str
|
|
126
|
-
) -> bool:
|
|
127
|
-
"""Replace all trigger links for an agent (atomic operation)."""
|
|
128
|
-
pass
|
|
129
|
-
|
|
130
|
-
@abstractmethod
|
|
131
|
-
async def replace_trigger_agent_links(
|
|
132
|
-
self,
|
|
133
|
-
registration_id: str,
|
|
134
|
-
agent_ids: List[str],
|
|
135
|
-
created_by: str
|
|
136
|
-
) -> bool:
|
|
137
|
-
"""Replace all agent links for a trigger (atomic operation)."""
|
|
138
|
-
pass
|
|
139
|
-
|
|
119
|
+
|
|
140
120
|
# ========== Helper Methods ==========
|
|
141
121
|
|
|
142
122
|
@abstractmethod
|
|
@@ -277,68 +277,6 @@ class SupabaseTriggerDatabase(TriggerDatabaseInterface):
|
|
|
277
277
|
logger.error(f"Error getting triggers for agent: {e}")
|
|
278
278
|
return []
|
|
279
279
|
|
|
280
|
-
async def set_agent_trigger_links(
|
|
281
|
-
self,
|
|
282
|
-
agent_id: str,
|
|
283
|
-
registration_ids: List[str],
|
|
284
|
-
created_by: str
|
|
285
|
-
) -> bool:
|
|
286
|
-
"""Replace all trigger links for an agent (atomic operation)."""
|
|
287
|
-
try:
|
|
288
|
-
# Delete existing links
|
|
289
|
-
await self.client.table("agent_trigger_links").delete().eq("agent_id", agent_id).execute()
|
|
290
|
-
|
|
291
|
-
# Create new links
|
|
292
|
-
if registration_ids:
|
|
293
|
-
links = [
|
|
294
|
-
{
|
|
295
|
-
"agent_id": agent_id,
|
|
296
|
-
"registration_id": reg_id,
|
|
297
|
-
"created_by": created_by
|
|
298
|
-
}
|
|
299
|
-
for reg_id in registration_ids
|
|
300
|
-
]
|
|
301
|
-
|
|
302
|
-
response = self.client.table("agent_trigger_links").insert(links).execute()
|
|
303
|
-
return bool(response.data)
|
|
304
|
-
|
|
305
|
-
return True # Successfully cleared all links
|
|
306
|
-
|
|
307
|
-
except Exception as e:
|
|
308
|
-
logger.error(f"Error setting agent trigger links: {e}")
|
|
309
|
-
return False
|
|
310
|
-
|
|
311
|
-
async def replace_trigger_agent_links(
|
|
312
|
-
self,
|
|
313
|
-
registration_id: str,
|
|
314
|
-
agent_ids: List[str],
|
|
315
|
-
created_by: str
|
|
316
|
-
) -> bool:
|
|
317
|
-
"""Replace all agent links for a trigger (atomic operation)."""
|
|
318
|
-
try:
|
|
319
|
-
# Delete existing links
|
|
320
|
-
await self.client.table("agent_trigger_links").delete().eq("registration_id", registration_id).execute()
|
|
321
|
-
|
|
322
|
-
# Create new links
|
|
323
|
-
if agent_ids:
|
|
324
|
-
links = [
|
|
325
|
-
{
|
|
326
|
-
"agent_id": agent_id,
|
|
327
|
-
"registration_id": registration_id,
|
|
328
|
-
"created_by": created_by
|
|
329
|
-
}
|
|
330
|
-
for agent_id in agent_ids
|
|
331
|
-
]
|
|
332
|
-
|
|
333
|
-
response = self.client.table("agent_trigger_links").insert(links).execute()
|
|
334
|
-
return bool(response.data)
|
|
335
|
-
|
|
336
|
-
return True # Successfully cleared all links
|
|
337
|
-
|
|
338
|
-
except Exception as e:
|
|
339
|
-
logger.error(f"Error replacing trigger agent links: {e}")
|
|
340
|
-
return False
|
|
341
|
-
|
|
342
280
|
# ========== Helper Methods ==========
|
|
343
281
|
|
|
344
282
|
async def get_user_from_token(self, token: str) -> Optional[str]:
|
{langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/.github/workflows/release.yml
RENAMED
|
File without changes
|
|
File without changes
|
{langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/langchain_triggers/__init__.py
RENAMED
|
File without changes
|
{langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/langchain_triggers/core.py
RENAMED
|
File without changes
|
|
File without changes
|
{langchain_trigger_server-0.1.3 → langchain_trigger_server-0.1.6}/langchain_triggers/decorators.py
RENAMED
|
File without changes
|
|
File without changes
|