-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathagents.ts
More file actions
3691 lines (3152 loc) · 88.6 KB
/
agents.ts
File metadata and controls
3691 lines (3152 loc) · 88.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import * as AgentsAPI from './agents';
import * as ToolsAPI from '../tools';
import * as ArchivesAPI from './archives';
import {
ArchiveAttachParams,
ArchiveAttachResponse,
ArchiveDetachParams,
ArchiveDetachResponse,
Archives,
} from './archives';
import * as BlocksAPI from './blocks';
import {
Block,
BlockAttachParams,
BlockDetachParams,
BlockListParams,
BlockRetrieveParams,
BlockUpdate,
BlockUpdateParams,
Blocks,
} from './blocks';
import * as FilesAPI from './files';
import {
FileCloseAllResponse,
FileCloseParams,
FileCloseResponse,
FileListParams,
FileListResponse,
FileListResponsesNextFilesPage,
FileOpenParams,
FileOpenResponse,
Files,
} from './files';
import * as FoldersAPI from './folders';
import {
FolderAttachParams,
FolderDetachParams,
FolderListParams,
FolderListResponse,
FolderListResponsesArrayPage,
Folders,
} from './folders';
import * as IdentitiesAPI from './identities';
import {
Identities,
IdentityAttachParams,
IdentityAttachResponse,
IdentityDetachParams,
IdentityDetachResponse,
} from './identities';
import * as MessagesAPI from './messages';
import {
ApprovalCreate,
ApprovalRequestMessage,
ApprovalResponseMessage,
ApprovalReturn,
AssistantMessage,
EventMessage,
HiddenReasoningMessage,
ImageContent,
InternalMessage,
JobStatus,
JobType,
LettaAssistantMessageContentUnion,
LettaRequest,
LettaResponse,
LettaStreamingRequest,
LettaStreamingResponse,
LettaUserMessageContentUnion,
Message,
MessageCancelParams,
MessageCancelResponse,
MessageCompactParams,
MessageCreateAsyncParams,
MessageCreateParams,
MessageCreateParamsNonStreaming,
MessageCreateParamsStreaming,
MessageListParams,
MessageResetParams,
MessageRole,
MessageStreamParams,
MessageType,
Messages,
MessagesArrayPage,
OmittedReasoningContent,
ReasoningContent,
ReasoningMessage,
RedactedReasoningContent,
Run,
SummaryMessage,
SystemMessage,
TextContent,
ToolCall,
ToolCallContent,
ToolCallDelta,
ToolCallMessage,
ToolReturn,
ToolReturnContent,
UpdateAssistantMessage,
UpdateReasoningMessage,
UpdateSystemMessage,
UpdateUserMessage,
UserMessage,
} from './messages';
import * as PassagesAPI from './passages';
import {
PassageCreateParams,
PassageCreateResponse,
PassageDeleteParams,
PassageDeleteResponse,
PassageListParams,
PassageListResponse,
PassageSearchParams,
PassageSearchResponse,
Passages,
} from './passages';
import * as ScheduleAPI from './schedule';
import {
Schedule,
ScheduleCreateParams,
ScheduleCreateResponse,
ScheduleDeleteParams,
ScheduleDeleteResponse,
ScheduleListParams,
ScheduleListResponse,
ScheduleRetrieveParams,
ScheduleRetrieveResponse,
} from './schedule';
import * as AgentsToolsAPI from './tools';
import {
ToolAttachParams,
ToolDetachParams,
ToolExecuteRequest,
ToolExecutionResult,
ToolListParams,
ToolRunParams,
ToolUpdateApprovalParams,
Tools,
} from './tools';
import * as ResourcesArchivesAPI from '../archives/archives';
import * as ResourcesBlocksAPI from '../blocks/blocks';
import * as ModelsAPI from '../models/models';
import * as RunsAPI from '../runs/runs';
import { APIPromise } from '../../core/api-promise';
import { ArrayPage, type ArrayPageParams, PagePromise } from '../../core/pagination';
import { type Uploadable } from '../../core/uploads';
import { buildHeaders } from '../../internal/headers';
import { RequestOptions } from '../../internal/request-options';
import { multipartFormRequestOptions } from '../../internal/uploads';
import { path } from '../../internal/utils/path';
export class Agents extends APIResource {
messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client);
schedule: ScheduleAPI.Schedule = new ScheduleAPI.Schedule(this._client);
blocks: BlocksAPI.Blocks = new BlocksAPI.Blocks(this._client);
tools: AgentsToolsAPI.Tools = new AgentsToolsAPI.Tools(this._client);
folders: FoldersAPI.Folders = new FoldersAPI.Folders(this._client);
files: FilesAPI.Files = new FilesAPI.Files(this._client);
archives: ArchivesAPI.Archives = new ArchivesAPI.Archives(this._client);
passages: PassagesAPI.Passages = new PassagesAPI.Passages(this._client);
identities: IdentitiesAPI.Identities = new IdentitiesAPI.Identities(this._client);
/**
* Create an agent.
*/
create(body: AgentCreateParams, options?: RequestOptions): APIPromise<AgentState> {
return this._client.post('/v1/agents/', { body, ...options });
}
/**
* Get the state of the agent.
*/
retrieve(
agentID: string,
query: AgentRetrieveParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<AgentState> {
return this._client.get(path`/v1/agents/${agentID}`, { query, ...options });
}
/**
* Update an existing agent.
*/
update(agentID: string, body: AgentUpdateParams, options?: RequestOptions): APIPromise<AgentState> {
return this._client.patch(path`/v1/agents/${agentID}`, { body, ...options });
}
/**
* Get a list of all agents.
*/
list(
query: AgentListParams | null | undefined = {},
options?: RequestOptions,
): PagePromise<AgentStatesArrayPage, AgentState> {
return this._client.getAPIList('/v1/agents/', ArrayPage<AgentState>, { query, ...options });
}
/**
* Delete an agent.
*/
delete(agentID: string, options?: RequestOptions): APIPromise<unknown> {
return this._client.delete(path`/v1/agents/${agentID}`, options);
}
/**
* Export the serialized JSON representation of an agent, formatted with
* indentation.
*/
exportFile(
agentID: string,
query: AgentExportFileParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<string> {
return this._client.get(path`/v1/agents/${agentID}/export`, { query, ...options });
}
/**
* Import a serialized agent file and recreate the agent(s) in the system. Returns
* the IDs of all imported agents.
*/
importFile(params: AgentImportFileParams, options?: RequestOptions): APIPromise<AgentImportFileResponse> {
const { 'x-override-embedding-model': xOverrideEmbeddingModel, ...body } = params;
return this._client.post(
'/v1/agents/import',
multipartFormRequestOptions(
{
body,
...options,
headers: buildHeaders([
{
...(xOverrideEmbeddingModel != null ?
{ 'x-override-embedding-model': xOverrideEmbeddingModel }
: undefined),
},
options?.headers,
]),
},
this._client,
),
);
}
/**
* Manually trigger system prompt recompilation for an agent.
*/
recompile(
agentID: string,
params: AgentRecompileParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<string> {
const { dry_run, update_timestamp } = params ?? {};
return this._client.post(path`/v1/agents/${agentID}/recompile`, {
query: { dry_run, update_timestamp },
...options,
});
}
}
export type AgentStatesArrayPage = ArrayPage<AgentState>;
export interface AgentEnvironmentVariable {
/**
* The ID of the agent this environment variable belongs to.
*/
agent_id: string;
/**
* The name of the environment variable.
*/
key: string;
/**
* The value of the environment variable.
*/
value: string;
/**
* The human-friendly ID of the Agent-env
*/
id?: string;
/**
* The timestamp when the object was created.
*/
created_at?: string | null;
/**
* The id of the user that made this object.
*/
created_by_id?: string | null;
/**
* An optional description of the environment variable.
*/
description?: string | null;
/**
* The id of the user that made this object.
*/
last_updated_by_id?: string | null;
/**
* The timestamp when the object was last updated.
*/
updated_at?: string | null;
/**
* Encrypted secret value (stored as encrypted string)
*/
value_enc?: string | null;
}
/**
* Representation of an agent's state. This is the state of the agent at a given
* time, and is persisted in the DB backend. The state has all the information
* needed to recreate a persisted agent.
*/
export interface AgentState {
/**
* The id of the agent. Assigned by the database.
*/
id: string;
/**
* The type of agent.
*/
agent_type: AgentType;
/**
* The memory blocks used by the agent.
*/
blocks: Array<BlocksAPI.Block>;
/**
* @deprecated Deprecated: Use `model` field instead. The LLM configuration used by
* the agent.
*/
llm_config: ModelsAPI.LlmConfig;
/**
* @deprecated Deprecated: Use `blocks` field instead. The in-context memory of the
* agent.
*/
memory: AgentState.Memory;
/**
* The name of the agent.
*/
name: string;
/**
* @deprecated Deprecated: Use `folders` field instead. The sources used by the
* agent.
*/
sources: Array<AgentState.Source>;
/**
* The system prompt used by the agent.
*/
system: string;
/**
* The tags associated with the agent.
*/
tags: Array<string>;
/**
* The tools used by the agent.
*/
tools: Array<ToolsAPI.Tool>;
/**
* The base template id of the agent.
*/
base_template_id?: string | null;
/**
* Configuration for conversation compaction / summarization.
*
* Per-model settings (temperature, max tokens, etc.) are derived from the default
* configuration for that handle.
*/
compaction_settings?: AgentState.CompactionSettings | null;
/**
* The timestamp when the object was created.
*/
created_at?: string | null;
/**
* The id of the user that made this object.
*/
created_by_id?: string | null;
/**
* The id of the deployment.
*/
deployment_id?: string | null;
/**
* The description of the agent.
*/
description?: string | null;
/**
* The embedding model handle used by the agent (format: provider/model-name).
*/
embedding?: string | null;
/**
* @deprecated Configuration for embedding model connection and processing
* parameters.
*/
embedding_config?: ModelsAPI.EmbeddingConfig | null;
/**
* If set to True, memory management will move to a background agent thread.
*/
enable_sleeptime?: boolean | null;
/**
* The id of the entity within the template.
*/
entity_id?: string | null;
/**
* If set to True, the agent will be hidden.
*/
hidden?: boolean | null;
/**
* The identities associated with this agent.
*/
identities?: Array<AgentState.Identity>;
/**
* @deprecated Deprecated: Use `identities` field instead. The ids of the
* identities associated with this agent.
*/
identity_ids?: Array<string>;
/**
* The timestamp when the agent last completed a run.
*/
last_run_completion?: string | null;
/**
* The duration in milliseconds of the agent's last run.
*/
last_run_duration_ms?: number | null;
/**
* The stop reason from the agent's last run.
*/
last_stop_reason?: RunsAPI.StopReasonType | null;
/**
* The id of the user that made this object.
*/
last_updated_by_id?: string | null;
/**
* The multi-agent group that this agent manages
*/
managed_group?: AgentState.ManagedGroup | null;
/**
* Maximum number of files that can be open at once for this agent. Setting this
* too high may exceed the context window, which will break the agent.
*/
max_files_open?: number | null;
/**
* If set to True, the agent will not remember previous messages (though the agent
* will still retain state via core memory blocks and archival/recall memory). Not
* recommended unless you have an advanced use case.
*/
message_buffer_autoclear?: boolean;
/**
* The ids of the messages in the agent's in-context memory.
*/
message_ids?: Array<string> | null;
/**
* The metadata of the agent.
*/
metadata?: { [key: string]: unknown } | null;
/**
* The model handle used by the agent (format: provider/model-name).
*/
model?: string | null;
/**
* The model settings used by the agent.
*/
model_settings?:
| OpenAIModelSettings
| AnthropicModelSettings
| GoogleAIModelSettings
| GoogleVertexModelSettings
| AzureModelSettings
| XaiModelSettings
| AgentState.ZaiModelSettings
| GroqModelSettings
| DeepseekModelSettings
| TogetherModelSettings
| BedrockModelSettings
| AgentState.OpenRouterModelSettings
| AgentState.ChatGptoAuthModelSettings
| null;
/**
* @deprecated Deprecated: Use `managed_group` field instead. The multi-agent group
* that this agent manages.
*/
multi_agent_group?: AgentState.MultiAgentGroup | null;
/**
* A message representing a request for approval to call a tool (generated by the
* LLM to trigger tool execution).
*
* Args: id (str): The ID of the message date (datetime): The date the message was
* created in ISO format name (Optional[str]): The name of the sender of the
* message tool_call (ToolCall): The tool call
*/
pending_approval?: MessagesAPI.ApprovalRequestMessage | null;
/**
* The per-file view window character limit for this agent. Setting this too high
* may exceed the context window, which will break the agent.
*/
per_file_view_window_char_limit?: number | null;
/**
* The id of the project the agent belongs to.
*/
project_id?: string | null;
/**
* The response format used by the agent
*/
response_format?: TextResponseFormat | JsonSchemaResponseFormat | JsonObjectResponseFormat | null;
/**
* The environment variables for tool execution specific to this agent.
*/
secrets?: Array<AgentEnvironmentVariable>;
/**
* The id of the template the agent belongs to.
*/
template_id?: string | null;
/**
* The timezone of the agent (IANA format).
*/
timezone?: string | null;
/**
* @deprecated Deprecated: use `secrets` field instead.
*/
tool_exec_environment_variables?: Array<AgentEnvironmentVariable>;
/**
* The list of tool rules.
*/
tool_rules?: Array<
| ChildToolRule
| InitToolRule
| TerminalToolRule
| ConditionalToolRule
| ContinueToolRule
| RequiredBeforeExitToolRule
| MaxCountPerStepToolRule
| ParentToolRule
| RequiresApprovalToolRule
> | null;
/**
* The timestamp when the object was last updated.
*/
updated_at?: string | null;
}
export namespace AgentState {
/**
* @deprecated Deprecated: Use `blocks` field instead. The in-context memory of the
* agent.
*/
export interface Memory {
/**
* Memory blocks contained in the agent's in-context memory
*/
blocks: Array<BlocksAPI.Block>;
/**
* Agent type controlling prompt rendering.
*/
agent_type?: AgentsAPI.AgentType | (string & {}) | null;
/**
* Special blocks representing the agent's in-context memory of an attached file
*/
file_blocks?: Array<Memory.FileBlock>;
/**
* Whether this agent uses git-backed memory with structured labels.
*/
git_enabled?: boolean;
/**
* Deprecated. Ignored for performance.
*/
prompt_template?: string;
}
export namespace Memory {
export interface FileBlock {
/**
* Unique identifier of the file.
*/
file_id: string;
/**
* True if the agent currently has the file open.
*/
is_open: boolean;
/**
* @deprecated Deprecated: Use `folder_id` field instead. Unique identifier of the
* source.
*/
source_id: string;
/**
* Value of the block.
*/
value: string;
/**
* The human-friendly ID of the Block
*/
id?: string;
/**
* The base template id of the block.
*/
base_template_id?: string | null;
/**
* The id of the user that made this Block.
*/
created_by_id?: string | null;
/**
* The id of the deployment.
*/
deployment_id?: string | null;
/**
* Description of the block.
*/
description?: string | null;
/**
* The id of the entity within the template.
*/
entity_id?: string | null;
/**
* If set to True, the block will be hidden.
*/
hidden?: boolean | null;
/**
* Whether the block is a template (e.g. saved human/persona options).
*/
is_template?: boolean;
/**
* Label of the block (e.g. 'human', 'persona') in the context window.
*/
label?: string | null;
/**
* UTC timestamp of the agent’s most recent access to this file. Any operations
* from the open, close, or search tools will update this field.
*/
last_accessed_at?: string | null;
/**
* The id of the user that last updated this Block.
*/
last_updated_by_id?: string | null;
/**
* Character limit of the block.
*/
limit?: number;
/**
* Metadata of the block.
*/
metadata?: { [key: string]: unknown } | null;
/**
* Preserve the block on template migration.
*/
preserve_on_migration?: boolean | null;
/**
* The associated project id.
*/
project_id?: string | null;
/**
* Whether the agent has read-only access to the block.
*/
read_only?: boolean;
/**
* The tags associated with the block.
*/
tags?: Array<string> | null;
/**
* The id of the template.
*/
template_id?: string | null;
/**
* Name of the block if it is a template.
*/
template_name?: string | null;
}
}
/**
* (Deprecated: Use Folder) Representation of a source, which is a collection of
* files and passages.
*/
export interface Source {
/**
* The human-friendly ID of the Source
*/
id: string;
/**
* The embedding configuration used by the source.
*/
embedding_config: ModelsAPI.EmbeddingConfig;
/**
* The name of the source.
*/
name: string;
/**
* The timestamp when the source was created.
*/
created_at?: string | null;
/**
* The id of the user that made this Tool.
*/
created_by_id?: string | null;
/**
* The description of the source.
*/
description?: string | null;
/**
* Instructions for how to use the source.
*/
instructions?: string | null;
/**
* The id of the user that made this Tool.
*/
last_updated_by_id?: string | null;
/**
* Metadata associated with the source.
*/
metadata?: { [key: string]: unknown } | null;
/**
* The timestamp when the source was last updated.
*/
updated_at?: string | null;
/**
* The vector database provider used for this source's passages
*/
vector_db_provider?: ResourcesArchivesAPI.VectorDBProvider;
}
/**
* Configuration for conversation compaction / summarization.
*
* Per-model settings (temperature, max tokens, etc.) are derived from the default
* configuration for that handle.
*/
export interface CompactionSettings {
/**
* The maximum length of the summary in characters. If none, no clipping is
* performed.
*/
clip_chars?: number | null;
/**
* The type of summarization technique use.
*/
mode?: 'all' | 'sliding_window' | 'self_compact_all' | 'self_compact_sliding_window';
/**
* Model handle to use for sliding_window/all summarization (format:
* provider/model-name). If None, uses lightweight provider-specific defaults.
*/
model?: string | null;
/**
* Optional model settings used to override defaults for the summarizer model.
*/
model_settings?:
| AgentsAPI.OpenAIModelSettings
| AgentsAPI.AnthropicModelSettings
| AgentsAPI.GoogleAIModelSettings
| AgentsAPI.GoogleVertexModelSettings
| AgentsAPI.AzureModelSettings
| AgentsAPI.XaiModelSettings
| CompactionSettings.ZaiModelSettings
| AgentsAPI.GroqModelSettings
| AgentsAPI.DeepseekModelSettings
| AgentsAPI.TogetherModelSettings
| AgentsAPI.BedrockModelSettings
| CompactionSettings.OpenRouterModelSettings
| CompactionSettings.ChatGptoAuthModelSettings
| null;
/**
* The prompt to use for summarization. If None, uses mode-specific default.
*/
prompt?: string | null;
/**
* Whether to include an acknowledgement post-prompt (helps prevent non-summary
* outputs).
*/
prompt_acknowledgement?: boolean;
/**
* The percentage of the context window to keep post-summarization (only used in
* sliding window modes).
*/
sliding_window_percentage?: number;
}
export namespace CompactionSettings {
/**
* Z.ai (ZhipuAI) model configuration (OpenAI-compatible).
*/
export interface ZaiModelSettings {
/**
* The maximum number of tokens the model can generate.
*/
max_output_tokens?: number;
/**
* Whether to enable parallel tool calling.
*/
parallel_tool_calls?: boolean;
/**
* The type of the provider.
*/
provider_type?: 'zai';
/**
* The response format for the model.
*/
response_format?:
| AgentsAPI.TextResponseFormat
| AgentsAPI.JsonSchemaResponseFormat
| AgentsAPI.JsonObjectResponseFormat
| null;
/**
* The temperature of the model.
*/
temperature?: number;
/**
* The thinking configuration for GLM-4.5+ models.
*/
thinking?: ZaiModelSettings.Thinking;
}
export namespace ZaiModelSettings {
/**
* The thinking configuration for GLM-4.5+ models.
*/
export interface Thinking {
/**
* If False, preserved thinking is used (recommended for agents).
*/
clear_thinking?: boolean;
/**
* Whether thinking is enabled or disabled.
*/
type?: 'enabled' | 'disabled';
}
}
/**
* OpenRouter model configuration (OpenAI-compatible).
*/
export interface OpenRouterModelSettings {
/**
* The maximum number of tokens the model can generate.
*/
max_output_tokens?: number;
/**
* Whether to enable parallel tool calling.
*/
parallel_tool_calls?: boolean;
/**
* The type of the provider.
*/
provider_type?: 'openrouter';
/**
* The response format for the model.
*/
response_format?:
| AgentsAPI.TextResponseFormat
| AgentsAPI.JsonSchemaResponseFormat
| AgentsAPI.JsonObjectResponseFormat
| null;
/**
* The temperature of the model.
*/
temperature?: number;
}
/**
* ChatGPT OAuth model configuration (uses ChatGPT backend API).
*/
export interface ChatGptoAuthModelSettings {
/**
* The maximum number of tokens the model can generate.
*/
max_output_tokens?: number;
/**
* Whether to enable parallel tool calling.
*/
parallel_tool_calls?: boolean;
/**
* The type of the provider.
*/
provider_type?: 'chatgpt_oauth';
/**
* The reasoning configuration for the model.
*/
reasoning?: ChatGptoAuthModelSettings.Reasoning;
/**
* The temperature of the model.
*/
temperature?: number;
}
export namespace ChatGptoAuthModelSettings {
/**
* The reasoning configuration for the model.
*/
export interface Reasoning {
/**
* The reasoning effort level for GPT-5.x and o-series models.
*/
reasoning_effort?: 'none' | 'low' | 'medium' | 'high' | 'xhigh';
}
}
}
export interface Identity {
/**