trodo-python 2.18.0__py3-none-any.whl → 2.18.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.
trodo/__init__.py CHANGED
@@ -322,7 +322,7 @@ def reset(distinct_id: str) -> ResetResult:
322
322
  def get_prompt(
323
323
  name: str,
324
324
  label: Optional[str] = None,
325
- version: Optional[int] = None,
325
+ version: Optional[Union[int, str]] = None,
326
326
  cache_ttl_seconds: Optional[float] = None,
327
327
  fallback: Optional[Dict[str, Any]] = None,
328
328
  max_retries: int = 2,
@@ -330,7 +330,9 @@ def get_prompt(
330
330
  """Fetch a managed prompt by name.
331
331
 
332
332
  Follows the ``production`` label by default; pass ``label`` for a different
333
- one or ``version`` to pin exactly.
333
+ one or ``version`` to pin exactly. ``version`` may be the integer
334
+ ``version_no`` or a ``version_hash`` (full, or an unambiguous short prefix
335
+ like ``a3f9c2``) — the hash is the stable identity, so prefer it.
334
336
 
335
337
  Cached for 60s with stale-while-revalidate, so a Trodo outage degrades
336
338
  instead of taking your app down. Pass ``fallback`` to cover cold start::
@@ -524,14 +526,21 @@ def wrap_agent(
524
526
  conversation_id: Optional[str] = None,
525
527
  parent_run_id: Optional[str] = None,
526
528
  metadata: Optional[Dict[str, Any]] = None,
529
+ user: Optional[Dict[str, Any]] = None,
527
530
  ) -> _wrap_agent_ctx:
528
- """Wrap a block as an agent run — returns a context manager yielding RunHandle."""
531
+ """Wrap a block as an agent run — returns a context manager yielding RunHandle.
532
+
533
+ ``user`` carries profile traits alongside the run — ``{"properties": ...,
534
+ "set_once": ..., "fixed_properties": ...}`` — so a request handler can
535
+ attribute the run and enrich the profile in one round trip.
536
+ """
529
537
  return _get_client().wrap_agent(
530
538
  agent_name,
531
539
  distinct_id=distinct_id,
532
540
  conversation_id=conversation_id,
533
541
  parent_run_id=parent_run_id,
534
542
  metadata=metadata,
543
+ user=user,
535
544
  )
536
545
 
537
546
 
@@ -540,14 +549,18 @@ def agent(
540
549
  *,
541
550
  distinct_id: Optional[str] = None,
542
551
  conversation_id: Optional[str] = None,
552
+ parent_run_id: Optional[str] = None,
543
553
  metadata: Optional[Dict[str, Any]] = None,
554
+ user: Optional[Dict[str, Any]] = None,
544
555
  ) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
545
556
  """Decorator form of wrap_agent."""
546
557
  return _get_client().agent(
547
558
  agent_name,
548
559
  distinct_id=distinct_id,
549
560
  conversation_id=conversation_id,
561
+ parent_run_id=parent_run_id,
550
562
  metadata=metadata,
563
+ user=user,
551
564
  )
552
565
 
553
566
 
@@ -591,6 +604,7 @@ def start_run(
591
604
  parent_run_id: Optional[str] = None,
592
605
  metadata: Optional[Dict[str, Any]] = None,
593
606
  input: Any = None,
607
+ user: Optional[Dict[str, Any]] = None,
594
608
  ) -> str:
595
609
  """Open a Run record without a context manager.
596
610
 
@@ -607,6 +621,7 @@ def start_run(
607
621
  parent_run_id=parent_run_id,
608
622
  metadata=metadata,
609
623
  input=input,
624
+ user=user,
610
625
  )
611
626
 
612
627
 
trodo/client.py CHANGED
@@ -357,7 +357,9 @@ class TrodoClient:
357
357
  *,
358
358
  distinct_id: Optional[str] = None,
359
359
  conversation_id: Optional[str] = None,
360
+ parent_run_id: Optional[str] = None,
360
361
  metadata: Optional[Dict[str, Any]] = None,
362
+ user: Optional[Dict[str, Any]] = None,
361
363
  ) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
362
364
  """Decorator form of wrap_agent."""
363
365
 
@@ -368,7 +370,9 @@ class TrodoClient:
368
370
  agent_name,
369
371
  distinct_id=distinct_id,
370
372
  conversation_id=conversation_id,
373
+ parent_run_id=parent_run_id,
371
374
  metadata=metadata,
375
+ user=user,
372
376
  ) as run:
373
377
  result = fn(*args, **kwargs)
374
378
  run.set_output(result)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trodo-python
3
- Version: 2.18.0
3
+ Version: 2.18.2
4
4
  Summary: Trodo Analytics SDK for Python — server-side event tracking
5
5
  License: ISC
6
6
  Keywords: analytics,tracking,trodo,server-side
@@ -1,5 +1,5 @@
1
- trodo/__init__.py,sha256=Z24IqU5MsOX2VP6xwWcgpy5UiJb3DniXFmQPiiYlxtQ,26243
2
- trodo/client.py,sha256=5Uxt0tTLDjuMlXIqqdTbg4uiuISY5u7MTK4F1wahdfc,22281
1
+ trodo/__init__.py,sha256=LxN-qzeCDU_SpYs0gsZQxvdj5PuWd8cOBUqYGk9viLc,26928
2
+ trodo/client.py,sha256=9UYaHZtWPMYdlG2xWVf77PQJ9DfFgN-zobTh60i8_Cc,22453
3
3
  trodo/types.py,sha256=eySgUvCXROG2TxtxgiU0MNr5iH0DEcduK8bmYtTKG44,3138
4
4
  trodo/user_context.py,sha256=uHCI2WYoOI3cNwdIUEuZdX4VYSu14pzm348ksn6hn_c,8195
5
5
  trodo/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -36,7 +36,7 @@ trodo/session/server_session.py,sha256=McsudEiq33XDq3nqxgzBcUvIjQxCMscwEuAPnYXrT
36
36
  trodo/session/session_manager.py,sha256=7ht5LeeZX1HLLfPeNV_a8NkXGbHl3up0CRtCGr3EzjQ,2995
37
37
  trodo/util/__init__.py,sha256=Z9c4rPPdKg06Kk3byKheDqksSgR4WNvS475oQ5sNljc,54
38
38
  trodo/util/lru.py,sha256=QIsM7s6J_E9ZjiXatSyReZIEeGypTAcgrPWWy8YsRa4,2465
39
- trodo_python-2.18.0.dist-info/METADATA,sha256=Pa8V9NdIZEs6q0o4dyj4WIOBKBmd52xEt-NRQ_LgfUo,25308
40
- trodo_python-2.18.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
41
- trodo_python-2.18.0.dist-info/top_level.txt,sha256=VCQu1CJWFmNsqTs1YxMcw4Mq35Tc3z3uI9RwHEXAayQ,6
42
- trodo_python-2.18.0.dist-info/RECORD,,
39
+ trodo_python-2.18.2.dist-info/METADATA,sha256=UnFh9i8kRSmo6JfdHcRWy7dYGm7vGW714FgDC_5ckM8,25308
40
+ trodo_python-2.18.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
41
+ trodo_python-2.18.2.dist-info/top_level.txt,sha256=VCQu1CJWFmNsqTs1YxMcw4Mq35Tc3z3uI9RwHEXAayQ,6
42
+ trodo_python-2.18.2.dist-info/RECORD,,