@letta-ai/letta-agent-sdk 0.7.5 → 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;
@@ -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);
@@ -12770,4 +12788,4 @@ export {
12770
12788
  CloudManagedSandboxExpiredError
12771
12789
  };
12772
12790
 
12773
- //# debugId=4189F3F92EE00D0D64756E2164756E21
12791
+ //# debugId=7375838F6D261D8064756E2164756E21