langchain-trigger-server 0.2.10__py3-none-any.whl → 0.31__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.2.10
3
+ Version: 0.31
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
@@ -0,0 +1,15 @@
1
+ langchain_triggers/__init__.py,sha256=WoW9LC_FJRs42mLWq2iuM-jjPow2Rue50q2zm56Oul0,536
2
+ langchain_triggers/app.py,sha256=NeMCtNbNN52Segd2SL9zIN8W4Z7q1qNjNQMS3CuwYvA,39496
3
+ langchain_triggers/core.py,sha256=6r_91UWt7c26TVqkDxHc2xjmaQl42g-iFHGEWuDo0gs,3929
4
+ langchain_triggers/cron_manager.py,sha256=PueW_z7gdkSza9J05W1VV2OxsfqvodMo7ZlAQJKMvpI,16408
5
+ langchain_triggers/decorators.py,sha256=x3hVTCJgykSxWutH9-z-Bq7JdspMOWOc_wNRWRzAzPM,4620
6
+ langchain_triggers/auth/__init__.py,sha256=RtDKuBoKYuyHzLNpKr74cmALO0PhHlWO9Ho7k3CUYFE,349
7
+ langchain_triggers/auth/slack_hmac.py,sha256=kiwjhTXITgQvLAtEcOv8BnnWJRJcxaQ9dXkQm3JJDQ4,2948
8
+ langchain_triggers/database/__init__.py,sha256=B1I1qmVr3U1CSf0VkjxsL4W5QGda5T7uB_CsJq6yBF4,535
9
+ langchain_triggers/database/interface.py,sha256=jpADOOwcBQo1ZichgiZVaOvfZqEqVVo8Ea7ATWWTSBE,4283
10
+ langchain_triggers/database/supabase.py,sha256=zi_75GbqRvzzlXd5EgfYof4h6vHWOLS4I1759wvY9kQ,17009
11
+ langchain_triggers/triggers/__init__.py,sha256=Uw1544gxzN4XDRn2RzpZ5EAG6EAF38ZYQtVvlciEsMs,146
12
+ langchain_triggers/triggers/cron_trigger.py,sha256=tfCxlbtn7__0PRoVsZuEErln3bMckMDh1xjspmhYKNU,3309
13
+ langchain_trigger_server-0.31.dist-info/METADATA,sha256=RfhfZJWc_j-lHXKijzepwf7cJOruizBVpv8CCm1oDBE,1485
14
+ langchain_trigger_server-0.31.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ langchain_trigger_server-0.31.dist-info/RECORD,,
langchain_triggers/app.py CHANGED
@@ -21,10 +21,10 @@ from .auth.slack_hmac import (
21
21
  get_slack_signing_secret,
22
22
  verify_slack_signature,
23
23
  )
24
+ from .core import TriggerType
24
25
  from .cron_manager import CronTriggerManager
25
26
  from .database import TriggerDatabaseInterface, create_database
26
27
  from .decorators import TriggerTemplate
27
- from .triggers.cron_trigger import CRON_TRIGGER_ID
28
28
 
29
29
  logger = logging.getLogger(__name__)
30
30
 
@@ -566,12 +566,34 @@ class TriggerServer:
566
566
  detail="Trigger registration not found or access denied",
567
567
  )
568
568
 
569
- # Get the template to check if it's a cron trigger
569
+ # Get the template to check if it's a polling trigger
570
570
  template_id = registration.get("template_id")
571
- if template_id != CRON_TRIGGER_ID:
571
+ tmpl = (
572
+ next((t for t in self.triggers if t.id == template_id), None)
573
+ if template_id
574
+ else None
575
+ )
576
+ if not template_id or not tmpl:
577
+ error_reason = (
578
+ "missing_template_id"
579
+ if not template_id
580
+ else "template_not_found"
581
+ )
582
+ logger.error(
583
+ "manual_execute_error registration_id=%s template_id=%s error=%s",
584
+ registration_id,
585
+ template_id,
586
+ error_reason,
587
+ stack_info=True,
588
+ )
589
+ raise HTTPException(status_code=500, detail="Internal server error")
590
+ if (
591
+ getattr(tmpl.trigger_type, "value", tmpl.trigger_type)
592
+ != TriggerType.POLLING.value
593
+ ):
572
594
  raise HTTPException(
573
595
  status_code=400,
574
- detail="Manual execution is only supported for cron triggers",
596
+ detail="Manual execution is only supported for polling triggers",
575
597
  )
576
598
 
577
599
  # Execute the cron trigger using the cron manager
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import logging
6
+ from enum import Enum
6
7
  from typing import Any
7
8
 
8
9
  from pydantic import BaseModel, Field
@@ -10,6 +11,13 @@ from pydantic import BaseModel, Field
10
11
  logger = logging.getLogger(__name__)
11
12
 
12
13
 
14
+ class TriggerType(str, Enum):
15
+ """Type of trigger supported by the framework."""
16
+
17
+ WEBHOOK = "webhook"
18
+ POLLING = "polling"
19
+
20
+
13
21
  class ProviderAuthInfo(BaseModel):
14
22
  """Authentication info for a specific OAuth provider."""
15
23
 
@@ -8,7 +8,7 @@ from apscheduler.schedulers.asyncio import AsyncIOScheduler
8
8
  from apscheduler.triggers.cron import CronTrigger as APSCronTrigger
9
9
  from pydantic import BaseModel
10
10
 
11
- from langchain_triggers.triggers.cron_trigger import CRON_TRIGGER_ID
11
+ from langchain_triggers.core import TriggerHandlerResult, TriggerType
12
12
 
13
13
  logger = logging.getLogger(__name__)
14
14
 
@@ -36,10 +36,19 @@ class CronTriggerManager:
36
36
  self.execution_history = [] # Keep recent execution history
37
37
  self.max_history = 1000
38
38
 
39
+ def _is_polling(self, trigger) -> bool:
40
+ ttype = getattr(trigger, "trigger_type", None)
41
+ val = getattr(ttype, "value", ttype)
42
+ try:
43
+ return str(val).lower() == TriggerType.POLLING.value
44
+ except Exception:
45
+ return False
46
+
39
47
  async def start(self):
40
48
  """Start scheduler and load existing cron registrations."""
41
49
  try:
42
50
  self.scheduler.start()
51
+ logger.info("polling_manager_started timezone=UTC")
43
52
  await self._load_existing_registrations()
44
53
  except Exception as e:
45
54
  logger.error(f"Failed to start CronTriggerManager: {e}")
@@ -53,25 +62,59 @@ class CronTriggerManager:
53
62
  logger.error(f"Error shutting down CronTriggerManager: {e}")
54
63
 
55
64
  async def _load_existing_registrations(self):
56
- """Load all existing cron registrations from database and schedule them."""
65
+ """Load all existing polling registrations from database and schedule them.
66
+
67
+ Discovers polling-capable triggers dynamically from registered templates.
68
+ """
57
69
  try:
58
- registrations = await self.trigger_server.database.get_all_registrations(
59
- CRON_TRIGGER_ID
70
+ scheduled_total = 0
71
+ polling_templates = [
72
+ t for t in self.trigger_server.triggers if self._is_polling(t)
73
+ ]
74
+ ids_csv = ",".join([t.id for t in polling_templates]) or ""
75
+ logger.info(
76
+ f"polling_templates_loaded count={len(polling_templates)} ids={ids_csv}"
60
77
  )
61
78
 
62
- scheduled_count = 0
63
- for registration in registrations:
64
- if registration.get("status") == "active":
65
- try:
66
- await self._schedule_cron_job(registration)
67
- scheduled_count += 1
68
- except Exception as e:
69
- logger.error(
70
- f"Failed to schedule existing cron job {registration.get('id')}: {e}"
79
+ for template in polling_templates:
80
+ template_id = template.id
81
+ logger.info(
82
+ "polling_template "
83
+ f"template_id={template_id} provider={(template.provider or '').lower()} name={getattr(template, 'name', '')}"
84
+ )
85
+ try:
86
+ registrations = (
87
+ await self.trigger_server.database.get_all_registrations(
88
+ template_id
71
89
  )
72
-
90
+ )
91
+ logger.info(
92
+ f"registrations_fetched template_id={template_id} count={len(registrations)}"
93
+ )
94
+ except Exception as e:
95
+ logger.error(
96
+ f"registrations_fetch_err template_id={template_id} error={str(e)}"
97
+ )
98
+ continue
99
+
100
+ scheduled_for_template = 0
101
+ for registration in registrations:
102
+ if registration.get("status") == "active":
103
+ try:
104
+ await self._schedule_cron_job(registration)
105
+ scheduled_total += 1
106
+ scheduled_for_template += 1
107
+ except Exception as e:
108
+ logger.error(
109
+ "registration_schedule_err "
110
+ f"registration_id={registration.get('id')} template_id={template_id} error={str(e)}"
111
+ )
112
+ logger.debug(
113
+ f"registrations_scheduled template_id={template_id} scheduled={scheduled_for_template}"
114
+ )
115
+ logger.debug(f"polling_schedule_complete total_scheduled={scheduled_total}")
73
116
  except Exception as e:
74
- logger.error(f"Failed to load existing cron registrations: {e}")
117
+ logger.error(f"polling_load_err error={str(e)}")
75
118
 
76
119
  async def reload_from_database(self):
77
120
  """Reload all cron registrations from database, replacing current schedules."""
@@ -88,15 +131,39 @@ class CronTriggerManager:
88
131
  raise
89
132
 
90
133
  async def on_registration_created(self, registration: dict[str, Any]):
91
- """Called when a new cron registration is created."""
92
- if registration.get("trigger_template_id") == CRON_TRIGGER_ID:
134
+ """Called when a new polling registration is created."""
135
+ template_id_raw = registration.get("template_id")
136
+ template_id = str(template_id_raw) if template_id_raw is not None else None
137
+ if template_id is None:
138
+ logger.error(
139
+ "registration_missing_template_id id=%s", registration.get("id")
140
+ )
141
+ return
142
+ tmpl = next(
143
+ (t for t in self.trigger_server.triggers if t.id == template_id), None
144
+ )
145
+ if not tmpl:
146
+ logger.error(
147
+ "registration_template_not_found id=%s template_id=%s",
148
+ registration.get("id"),
149
+ template_id,
150
+ )
151
+ return
152
+ if self._is_polling(tmpl):
93
153
  try:
94
154
  await self._schedule_cron_job(registration)
95
155
  except Exception as e:
96
156
  logger.error(
97
- f"Failed to schedule new cron job {registration['id']}: {e}"
157
+ f"Failed to schedule new cron job {registration.get('id')}: {e}"
98
158
  )
99
159
  raise
160
+ else:
161
+ logger.debug(
162
+ "registration_not_polling id=%s template_id=%s trigger_type=%s",
163
+ registration.get("id"),
164
+ template_id,
165
+ tmpl.trigger_type,
166
+ )
100
167
 
101
168
  async def on_registration_deleted(self, registration_id: str):
102
169
  """Called when a cron registration is deleted."""
@@ -106,25 +173,36 @@ class CronTriggerManager:
106
173
  logger.error(f"Failed to unschedule cron job {registration_id}: {e}")
107
174
 
108
175
  async def _schedule_cron_job(self, registration: dict[str, Any]):
109
- """Add a cron job to the scheduler."""
176
+ """Add a polling job to the scheduler using a 5-field crontab."""
110
177
  registration_id = registration["id"]
111
178
  resource_data = registration.get("resource", {})
112
- crontab = resource_data.get("crontab", "")
113
-
114
- if not crontab:
115
- raise ValueError(
116
- f"No crontab pattern found in registration {registration_id}"
117
- )
179
+ crontab = (resource_data.get("crontab") or "").strip()
180
+ template_id = registration.get("template_id")
181
+ template_id = str(template_id) if template_id is not None else None
182
+ tmpl = next(
183
+ (t for t in self.trigger_server.triggers if t.id == template_id), None
184
+ )
185
+ if tmpl and not crontab:
186
+ crontab = (getattr(tmpl, "default_crontab", None) or "").strip()
118
187
 
119
188
  try:
120
- # Parse cron expression
121
- cron_parts = crontab.strip().split()
189
+ if not crontab:
190
+ if template_id is None:
191
+ raise ValueError(
192
+ f"No schedule provided for registration {registration_id} (missing template_id)"
193
+ )
194
+ if tmpl is None:
195
+ raise ValueError(
196
+ f"No schedule provided for registration {registration_id} (template '{template_id}' not found)"
197
+ )
198
+ raise ValueError(
199
+ f"No schedule provided for registration {registration_id} (no crontab and no default_crontab for template '{template_id}')"
200
+ )
201
+
202
+ cron_parts = crontab.split()
122
203
  if len(cron_parts) != 5:
123
204
  raise ValueError(f"Invalid cron format: {crontab} (expected 5 parts)")
124
-
125
205
  minute, hour, day, month, day_of_week = cron_parts
126
-
127
- # Create APScheduler cron trigger
128
206
  trigger = APSCronTrigger(
129
207
  minute=minute,
130
208
  hour=hour,
@@ -133,15 +211,18 @@ class CronTriggerManager:
133
211
  day_of_week=day_of_week,
134
212
  timezone="UTC",
135
213
  )
214
+ job_id = f"cron_{registration_id}"
215
+ logger.info(
216
+ f"schedule_cron registration_id={registration_id} crontab='{crontab}' job_id={job_id}"
217
+ )
136
218
 
137
- # Schedule the job
138
219
  job = self.scheduler.add_job(
139
220
  self._execute_cron_job_with_monitoring,
140
221
  trigger=trigger,
141
222
  args=[registration],
142
- id=f"cron_{registration_id}",
143
- name=f"Cron job for registration {registration_id}",
144
- max_instances=1, # Prevent overlapping executions
223
+ id=job_id,
224
+ name=f"Polling job for registration {registration_id}",
225
+ max_instances=1,
145
226
  replace_existing=True,
146
227
  )
147
228
 
@@ -149,7 +230,7 @@ class CronTriggerManager:
149
230
 
150
231
  except Exception as e:
151
232
  logger.error(
152
- f"Failed to schedule cron job for registration {registration_id}: {e}"
233
+ f"Failed to schedule polling job for registration {registration_id}: {e}"
153
234
  )
154
235
  raise
155
236
 
@@ -202,6 +283,8 @@ class CronTriggerManager:
202
283
  """Execute a cron job - invoke agents. Can be called manually or by scheduler."""
203
284
  registration_id = registration["id"]
204
285
  user_id = registration["user_id"]
286
+ template_id = registration.get("template_id")
287
+ template_id = str(template_id) if template_id is not None else None
205
288
  tenant_id = (
206
289
  registration.get("metadata", {}).get("client_metadata", {}).get("tenant_id")
207
290
  )
@@ -215,45 +298,98 @@ class CronTriggerManager:
215
298
  logger.warning(f"No agents linked to cron job {registration_id}")
216
299
  return 0
217
300
 
218
- agents_invoked = 0
219
- for agent_link in agent_links:
220
- agent_id = (
221
- agent_link
222
- if isinstance(agent_link, str)
223
- else agent_link.get("agent_id")
301
+ tmpl = next(
302
+ (t for t in self.trigger_server.triggers if t.id == template_id), None
303
+ )
304
+
305
+ if not tmpl or not self._is_polling(tmpl):
306
+ available_ids = ",".join([t.id for t in self.trigger_server.triggers])
307
+ logger.error(
308
+ "template_not_polling "
309
+ f"template_id={template_id} available_templates={available_ids}"
224
310
  )
225
- # Ensure agent_id and user_id are strings for JSON serialization
226
- agent_id_str = str(agent_id)
227
- user_id_str = str(user_id)
228
- tenant_id_str = str(tenant_id)
229
-
230
- current_time = datetime.utcnow()
231
- current_time_str = current_time.strftime("%A, %B %d, %Y at %H:%M UTC")
232
-
233
- agent_input = {
234
- "messages": [
235
- {
236
- "role": "human",
237
- "content": f"ACTION: triggering cron from langchain-trigger-server\nCURRENT TIME: {current_time_str}",
238
- }
239
- ]
240
- }
311
+ return 0
241
312
 
242
- try:
243
- success = await self.trigger_server._invoke_agent(
244
- agent_id=agent_id_str,
245
- user_id=user_id_str,
246
- tenant_id=tenant_id_str,
247
- input_data=agent_input,
248
- )
249
- if success:
250
- agents_invoked += 1
313
+ result: TriggerHandlerResult = await tmpl.poll_handler(
314
+ registration,
315
+ self.trigger_server.database,
316
+ self.trigger_server.langchain_auth_client,
317
+ )
251
318
 
252
- except Exception as e:
253
- logger.error(
254
- f" Error invoking agent {agent_id_str} for cron job {registration_id}: {e}"
255
- )
319
+ if not result.invoke_agent:
320
+ logger.info(
321
+ "poll_result "
322
+ f"registration_id={registration_id} "
323
+ f"trigger_id={template_id} "
324
+ f"provider={(tmpl.provider or '').lower()} "
325
+ f"invoke_agent=false messages_count=0"
326
+ )
327
+ return 0
328
+
329
+ agents_invoked = 0
330
+ messages = result.agent_messages or []
331
+
332
+ logger.info(
333
+ "poll_result "
334
+ f"registration_id={registration_id} "
335
+ f"trigger_id={template_id} "
336
+ f"provider={(tmpl.provider or '').lower()} "
337
+ f"invoke_agent=true messages_count={len(messages)} "
338
+ f"agents_linked={len(agent_links)}"
339
+ )
256
340
 
341
+ for message in messages:
342
+ for agent_link in agent_links:
343
+ agent_id = (
344
+ agent_link
345
+ if isinstance(agent_link, str)
346
+ else agent_link.get("agent_id")
347
+ )
348
+ # Ensure agent_id and user_id are strings for JSON serialization
349
+ agent_id_str = str(agent_id)
350
+ user_id_str = str(user_id)
351
+ tenant_id_str = str(tenant_id)
352
+
353
+ current_time = datetime.utcnow()
354
+ current_time_str = current_time.strftime("%A, %B %d, %Y at %H:%M UTC")
355
+
356
+ agent_input = {
357
+ "messages": [
358
+ {
359
+ "role": "human",
360
+ "content": f"ACTION: triggering cron from langchain-trigger-server\nCURRENT TIME: {current_time_str}\n\n{message}",
361
+ }
362
+ ]
363
+ }
364
+
365
+ try:
366
+ success = await self.trigger_server._invoke_agent(
367
+ agent_id=agent_id_str,
368
+ user_id=user_id_str,
369
+ tenant_id=tenant_id_str,
370
+ input_data=agent_input,
371
+ )
372
+ if success:
373
+ logger.info(
374
+ "invoke_agent_ok "
375
+ f"registration_id={registration_id} "
376
+ f"agent_id={agent_id_str}"
377
+ )
378
+ agents_invoked += 1
379
+ except Exception as e:
380
+ logger.error(
381
+ "invoke_agent_err "
382
+ f"registration_id={registration_id} "
383
+ f"agent_id={agent_id_str} "
384
+ f"error={str(e)}"
385
+ )
386
+
387
+ logger.info(
388
+ "poll_invoke_summary "
389
+ f"registration_id={registration_id} "
390
+ f"agents_invoked={agents_invoked} "
391
+ f"messages_count={len(messages)}"
392
+ )
257
393
  return agents_invoked
258
394
 
259
395
  async def _record_execution(self, execution: CronJobExecution):
@@ -1,4 +1,8 @@
1
- """Trigger system - templates with registration and webhook handlers."""
1
+ """Trigger system - templates with registration and webhook handlers.
2
+
3
+ Also supports polling triggers (no HTTP route) via a `poll_handler` that the
4
+ framework scheduler can call on a cadence.
5
+ """
2
6
 
3
7
  from __future__ import annotations
4
8
 
@@ -8,7 +12,7 @@ from typing import Any, get_type_hints
8
12
  from langchain_auth.client import Client
9
13
  from pydantic import BaseModel
10
14
 
11
- from .core import TriggerHandlerResult, TriggerRegistrationResult
15
+ from .core import TriggerHandlerResult, TriggerRegistrationResult, TriggerType
12
16
 
13
17
 
14
18
  class TriggerTemplate:
@@ -22,7 +26,11 @@ class TriggerTemplate:
22
26
  description: str,
23
27
  registration_model: type[BaseModel],
24
28
  registration_handler,
25
- trigger_handler,
29
+ trigger_handler=None,
30
+ *,
31
+ trigger_type: TriggerType = TriggerType.WEBHOOK,
32
+ poll_handler: Any | None = None,
33
+ default_crontab: str | None = None,
26
34
  ):
27
35
  self.id = id
28
36
  self.provider = provider
@@ -31,12 +39,15 @@ class TriggerTemplate:
31
39
  self.registration_model = registration_model
32
40
  self.registration_handler = registration_handler
33
41
  self.trigger_handler = trigger_handler
42
+ self.trigger_type = trigger_type
43
+ self.poll_handler = poll_handler
44
+ self.default_crontab = default_crontab
34
45
 
35
46
  self._validate_handler_signatures()
36
47
 
37
48
  def _validate_handler_signatures(self):
38
49
  """Validate that all handler functions have the correct signatures."""
39
- # Expected: async def handler(user_id: str, auth_client: Client, registration: RegistrationModel) -> TriggerRegistrationResult
50
+ # Expected reg: async def handler(user_id: str, auth_client: Client, registration: RegistrationModel) -> TriggerRegistrationResult
40
51
  self._validate_handler(
41
52
  "registration_handler",
42
53
  self.registration_handler,
@@ -44,13 +55,28 @@ class TriggerTemplate:
44
55
  TriggerRegistrationResult,
45
56
  )
46
57
 
47
- # Expected: async def handler(payload: Dict[str, Any], query_params: Dict[str, str], database, auth_client: Client) -> TriggerHandlerResult
48
- self._validate_handler(
49
- "trigger_handler",
50
- self.trigger_handler,
51
- [dict[str, Any], dict[str, str], Any, Client],
52
- TriggerHandlerResult,
53
- )
58
+ if self.trigger_type == TriggerType.WEBHOOK:
59
+ if not self.trigger_handler:
60
+ raise TypeError(
61
+ f"trigger_handler required for webhook trigger '{self.id}'"
62
+ )
63
+ self._validate_handler(
64
+ "trigger_handler",
65
+ self.trigger_handler,
66
+ [dict[str, Any], dict[str, str], Any, Client],
67
+ TriggerHandlerResult,
68
+ )
69
+ else:
70
+ if not self.poll_handler:
71
+ raise TypeError(
72
+ f"poll_handler required for polling trigger '{self.id}'"
73
+ )
74
+ self._validate_handler(
75
+ "poll_handler",
76
+ self.poll_handler,
77
+ [dict[str, Any], Any, Client],
78
+ TriggerHandlerResult,
79
+ )
54
80
 
55
81
  def _validate_handler(
56
82
  self,
@@ -12,6 +12,7 @@ from langchain_triggers.core import (
12
12
  TriggerHandlerResult,
13
13
  TriggerRegistrationModel,
14
14
  TriggerRegistrationResult,
15
+ TriggerType,
15
16
  )
16
17
  from langchain_triggers.decorators import TriggerTemplate
17
18
 
@@ -73,20 +74,25 @@ async def cron_registration_handler(
73
74
  )
74
75
 
75
76
 
76
- async def cron_trigger_handler(
77
- payload: dict[str, Any],
78
- query_params: dict[str, str],
77
+ async def cron_poll_handler(
78
+ registration: dict[str, Any],
79
79
  database,
80
80
  auth_client: Client,
81
81
  ) -> TriggerHandlerResult:
82
- """Cron trigger handler - this should never be called via HTTP."""
83
- logger.warning("Cron trigger handler called via HTTP - this shouldn't happen")
82
+ """Polling handler for generic cron.
83
+
84
+ Produces a simple time-based message for linked agents.
85
+ """
86
+ current_time = datetime.utcnow()
87
+ current_time_str = current_time.strftime("%A, %B %d, %Y at %H:%M UTC")
88
+ message = (
89
+ "ACTION: triggering cron from langchain-trigger-server\n"
90
+ f"CURRENT TIME: {current_time_str}"
91
+ )
84
92
  return TriggerHandlerResult(
85
- invoke_agent=False,
86
- response_body={
87
- "success": False,
88
- "message": "Cron triggers are executed by scheduler, not HTTP requests",
89
- },
93
+ invoke_agent=True,
94
+ agent_messages=[message],
95
+ registration=registration,
90
96
  )
91
97
 
92
98
 
@@ -97,5 +103,6 @@ cron_trigger = TriggerTemplate(
97
103
  description="Triggers agents on a cron schedule",
98
104
  registration_model=CronRegistration,
99
105
  registration_handler=cron_registration_handler,
100
- trigger_handler=cron_trigger_handler,
106
+ trigger_type=TriggerType.POLLING,
107
+ poll_handler=cron_poll_handler,
101
108
  )
@@ -1,15 +0,0 @@
1
- langchain_triggers/__init__.py,sha256=WoW9LC_FJRs42mLWq2iuM-jjPow2Rue50q2zm56Oul0,536
2
- langchain_triggers/app.py,sha256=rVl_Yc2n0bz37mPb3E1MnPG2bCXH-bZkuuleaQIII8U,38569
3
- langchain_triggers/core.py,sha256=_CNZRyj78yCHG8FACwhCmZ0zvRoWls924OIFYMOC27Q,3772
4
- langchain_triggers/cron_manager.py,sha256=ISo-P2gw7eQ6y7xWQOfojqcJr_K-zagZt9Ocy8nX0fw,10477
5
- langchain_triggers/decorators.py,sha256=zsfgf171qkEDdIiSn8LUr--3dz6bxBBKZO6dpRM2ILs,3711
6
- langchain_triggers/auth/__init__.py,sha256=RtDKuBoKYuyHzLNpKr74cmALO0PhHlWO9Ho7k3CUYFE,349
7
- langchain_triggers/auth/slack_hmac.py,sha256=kiwjhTXITgQvLAtEcOv8BnnWJRJcxaQ9dXkQm3JJDQ4,2948
8
- langchain_triggers/database/__init__.py,sha256=B1I1qmVr3U1CSf0VkjxsL4W5QGda5T7uB_CsJq6yBF4,535
9
- langchain_triggers/database/interface.py,sha256=jpADOOwcBQo1ZichgiZVaOvfZqEqVVo8Ea7ATWWTSBE,4283
10
- langchain_triggers/database/supabase.py,sha256=zi_75GbqRvzzlXd5EgfYof4h6vHWOLS4I1759wvY9kQ,17009
11
- langchain_triggers/triggers/__init__.py,sha256=Uw1544gxzN4XDRn2RzpZ5EAG6EAF38ZYQtVvlciEsMs,146
12
- langchain_triggers/triggers/cron_trigger.py,sha256=SeWz_ETBCBO1_r96tzTZgsvn4BdF4yMKabygjmHoGwY,3174
13
- langchain_trigger_server-0.2.10.dist-info/METADATA,sha256=EcKCDT6DqADexKESf7YhP8mMkZImpBDRaGHnvl4XAdU,1487
14
- langchain_trigger_server-0.2.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- langchain_trigger_server-0.2.10.dist-info/RECORD,,