@reminix/sdk 0.10.0 → 0.12.0
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/CHANGELOG.md +43 -0
- package/README.md +47 -0
- package/client.d.mts +19 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +19 -4
- package/client.d.ts.map +1 -1
- package/client.js +18 -0
- package/client.js.map +1 -1
- package/client.mjs +18 -0
- package/client.mjs.map +1 -1
- package/core/pagination.d.mts +57 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +57 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +108 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +102 -0
- package/core/pagination.mjs.map +1 -0
- package/index.d.mts +1 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -0
- package/index.mjs.map +1 -1
- package/package.json +11 -1
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +2 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +6 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +2 -0
- package/pagination.mjs.map +1 -0
- package/resources/agents.d.mts +246 -90
- package/resources/agents.d.mts.map +1 -1
- package/resources/agents.d.ts +246 -90
- package/resources/agents.d.ts.map +1 -1
- package/resources/agents.js +28 -2
- package/resources/agents.js.map +1 -1
- package/resources/agents.mjs +28 -2
- package/resources/agents.mjs.map +1 -1
- package/resources/conversations.d.mts +107 -0
- package/resources/conversations.d.mts.map +1 -0
- package/resources/conversations.d.ts +107 -0
- package/resources/conversations.d.ts.map +1 -0
- package/resources/conversations.js +41 -0
- package/resources/conversations.js.map +1 -0
- package/resources/conversations.mjs +37 -0
- package/resources/conversations.mjs.map +1 -0
- package/resources/execution-logs.d.mts +93 -0
- package/resources/execution-logs.d.mts.map +1 -0
- package/resources/execution-logs.d.ts +93 -0
- package/resources/execution-logs.d.ts.map +1 -0
- package/resources/execution-logs.js +33 -0
- package/resources/execution-logs.js.map +1 -0
- package/resources/execution-logs.mjs +29 -0
- package/resources/execution-logs.mjs.map +1 -0
- package/resources/index.d.mts +5 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +5 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +7 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -0
- package/resources/index.mjs.map +1 -1
- package/resources/projects.d.mts +1 -11
- package/resources/projects.d.mts.map +1 -1
- package/resources/projects.d.ts +1 -11
- package/resources/projects.d.ts.map +1 -1
- package/resources/tools.d.mts +152 -0
- package/resources/tools.d.mts.map +1 -0
- package/resources/tools.d.ts +152 -0
- package/resources/tools.d.ts.map +1 -0
- package/resources/tools.js +59 -0
- package/resources/tools.js.map +1 -0
- package/resources/tools.mjs +55 -0
- package/resources/tools.mjs.map +1 -0
- package/src/client.ts +86 -4
- package/src/core/pagination.ts +165 -0
- package/src/index.ts +1 -0
- package/src/pagination.ts +2 -0
- package/src/resources/agents.ts +296 -89
- package/src/resources/conversations.ts +146 -0
- package/src/resources/execution-logs.ts +125 -0
- package/src/resources/index.ts +26 -2
- package/src/resources/projects.ts +1 -13
- package/src/resources/tools.ts +192 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/resources/agents.ts
CHANGED
|
@@ -3,48 +3,61 @@
|
|
|
3
3
|
import { APIResource } from '../core/resource';
|
|
4
4
|
import * as AgentsAPI from './agents';
|
|
5
5
|
import { APIPromise } from '../core/api-promise';
|
|
6
|
+
import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
|
|
6
7
|
import { Stream } from '../core/streaming';
|
|
7
8
|
import { RequestOptions } from '../internal/request-options';
|
|
8
9
|
import { path } from '../internal/utils/path';
|
|
9
10
|
|
|
10
11
|
export class Agents extends APIResource {
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
* conversation context through the messages array, allowing for multi-turn
|
|
14
|
-
* conversations.
|
|
13
|
+
* Get details of a specific agent by name.
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const agent = await client.agents.retrieve('x');
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
retrieve(name: string, options?: RequestOptions): APIPromise<Agent> {
|
|
21
|
+
return this._client.get(path`/agents/${name}`, options);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* List all agents in the project with optional filtering by type and status.
|
|
24
26
|
*
|
|
25
|
-
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* // Automatically fetches more pages as needed.
|
|
30
|
+
* for await (const agent of client.agents.list()) {
|
|
31
|
+
* // ...
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
list(
|
|
36
|
+
query: AgentListParams | null | undefined = {},
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): PagePromise<AgentsCursor, Agent> {
|
|
39
|
+
return this._client.getAPIList('/agents', Cursor<Agent>, { query, ...options });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Send a chat message to an agent and receive a response.
|
|
26
44
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* - Multi-step question answering
|
|
30
|
-
* - Conversational agents that need context
|
|
45
|
+
* **Supported Agents:** Managed agents only. Custom agents should use the /execute
|
|
46
|
+
* endpoint.
|
|
31
47
|
*
|
|
32
|
-
* **
|
|
48
|
+
* **Tool Calls:** Messages support the OpenAI tool calling format:
|
|
33
49
|
*
|
|
34
|
-
* -
|
|
35
|
-
* -
|
|
36
|
-
* -
|
|
50
|
+
* - Assistant messages can include `tool_calls` array with function calls
|
|
51
|
+
* - Tool result messages use `role: "tool"` with `tool_call_id` and `name`
|
|
52
|
+
* - Content can be `null` when `tool_calls` is present
|
|
37
53
|
*
|
|
38
|
-
* **Streaming:** Set `stream: true`
|
|
39
|
-
*
|
|
40
|
-
* chat interfaces.
|
|
54
|
+
* **Streaming:** Set `stream: true` to receive Server-Sent Events (SSE) for
|
|
55
|
+
* real-time responses.
|
|
41
56
|
*
|
|
42
57
|
* @example
|
|
43
58
|
* ```ts
|
|
44
59
|
* const response = await client.agents.chat('name', {
|
|
45
|
-
* messages: [
|
|
46
|
-
* { role: 'user', content: 'What is the weather today?' },
|
|
47
|
-
* ],
|
|
60
|
+
* messages: [{ content: 'string', role: 'system' }],
|
|
48
61
|
* });
|
|
49
62
|
* ```
|
|
50
63
|
*/
|
|
@@ -76,8 +89,12 @@ export class Agents extends APIResource {
|
|
|
76
89
|
}
|
|
77
90
|
|
|
78
91
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
92
|
+
* Invoke a custom agent with the provided input.
|
|
93
|
+
*
|
|
94
|
+
* **Supported Agents:** Custom agents only. Managed agents should use the /chat
|
|
95
|
+
* endpoint.
|
|
96
|
+
*
|
|
97
|
+
* **Input:** Pass structured input data matching the agent's parameter schema.
|
|
81
98
|
*
|
|
82
99
|
* **Timeout:** Agent invocations have a 60-second timeout. If the agent takes
|
|
83
100
|
* longer to respond, you will receive a 504 Gateway Timeout error. For
|
|
@@ -88,30 +105,18 @@ export class Agents extends APIResource {
|
|
|
88
105
|
* with a unique value (e.g., UUID) to ensure duplicate requests return the same
|
|
89
106
|
* response. Keys are valid for 24 hours. Streaming responses are not cached.
|
|
90
107
|
*
|
|
91
|
-
* **Use cases:**
|
|
92
|
-
*
|
|
93
|
-
* - Data analysis and processing
|
|
94
|
-
* - Content generation (with streaming for long outputs)
|
|
95
|
-
* - One-time operations that don't require conversation history
|
|
96
|
-
* - API-like operations
|
|
97
|
-
*
|
|
98
108
|
* **Streaming:** Set `stream: true` in the request body to receive Server-Sent
|
|
99
109
|
* Events (SSE) stream with incremental chunks. Useful for long-running tasks or
|
|
100
|
-
* real-time
|
|
110
|
+
* real-time responses.
|
|
101
111
|
*
|
|
102
112
|
* @example
|
|
103
113
|
* ```ts
|
|
104
|
-
* const response = await client.agents.invoke('name'
|
|
105
|
-
* input: {
|
|
106
|
-
* task: 'analyze this data',
|
|
107
|
-
* data: { value: 123, items: ['a', 'b', 'c'] },
|
|
108
|
-
* },
|
|
109
|
-
* });
|
|
114
|
+
* const response = await client.agents.invoke('name');
|
|
110
115
|
* ```
|
|
111
116
|
*/
|
|
112
117
|
invoke(
|
|
113
118
|
name: string,
|
|
114
|
-
body
|
|
119
|
+
body?: AgentInvokeParamsNonStreaming,
|
|
115
120
|
options?: RequestOptions,
|
|
116
121
|
): APIPromise<AgentInvokeResponse>;
|
|
117
122
|
invoke(
|
|
@@ -121,27 +126,182 @@ export class Agents extends APIResource {
|
|
|
121
126
|
): APIPromise<Stream<StreamChunk>>;
|
|
122
127
|
invoke(
|
|
123
128
|
name: string,
|
|
124
|
-
body
|
|
129
|
+
body?: AgentInvokeParamsBase | undefined,
|
|
125
130
|
options?: RequestOptions,
|
|
126
131
|
): APIPromise<Stream<StreamChunk> | AgentInvokeResponse>;
|
|
127
132
|
invoke(
|
|
128
133
|
name: string,
|
|
129
|
-
body: AgentInvokeParams,
|
|
134
|
+
body: AgentInvokeParams | undefined = {},
|
|
130
135
|
options?: RequestOptions,
|
|
131
136
|
): APIPromise<AgentInvokeResponse> | APIPromise<Stream<StreamChunk>> {
|
|
132
137
|
return this._client.post(path`/agents/${name}/invoke`, {
|
|
133
138
|
body,
|
|
134
139
|
...options,
|
|
135
|
-
stream: body
|
|
140
|
+
stream: body?.stream ?? false,
|
|
136
141
|
}) as APIPromise<AgentInvokeResponse> | APIPromise<Stream<StreamChunk>>;
|
|
137
142
|
}
|
|
138
143
|
}
|
|
139
144
|
|
|
145
|
+
export type AgentsCursor = Cursor<Agent>;
|
|
146
|
+
|
|
147
|
+
export interface Agent {
|
|
148
|
+
/**
|
|
149
|
+
* Unique agent ID
|
|
150
|
+
*/
|
|
151
|
+
id: string;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Whether agent supports chat interface
|
|
155
|
+
*/
|
|
156
|
+
canChat: boolean | null;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Whether agent supports streaming
|
|
160
|
+
*/
|
|
161
|
+
canStream: boolean | null;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Agent configuration (for managed agents)
|
|
165
|
+
*/
|
|
166
|
+
config: AgentConfig | null;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Creation timestamp
|
|
170
|
+
*/
|
|
171
|
+
createdAt: string;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* User who created the agent
|
|
175
|
+
*/
|
|
176
|
+
createdBy: string | null;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Agent description
|
|
180
|
+
*/
|
|
181
|
+
description: string | null;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* When the agent was discovered (for custom agents)
|
|
185
|
+
*/
|
|
186
|
+
discoveredAt: string | null;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Agent name
|
|
190
|
+
*/
|
|
191
|
+
name: string;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* JSON Schema for agent input parameters
|
|
195
|
+
*/
|
|
196
|
+
output: Agent.Output | null;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* JSON Schema for agent input parameters
|
|
200
|
+
*/
|
|
201
|
+
parameters: Agent.Parameters | null;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Project ID
|
|
205
|
+
*/
|
|
206
|
+
projectId: string;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Top-level keys expected in request body
|
|
210
|
+
*/
|
|
211
|
+
requestKeys: Array<string> | null;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Top-level keys returned in response body
|
|
215
|
+
*/
|
|
216
|
+
responseKeys: Array<string> | null;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Agent status
|
|
220
|
+
*/
|
|
221
|
+
status: 'active' | 'inactive';
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Agent type: "managed" for UI-created, "{language}" for custom agents (e.g.,
|
|
225
|
+
* "python"), or "{language}-{adapter}" for adapter-based (e.g.,
|
|
226
|
+
* "python-langchain")
|
|
227
|
+
*/
|
|
228
|
+
type: string;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Last update timestamp
|
|
232
|
+
*/
|
|
233
|
+
updatedAt: string;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export namespace Agent {
|
|
237
|
+
/**
|
|
238
|
+
* JSON Schema for agent input parameters
|
|
239
|
+
*/
|
|
240
|
+
export interface Output {
|
|
241
|
+
type: string;
|
|
242
|
+
|
|
243
|
+
properties?: { [key: string]: unknown };
|
|
244
|
+
|
|
245
|
+
required?: Array<string>;
|
|
246
|
+
|
|
247
|
+
[k: string]: unknown;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* JSON Schema for agent input parameters
|
|
252
|
+
*/
|
|
253
|
+
export interface Parameters {
|
|
254
|
+
type: string;
|
|
255
|
+
|
|
256
|
+
properties?: { [key: string]: unknown };
|
|
257
|
+
|
|
258
|
+
required?: Array<string>;
|
|
259
|
+
|
|
260
|
+
[k: string]: unknown;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Agent configuration (for managed agents)
|
|
266
|
+
*/
|
|
267
|
+
export interface AgentConfig {
|
|
268
|
+
/**
|
|
269
|
+
* Model identifier (e.g., "gpt-4o", "claude-sonnet-4-20250514")
|
|
270
|
+
*/
|
|
271
|
+
model: string;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* LLM provider
|
|
275
|
+
*/
|
|
276
|
+
provider: 'openai' | 'anthropic';
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* System prompt for the agent
|
|
280
|
+
*/
|
|
281
|
+
systemPrompt: string;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* List of tools available to the agent
|
|
285
|
+
*/
|
|
286
|
+
tools: Array<string>;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Maximum tool call iterations
|
|
290
|
+
*/
|
|
291
|
+
maxIterations?: number;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Whether to require approval for tool calls
|
|
295
|
+
*/
|
|
296
|
+
requireApproval?: boolean;
|
|
297
|
+
}
|
|
298
|
+
|
|
140
299
|
export interface ChatMessage {
|
|
141
300
|
/**
|
|
142
|
-
* Message content. Can be string, array (multimodal),
|
|
301
|
+
* Message content. Can be string, array (multimodal), object (tool), or null (when
|
|
302
|
+
* tool_calls present).
|
|
143
303
|
*/
|
|
144
|
-
content: string | Array<ChatMessage.MultimodalContent> | { [key: string]: unknown };
|
|
304
|
+
content: string | Array<ChatMessage.MultimodalContent> | { [key: string]: unknown } | null;
|
|
145
305
|
|
|
146
306
|
/**
|
|
147
307
|
* Message role
|
|
@@ -154,9 +314,14 @@ export interface ChatMessage {
|
|
|
154
314
|
name?: string;
|
|
155
315
|
|
|
156
316
|
/**
|
|
157
|
-
* Tool call ID (for tool role)
|
|
317
|
+
* Tool call ID (for tool role messages)
|
|
158
318
|
*/
|
|
159
319
|
tool_call_id?: string;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Tool calls requested by assistant (for assistant role messages)
|
|
323
|
+
*/
|
|
324
|
+
tool_calls?: Array<ChatMessage.ToolCall>;
|
|
160
325
|
}
|
|
161
326
|
|
|
162
327
|
export namespace ChatMessage {
|
|
@@ -173,26 +338,22 @@ export namespace ChatMessage {
|
|
|
173
338
|
url: string;
|
|
174
339
|
}
|
|
175
340
|
}
|
|
176
|
-
}
|
|
177
341
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
*/
|
|
181
|
-
export interface Context {
|
|
182
|
-
/**
|
|
183
|
-
* ID to track multi-turn conversations
|
|
184
|
-
*/
|
|
185
|
-
conversation_id?: string;
|
|
342
|
+
export interface ToolCall {
|
|
343
|
+
id: string;
|
|
186
344
|
|
|
187
|
-
|
|
188
|
-
* Additional custom context fields
|
|
189
|
-
*/
|
|
190
|
-
custom?: { [key: string]: unknown };
|
|
345
|
+
function: ToolCall.Function;
|
|
191
346
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
347
|
+
type: 'function';
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export namespace ToolCall {
|
|
351
|
+
export interface Function {
|
|
352
|
+
arguments: string;
|
|
353
|
+
|
|
354
|
+
name: string;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
196
357
|
}
|
|
197
358
|
|
|
198
359
|
export interface StreamChunk {
|
|
@@ -200,61 +361,91 @@ export interface StreamChunk {
|
|
|
200
361
|
* Text chunk from the stream
|
|
201
362
|
*/
|
|
202
363
|
chunk: string;
|
|
364
|
+
|
|
365
|
+
[k: string]: unknown;
|
|
203
366
|
}
|
|
204
367
|
|
|
205
368
|
export interface AgentChatResponse {
|
|
206
369
|
/**
|
|
207
|
-
*
|
|
370
|
+
* Array of assistant response messages
|
|
208
371
|
*/
|
|
209
372
|
messages: Array<ChatMessage>;
|
|
210
373
|
|
|
211
374
|
/**
|
|
212
|
-
*
|
|
375
|
+
* Conversation ID (present when conversation persistence is enabled)
|
|
213
376
|
*/
|
|
214
|
-
|
|
377
|
+
conversation_id?: string;
|
|
215
378
|
}
|
|
216
379
|
|
|
217
|
-
|
|
380
|
+
/**
|
|
381
|
+
* Response with dynamic keys based on agent configuration. Regular agents return {
|
|
382
|
+
* output: ... }, chat agents return { messages: [...] }.
|
|
383
|
+
*/
|
|
384
|
+
export type AgentInvokeResponse = { [key: string]: unknown };
|
|
385
|
+
|
|
386
|
+
export interface AgentListParams extends CursorParams {
|
|
387
|
+
/**
|
|
388
|
+
* Filter by agent status
|
|
389
|
+
*/
|
|
390
|
+
status?: 'active' | 'inactive';
|
|
391
|
+
|
|
218
392
|
/**
|
|
219
|
-
*
|
|
393
|
+
* Filter by agent type (managed, python, typescript, python-langchain, etc.)
|
|
220
394
|
*/
|
|
221
|
-
|
|
395
|
+
type?: string;
|
|
222
396
|
}
|
|
223
397
|
|
|
224
398
|
export type AgentChatParams = AgentChatParamsNonStreaming | AgentChatParamsStreaming;
|
|
225
399
|
|
|
226
400
|
export interface AgentChatParamsBase {
|
|
227
401
|
/**
|
|
228
|
-
*
|
|
402
|
+
* Array of chat messages
|
|
229
403
|
*/
|
|
230
404
|
messages: Array<ChatMessage>;
|
|
231
405
|
|
|
232
406
|
/**
|
|
233
|
-
* Optional
|
|
407
|
+
* Optional context for the agent execution
|
|
234
408
|
*/
|
|
235
|
-
context?: Context;
|
|
409
|
+
context?: AgentChatParams.Context;
|
|
236
410
|
|
|
237
411
|
/**
|
|
238
|
-
*
|
|
412
|
+
* Conversation ID to continue an existing conversation
|
|
413
|
+
*/
|
|
414
|
+
conversation_id?: string;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Enable streaming response
|
|
239
418
|
*/
|
|
240
419
|
stream?: boolean;
|
|
241
420
|
}
|
|
242
421
|
|
|
243
422
|
export namespace AgentChatParams {
|
|
423
|
+
/**
|
|
424
|
+
* Optional context for the agent execution
|
|
425
|
+
*/
|
|
426
|
+
export interface Context {
|
|
427
|
+
/**
|
|
428
|
+
* Identity fields for conversation scoping (e.g., user_id, tenant_id)
|
|
429
|
+
*/
|
|
430
|
+
identity?: { [key: string]: unknown };
|
|
431
|
+
|
|
432
|
+
[k: string]: unknown;
|
|
433
|
+
}
|
|
434
|
+
|
|
244
435
|
export type AgentChatParamsNonStreaming = AgentsAPI.AgentChatParamsNonStreaming;
|
|
245
436
|
export type AgentChatParamsStreaming = AgentsAPI.AgentChatParamsStreaming;
|
|
246
437
|
}
|
|
247
438
|
|
|
248
439
|
export interface AgentChatParamsNonStreaming extends AgentChatParamsBase {
|
|
249
440
|
/**
|
|
250
|
-
*
|
|
441
|
+
* Enable streaming response
|
|
251
442
|
*/
|
|
252
443
|
stream?: false;
|
|
253
444
|
}
|
|
254
445
|
|
|
255
446
|
export interface AgentChatParamsStreaming extends AgentChatParamsBase {
|
|
256
447
|
/**
|
|
257
|
-
*
|
|
448
|
+
* Enable streaming response
|
|
258
449
|
*/
|
|
259
450
|
stream: true;
|
|
260
451
|
}
|
|
@@ -263,47 +454,63 @@ export type AgentInvokeParams = AgentInvokeParamsNonStreaming | AgentInvokeParam
|
|
|
263
454
|
|
|
264
455
|
export interface AgentInvokeParamsBase {
|
|
265
456
|
/**
|
|
266
|
-
*
|
|
267
|
-
*/
|
|
268
|
-
input: { [key: string]: unknown };
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Optional request context passed to the agent handler.
|
|
457
|
+
* Optional context for the agent execution
|
|
272
458
|
*/
|
|
273
|
-
context?: Context;
|
|
459
|
+
context?: AgentInvokeParams.Context;
|
|
274
460
|
|
|
275
461
|
/**
|
|
276
|
-
*
|
|
462
|
+
* Enable streaming response (SSE)
|
|
277
463
|
*/
|
|
278
464
|
stream?: boolean;
|
|
465
|
+
|
|
466
|
+
[k: string]: unknown;
|
|
279
467
|
}
|
|
280
468
|
|
|
281
469
|
export namespace AgentInvokeParams {
|
|
470
|
+
/**
|
|
471
|
+
* Optional context for the agent execution
|
|
472
|
+
*/
|
|
473
|
+
export interface Context {
|
|
474
|
+
/**
|
|
475
|
+
* Identity fields for conversation scoping (e.g., user_id, tenant_id)
|
|
476
|
+
*/
|
|
477
|
+
identity?: { [key: string]: unknown };
|
|
478
|
+
|
|
479
|
+
[k: string]: unknown;
|
|
480
|
+
}
|
|
481
|
+
|
|
282
482
|
export type AgentInvokeParamsNonStreaming = AgentsAPI.AgentInvokeParamsNonStreaming;
|
|
283
483
|
export type AgentInvokeParamsStreaming = AgentsAPI.AgentInvokeParamsStreaming;
|
|
284
484
|
}
|
|
285
485
|
|
|
286
486
|
export interface AgentInvokeParamsNonStreaming extends AgentInvokeParamsBase {
|
|
287
487
|
/**
|
|
288
|
-
*
|
|
488
|
+
* Enable streaming response (SSE)
|
|
289
489
|
*/
|
|
290
490
|
stream?: false;
|
|
491
|
+
|
|
492
|
+
[k: string]: unknown;
|
|
291
493
|
}
|
|
292
494
|
|
|
293
495
|
export interface AgentInvokeParamsStreaming extends AgentInvokeParamsBase {
|
|
294
496
|
/**
|
|
295
|
-
*
|
|
497
|
+
* Enable streaming response (SSE)
|
|
296
498
|
*/
|
|
297
499
|
stream: true;
|
|
500
|
+
|
|
501
|
+
[k: string]: unknown;
|
|
298
502
|
}
|
|
299
503
|
|
|
300
504
|
export declare namespace Agents {
|
|
301
505
|
export {
|
|
506
|
+
type Agent as Agent,
|
|
507
|
+
type AgentConfig as AgentConfig,
|
|
302
508
|
type ChatMessage as ChatMessage,
|
|
303
|
-
type Context as Context,
|
|
304
509
|
type StreamChunk as StreamChunk,
|
|
305
510
|
type AgentChatResponse as AgentChatResponse,
|
|
306
511
|
type AgentInvokeResponse as AgentInvokeResponse,
|
|
512
|
+
type AgentsCursor as AgentsCursor,
|
|
513
|
+
type AgentListParams as AgentListParams,
|
|
307
514
|
type AgentChatParams as AgentChatParams,
|
|
308
515
|
type AgentChatParamsNonStreaming as AgentChatParamsNonStreaming,
|
|
309
516
|
type AgentChatParamsStreaming as AgentChatParamsStreaming,
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
|
|
6
|
+
import { buildHeaders } from '../internal/headers';
|
|
7
|
+
import { RequestOptions } from '../internal/request-options';
|
|
8
|
+
import { path } from '../internal/utils/path';
|
|
9
|
+
|
|
10
|
+
export class Conversations extends APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* Get details of a specific conversation including all messages.
|
|
13
|
+
*/
|
|
14
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<ConversationRetrieveResponse> {
|
|
15
|
+
return this._client.get(path`/conversations/${id}`, options);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* List conversations for the project with optional filtering.
|
|
20
|
+
*
|
|
21
|
+
* Conversations store chat history between users and agents. Use filters to narrow
|
|
22
|
+
* down results by agent name or identity fields.
|
|
23
|
+
*
|
|
24
|
+
* **Filters:**
|
|
25
|
+
*
|
|
26
|
+
* - `agent_name`: Filter by agent name
|
|
27
|
+
* - `identity.*`: Filter by identity fields (e.g., identity.user_id=user_123)
|
|
28
|
+
*/
|
|
29
|
+
list(
|
|
30
|
+
query: ConversationListParams | null | undefined = {},
|
|
31
|
+
options?: RequestOptions,
|
|
32
|
+
): PagePromise<ConversationsCursor, Conversation> {
|
|
33
|
+
return this._client.getAPIList('/conversations', Cursor<Conversation>, { query, ...options });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Delete a conversation and all its messages. This action cannot be undone.
|
|
38
|
+
*/
|
|
39
|
+
delete(id: string, options?: RequestOptions): APIPromise<void> {
|
|
40
|
+
return this._client.delete(path`/conversations/${id}`, {
|
|
41
|
+
...options,
|
|
42
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type ConversationsCursor = Cursor<Conversation>;
|
|
48
|
+
|
|
49
|
+
export interface Conversation {
|
|
50
|
+
/**
|
|
51
|
+
* Unique conversation ID
|
|
52
|
+
*/
|
|
53
|
+
id: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Agent name
|
|
57
|
+
*/
|
|
58
|
+
agentName: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* When the conversation was created
|
|
62
|
+
*/
|
|
63
|
+
createdAt: string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Identity fields for conversation scoping
|
|
67
|
+
*/
|
|
68
|
+
identity: { [key: string]: unknown };
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Project ID
|
|
72
|
+
*/
|
|
73
|
+
projectId: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* When the conversation was last updated
|
|
77
|
+
*/
|
|
78
|
+
updatedAt: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface ConversationRetrieveResponse extends Conversation {
|
|
82
|
+
/**
|
|
83
|
+
* Conversation messages
|
|
84
|
+
*/
|
|
85
|
+
messages: Array<ConversationRetrieveResponse.Message>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export namespace ConversationRetrieveResponse {
|
|
89
|
+
export interface Message {
|
|
90
|
+
/**
|
|
91
|
+
* Unique message ID
|
|
92
|
+
*/
|
|
93
|
+
id: string;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Message content
|
|
97
|
+
*/
|
|
98
|
+
content: string | null;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Conversation ID
|
|
102
|
+
*/
|
|
103
|
+
conversationId: string;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* When the message was created
|
|
107
|
+
*/
|
|
108
|
+
createdAt: string;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Tool name (for tool messages)
|
|
112
|
+
*/
|
|
113
|
+
name: string | null;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Message role
|
|
117
|
+
*/
|
|
118
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Tool call ID (for tool messages)
|
|
122
|
+
*/
|
|
123
|
+
toolCallId: string | null;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Tool calls (for assistant messages)
|
|
127
|
+
*/
|
|
128
|
+
toolCalls?: unknown;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface ConversationListParams extends CursorParams {
|
|
133
|
+
/**
|
|
134
|
+
* Filter by agent name
|
|
135
|
+
*/
|
|
136
|
+
agent_name?: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export declare namespace Conversations {
|
|
140
|
+
export {
|
|
141
|
+
type Conversation as Conversation,
|
|
142
|
+
type ConversationRetrieveResponse as ConversationRetrieveResponse,
|
|
143
|
+
type ConversationsCursor as ConversationsCursor,
|
|
144
|
+
type ConversationListParams as ConversationListParams,
|
|
145
|
+
};
|
|
146
|
+
}
|