@letta-ai/letta-client 1.3.1 → 1.3.3

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +40 -79
  3. package/client.d.mts +5 -5
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +5 -5
  6. package/client.d.ts.map +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +1 -1
  9. package/client.mjs.map +1 -1
  10. package/internal/detect-platform.d.mts +1 -0
  11. package/internal/detect-platform.d.mts.map +1 -1
  12. package/internal/detect-platform.d.ts +1 -0
  13. package/internal/detect-platform.d.ts.map +1 -1
  14. package/internal/detect-platform.js +5 -0
  15. package/internal/detect-platform.js.map +1 -1
  16. package/internal/detect-platform.mjs +5 -0
  17. package/internal/detect-platform.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/agents/agents.d.mts +4 -0
  20. package/resources/agents/agents.d.mts.map +1 -1
  21. package/resources/agents/agents.d.ts +4 -0
  22. package/resources/agents/agents.d.ts.map +1 -1
  23. package/resources/agents/agents.js +4 -0
  24. package/resources/agents/agents.js.map +1 -1
  25. package/resources/agents/agents.mjs +4 -0
  26. package/resources/agents/agents.mjs.map +1 -1
  27. package/resources/agents/index.d.mts +1 -0
  28. package/resources/agents/index.d.mts.map +1 -1
  29. package/resources/agents/index.d.ts +1 -0
  30. package/resources/agents/index.d.ts.map +1 -1
  31. package/resources/agents/index.js +3 -1
  32. package/resources/agents/index.js.map +1 -1
  33. package/resources/agents/index.mjs +1 -0
  34. package/resources/agents/index.mjs.map +1 -1
  35. package/resources/agents/messages.d.mts +33 -1
  36. package/resources/agents/messages.d.mts.map +1 -1
  37. package/resources/agents/messages.d.ts +33 -1
  38. package/resources/agents/messages.d.ts.map +1 -1
  39. package/resources/agents/passages.d.mts +139 -0
  40. package/resources/agents/passages.d.mts.map +1 -0
  41. package/resources/agents/passages.d.ts +139 -0
  42. package/resources/agents/passages.d.ts.map +1 -0
  43. package/resources/agents/passages.js +49 -0
  44. package/resources/agents/passages.js.map +1 -0
  45. package/resources/agents/passages.mjs +45 -0
  46. package/resources/agents/passages.mjs.map +1 -0
  47. package/resources/agents/tools.d.mts +3 -3
  48. package/resources/agents/tools.d.ts +3 -3
  49. package/resources/identities/identities.d.mts +4 -0
  50. package/resources/identities/identities.d.mts.map +1 -1
  51. package/resources/identities/identities.d.ts +4 -0
  52. package/resources/identities/identities.d.ts.map +1 -1
  53. package/resources/identities/identities.js.map +1 -1
  54. package/resources/identities/identities.mjs.map +1 -1
  55. package/resources/index.d.mts +2 -2
  56. package/resources/index.d.mts.map +1 -1
  57. package/resources/index.d.ts +2 -2
  58. package/resources/index.d.ts.map +1 -1
  59. package/resources/index.js.map +1 -1
  60. package/resources/index.mjs +1 -1
  61. package/resources/index.mjs.map +1 -1
  62. package/resources/runs/usage.d.mts +4 -2
  63. package/resources/runs/usage.d.mts.map +1 -1
  64. package/resources/runs/usage.d.ts +4 -2
  65. package/resources/runs/usage.d.ts.map +1 -1
  66. package/resources/steps/steps.d.mts +8 -1
  67. package/resources/steps/steps.d.mts.map +1 -1
  68. package/resources/steps/steps.d.ts +8 -1
  69. package/resources/steps/steps.d.ts.map +1 -1
  70. package/resources/steps/steps.js.map +1 -1
  71. package/resources/steps/steps.mjs.map +1 -1
  72. package/resources/templates/index.d.mts +1 -1
  73. package/resources/templates/index.d.mts.map +1 -1
  74. package/resources/templates/index.d.ts +1 -1
  75. package/resources/templates/index.d.ts.map +1 -1
  76. package/resources/templates/index.js.map +1 -1
  77. package/resources/templates/index.mjs +1 -1
  78. package/resources/templates/index.mjs.map +1 -1
  79. package/resources/templates/templates.d.mts +99 -0
  80. package/resources/templates/templates.d.mts.map +1 -1
  81. package/resources/templates/templates.d.ts +99 -0
  82. package/resources/templates/templates.d.ts.map +1 -1
  83. package/resources/templates/templates.js +19 -0
  84. package/resources/templates/templates.js.map +1 -1
  85. package/resources/templates/templates.mjs +19 -0
  86. package/resources/templates/templates.mjs.map +1 -1
  87. package/resources/tools.d.mts +5 -6
  88. package/resources/tools.d.mts.map +1 -1
  89. package/resources/tools.d.ts +5 -6
  90. package/resources/tools.d.ts.map +1 -1
  91. package/resources/tools.js +0 -6
  92. package/resources/tools.js.map +1 -1
  93. package/resources/tools.mjs +0 -6
  94. package/resources/tools.mjs.map +1 -1
  95. package/src/client.ts +19 -5
  96. package/src/internal/detect-platform.ts +6 -0
  97. package/src/resources/agents/agents.ts +26 -0
  98. package/src/resources/agents/index.ts +11 -0
  99. package/src/resources/agents/messages.ts +39 -1
  100. package/src/resources/agents/passages.ts +199 -0
  101. package/src/resources/agents/tools.ts +3 -3
  102. package/src/resources/identities/identities.ts +4 -0
  103. package/src/resources/index.ts +9 -2
  104. package/src/resources/runs/usage.ts +6 -2
  105. package/src/resources/steps/steps.ts +7 -1
  106. package/src/resources/templates/index.ts +9 -1
  107. package/src/resources/templates/templates.ts +143 -0
  108. package/src/resources/tools.ts +5 -10
  109. package/src/version.ts +1 -1
  110. package/version.d.mts +1 -1
  111. package/version.d.ts +1 -1
  112. package/version.js +1 -1
  113. package/version.mjs +1 -1
@@ -213,6 +213,10 @@ export interface IdentityListParams extends ArrayPageParams {
213
213
 
214
214
  name?: string | null;
215
215
 
216
+ /**
217
+ * @deprecated [DEPRECATED: Use X-Project-Id header instead] Filter identities by
218
+ * project ID
219
+ */
216
220
  project_id?: string | null;
217
221
  }
218
222
 
@@ -162,7 +162,15 @@ export {
162
162
  type StepsArrayPage,
163
163
  } from './steps/steps';
164
164
  export { Tags, type TagListResponse, type TagListParams } from './tags';
165
- export { Templates } from './templates/templates';
165
+ export {
166
+ Templates,
167
+ type TemplateCreateResponse,
168
+ type TemplateUpdateResponse,
169
+ type TemplateDeleteResponse,
170
+ type TemplateCreateParams,
171
+ type TemplateUpdateParams,
172
+ type TemplateDeleteParams,
173
+ } from './templates/templates';
166
174
  export {
167
175
  Tools,
168
176
  type NpmRequirement,
@@ -175,7 +183,6 @@ export {
175
183
  type ToolType,
176
184
  type ToolDeleteResponse,
177
185
  type ToolSearchResponse,
178
- type ToolUpsertBaseToolsResponse,
179
186
  type ToolCreateParams,
180
187
  type ToolUpdateParams,
181
188
  type ToolListParams,
@@ -28,11 +28,15 @@ export interface UsageRetrieveResponse {
28
28
 
29
29
  export namespace UsageRetrieveResponse {
30
30
  export interface CompletionTokensDetails {
31
- reasoning_tokens?: number;
31
+ reasoning_tokens?: number | null;
32
32
  }
33
33
 
34
34
  export interface PromptTokensDetails {
35
- cached_tokens?: number;
35
+ cache_creation_tokens?: number | null;
36
+
37
+ cache_read_tokens?: number | null;
38
+
39
+ cached_tokens?: number | null;
36
40
  }
37
41
  }
38
42
 
@@ -111,7 +111,7 @@ export interface Step {
111
111
  completion_tokens?: number | null;
112
112
 
113
113
  /**
114
- * Metadata for the agent.
114
+ * Detailed completion token breakdown (e.g., reasoning_tokens).
115
115
  */
116
116
  completion_tokens_details?: { [key: string]: unknown } | null;
117
117
 
@@ -166,6 +166,12 @@ export interface Step {
166
166
  */
167
167
  prompt_tokens?: number | null;
168
168
 
169
+ /**
170
+ * Detailed prompt token breakdown (e.g., cached_tokens, cache_read_tokens,
171
+ * cache_creation_tokens).
172
+ */
173
+ prompt_tokens_details?: { [key: string]: unknown } | null;
174
+
169
175
  /**
170
176
  * The category of the provider used for this step.
171
177
  */
@@ -1,4 +1,12 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  export { Agents, type AgentCreateResponse, type AgentCreateParams } from './agents';
4
- export { Templates } from './templates';
4
+ export {
5
+ Templates,
6
+ type TemplateCreateResponse,
7
+ type TemplateUpdateResponse,
8
+ type TemplateDeleteResponse,
9
+ type TemplateCreateParams,
10
+ type TemplateUpdateParams,
11
+ type TemplateDeleteParams,
12
+ } from './templates';
@@ -3,14 +3,157 @@
3
3
  import { APIResource } from '../../core/resource';
4
4
  import * as AgentsAPI from './agents';
5
5
  import { AgentCreateParams, AgentCreateResponse, Agents } from './agents';
6
+ import { APIPromise } from '../../core/api-promise';
7
+ import { RequestOptions } from '../../internal/request-options';
8
+ import { path } from '../../internal/utils/path';
6
9
 
7
10
  export class Templates extends APIResource {
8
11
  agents: AgentsAPI.Agents = new AgentsAPI.Agents(this._client);
12
+
13
+ /**
14
+ * Creates a new template from an existing agent or agent file
15
+ */
16
+ create(body: TemplateCreateParams, options?: RequestOptions): APIPromise<TemplateCreateResponse> {
17
+ return this._client.post('/v1/templates', { body, ...options });
18
+ }
19
+
20
+ /**
21
+ * Updates the current working version of a template from an agent file
22
+ */
23
+ update(
24
+ templateName: string,
25
+ body: TemplateUpdateParams,
26
+ options?: RequestOptions,
27
+ ): APIPromise<TemplateUpdateResponse> {
28
+ return this._client.patch(path`/v1/templates/${templateName}`, { body, ...options });
29
+ }
30
+
31
+ /**
32
+ * Deletes all versions of a template with the specified name
33
+ */
34
+ delete(
35
+ templateName: string,
36
+ body?: TemplateDeleteParams | null | undefined,
37
+ options?: RequestOptions,
38
+ ): APIPromise<TemplateDeleteResponse> {
39
+ return this._client.delete(path`/v1/templates/${templateName}`, { body, ...options });
40
+ }
41
+ }
42
+
43
+ export interface TemplateCreateResponse {
44
+ id: string;
45
+
46
+ /**
47
+ * The latest version of the template
48
+ */
49
+ latest_version: string;
50
+
51
+ /**
52
+ * The exact name of the template
53
+ */
54
+ name: string;
55
+
56
+ project_id: string;
57
+
58
+ project_slug: string;
59
+
60
+ /**
61
+ * The full name of the template, including version and project slug
62
+ */
63
+ template_deployment_slug: string;
64
+
65
+ /**
66
+ * When the template was last updated
67
+ */
68
+ updated_at: string;
69
+
70
+ description?: string;
71
+ }
72
+
73
+ export interface TemplateUpdateResponse {
74
+ success: boolean;
75
+
76
+ message?: string;
77
+ }
78
+
79
+ export interface TemplateDeleteResponse {
80
+ success: boolean;
9
81
  }
10
82
 
83
+ export type TemplateCreateParams = TemplateCreateParams.Variant0 | TemplateCreateParams.Variant1;
84
+
85
+ export declare namespace TemplateCreateParams {
86
+ export interface Variant0 {
87
+ /**
88
+ * The ID of the agent to use as a template, can be from any project
89
+ */
90
+ agent_id: string;
91
+
92
+ type: 'agent';
93
+
94
+ /**
95
+ * Optional custom name for the template. If not provided, a random name will be
96
+ * generated.
97
+ */
98
+ name?: string;
99
+ }
100
+
101
+ export interface Variant1 {
102
+ /**
103
+ * The agent file to use as a template, this should be a JSON file exported from
104
+ * the platform
105
+ */
106
+ agent_file: { [key: string]: unknown };
107
+
108
+ type: 'agent_file';
109
+
110
+ /**
111
+ * Optional custom name for the template. If not provided, a random name will be
112
+ * generated.
113
+ */
114
+ name?: string;
115
+
116
+ /**
117
+ * If true, update existing custom tools source_code and json_schema (source_type
118
+ * cannot be changed)
119
+ */
120
+ update_existing_tools?: boolean;
121
+ }
122
+ }
123
+
124
+ export interface TemplateUpdateParams {
125
+ /**
126
+ * The agent file to update the current template version from
127
+ */
128
+ agent_file_json: { [key: string]: unknown };
129
+
130
+ /**
131
+ * If true, Letta will automatically save any changes as a version before updating
132
+ * the template
133
+ */
134
+ save_existing_changes?: boolean;
135
+
136
+ /**
137
+ * If true, update existing custom tools source_code and json_schema (source_type
138
+ * cannot be changed)
139
+ */
140
+ update_existing_tools?: boolean;
141
+ }
142
+
143
+ export interface TemplateDeleteParams {}
144
+
11
145
  Templates.Agents = Agents;
12
146
 
13
147
  export declare namespace Templates {
148
+ export {
149
+ type TemplateCreateResponse as TemplateCreateResponse,
150
+ type TemplateUpdateResponse as TemplateUpdateResponse,
151
+ type TemplateDeleteResponse as TemplateDeleteResponse,
152
+ type TemplateCreateParams as TemplateCreateParams,
153
+ type TemplateUpdateParams as TemplateUpdateParams,
154
+ type TemplateDeleteParams as TemplateDeleteParams,
155
+ };
156
+
14
157
  export {
15
158
  Agents as Agents,
16
159
  type AgentCreateResponse as AgentCreateResponse,
@@ -64,13 +64,6 @@ export class Tools extends APIResource {
64
64
  upsert(body: ToolUpsertParams, options?: RequestOptions): APIPromise<Tool> {
65
65
  return this._client.put('/v1/tools/', { body, ...options });
66
66
  }
67
-
68
- /**
69
- * Upsert base tools
70
- */
71
- upsertBaseTools(options?: RequestOptions): APIPromise<ToolUpsertBaseToolsResponse> {
72
- return this._client.post('/v1/tools/add-base-tools', options);
73
- }
74
67
  }
75
68
 
76
69
  export type ToolsArrayPage = ArrayPage<Tool>;
@@ -164,6 +157,11 @@ export interface Tool {
164
157
  */
165
158
  pip_requirements?: Array<PipRequirement> | null;
166
159
 
160
+ /**
161
+ * The project id of the tool.
162
+ */
163
+ project_id?: string | null;
164
+
167
165
  /**
168
166
  * The maximum number of characters in the response.
169
167
  */
@@ -393,8 +391,6 @@ export type ToolDeleteResponse = unknown;
393
391
 
394
392
  export type ToolSearchResponse = Array<ToolSearchResult>;
395
393
 
396
- export type ToolUpsertBaseToolsResponse = Array<Tool>;
397
-
398
394
  export interface ToolCreateParams {
399
395
  /**
400
396
  * The source code of the function.
@@ -653,7 +649,6 @@ export declare namespace Tools {
653
649
  type ToolType as ToolType,
654
650
  type ToolDeleteResponse as ToolDeleteResponse,
655
651
  type ToolSearchResponse as ToolSearchResponse,
656
- type ToolUpsertBaseToolsResponse as ToolUpsertBaseToolsResponse,
657
652
  type ToolsArrayPage as ToolsArrayPage,
658
653
  type ToolCreateParams as ToolCreateParams,
659
654
  type ToolUpdateParams as ToolUpdateParams,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.3.1'; // x-release-please-version
1
+ export const VERSION = '1.3.3'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.3.1";
1
+ export declare const VERSION = "1.3.3";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.3.1";
1
+ export declare const VERSION = "1.3.3";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.3.1'; // x-release-please-version
4
+ exports.VERSION = '1.3.3'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.3.1'; // x-release-please-version
1
+ export const VERSION = '1.3.3'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map