@letta-ai/letta-agent-sdk 0.7.4 → 0.7.6

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
@@ -32,6 +32,19 @@ for await (const message of session.stream()) {
32
32
  }
33
33
  ```
34
34
 
35
+ Latency-sensitive applications can initialize the runtime and transport before
36
+ the first user action without fetching transcript history or invoking the model:
37
+
38
+ ```typescript
39
+ const session = client.resumeSession(conversationId);
40
+ await session.ready();
41
+ await session.send(message);
42
+ ```
43
+
44
+ `ready()` is idempotent and safe to call concurrently. `SDKResultMessage.durationMs`
45
+ measures the tracked turn and excludes session initialization; measure `ready()`
46
+ separately when startup latency matters.
47
+
35
48
  Set `LETTA_API_KEY` for the cloud backend. See the [quickstart](https://docs.letta.com/agent-sdk/quickstart) for the local and self-hosted paths.
36
49
 
37
50
  ## Where your agents run
@@ -9337,6 +9337,22 @@ class RemoteClientSessionCore {
9337
9337
  this.initializePromise = memo;
9338
9338
  return memo;
9339
9339
  }
9340
+ async ready() {
9341
+ if (this.closed)
9342
+ throw new Error("Session is closed");
9343
+ if (!this.initialized)
9344
+ await this.initialize();
9345
+ await this.recoverIdleTransportIfNeeded();
9346
+ if (!this._agentId || !this._conversationId) {
9347
+ throw new Error("Session is not initialized");
9348
+ }
9349
+ return {
9350
+ agentId: this._agentId,
9351
+ conversationId: this._conversationId,
9352
+ model: this._model || undefined,
9353
+ ...this.toolNames !== undefined ? { tools: [...this.toolNames] } : {}
9354
+ };
9355
+ }
9340
9356
  async performInitialize() {
9341
9357
  const init = await this.initializeRuntimeController();
9342
9358
  this.controller = init.controller;
@@ -9486,7 +9502,7 @@ class RemoteClientSessionCore {
9486
9502
  }
9487
9503
  async updateModel(update) {
9488
9504
  if (this.mode.kind === "session" && this.mode.options.stateless === true) {
9489
- throw new Error("updateModel() is unavailable in a stateless session because it changes persisted agent configuration.");
9505
+ throw new Error("updateModel() is unavailable in a stateless session because it changes persistent model configuration.");
9490
9506
  }
9491
9507
  if (!this.initialized) {
9492
9508
  await this.initialize();
@@ -11114,6 +11130,8 @@ class CloudEnvironmentSession extends RemoteClientSessionCore {
11114
11130
  }
11115
11131
  async initializeRuntimeController() {
11116
11132
  await this.mcpCleanup;
11133
+ if (!this.closed)
11134
+ this.sandboxLifecycleClosing = false;
11117
11135
  const resolved = await this.resolveRuntime();
11118
11136
  const connection = await this.resolveConnectionForRuntime(resolved.runtime).catch(async (error) => {
11119
11137
  await this.cleanupSessionRepositories(resolved.runtime.agent_id, resolved.runtime.conversation_id);
@@ -11876,7 +11894,7 @@ function validateCreateSessionOptions(options) {
11876
11894
  ["resources", options.resources]
11877
11895
  ].find(([, value]) => value !== undefined);
11878
11896
  if (persistedOption) {
11879
- throw new Error(`stateless sessions cannot set ${persistedOption[0]} because it changes persisted agent configuration.`);
11897
+ throw new Error(`stateless sessions cannot set ${persistedOption[0]} because it changes persistent configuration.`);
11880
11898
  }
11881
11899
  }
11882
11900
  validateClientToolset(options.toolset);
@@ -12770,4 +12788,4 @@ export {
12770
12788
  CloudManagedSandboxExpiredError
12771
12789
  };
12772
12790
 
12773
- //# debugId=D64E5E8DF2F0895364756E2164756E21
12791
+ //# debugId=7375838F6D261D8064756E2164756E21