langchain-trigger-server 0.2.9__py3-none-any.whl → 0.2.10__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.9
3
+ Version: 0.2.10
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
@@ -1,5 +1,5 @@
1
1
  langchain_triggers/__init__.py,sha256=WoW9LC_FJRs42mLWq2iuM-jjPow2Rue50q2zm56Oul0,536
2
- langchain_triggers/app.py,sha256=MARlj82Ena79n0MG23m-Vu9w6YDQWqp0Ao24TuEKTzs,35325
2
+ langchain_triggers/app.py,sha256=rVl_Yc2n0bz37mPb3E1MnPG2bCXH-bZkuuleaQIII8U,38569
3
3
  langchain_triggers/core.py,sha256=_CNZRyj78yCHG8FACwhCmZ0zvRoWls924OIFYMOC27Q,3772
4
4
  langchain_triggers/cron_manager.py,sha256=ISo-P2gw7eQ6y7xWQOfojqcJr_K-zagZt9Ocy8nX0fw,10477
5
5
  langchain_triggers/decorators.py,sha256=zsfgf171qkEDdIiSn8LUr--3dz6bxBBKZO6dpRM2ILs,3711
@@ -10,6 +10,6 @@ langchain_triggers/database/interface.py,sha256=jpADOOwcBQo1ZichgiZVaOvfZqEqVVo8
10
10
  langchain_triggers/database/supabase.py,sha256=zi_75GbqRvzzlXd5EgfYof4h6vHWOLS4I1759wvY9kQ,17009
11
11
  langchain_triggers/triggers/__init__.py,sha256=Uw1544gxzN4XDRn2RzpZ5EAG6EAF38ZYQtVvlciEsMs,146
12
12
  langchain_triggers/triggers/cron_trigger.py,sha256=SeWz_ETBCBO1_r96tzTZgsvn4BdF4yMKabygjmHoGwY,3174
13
- langchain_trigger_server-0.2.9.dist-info/METADATA,sha256=8ER3hixfKxyvOIn308bFj64yjZkscTxotQRkah3pS60,1486
14
- langchain_trigger_server-0.2.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- langchain_trigger_server-0.2.9.dist-info/RECORD,,
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,,
langchain_triggers/app.py CHANGED
@@ -594,6 +594,14 @@ class TriggerServer:
594
594
  ) -> dict[str, Any]:
595
595
  """Handle an incoming request with a handler function."""
596
596
  try:
597
+ logger.info(
598
+ "incoming_trigger_request method=%s path=%s trigger_id=%s provider=%s content_type=%s",
599
+ request.method,
600
+ request.url.path,
601
+ getattr(trigger, "id", "<unknown>"),
602
+ getattr(trigger, "provider", "<unknown>"),
603
+ request.headers.get("content-type", ""),
604
+ )
597
605
  if request.method == "POST":
598
606
  if request.headers.get("content-type", "").startswith(
599
607
  "application/json"
@@ -601,16 +609,34 @@ class TriggerServer:
601
609
  # Read body once for both auth and parsing
602
610
  body_bytes = await request.body()
603
611
  body_str = body_bytes.decode("utf-8")
612
+ logger.debug(
613
+ "request_body_read bytes=%s",
614
+ len(body_bytes) if body_bytes is not None else 0,
615
+ )
604
616
 
605
617
  # TODO(sam/palash): We should not have API specific things in this framework repo. We should clean this up.
606
618
  if self._is_slack_trigger(trigger):
619
+ logger.info(
620
+ "slack_request_detected trigger_id=%s verifying_signature=true",
621
+ getattr(trigger, "id", "<unknown>"),
622
+ )
607
623
  await self._verify_slack_webhook_auth_with_body(
608
624
  request, body_str
609
625
  )
610
626
 
611
627
  import json
612
628
 
613
- payload = json.loads(body_str)
629
+ try:
630
+ payload = json.loads(body_str)
631
+ except Exception as e:
632
+ logger.error("json_parse_error error=%s", e)
633
+ raise
634
+ logger.info(
635
+ "payload_parsed kind=json keys=%s",
636
+ sorted(payload.keys())
637
+ if isinstance(payload, dict)
638
+ else "<non-dict>",
639
+ )
614
640
 
615
641
  if (
616
642
  payload.get("type") == "url_verification"
@@ -622,22 +648,55 @@ class TriggerServer:
622
648
  # Handle form data or other content types
623
649
  body = await request.body()
624
650
  payload = {"raw_body": body.decode("utf-8") if body else ""}
651
+ logger.info(
652
+ "payload_parsed kind=raw length=%s",
653
+ len(payload.get("raw_body", "")),
654
+ )
625
655
  else:
626
656
  payload = dict(request.query_params)
657
+ logger.info(
658
+ "payload_parsed kind=query keys=%s",
659
+ sorted(payload.keys()),
660
+ )
627
661
 
628
662
  query_params = dict(request.query_params)
663
+ logger.info(
664
+ "invoking_trigger_handler trigger_id=%s provider=%s query_keys=%s",
665
+ getattr(trigger, "id", "<unknown>"),
666
+ getattr(trigger, "provider", "<unknown>"),
667
+ sorted(query_params.keys()),
668
+ )
629
669
  result = await trigger.trigger_handler(
630
670
  payload, query_params, self.database, self.langchain_auth_client
631
671
  )
672
+ logger.info(
673
+ "trigger_handler_completed invoke_agent=%s messages=%s has_registration=%s",
674
+ getattr(result, "invoke_agent", None),
675
+ len(getattr(result, "agent_messages", []) or []),
676
+ bool(getattr(result, "registration", None)),
677
+ )
632
678
  if not result.invoke_agent:
679
+ logger.info(
680
+ "no_agent_invocation trigger_id=%s returning_handler_response=true",
681
+ getattr(trigger, "id", "<unknown>"),
682
+ )
633
683
  return result.response_body
634
684
 
635
685
  registration_id = result.registration["id"]
636
686
  agent_links = await self.database.get_agents_for_trigger(registration_id)
687
+ logger.info(
688
+ "agent_links_fetched registration_id=%s count=%s",
689
+ registration_id,
690
+ len(agent_links) if agent_links is not None else 0,
691
+ )
637
692
 
638
693
  agents_invoked = 0
639
694
  # Iterate through each message and invoke agents for each
640
695
  for message in result.agent_messages:
696
+ logger.debug(
697
+ "processing_agent_message message_len=%s",
698
+ len(str(message)) if message is not None else 0,
699
+ )
641
700
  for agent_link in agent_links:
642
701
  agent_id = (
643
702
  agent_link
@@ -656,6 +715,12 @@ class TriggerServer:
656
715
  agent_input = {"messages": [{"role": "human", "content": message}]}
657
716
 
658
717
  try:
718
+ logger.info(
719
+ "invoking_agent assistant_id=%s user_id=%s tenant_id=%s",
720
+ agent_id_str,
721
+ user_id_str,
722
+ tenant_id_str,
723
+ )
659
724
  success = await self._invoke_agent(
660
725
  agent_id=agent_id_str,
661
726
  user_id=user_id_str,
@@ -664,6 +729,11 @@ class TriggerServer:
664
729
  )
665
730
  if success:
666
731
  agents_invoked += 1
732
+ logger.info(
733
+ "agent_invocation_success assistant_id=%s registration_id=%s",
734
+ agent_id_str,
735
+ registration_id,
736
+ )
667
737
  except Exception as e:
668
738
  logger.error(
669
739
  f"Error invoking agent {agent_id_str}: {e}", exc_info=True