langchain-trigger-server 0.3.7__py3-none-any.whl → 0.3.8__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 langchain-trigger-server might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langchain-trigger-server
3
- Version: 0.3.7
3
+ Version: 0.3.8
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
@@ -8,7 +8,7 @@ langchain_triggers/auth/__init__.py,sha256=Y4DXRRAgCeXK2vVDpJBdaeh3Uq2FA3YIAs4n7
8
8
  langchain_triggers/database/__init__.py,sha256=8OxGLTh2VWQ-GVVFjrOOL1qdgQ9lkmjUV1racLGuk7E,135
9
9
  langchain_triggers/database/interface.py,sha256=Wu1MOl1rugFFVcDVM4nEMgyvwW5JxUCNpS3oD6EwkCQ,3716
10
10
  langchain_triggers/triggers/__init__.py,sha256=Uw1544gxzN4XDRn2RzpZ5EAG6EAF38ZYQtVvlciEsMs,146
11
- langchain_triggers/triggers/cron_trigger.py,sha256=TDWsgg0JqnKdA2rjO4JnzDJtj1csXpe4Mn3YOC4tbm0,4575
12
- langchain_trigger_server-0.3.7.dist-info/METADATA,sha256=H4aU9CCkVRyB_ge8frvCyC_vlXXXj5on4fDEQT7o-fk,1438
13
- langchain_trigger_server-0.3.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
- langchain_trigger_server-0.3.7.dist-info/RECORD,,
11
+ langchain_triggers/triggers/cron_trigger.py,sha256=H1GK8XmSPFbSQiP7UBuvgInNwQURGuqGi4gKlCHkYcw,5315
12
+ langchain_trigger_server-0.3.8.dist-info/METADATA,sha256=QDMEDjZByDqSmdeR8COZNS44tzgO37L0lg5o8nBI57w,1438
13
+ langchain_trigger_server-0.3.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ langchain_trigger_server-0.3.8.dist-info/RECORD,,
@@ -1,6 +1,7 @@
1
1
  """Cron-based trigger for scheduled agent execution."""
2
2
 
3
3
  import logging
4
+ import uuid
4
5
  from datetime import datetime
5
6
  from typing import Any
6
7
 
@@ -85,11 +86,14 @@ async def cron_poll_handler(
85
86
  tenant_id = str(registration.get("tenant_id", ""))
86
87
 
87
88
  agent_links = await database.get_agents_for_trigger(registration_id)
89
+
88
90
  if not agent_links:
89
91
  logger.info(f"cron_no_linked_agents registration_id={registration_id}")
90
92
  return {"success": True, "message": "No linked agents", "agents_invoked": 0}
91
93
 
92
- client = get_client(url=get_langgraph_url(), api_key=None)
94
+ langgraph_url = get_langgraph_url()
95
+
96
+ client = get_client(url=langgraph_url, api_key=None)
93
97
  headers = create_service_auth_headers(user_id, tenant_id)
94
98
 
95
99
  current_time = datetime.utcnow()
@@ -100,9 +104,27 @@ async def cron_poll_handler(
100
104
  agent_id = str(
101
105
  agent_link if isinstance(agent_link, str) else agent_link.get("agent_id")
102
106
  )
107
+
103
108
  try:
109
+ thread_id = str(uuid.uuid4())
110
+
111
+ try:
112
+ await client.threads.create(
113
+ thread_id=thread_id,
114
+ if_exists="do_nothing",
115
+ metadata={
116
+ "triggered_by": "cron-trigger",
117
+ "user_id": user_id,
118
+ "tenant_id": tenant_id,
119
+ "registration_id": str(registration_id),
120
+ },
121
+ headers=headers,
122
+ )
123
+ except Exception as thread_err:
124
+ logger.warning(f"cron_thread_create_failed thread_id={thread_id} error={str(thread_err)}")
125
+
104
126
  await client.runs.create(
105
- None,
127
+ thread_id,
106
128
  agent_id,
107
129
  input={
108
130
  "messages": [
@@ -115,7 +137,7 @@ async def cron_poll_handler(
115
137
  headers=headers,
116
138
  )
117
139
  logger.info(
118
- f"cron_run_ok registration_id={registration_id} agent_id={agent_id}"
140
+ f"cron_run_ok registration_id={registration_id} agent_id={agent_id} thread_id={thread_id}"
119
141
  )
120
142
  agents_invoked += 1
121
143
  except Exception as e: