@letta-ai/letta-agent-sdk 0.8.39 → 0.8.41

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.
package/README.md CHANGED
@@ -56,6 +56,11 @@ await session.send(message);
56
56
  measures the tracked turn and excludes session initialization; measure `ready()`
57
57
  separately when startup latency matters.
58
58
 
59
+ Use the final `result.success` to determine whether a turn succeeded. A turn can
60
+ recover from a failed API run: run-scoped errors and explicitly nonterminal
61
+ error notices remain `stream_event` diagnostics while the harness continues.
62
+ They do not close the session or produce a failed result on their own.
63
+
59
64
  For a simple question that should not create or use an agent, call `query()`.
60
65
  It creates an ordinary conversation from the supplied model and
61
66
  system prompt, streams the turn, and closes the runtime when iteration ends:
@@ -13279,6 +13279,7 @@ class RemoteTurnCoordinator {
13279
13279
  runIds: new Set,
13280
13280
  observedTurnEvidence: false,
13281
13281
  observedRequiresApprovalStop: false,
13282
+ observedRunError: false,
13282
13283
  pendingTerminal: null,
13283
13284
  pendingTerminalTimeout: null,
13284
13285
  deferredMessages: [],
@@ -13550,7 +13551,7 @@ class RemoteTurnCoordinator {
13550
13551
  return;
13551
13552
  }
13552
13553
  if (status === "WAITING_ON_INPUT" && active.observedTurnEvidence) {
13553
- if (active.pendingTerminal)
13554
+ if (active.pendingTerminal || active.observedRunError)
13554
13555
  return;
13555
13556
  this.completeActiveTurn({
13556
13557
  runtime: active.runtime,
@@ -13743,6 +13744,11 @@ class RemoteTurnCoordinator {
13743
13744
  runId
13744
13745
  };
13745
13746
  }
13747
+ if (messageType === "error_message" && runId !== undefined && typeof delta.error_type === "string" || messageType === "loop_error" && delta.is_terminal === false) {
13748
+ if (this.activeTurn)
13749
+ this.activeTurn.observedRunError = true;
13750
+ return { type: "stream_event", event: delta, uuid };
13751
+ }
13746
13752
  if (messageType === "error_message" || messageType === "loop_error") {
13747
13753
  const detail = (typeof delta.detail === "string" ? delta.detail : undefined) ?? (typeof delta.message === "string" ? delta.message : undefined) ?? `${this.label} turn failed`;
13748
13754
  const stopReason = (typeof delta.stop_reason === "string" ? delta.stop_reason : undefined) ?? (typeof delta.error_type === "string" ? delta.error_type : undefined) ?? "error";
@@ -17823,4 +17829,4 @@ export {
17823
17829
  CloudManagedSandboxExpiredError
17824
17830
  };
17825
17831
 
17826
- //# debugId=83C55A00D38E0ADC64756E2164756E21
17832
+ //# debugId=6C4F6F272ADD204664756E2164756E21