@notionhq/client 5.25.1 → 5.26.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.
@@ -0,0 +1,3241 @@
1
+ import type { EmptyObject, IdRequest, IdResponse, PageIconResponse } from "./common";
2
+ /**
3
+ * Parameters for opening a session stream.
4
+ */
5
+ export type UpdateSessionStreamParameters = {
6
+ message: string;
7
+ agent_id?: string | "notion_ai" | "33333333-3333-3333-3333-333333333333";
8
+ session_id?: string;
9
+ attachments?: Array<{
10
+ file_upload: {
11
+ id: string;
12
+ };
13
+ /**
14
+ * Always `file_upload`
15
+ */
16
+ type?: "file_upload";
17
+ name?: string;
18
+ }>;
19
+ metadata?: Record<string, string>;
20
+ prompt_context?: string;
21
+ } | {
22
+ session_id: string;
23
+ actions: Array<{
24
+ action_id: string;
25
+ /**
26
+ * One of: `approve`, `reject`
27
+ */
28
+ option_id: "approve" | "reject";
29
+ }>;
30
+ metadata?: Record<string, string>;
31
+ } | {
32
+ session_id: string;
33
+ continue_from: string;
34
+ };
35
+ /**
36
+ * An event emitted by a session stream.
37
+ */
38
+ type SessionStreamEventBase = {
39
+ /**
40
+ * Always `session_event`
41
+ */
42
+ object: "session_event";
43
+ id: string;
44
+ session_id: string;
45
+ sequence: number;
46
+ created_at: string;
47
+ };
48
+ type SessionStreamTextContent = {
49
+ /**
50
+ * Always `text`
51
+ */
52
+ type: "text";
53
+ text: string;
54
+ };
55
+ type SessionStreamFileContent = {
56
+ /**
57
+ * Always `file`
58
+ */
59
+ type: "file";
60
+ file_id: string;
61
+ };
62
+ type SessionStreamContentBlock = SessionStreamTextContent | SessionStreamFileContent;
63
+ type SessionStreamRequiredAction = {
64
+ action_id: string;
65
+ title: string;
66
+ options: Array<{
67
+ /**
68
+ * One of: `approve`, `reject`
69
+ */
70
+ id: "approve" | "reject";
71
+ label: string;
72
+ }>;
73
+ };
74
+ type SessionStreamError = {
75
+ code: string;
76
+ message: string;
77
+ retryable: boolean;
78
+ };
79
+ type SessionStreamUsage = {
80
+ input_tokens?: number;
81
+ output_tokens?: number;
82
+ total_tokens: number;
83
+ };
84
+ type SessionStreamArtifact = {
85
+ /**
86
+ * Always `page`
87
+ */
88
+ type: "page";
89
+ url: string;
90
+ title: string;
91
+ } | {
92
+ /**
93
+ * Always `html_artifact`
94
+ */
95
+ type: "html_artifact";
96
+ url: string;
97
+ page_url: string;
98
+ };
99
+ type SessionStreamCommittedEvent = (SessionStreamEventBase & {
100
+ /**
101
+ * Always `user.message`
102
+ */
103
+ type: "user.message";
104
+ content: Array<SessionStreamContentBlock>;
105
+ metadata?: Record<string, string>;
106
+ }) | (SessionStreamEventBase & {
107
+ /**
108
+ * Always `agent.message`
109
+ */
110
+ type: "agent.message";
111
+ content: Array<SessionStreamTextContent>;
112
+ }) | (SessionStreamEventBase & {
113
+ /**
114
+ * Always `agent.tool_use`
115
+ */
116
+ type: "agent.tool_use";
117
+ tool_name: string;
118
+ }) | (SessionStreamEventBase & {
119
+ /**
120
+ * Always `agent.tool_result`
121
+ */
122
+ type: "agent.tool_result";
123
+ tool_use_id: string;
124
+ tool_name: string;
125
+ is_error: boolean;
126
+ }) | (SessionStreamEventBase & {
127
+ /**
128
+ * Always `session.status`
129
+ */
130
+ type: "session.status";
131
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
132
+ required_actions?: Array<SessionStreamRequiredAction>;
133
+ error?: SessionStreamError;
134
+ usage?: SessionStreamUsage;
135
+ artifacts?: Array<SessionStreamArtifact>;
136
+ });
137
+ type SessionStreamProvisionalEvent = {
138
+ /**
139
+ * Always `session_event`
140
+ */
141
+ object: "session_event";
142
+ id: string;
143
+ session_id: string;
144
+ created_at: string;
145
+ /**
146
+ * Always `agent.message`
147
+ */
148
+ type: "agent.message";
149
+ content: Array<SessionStreamTextContent>;
150
+ } | {
151
+ /**
152
+ * Always `session_event`
153
+ */
154
+ object: "session_event";
155
+ id: string;
156
+ session_id: string;
157
+ created_at: string;
158
+ /**
159
+ * Always `agent.tool_use`
160
+ */
161
+ type: "agent.tool_use";
162
+ tool_name: string;
163
+ };
164
+ export type UpdateSessionStreamResponse = {
165
+ /**
166
+ * Always `session.snapshot`
167
+ */
168
+ type: "session.snapshot";
169
+ session: {
170
+ /**
171
+ * Always `session`
172
+ */
173
+ object: "session";
174
+ id: string;
175
+ agent_id: string;
176
+ title: string;
177
+ /**
178
+ * One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`, `terminated`
179
+ */
180
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
181
+ created_at: string;
182
+ updated_at: string;
183
+ required_actions?: Array<{
184
+ action_id: string;
185
+ title: string;
186
+ options: Array<{
187
+ /**
188
+ * One of: `approve`, `reject`
189
+ */
190
+ id: "approve" | "reject";
191
+ label: string;
192
+ }>;
193
+ }>;
194
+ error?: {
195
+ code: string;
196
+ message: string;
197
+ retryable: boolean;
198
+ };
199
+ };
200
+ } | {
201
+ /**
202
+ * Always `event.provisional`
203
+ */
204
+ type: "event.provisional";
205
+ event: SessionStreamProvisionalEvent;
206
+ } | {
207
+ /**
208
+ * Always `event.committed`
209
+ */
210
+ type: "event.committed";
211
+ event: SessionStreamCommittedEvent;
212
+ } | {
213
+ /**
214
+ * Always `stream.timeout`
215
+ */
216
+ type: "stream.timeout";
217
+ session_id: string;
218
+ message: string;
219
+ } | {
220
+ /**
221
+ * Always `stream.end`
222
+ */
223
+ type: "stream.end";
224
+ session_id: string;
225
+ /**
226
+ * One of: `requires_action`, `completed`, `failed`, `canceled`, `terminated`
227
+ */
228
+ status: "requires_action" | "completed" | "failed" | "canceled" | "terminated";
229
+ last_sequence: number;
230
+ } | {
231
+ /**
232
+ * Always `stream.error`
233
+ */
234
+ type: "stream.error";
235
+ error: {
236
+ code: string;
237
+ message: string;
238
+ /**
239
+ * One of: `true`, `false`
240
+ */
241
+ retryable: true | false;
242
+ };
243
+ session_id?: string;
244
+ };
245
+ /**
246
+ * Open a session stream.
247
+ */
248
+ export declare const updateSessionStream: {
249
+ readonly method: "post";
250
+ readonly pathParams: readonly [];
251
+ readonly queryParams: readonly [];
252
+ readonly bodyParams: readonly ["message", "agent_id", "session_id", "attachments", "metadata", "prompt_context", "actions", "continue_from"];
253
+ readonly headers: {
254
+ readonly Accept: "text/event-stream";
255
+ };
256
+ readonly path: () => string;
257
+ };
258
+ type AgentBatchBodyParameters = {
259
+ operations: Array<{
260
+ action: "update_status";
261
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
262
+ fields: {
263
+ status: "active" | "disabled";
264
+ };
265
+ } | {
266
+ action: "update_credit_limit";
267
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
268
+ fields: {
269
+ credit_limit: number | null;
270
+ };
271
+ } | {
272
+ action: "delete";
273
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
274
+ }>;
275
+ };
276
+ export type AgentBatchParameters = AgentBatchBodyParameters;
277
+ export type AgentBatchResponse = {
278
+ object: "async_task";
279
+ id: string;
280
+ status_url: string;
281
+ created_time: string;
282
+ operation: {
283
+ surface: "rest" | "mcp";
284
+ name: string;
285
+ };
286
+ status: "queued" | "running" | "retrying";
287
+ poll_after_seconds: number;
288
+ };
289
+ /**
290
+ * Apply many agent operations
291
+ */
292
+ export declare const agentBatch: {
293
+ readonly method: "post";
294
+ readonly pathParams: readonly [];
295
+ readonly queryParams: readonly [];
296
+ readonly bodyParams: readonly ["operations"];
297
+ readonly path: () => string;
298
+ };
299
+ type CancelSessionPathParameters = {
300
+ session_id: IdRequest;
301
+ };
302
+ type CancelSessionBodyParameters = {
303
+ event_id?: string;
304
+ };
305
+ export type CancelSessionParameters = CancelSessionPathParameters & CancelSessionBodyParameters;
306
+ export type CancelSessionResponse = {
307
+ object: "session";
308
+ id: string;
309
+ agent_id: string;
310
+ title: string;
311
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
312
+ created_at: string;
313
+ updated_at: string;
314
+ required_actions?: Array<{
315
+ action_id: string;
316
+ title: string;
317
+ options: Array<{
318
+ id: "approve" | "reject";
319
+ label: string;
320
+ }>;
321
+ }>;
322
+ error?: {
323
+ code: string;
324
+ message: string;
325
+ retryable: boolean;
326
+ };
327
+ };
328
+ /**
329
+ * Cancel a session
330
+ */
331
+ export declare const cancelSession: {
332
+ readonly method: "post";
333
+ readonly pathParams: readonly ["session_id"];
334
+ readonly queryParams: readonly [];
335
+ readonly bodyParams: readonly ["event_id"];
336
+ readonly path: (p: CancelSessionPathParameters) => string;
337
+ };
338
+ type ChatWithAgentPathParameters = {
339
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
340
+ };
341
+ type ChatWithAgentQueryParameters = {
342
+ verbose?: boolean;
343
+ };
344
+ type ChatWithAgentBodyParameters = {
345
+ message?: string;
346
+ attachments?: Array<{
347
+ file_upload: {
348
+ id: string;
349
+ };
350
+ type?: "file_upload";
351
+ name?: string;
352
+ }>;
353
+ metadata?: Record<string, string>;
354
+ prompt_context?: string;
355
+ /** @deprecated */
356
+ thread_id?: IdRequest;
357
+ };
358
+ export type ChatWithAgentParameters = ChatWithAgentPathParameters & ChatWithAgentQueryParameters & ChatWithAgentBodyParameters;
359
+ export type ChatWithAgentResponse = {
360
+ object: "chat.invocation";
361
+ agent_id: string;
362
+ thread_id: string;
363
+ invocation_id: string;
364
+ status: "pending";
365
+ };
366
+ /**
367
+ * Chat with agent
368
+ */
369
+ export declare const chatWithAgent: {
370
+ readonly method: "post";
371
+ readonly pathParams: readonly ["agent_id"];
372
+ readonly queryParams: readonly ["verbose"];
373
+ readonly bodyParams: readonly ["message", "attachments", "metadata", "prompt_context", "thread_id"];
374
+ readonly path: (p: ChatWithAgentPathParameters) => string;
375
+ };
376
+ type ContinueThreadPathParameters = {
377
+ thread_id: IdRequest;
378
+ };
379
+ type ContinueThreadBodyParameters = {
380
+ action_id: IdRequest;
381
+ option_id: "approve" | "reject";
382
+ } | {
383
+ action_id: IdRequest;
384
+ option_id: "use_connection";
385
+ input: {
386
+ connection_id: IdRequest;
387
+ };
388
+ };
389
+ export type ContinueThreadParameters = ContinueThreadPathParameters & ContinueThreadBodyParameters;
390
+ export type ContinueThreadResponse = {
391
+ object: "chat.invocation";
392
+ agent_id: string;
393
+ thread_id: string;
394
+ invocation_id: string;
395
+ status: "pending";
396
+ };
397
+ /**
398
+ * Continue a thread
399
+ */
400
+ export declare const continueThread: {
401
+ readonly method: "post";
402
+ readonly pathParams: readonly ["thread_id"];
403
+ readonly queryParams: readonly [];
404
+ readonly bodyParams: readonly ["action_id", "option_id", "input"];
405
+ readonly path: (p: ContinueThreadPathParameters) => string;
406
+ };
407
+ type CreateExternalAgentStubVaultPathParameters = {
408
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
409
+ };
410
+ type CreateExternalAgentStubVaultBodyParameters = {
411
+ name: string;
412
+ credential: {
413
+ value: string;
414
+ expires_at: string;
415
+ };
416
+ target: {
417
+ type: "mcp_server";
418
+ server_url: string;
419
+ authorization: {
420
+ type: "bearer";
421
+ };
422
+ };
423
+ };
424
+ export type CreateExternalAgentStubVaultParameters = CreateExternalAgentStubVaultPathParameters & CreateExternalAgentStubVaultBodyParameters;
425
+ export type CreateExternalAgentStubVaultResponse = {
426
+ id: string;
427
+ name: string;
428
+ credential: {
429
+ expires_at: string;
430
+ };
431
+ target: {
432
+ type: "mcp_server";
433
+ server_url: string;
434
+ authorization: {
435
+ type: "bearer";
436
+ };
437
+ };
438
+ status: "active" | "expired";
439
+ version: number;
440
+ created_at: string;
441
+ updated_at: string;
442
+ };
443
+ /**
444
+ * Create external agent stub vault
445
+ */
446
+ export declare const createExternalAgentStubVault: {
447
+ readonly method: "post";
448
+ readonly pathParams: readonly ["agent_id"];
449
+ readonly queryParams: readonly [];
450
+ readonly bodyParams: readonly ["name", "credential", "target"];
451
+ readonly path: (p: CreateExternalAgentStubVaultPathParameters) => string;
452
+ };
453
+ type DeleteAgentPathParameters = {
454
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
455
+ };
456
+ export type DeleteAgentParameters = DeleteAgentPathParameters;
457
+ export type DeleteAgentResponse = {
458
+ agent_id: IdResponse;
459
+ status: "deleted";
460
+ deleted_at: string;
461
+ };
462
+ /**
463
+ * Delete agent
464
+ */
465
+ export declare const deleteAgent: {
466
+ readonly method: "delete";
467
+ readonly pathParams: readonly ["agent_id"];
468
+ readonly queryParams: readonly [];
469
+ readonly bodyParams: readonly [];
470
+ readonly path: (p: DeleteAgentPathParameters) => string;
471
+ };
472
+ type GetAgentPathParameters = {
473
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
474
+ };
475
+ type GetAgentQueryParameters = {
476
+ verbose?: boolean;
477
+ };
478
+ export type GetAgentParameters = GetAgentPathParameters & GetAgentQueryParameters;
479
+ export type GetAgentResponse = {
480
+ object: "agent";
481
+ id: IdResponse;
482
+ agent_type: "notion_ai" | "custom_agent" | "autofill_custom_agent" | "external";
483
+ name: string;
484
+ description: string | null;
485
+ instructions_page_id: IdResponse | null;
486
+ icon: PageIconResponse | {
487
+ type: "custom_agent_avatar";
488
+ custom_agent_avatar: {
489
+ static_url: string;
490
+ animated_url: string;
491
+ };
492
+ } | null;
493
+ model: {
494
+ mode: "auto";
495
+ } | {
496
+ mode: "pinned";
497
+ id: string | null;
498
+ };
499
+ connections: Array<{
500
+ type: "notion";
501
+ name: string;
502
+ account: null;
503
+ permissions: Array<{
504
+ target: {
505
+ type: "page";
506
+ id: string;
507
+ } | {
508
+ type: "database_property";
509
+ data_source_id: string;
510
+ property_id: string;
511
+ } | {
512
+ type: "agent";
513
+ id: string;
514
+ } | {
515
+ type: "workspace";
516
+ } | {
517
+ type: "owner_private_pages";
518
+ } | {
519
+ type: "web_search";
520
+ allowed_domains: Array<string> | null;
521
+ } | {
522
+ type: "notion_help_docs_search";
523
+ };
524
+ scopes: Array<string>;
525
+ }>;
526
+ } | {
527
+ type: "slack";
528
+ name: string;
529
+ account: {
530
+ type: "slack_workspace";
531
+ team_id: string;
532
+ } | "hidden" | null;
533
+ permissions: Array<{
534
+ target: {
535
+ type: "slack_channel";
536
+ id: string;
537
+ } | {
538
+ type: "slack_all_public_channels";
539
+ } | {
540
+ type: "slack_all_channels";
541
+ };
542
+ scopes: Array<string>;
543
+ }>;
544
+ } | {
545
+ type: "discord";
546
+ name: string;
547
+ account: {
548
+ type: "discord_server";
549
+ id: string;
550
+ } | "hidden" | null;
551
+ permissions: Array<{
552
+ target: {
553
+ type: "discord_channel";
554
+ id: string;
555
+ } | {
556
+ type: "discord_all_channels";
557
+ };
558
+ scopes: Array<string>;
559
+ }>;
560
+ } | {
561
+ type: "mcp_server";
562
+ name: string;
563
+ account: {
564
+ type: "mcp_server";
565
+ server_host: string;
566
+ } | "hidden" | null;
567
+ enabled_tools: Array<{
568
+ name: string;
569
+ title: string | null;
570
+ }> | "hidden" | null;
571
+ run_tools_automatically: {
572
+ read: boolean;
573
+ write: boolean;
574
+ };
575
+ } | {
576
+ type: "custom_mcp_server";
577
+ name: string;
578
+ account: {
579
+ type: "mcp_server";
580
+ server_host: string;
581
+ } | "hidden" | null;
582
+ enabled_tools: Array<{
583
+ name: string;
584
+ title: string | null;
585
+ }> | "hidden" | null;
586
+ run_tools_automatically: {
587
+ read: boolean;
588
+ write: boolean;
589
+ };
590
+ } | {
591
+ type: "asana" | "box" | "browser" | "calendar" | "computer" | "confluence" | "cursor" | "files" | "fs" | "github" | "gmail" | "google_calendar" | "google_drive" | "google_drive_oauth" | "gtm" | "helpdocs" | "images" | "jira" | "linear" | "mail" | "marketplace" | "memory" | "microsoft_teams" | "outlook" | "salesforce" | "search" | "security" | "sharepoint" | "skills" | "system" | "test" | "web" | "webhooks" | "worker" | "workers";
592
+ name: string;
593
+ account: string | null;
594
+ permissions: Array<{
595
+ target: {
596
+ type: string;
597
+ id: string;
598
+ };
599
+ scopes: Array<string>;
600
+ }>;
601
+ }>;
602
+ status: "active" | "disabled" | "deleted";
603
+ pause_reason: "run_limit" | "credit_limit" | "runaway_credit_usage" | "workspace_credit_limit" | "failure_limit" | "mark_session_failed_autopause" | "disabled_from_workspace_settings" | "disabled_from_api" | "disabled_from_agent_settings" | "disabled_due_to_no_members_with_access" | "disabled_due_to_lack_of_editors" | "disabled_by_notion" | "internal_error" | "needs_user_review" | "tool_unavailable" | null;
604
+ created_by: {
605
+ object: "user";
606
+ type: "user";
607
+ id: IdResponse;
608
+ } | null;
609
+ version: {
610
+ id: IdResponse;
611
+ number: number;
612
+ published_at: string;
613
+ } | null;
614
+ agent_version: {
615
+ id: IdResponse;
616
+ number: number;
617
+ published_at: string;
618
+ } | null;
619
+ has_unpublished_changes: boolean | "hidden";
620
+ last_run_time: string | "hidden" | null;
621
+ last_run_at: string | "hidden" | null;
622
+ credit_limit: number | "hidden" | null;
623
+ triggers: Array<{
624
+ type: string;
625
+ enabled: boolean;
626
+ schedule?: {
627
+ frequency: string;
628
+ interval: number;
629
+ weekdays?: Array<string>;
630
+ monthdays?: Array<number>;
631
+ week_numbers?: Array<number>;
632
+ hour?: number;
633
+ minute?: number;
634
+ timezone?: string;
635
+ start_date?: string;
636
+ end?: {
637
+ type: "date";
638
+ end_at: string;
639
+ } | {
640
+ type: "count";
641
+ occurrences: number;
642
+ };
643
+ };
644
+ config?: Record<string, Record<string, never>>;
645
+ }>;
646
+ created_time?: string;
647
+ last_edited_time?: string;
648
+ instructions?: string | null;
649
+ };
650
+ /**
651
+ * Get agent
652
+ */
653
+ export declare const getAgent: {
654
+ readonly method: "get";
655
+ readonly pathParams: readonly ["agent_id"];
656
+ readonly queryParams: readonly ["verbose"];
657
+ readonly bodyParams: readonly [];
658
+ readonly path: (p: GetAgentPathParameters) => string;
659
+ };
660
+ type DeleteExternalAgentStubVaultPathParameters = {
661
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
662
+ vault_id: string;
663
+ };
664
+ export type DeleteExternalAgentStubVaultParameters = DeleteExternalAgentStubVaultPathParameters;
665
+ export type DeleteExternalAgentStubVaultResponse = EmptyObject;
666
+ /**
667
+ * Delete external agent stub vault
668
+ */
669
+ export declare const deleteExternalAgentStubVault: {
670
+ readonly method: "delete";
671
+ readonly pathParams: readonly ["agent_id", "vault_id"];
672
+ readonly queryParams: readonly [];
673
+ readonly bodyParams: readonly [];
674
+ readonly path: (p: DeleteExternalAgentStubVaultPathParameters) => string;
675
+ };
676
+ type UpdateExternalAgentStubVaultPathParameters = {
677
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
678
+ vault_id: string;
679
+ };
680
+ type UpdateExternalAgentStubVaultBodyParameters = {
681
+ expected_version: number;
682
+ credential: {
683
+ value: string;
684
+ expires_at: string;
685
+ };
686
+ };
687
+ export type UpdateExternalAgentStubVaultParameters = UpdateExternalAgentStubVaultPathParameters & UpdateExternalAgentStubVaultBodyParameters;
688
+ export type UpdateExternalAgentStubVaultResponse = {
689
+ id: string;
690
+ name: string;
691
+ credential: {
692
+ expires_at: string;
693
+ };
694
+ target: {
695
+ type: "mcp_server";
696
+ server_url: string;
697
+ authorization: {
698
+ type: "bearer";
699
+ };
700
+ };
701
+ status: "active" | "expired";
702
+ version: number;
703
+ created_at: string;
704
+ updated_at: string;
705
+ };
706
+ /**
707
+ * Update external agent stub vault
708
+ */
709
+ export declare const updateExternalAgentStubVault: {
710
+ readonly method: "patch";
711
+ readonly pathParams: readonly ["agent_id", "vault_id"];
712
+ readonly queryParams: readonly [];
713
+ readonly bodyParams: readonly ["expected_version", "credential"];
714
+ readonly path: (p: UpdateExternalAgentStubVaultPathParameters) => string;
715
+ };
716
+ type GetInsightsPathParameters = {
717
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
718
+ };
719
+ type GetInsightsQueryParameters = {
720
+ start_time?: number;
721
+ end_time?: number;
722
+ };
723
+ export type GetInsightsParameters = GetInsightsPathParameters & GetInsightsQueryParameters;
724
+ export type GetInsightsResponse = {
725
+ object: "agent_insights";
726
+ id: IdResponse;
727
+ name: string;
728
+ agent_type: "custom_agent" | "autofill_custom_agent";
729
+ status: "active" | "disabled" | "deleted";
730
+ pause_reason: "run_limit" | "credit_limit" | "runaway_credit_usage" | "workspace_credit_limit" | "failure_limit" | "mark_session_failed_autopause" | "disabled_from_workspace_settings" | "disabled_from_api" | "disabled_from_agent_settings" | "disabled_due_to_no_members_with_access" | "disabled_due_to_lack_of_editors" | "disabled_by_notion" | "internal_error" | "needs_user_review" | "tool_unavailable" | null;
731
+ created_by: {
732
+ id: string;
733
+ type: "user" | "bot";
734
+ } | null;
735
+ total_credits_used: number;
736
+ credit_limit: number | "hidden" | null;
737
+ runs_completed: number;
738
+ };
739
+ /**
740
+ * Get agent insights
741
+ */
742
+ export declare const getInsights: {
743
+ readonly method: "get";
744
+ readonly pathParams: readonly ["agent_id"];
745
+ readonly queryParams: readonly ["start_time", "end_time"];
746
+ readonly bodyParams: readonly [];
747
+ readonly path: (p: GetInsightsPathParameters) => string;
748
+ };
749
+ type ListAgentsQueryParameters = {
750
+ name?: string;
751
+ agent_type?: Array<"notion_ai" | "custom_agent" | "autofill_custom_agent" | "external">;
752
+ agent_ids?: Array<IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333">;
753
+ created_by?: Array<IdRequest | "me">;
754
+ start_cursor?: string | null;
755
+ page_size?: number;
756
+ verbose?: boolean;
757
+ };
758
+ export type ListAgentsParameters = ListAgentsQueryParameters;
759
+ export type ListAgentsResponse = {
760
+ object: "list";
761
+ type: "agent";
762
+ results: Array<{
763
+ object: "agent";
764
+ id: IdResponse;
765
+ agent_type: "notion_ai" | "custom_agent" | "autofill_custom_agent" | "external";
766
+ name: string;
767
+ description: string | null;
768
+ instructions_page_id: IdResponse | null;
769
+ icon: PageIconResponse | {
770
+ type: "custom_agent_avatar";
771
+ custom_agent_avatar: {
772
+ static_url: string;
773
+ animated_url: string;
774
+ };
775
+ } | null;
776
+ version: {
777
+ id: IdResponse;
778
+ number: number;
779
+ published_at: string;
780
+ } | null;
781
+ agent_version: {
782
+ id: IdResponse;
783
+ number: number;
784
+ published_at: string;
785
+ } | null;
786
+ model: {
787
+ mode: "auto";
788
+ } | {
789
+ mode: "pinned";
790
+ id: string | null;
791
+ };
792
+ connections: Array<{
793
+ type: "notion";
794
+ name: string;
795
+ account: null;
796
+ permissions: Array<{
797
+ target: {
798
+ type: "page";
799
+ id: string;
800
+ } | {
801
+ type: "database_property";
802
+ data_source_id: string;
803
+ property_id: string;
804
+ } | {
805
+ type: "agent";
806
+ id: string;
807
+ } | {
808
+ type: "workspace";
809
+ } | {
810
+ type: "owner_private_pages";
811
+ } | {
812
+ type: "web_search";
813
+ allowed_domains: Array<string> | null;
814
+ } | {
815
+ type: "notion_help_docs_search";
816
+ };
817
+ scopes: Array<string>;
818
+ }>;
819
+ } | {
820
+ type: "slack";
821
+ name: string;
822
+ account: {
823
+ type: "slack_workspace";
824
+ team_id: string;
825
+ } | "hidden" | null;
826
+ permissions: Array<{
827
+ target: {
828
+ type: "slack_channel";
829
+ id: string;
830
+ } | {
831
+ type: "slack_all_public_channels";
832
+ } | {
833
+ type: "slack_all_channels";
834
+ };
835
+ scopes: Array<string>;
836
+ }>;
837
+ } | {
838
+ type: "discord";
839
+ name: string;
840
+ account: {
841
+ type: "discord_server";
842
+ id: string;
843
+ } | "hidden" | null;
844
+ permissions: Array<{
845
+ target: {
846
+ type: "discord_channel";
847
+ id: string;
848
+ } | {
849
+ type: "discord_all_channels";
850
+ };
851
+ scopes: Array<string>;
852
+ }>;
853
+ } | {
854
+ type: "mcp_server";
855
+ name: string;
856
+ account: {
857
+ type: "mcp_server";
858
+ server_host: string;
859
+ } | "hidden" | null;
860
+ enabled_tools: Array<{
861
+ name: string;
862
+ title: string | null;
863
+ }> | "hidden" | null;
864
+ run_tools_automatically: {
865
+ read: boolean;
866
+ write: boolean;
867
+ };
868
+ } | {
869
+ type: "custom_mcp_server";
870
+ name: string;
871
+ account: {
872
+ type: "mcp_server";
873
+ server_host: string;
874
+ } | "hidden" | null;
875
+ enabled_tools: Array<{
876
+ name: string;
877
+ title: string | null;
878
+ }> | "hidden" | null;
879
+ run_tools_automatically: {
880
+ read: boolean;
881
+ write: boolean;
882
+ };
883
+ } | {
884
+ type: "asana" | "box" | "browser" | "calendar" | "computer" | "confluence" | "cursor" | "files" | "fs" | "github" | "gmail" | "google_calendar" | "google_drive" | "google_drive_oauth" | "gtm" | "helpdocs" | "images" | "jira" | "linear" | "mail" | "marketplace" | "memory" | "microsoft_teams" | "outlook" | "salesforce" | "search" | "security" | "sharepoint" | "skills" | "system" | "test" | "web" | "webhooks" | "worker" | "workers";
885
+ name: string;
886
+ account: string | null;
887
+ permissions: Array<{
888
+ target: {
889
+ type: string;
890
+ id: string;
891
+ };
892
+ scopes: Array<string>;
893
+ }>;
894
+ }>;
895
+ status: "active" | "disabled" | "deleted";
896
+ created_by: {
897
+ object: "user";
898
+ type: "user";
899
+ id: IdResponse;
900
+ } | null;
901
+ created_time: string | null;
902
+ last_edited_time: string | null;
903
+ last_run_time: string | "hidden" | null;
904
+ last_run_at: string | "hidden" | null;
905
+ instructions?: string | null;
906
+ }>;
907
+ has_more: boolean;
908
+ next_cursor: string | null;
909
+ };
910
+ /**
911
+ * List agents
912
+ */
913
+ export declare const listAgents: {
914
+ readonly method: "get";
915
+ readonly pathParams: readonly [];
916
+ readonly queryParams: readonly ["name", "agent_type", "agent_ids", "created_by", "start_cursor", "page_size", "verbose"];
917
+ readonly bodyParams: readonly [];
918
+ readonly path: () => string;
919
+ };
920
+ type ListExternalAgentStubSessionEventsPathParameters = {
921
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
922
+ session_id: IdRequest;
923
+ };
924
+ type ListExternalAgentStubSessionEventsQueryParameters = {
925
+ cursor?: string;
926
+ };
927
+ export type ListExternalAgentStubSessionEventsParameters = ListExternalAgentStubSessionEventsPathParameters & ListExternalAgentStubSessionEventsQueryParameters;
928
+ export type ListExternalAgentStubSessionEventsResponse = {
929
+ events: Array<{
930
+ type: "assistant.thinking";
931
+ text: string;
932
+ } | {
933
+ type: "assistant.message";
934
+ text: string;
935
+ } | {
936
+ type: "tool.started";
937
+ tool_call_id: string;
938
+ tool_name?: string;
939
+ input?: Record<string, never>;
940
+ } | {
941
+ type: "tool.output";
942
+ tool_call_id: string;
943
+ output?: Record<string, never>;
944
+ is_error?: boolean;
945
+ } | {
946
+ type: "error";
947
+ error: {
948
+ code: string;
949
+ message: string;
950
+ retryable: boolean;
951
+ additional_data?: Record<string, string | Array<string>>;
952
+ };
953
+ }>;
954
+ is_running: boolean;
955
+ next_cursor?: string;
956
+ };
957
+ /**
958
+ * List external agent stub session events
959
+ */
960
+ export declare const listExternalAgentStubSessionEvents: {
961
+ readonly method: "get";
962
+ readonly pathParams: readonly ["agent_id", "session_id"];
963
+ readonly queryParams: readonly ["cursor"];
964
+ readonly bodyParams: readonly [];
965
+ readonly path: (p: ListExternalAgentStubSessionEventsPathParameters) => string;
966
+ };
967
+ type ListThreadMessagesPathParameters = {
968
+ thread_id: IdRequest;
969
+ };
970
+ type ListThreadMessagesQueryParameters = {
971
+ verbose?: boolean;
972
+ role?: "user" | "agent";
973
+ start_cursor?: string | null;
974
+ page_size?: number;
975
+ };
976
+ export type ListThreadMessagesParameters = ListThreadMessagesPathParameters & ListThreadMessagesQueryParameters;
977
+ export type ListThreadMessagesResponse = {
978
+ object: "list";
979
+ type: "thread_message";
980
+ results: Array<{
981
+ object: "thread_message";
982
+ id: IdResponse;
983
+ role: "user" | "agent";
984
+ content: string;
985
+ created_time: string;
986
+ parent: {
987
+ type: "thread";
988
+ id: IdResponse;
989
+ };
990
+ attachments?: Array<{
991
+ name: string;
992
+ content_type: string;
993
+ url: string;
994
+ expiry_time?: string;
995
+ }>;
996
+ content_parts?: Array<{
997
+ type: "text";
998
+ text: string;
999
+ } | {
1000
+ type: "thinking";
1001
+ text: string;
1002
+ } | {
1003
+ type: "tool_call";
1004
+ tool_call_id: string | null;
1005
+ tool_name: string;
1006
+ input: string;
1007
+ results?: Array<{
1008
+ id: IdResponse;
1009
+ agent_step_id: IdResponse | null;
1010
+ tool_call_id: string | null;
1011
+ tool_name: string;
1012
+ tool_type: string;
1013
+ state: string;
1014
+ input: Record<string, never> | null;
1015
+ output: Record<string, never> | null;
1016
+ error: string | null;
1017
+ started_at: number;
1018
+ finished_at: number | null;
1019
+ duration_ms: number | null;
1020
+ }>;
1021
+ } | {
1022
+ type: "follow_ups";
1023
+ follow_ups: Array<{
1024
+ label: string;
1025
+ message: string;
1026
+ }>;
1027
+ } | {
1028
+ type: "custom_agent_template_picker";
1029
+ }>;
1030
+ pending_user_actions?: Array<{
1031
+ id: IdResponse;
1032
+ type: "tool_confirmation";
1033
+ title: string;
1034
+ requirements: Array<{
1035
+ type: "general";
1036
+ } | {
1037
+ type: "manage_workers";
1038
+ } | {
1039
+ type: "url_safety";
1040
+ urls: Array<string>;
1041
+ required_by_workspace_policy?: boolean;
1042
+ } | {
1043
+ type: "permission_escalation";
1044
+ destination_title?: string;
1045
+ source_titles?: Array<string>;
1046
+ } | {
1047
+ type: "delete_content";
1048
+ page_count: number;
1049
+ database_count: number;
1050
+ meeting_notes_block_count?: number;
1051
+ } | {
1052
+ type: "connect_integration";
1053
+ integration_type: string;
1054
+ integration_name: string;
1055
+ handoff_url: string;
1056
+ } | {
1057
+ type: "admin_mode";
1058
+ explanation?: string;
1059
+ }>;
1060
+ options: Array<{
1061
+ id: "approve";
1062
+ label: string;
1063
+ } | {
1064
+ id: "reject";
1065
+ label: string;
1066
+ } | {
1067
+ id: "use_connection";
1068
+ label: string;
1069
+ input: {
1070
+ type: "connection_id";
1071
+ required: true;
1072
+ };
1073
+ }>;
1074
+ }>;
1075
+ }>;
1076
+ has_more: boolean;
1077
+ next_cursor: string | null;
1078
+ };
1079
+ /**
1080
+ * List thread messages
1081
+ */
1082
+ export declare const listThreadMessages: {
1083
+ readonly method: "get";
1084
+ readonly pathParams: readonly ["thread_id"];
1085
+ readonly queryParams: readonly ["verbose", "role", "start_cursor", "page_size"];
1086
+ readonly bodyParams: readonly [];
1087
+ readonly path: (p: ListThreadMessagesPathParameters) => string;
1088
+ };
1089
+ type SendThreadMessagePathParameters = {
1090
+ thread_id: IdRequest;
1091
+ };
1092
+ type SendThreadMessageBodyParameters = {
1093
+ message?: string;
1094
+ attachments?: Array<{
1095
+ file_upload: {
1096
+ id: string;
1097
+ };
1098
+ type?: "file_upload";
1099
+ name?: string;
1100
+ }>;
1101
+ metadata?: Record<string, string>;
1102
+ prompt_context?: string;
1103
+ };
1104
+ export type SendThreadMessageParameters = SendThreadMessagePathParameters & SendThreadMessageBodyParameters;
1105
+ export type SendThreadMessageResponse = {
1106
+ object: "chat.invocation";
1107
+ agent_id: string;
1108
+ thread_id: string;
1109
+ invocation_id: string;
1110
+ status: "pending";
1111
+ };
1112
+ /**
1113
+ * Send a thread message
1114
+ */
1115
+ export declare const sendThreadMessage: {
1116
+ readonly method: "post";
1117
+ readonly pathParams: readonly ["thread_id"];
1118
+ readonly queryParams: readonly [];
1119
+ readonly bodyParams: readonly ["message", "attachments", "metadata", "prompt_context"];
1120
+ readonly path: (p: SendThreadMessagePathParameters) => string;
1121
+ };
1122
+ type ListThreadsPathParameters = {
1123
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
1124
+ };
1125
+ type ListThreadsQueryParameters = {
1126
+ id?: IdRequest;
1127
+ title?: string;
1128
+ status?: "pending" | "requires_action" | "completed" | "failed";
1129
+ activity?: "all" | "pending" | "in_progress" | "failed" | "success";
1130
+ created_by?: Array<IdRequest | "me">;
1131
+ last_used_by?: Array<IdRequest | "me">;
1132
+ sort_by?: "created_time" | "last_used_time";
1133
+ sort_direction?: "ascending" | "descending";
1134
+ start_cursor?: string | null;
1135
+ page_size?: number;
1136
+ };
1137
+ export type ListThreadsParameters = ListThreadsPathParameters & ListThreadsQueryParameters;
1138
+ export type ListThreadsResponse = {
1139
+ object: "list";
1140
+ type: "thread";
1141
+ results: Array<{
1142
+ object: "thread";
1143
+ id: IdResponse;
1144
+ title: string;
1145
+ status: "pending" | "requires_action" | "completed" | "failed";
1146
+ created_time: string;
1147
+ last_edited_time: string;
1148
+ created_by: {
1149
+ id: IdResponse;
1150
+ type: "bot" | "user";
1151
+ };
1152
+ agent_version: {
1153
+ id: IdResponse;
1154
+ number: number;
1155
+ published_at: string;
1156
+ } | null;
1157
+ models: {
1158
+ type: "auto";
1159
+ } | {
1160
+ type: "pinned";
1161
+ ids: Array<string | null>;
1162
+ };
1163
+ error?: string;
1164
+ trigger_type?: string;
1165
+ type_labels?: Array<string> | null;
1166
+ chat_user_emails?: Array<string> | null;
1167
+ tool_types?: Array<string> | null;
1168
+ tool_call_count?: number | null;
1169
+ credits_used?: number | null;
1170
+ runs_completed?: number | null;
1171
+ pending_user_actions?: Array<{
1172
+ id: IdResponse;
1173
+ type: "tool_confirmation";
1174
+ title: string;
1175
+ requirements: Array<{
1176
+ type: "general";
1177
+ } | {
1178
+ type: "manage_workers";
1179
+ } | {
1180
+ type: "url_safety";
1181
+ urls: Array<string>;
1182
+ required_by_workspace_policy?: boolean;
1183
+ } | {
1184
+ type: "permission_escalation";
1185
+ destination_title?: string;
1186
+ source_titles?: Array<string>;
1187
+ } | {
1188
+ type: "delete_content";
1189
+ page_count: number;
1190
+ database_count: number;
1191
+ meeting_notes_block_count?: number;
1192
+ } | {
1193
+ type: "connect_integration";
1194
+ integration_type: string;
1195
+ integration_name: string;
1196
+ handoff_url: string;
1197
+ } | {
1198
+ type: "admin_mode";
1199
+ explanation?: string;
1200
+ }>;
1201
+ options: Array<{
1202
+ id: "approve";
1203
+ label: string;
1204
+ } | {
1205
+ id: "reject";
1206
+ label: string;
1207
+ } | {
1208
+ id: "use_connection";
1209
+ label: string;
1210
+ input: {
1211
+ type: "connection_id";
1212
+ required: true;
1213
+ };
1214
+ }>;
1215
+ }>;
1216
+ }>;
1217
+ has_more: boolean;
1218
+ next_cursor: string | null;
1219
+ };
1220
+ /**
1221
+ * List threads
1222
+ */
1223
+ export declare const listThreads: {
1224
+ readonly method: "get";
1225
+ readonly pathParams: readonly ["agent_id"];
1226
+ readonly queryParams: readonly ["id", "title", "status", "activity", "created_by", "last_used_by", "sort_by", "sort_direction", "start_cursor", "page_size"];
1227
+ readonly bodyParams: readonly [];
1228
+ readonly path: (p: ListThreadsPathParameters) => string;
1229
+ };
1230
+ type QueryAgentsBodyParameters = {
1231
+ query?: string;
1232
+ filter?: {
1233
+ property: "id";
1234
+ id: {
1235
+ equals: string;
1236
+ };
1237
+ } | {
1238
+ property: "agent_type";
1239
+ string: {
1240
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1241
+ };
1242
+ } | {
1243
+ property: "created_by";
1244
+ people: {
1245
+ contains: string;
1246
+ };
1247
+ } | {
1248
+ property: "created_time";
1249
+ date: {
1250
+ after?: string;
1251
+ before?: string;
1252
+ };
1253
+ } | {
1254
+ property: "favorited";
1255
+ checkbox: {
1256
+ equals: boolean;
1257
+ };
1258
+ } | {
1259
+ property: "connections";
1260
+ mcp_server: {
1261
+ contains: string;
1262
+ };
1263
+ } | {
1264
+ property: "status";
1265
+ status: {
1266
+ in: Array<"active" | "disabled" | "deleted">;
1267
+ };
1268
+ } | {
1269
+ property: "model_mode";
1270
+ select: {
1271
+ equals: "auto" | "pinned";
1272
+ };
1273
+ } | {
1274
+ property: "agent_version";
1275
+ number: {
1276
+ equals: number;
1277
+ };
1278
+ } | {
1279
+ property: "last_run_at";
1280
+ date: {
1281
+ after?: string;
1282
+ before?: string;
1283
+ };
1284
+ } | {
1285
+ and: Array<{
1286
+ property: "id";
1287
+ id: {
1288
+ equals: string;
1289
+ };
1290
+ } | {
1291
+ property: "agent_type";
1292
+ string: {
1293
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1294
+ };
1295
+ } | {
1296
+ property: "created_by";
1297
+ people: {
1298
+ contains: string;
1299
+ };
1300
+ } | {
1301
+ property: "created_time";
1302
+ date: {
1303
+ after?: string;
1304
+ before?: string;
1305
+ };
1306
+ } | {
1307
+ property: "favorited";
1308
+ checkbox: {
1309
+ equals: boolean;
1310
+ };
1311
+ } | {
1312
+ property: "connections";
1313
+ mcp_server: {
1314
+ contains: string;
1315
+ };
1316
+ } | {
1317
+ property: "status";
1318
+ status: {
1319
+ in: Array<"active" | "disabled" | "deleted">;
1320
+ };
1321
+ } | {
1322
+ property: "model_mode";
1323
+ select: {
1324
+ equals: "auto" | "pinned";
1325
+ };
1326
+ } | {
1327
+ property: "agent_version";
1328
+ number: {
1329
+ equals: number;
1330
+ };
1331
+ } | {
1332
+ property: "last_run_at";
1333
+ date: {
1334
+ after?: string;
1335
+ before?: string;
1336
+ };
1337
+ } | {
1338
+ and: Array<{
1339
+ property: "id";
1340
+ id: {
1341
+ equals: string;
1342
+ };
1343
+ } | {
1344
+ property: "agent_type";
1345
+ string: {
1346
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1347
+ };
1348
+ } | {
1349
+ property: "created_by";
1350
+ people: {
1351
+ contains: string;
1352
+ };
1353
+ } | {
1354
+ property: "created_time";
1355
+ date: {
1356
+ after?: string;
1357
+ before?: string;
1358
+ };
1359
+ } | {
1360
+ property: "favorited";
1361
+ checkbox: {
1362
+ equals: boolean;
1363
+ };
1364
+ } | {
1365
+ property: "connections";
1366
+ mcp_server: {
1367
+ contains: string;
1368
+ };
1369
+ } | {
1370
+ property: "status";
1371
+ status: {
1372
+ in: Array<"active" | "disabled" | "deleted">;
1373
+ };
1374
+ } | {
1375
+ property: "model_mode";
1376
+ select: {
1377
+ equals: "auto" | "pinned";
1378
+ };
1379
+ } | {
1380
+ property: "agent_version";
1381
+ number: {
1382
+ equals: number;
1383
+ };
1384
+ } | {
1385
+ property: "last_run_at";
1386
+ date: {
1387
+ after?: string;
1388
+ before?: string;
1389
+ };
1390
+ }>;
1391
+ } | {
1392
+ or: Array<{
1393
+ property: "id";
1394
+ id: {
1395
+ equals: string;
1396
+ };
1397
+ } | {
1398
+ property: "agent_type";
1399
+ string: {
1400
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1401
+ };
1402
+ } | {
1403
+ property: "created_by";
1404
+ people: {
1405
+ contains: string;
1406
+ };
1407
+ } | {
1408
+ property: "created_time";
1409
+ date: {
1410
+ after?: string;
1411
+ before?: string;
1412
+ };
1413
+ } | {
1414
+ property: "favorited";
1415
+ checkbox: {
1416
+ equals: boolean;
1417
+ };
1418
+ } | {
1419
+ property: "connections";
1420
+ mcp_server: {
1421
+ contains: string;
1422
+ };
1423
+ } | {
1424
+ property: "status";
1425
+ status: {
1426
+ in: Array<"active" | "disabled" | "deleted">;
1427
+ };
1428
+ } | {
1429
+ property: "model_mode";
1430
+ select: {
1431
+ equals: "auto" | "pinned";
1432
+ };
1433
+ } | {
1434
+ property: "agent_version";
1435
+ number: {
1436
+ equals: number;
1437
+ };
1438
+ } | {
1439
+ property: "last_run_at";
1440
+ date: {
1441
+ after?: string;
1442
+ before?: string;
1443
+ };
1444
+ }>;
1445
+ }>;
1446
+ } | {
1447
+ or: Array<{
1448
+ property: "id";
1449
+ id: {
1450
+ equals: string;
1451
+ };
1452
+ } | {
1453
+ property: "agent_type";
1454
+ string: {
1455
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1456
+ };
1457
+ } | {
1458
+ property: "created_by";
1459
+ people: {
1460
+ contains: string;
1461
+ };
1462
+ } | {
1463
+ property: "created_time";
1464
+ date: {
1465
+ after?: string;
1466
+ before?: string;
1467
+ };
1468
+ } | {
1469
+ property: "favorited";
1470
+ checkbox: {
1471
+ equals: boolean;
1472
+ };
1473
+ } | {
1474
+ property: "connections";
1475
+ mcp_server: {
1476
+ contains: string;
1477
+ };
1478
+ } | {
1479
+ property: "status";
1480
+ status: {
1481
+ in: Array<"active" | "disabled" | "deleted">;
1482
+ };
1483
+ } | {
1484
+ property: "model_mode";
1485
+ select: {
1486
+ equals: "auto" | "pinned";
1487
+ };
1488
+ } | {
1489
+ property: "agent_version";
1490
+ number: {
1491
+ equals: number;
1492
+ };
1493
+ } | {
1494
+ property: "last_run_at";
1495
+ date: {
1496
+ after?: string;
1497
+ before?: string;
1498
+ };
1499
+ } | {
1500
+ and: Array<{
1501
+ property: "id";
1502
+ id: {
1503
+ equals: string;
1504
+ };
1505
+ } | {
1506
+ property: "agent_type";
1507
+ string: {
1508
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1509
+ };
1510
+ } | {
1511
+ property: "created_by";
1512
+ people: {
1513
+ contains: string;
1514
+ };
1515
+ } | {
1516
+ property: "created_time";
1517
+ date: {
1518
+ after?: string;
1519
+ before?: string;
1520
+ };
1521
+ } | {
1522
+ property: "favorited";
1523
+ checkbox: {
1524
+ equals: boolean;
1525
+ };
1526
+ } | {
1527
+ property: "connections";
1528
+ mcp_server: {
1529
+ contains: string;
1530
+ };
1531
+ } | {
1532
+ property: "status";
1533
+ status: {
1534
+ in: Array<"active" | "disabled" | "deleted">;
1535
+ };
1536
+ } | {
1537
+ property: "model_mode";
1538
+ select: {
1539
+ equals: "auto" | "pinned";
1540
+ };
1541
+ } | {
1542
+ property: "agent_version";
1543
+ number: {
1544
+ equals: number;
1545
+ };
1546
+ } | {
1547
+ property: "last_run_at";
1548
+ date: {
1549
+ after?: string;
1550
+ before?: string;
1551
+ };
1552
+ }>;
1553
+ } | {
1554
+ or: Array<{
1555
+ property: "id";
1556
+ id: {
1557
+ equals: string;
1558
+ };
1559
+ } | {
1560
+ property: "agent_type";
1561
+ string: {
1562
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1563
+ };
1564
+ } | {
1565
+ property: "created_by";
1566
+ people: {
1567
+ contains: string;
1568
+ };
1569
+ } | {
1570
+ property: "created_time";
1571
+ date: {
1572
+ after?: string;
1573
+ before?: string;
1574
+ };
1575
+ } | {
1576
+ property: "favorited";
1577
+ checkbox: {
1578
+ equals: boolean;
1579
+ };
1580
+ } | {
1581
+ property: "connections";
1582
+ mcp_server: {
1583
+ contains: string;
1584
+ };
1585
+ } | {
1586
+ property: "status";
1587
+ status: {
1588
+ in: Array<"active" | "disabled" | "deleted">;
1589
+ };
1590
+ } | {
1591
+ property: "model_mode";
1592
+ select: {
1593
+ equals: "auto" | "pinned";
1594
+ };
1595
+ } | {
1596
+ property: "agent_version";
1597
+ number: {
1598
+ equals: number;
1599
+ };
1600
+ } | {
1601
+ property: "last_run_at";
1602
+ date: {
1603
+ after?: string;
1604
+ before?: string;
1605
+ };
1606
+ }>;
1607
+ }>;
1608
+ };
1609
+ sorts?: Array<{
1610
+ property: "created_time" | "last_run_at";
1611
+ direction: "ascending" | "descending";
1612
+ }>;
1613
+ start_cursor?: string | null;
1614
+ page_size?: number;
1615
+ verbose?: boolean;
1616
+ include_deleted?: boolean;
1617
+ };
1618
+ export type QueryAgentsParameters = QueryAgentsBodyParameters;
1619
+ export type QueryAgentsResponse = {
1620
+ object: "list";
1621
+ type: "agent";
1622
+ results: Array<{
1623
+ object: "agent";
1624
+ id: IdResponse;
1625
+ agent_type: "custom_agent" | "autofill_custom_agent";
1626
+ name: string;
1627
+ description: string | null;
1628
+ instructions_page_id: IdResponse | null;
1629
+ icon: PageIconResponse | {
1630
+ type: "custom_agent_avatar";
1631
+ custom_agent_avatar: {
1632
+ static_url: string;
1633
+ animated_url: string;
1634
+ };
1635
+ } | null;
1636
+ model: {
1637
+ mode: "auto";
1638
+ } | {
1639
+ mode: "pinned";
1640
+ id: string | null;
1641
+ };
1642
+ connections: Array<{
1643
+ type: "notion";
1644
+ name: string;
1645
+ account: null;
1646
+ permissions: Array<{
1647
+ target: {
1648
+ type: "page";
1649
+ id: string;
1650
+ } | {
1651
+ type: "database_property";
1652
+ data_source_id: string;
1653
+ property_id: string;
1654
+ } | {
1655
+ type: "agent";
1656
+ id: string;
1657
+ } | {
1658
+ type: "workspace";
1659
+ } | {
1660
+ type: "owner_private_pages";
1661
+ } | {
1662
+ type: "web_search";
1663
+ allowed_domains: Array<string> | null;
1664
+ } | {
1665
+ type: "notion_help_docs_search";
1666
+ };
1667
+ scopes: Array<string>;
1668
+ }>;
1669
+ } | {
1670
+ type: "slack";
1671
+ name: string;
1672
+ account: {
1673
+ type: "slack_workspace";
1674
+ team_id: string;
1675
+ } | "hidden" | null;
1676
+ permissions: Array<{
1677
+ target: {
1678
+ type: "slack_channel";
1679
+ id: string;
1680
+ } | {
1681
+ type: "slack_all_public_channels";
1682
+ } | {
1683
+ type: "slack_all_channels";
1684
+ };
1685
+ scopes: Array<string>;
1686
+ }>;
1687
+ } | {
1688
+ type: "discord";
1689
+ name: string;
1690
+ account: {
1691
+ type: "discord_server";
1692
+ id: string;
1693
+ } | "hidden" | null;
1694
+ permissions: Array<{
1695
+ target: {
1696
+ type: "discord_channel";
1697
+ id: string;
1698
+ } | {
1699
+ type: "discord_all_channels";
1700
+ };
1701
+ scopes: Array<string>;
1702
+ }>;
1703
+ } | {
1704
+ type: "mcp_server";
1705
+ name: string;
1706
+ account: {
1707
+ type: "mcp_server";
1708
+ server_host: string;
1709
+ } | "hidden" | null;
1710
+ enabled_tools: Array<{
1711
+ name: string;
1712
+ title: string | null;
1713
+ }> | "hidden" | null;
1714
+ run_tools_automatically: {
1715
+ read: boolean;
1716
+ write: boolean;
1717
+ };
1718
+ } | {
1719
+ type: "custom_mcp_server";
1720
+ name: string;
1721
+ account: {
1722
+ type: "mcp_server";
1723
+ server_host: string;
1724
+ } | "hidden" | null;
1725
+ enabled_tools: Array<{
1726
+ name: string;
1727
+ title: string | null;
1728
+ }> | "hidden" | null;
1729
+ run_tools_automatically: {
1730
+ read: boolean;
1731
+ write: boolean;
1732
+ };
1733
+ } | {
1734
+ type: "asana" | "box" | "browser" | "calendar" | "computer" | "confluence" | "cursor" | "files" | "fs" | "github" | "gmail" | "google_calendar" | "google_drive" | "google_drive_oauth" | "gtm" | "helpdocs" | "images" | "jira" | "linear" | "mail" | "marketplace" | "memory" | "microsoft_teams" | "outlook" | "salesforce" | "search" | "security" | "sharepoint" | "skills" | "system" | "test" | "web" | "webhooks" | "worker" | "workers";
1735
+ name: string;
1736
+ account: string | null;
1737
+ permissions: Array<{
1738
+ target: {
1739
+ type: string;
1740
+ id: string;
1741
+ };
1742
+ scopes: Array<string>;
1743
+ }>;
1744
+ }>;
1745
+ status: "active" | "disabled" | "deleted";
1746
+ pause_reason: "run_limit" | "credit_limit" | "runaway_credit_usage" | "workspace_credit_limit" | "failure_limit" | "mark_session_failed_autopause" | "disabled_from_workspace_settings" | "disabled_from_api" | "disabled_from_agent_settings" | "disabled_due_to_no_members_with_access" | "disabled_due_to_lack_of_editors" | "disabled_by_notion" | "internal_error" | "needs_user_review" | "tool_unavailable" | null;
1747
+ created_by: {
1748
+ type: "user" | "bot";
1749
+ id: IdResponse;
1750
+ } | null;
1751
+ agent_version: {
1752
+ id: IdResponse;
1753
+ number: number;
1754
+ published_at: string;
1755
+ } | null;
1756
+ created_time: string;
1757
+ last_edited_time: string;
1758
+ last_run_at: string | "hidden" | null;
1759
+ credit_limit: number | "hidden" | null;
1760
+ triggers: Array<{
1761
+ type: string;
1762
+ enabled: boolean;
1763
+ schedule?: {
1764
+ frequency: string;
1765
+ interval: number;
1766
+ weekdays?: Array<string>;
1767
+ monthdays?: Array<number>;
1768
+ week_numbers?: Array<number>;
1769
+ hour?: number;
1770
+ minute?: number;
1771
+ timezone?: string;
1772
+ start_date?: string;
1773
+ end?: {
1774
+ type: "date";
1775
+ end_at: string;
1776
+ } | {
1777
+ type: "count";
1778
+ occurrences: number;
1779
+ };
1780
+ };
1781
+ config?: Record<string, Record<string, never>>;
1782
+ }>;
1783
+ instructions?: string | null;
1784
+ } | {
1785
+ object: "agent";
1786
+ id: "33333333-3333-3333-3333-333333333333";
1787
+ agent_type: "notion_ai";
1788
+ name: "Notion Agent";
1789
+ description: null;
1790
+ instructions_page_id: null;
1791
+ icon: PageIconResponse | {
1792
+ type: "custom_agent_avatar";
1793
+ custom_agent_avatar: {
1794
+ static_url: string;
1795
+ animated_url: string;
1796
+ };
1797
+ };
1798
+ model: {
1799
+ mode: "auto";
1800
+ } | {
1801
+ mode: "pinned";
1802
+ id: string | null;
1803
+ };
1804
+ connections: Array<{
1805
+ type: "notion";
1806
+ name: string;
1807
+ account: null;
1808
+ permissions: Array<{
1809
+ target: {
1810
+ type: "page";
1811
+ id: string;
1812
+ } | {
1813
+ type: "database_property";
1814
+ data_source_id: string;
1815
+ property_id: string;
1816
+ } | {
1817
+ type: "agent";
1818
+ id: string;
1819
+ } | {
1820
+ type: "workspace";
1821
+ } | {
1822
+ type: "owner_private_pages";
1823
+ } | {
1824
+ type: "web_search";
1825
+ allowed_domains: Array<string> | null;
1826
+ } | {
1827
+ type: "notion_help_docs_search";
1828
+ };
1829
+ scopes: Array<string>;
1830
+ }>;
1831
+ } | {
1832
+ type: "slack";
1833
+ name: string;
1834
+ account: {
1835
+ type: "slack_workspace";
1836
+ team_id: string;
1837
+ } | "hidden" | null;
1838
+ permissions: Array<{
1839
+ target: {
1840
+ type: "slack_channel";
1841
+ id: string;
1842
+ } | {
1843
+ type: "slack_all_public_channels";
1844
+ } | {
1845
+ type: "slack_all_channels";
1846
+ };
1847
+ scopes: Array<string>;
1848
+ }>;
1849
+ } | {
1850
+ type: "discord";
1851
+ name: string;
1852
+ account: {
1853
+ type: "discord_server";
1854
+ id: string;
1855
+ } | "hidden" | null;
1856
+ permissions: Array<{
1857
+ target: {
1858
+ type: "discord_channel";
1859
+ id: string;
1860
+ } | {
1861
+ type: "discord_all_channels";
1862
+ };
1863
+ scopes: Array<string>;
1864
+ }>;
1865
+ } | {
1866
+ type: "mcp_server";
1867
+ name: string;
1868
+ account: {
1869
+ type: "mcp_server";
1870
+ server_host: string;
1871
+ } | "hidden" | null;
1872
+ enabled_tools: Array<{
1873
+ name: string;
1874
+ title: string | null;
1875
+ }> | "hidden" | null;
1876
+ run_tools_automatically: {
1877
+ read: boolean;
1878
+ write: boolean;
1879
+ };
1880
+ } | {
1881
+ type: "custom_mcp_server";
1882
+ name: string;
1883
+ account: {
1884
+ type: "mcp_server";
1885
+ server_host: string;
1886
+ } | "hidden" | null;
1887
+ enabled_tools: Array<{
1888
+ name: string;
1889
+ title: string | null;
1890
+ }> | "hidden" | null;
1891
+ run_tools_automatically: {
1892
+ read: boolean;
1893
+ write: boolean;
1894
+ };
1895
+ } | {
1896
+ type: "asana" | "box" | "browser" | "calendar" | "computer" | "confluence" | "cursor" | "files" | "fs" | "github" | "gmail" | "google_calendar" | "google_drive" | "google_drive_oauth" | "gtm" | "helpdocs" | "images" | "jira" | "linear" | "mail" | "marketplace" | "memory" | "microsoft_teams" | "outlook" | "salesforce" | "search" | "security" | "sharepoint" | "skills" | "system" | "test" | "web" | "webhooks" | "worker" | "workers";
1897
+ name: string;
1898
+ account: string | null;
1899
+ permissions: Array<{
1900
+ target: {
1901
+ type: string;
1902
+ id: string;
1903
+ };
1904
+ scopes: Array<string>;
1905
+ }>;
1906
+ }>;
1907
+ status: "active";
1908
+ pause_reason: null;
1909
+ created_by: null;
1910
+ agent_version: null;
1911
+ created_time: null;
1912
+ last_edited_time: null;
1913
+ last_run_at: null;
1914
+ credit_limit: null;
1915
+ triggers: Array<{
1916
+ type: string;
1917
+ enabled: boolean;
1918
+ schedule?: {
1919
+ frequency: string;
1920
+ interval: number;
1921
+ weekdays?: Array<string>;
1922
+ monthdays?: Array<number>;
1923
+ week_numbers?: Array<number>;
1924
+ hour?: number;
1925
+ minute?: number;
1926
+ timezone?: string;
1927
+ start_date?: string;
1928
+ end?: {
1929
+ type: "date";
1930
+ end_at: string;
1931
+ } | {
1932
+ type: "count";
1933
+ occurrences: number;
1934
+ };
1935
+ };
1936
+ config?: Record<string, Record<string, never>>;
1937
+ }>;
1938
+ }>;
1939
+ has_more: boolean;
1940
+ next_cursor: string | null;
1941
+ };
1942
+ /**
1943
+ * Query agents
1944
+ */
1945
+ export declare const queryAgents: {
1946
+ readonly method: "post";
1947
+ readonly pathParams: readonly [];
1948
+ readonly queryParams: readonly [];
1949
+ readonly bodyParams: readonly ["query", "filter", "sorts", "start_cursor", "page_size", "verbose", "include_deleted"];
1950
+ readonly path: () => string;
1951
+ };
1952
+ type QuerySessionEventsPathParameters = {
1953
+ session_id: IdRequest;
1954
+ };
1955
+ type QuerySessionEventsBodyParameters = {
1956
+ filter?: {
1957
+ property: "id";
1958
+ string: {
1959
+ equals: string;
1960
+ };
1961
+ } | {
1962
+ property: "type";
1963
+ event_type: {
1964
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1965
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1966
+ };
1967
+ } | {
1968
+ property: "sequence";
1969
+ number: {
1970
+ greater_than?: number;
1971
+ greater_than_or_equal_to?: number;
1972
+ less_than?: number;
1973
+ less_than_or_equal_to?: number;
1974
+ };
1975
+ } | {
1976
+ property: "created_at";
1977
+ timestamp: {
1978
+ equals?: string;
1979
+ before?: string;
1980
+ after?: string;
1981
+ on_or_before?: string;
1982
+ on_or_after?: string;
1983
+ };
1984
+ } | {
1985
+ and: Array<{
1986
+ property: "id";
1987
+ string: {
1988
+ equals: string;
1989
+ };
1990
+ } | {
1991
+ property: "type";
1992
+ event_type: {
1993
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1994
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1995
+ };
1996
+ } | {
1997
+ property: "sequence";
1998
+ number: {
1999
+ greater_than?: number;
2000
+ greater_than_or_equal_to?: number;
2001
+ less_than?: number;
2002
+ less_than_or_equal_to?: number;
2003
+ };
2004
+ } | {
2005
+ property: "created_at";
2006
+ timestamp: {
2007
+ equals?: string;
2008
+ before?: string;
2009
+ after?: string;
2010
+ on_or_before?: string;
2011
+ on_or_after?: string;
2012
+ };
2013
+ } | {
2014
+ and: Array<{
2015
+ property: "id";
2016
+ string: {
2017
+ equals: string;
2018
+ };
2019
+ } | {
2020
+ property: "type";
2021
+ event_type: {
2022
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2023
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2024
+ };
2025
+ } | {
2026
+ property: "sequence";
2027
+ number: {
2028
+ greater_than?: number;
2029
+ greater_than_or_equal_to?: number;
2030
+ less_than?: number;
2031
+ less_than_or_equal_to?: number;
2032
+ };
2033
+ } | {
2034
+ property: "created_at";
2035
+ timestamp: {
2036
+ equals?: string;
2037
+ before?: string;
2038
+ after?: string;
2039
+ on_or_before?: string;
2040
+ on_or_after?: string;
2041
+ };
2042
+ } | {
2043
+ and: Array<{
2044
+ property: "id";
2045
+ string: {
2046
+ equals: string;
2047
+ };
2048
+ } | {
2049
+ property: "type";
2050
+ event_type: {
2051
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2052
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2053
+ };
2054
+ } | {
2055
+ property: "sequence";
2056
+ number: {
2057
+ greater_than?: number;
2058
+ greater_than_or_equal_to?: number;
2059
+ less_than?: number;
2060
+ less_than_or_equal_to?: number;
2061
+ };
2062
+ } | {
2063
+ property: "created_at";
2064
+ timestamp: {
2065
+ equals?: string;
2066
+ before?: string;
2067
+ after?: string;
2068
+ on_or_before?: string;
2069
+ on_or_after?: string;
2070
+ };
2071
+ }>;
2072
+ } | {
2073
+ or: Array<{
2074
+ property: "id";
2075
+ string: {
2076
+ equals: string;
2077
+ };
2078
+ } | {
2079
+ property: "type";
2080
+ event_type: {
2081
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2082
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2083
+ };
2084
+ } | {
2085
+ property: "sequence";
2086
+ number: {
2087
+ greater_than?: number;
2088
+ greater_than_or_equal_to?: number;
2089
+ less_than?: number;
2090
+ less_than_or_equal_to?: number;
2091
+ };
2092
+ } | {
2093
+ property: "created_at";
2094
+ timestamp: {
2095
+ equals?: string;
2096
+ before?: string;
2097
+ after?: string;
2098
+ on_or_before?: string;
2099
+ on_or_after?: string;
2100
+ };
2101
+ }>;
2102
+ }>;
2103
+ } | {
2104
+ or: Array<{
2105
+ property: "id";
2106
+ string: {
2107
+ equals: string;
2108
+ };
2109
+ } | {
2110
+ property: "type";
2111
+ event_type: {
2112
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2113
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2114
+ };
2115
+ } | {
2116
+ property: "sequence";
2117
+ number: {
2118
+ greater_than?: number;
2119
+ greater_than_or_equal_to?: number;
2120
+ less_than?: number;
2121
+ less_than_or_equal_to?: number;
2122
+ };
2123
+ } | {
2124
+ property: "created_at";
2125
+ timestamp: {
2126
+ equals?: string;
2127
+ before?: string;
2128
+ after?: string;
2129
+ on_or_before?: string;
2130
+ on_or_after?: string;
2131
+ };
2132
+ } | {
2133
+ and: Array<{
2134
+ property: "id";
2135
+ string: {
2136
+ equals: string;
2137
+ };
2138
+ } | {
2139
+ property: "type";
2140
+ event_type: {
2141
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2142
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2143
+ };
2144
+ } | {
2145
+ property: "sequence";
2146
+ number: {
2147
+ greater_than?: number;
2148
+ greater_than_or_equal_to?: number;
2149
+ less_than?: number;
2150
+ less_than_or_equal_to?: number;
2151
+ };
2152
+ } | {
2153
+ property: "created_at";
2154
+ timestamp: {
2155
+ equals?: string;
2156
+ before?: string;
2157
+ after?: string;
2158
+ on_or_before?: string;
2159
+ on_or_after?: string;
2160
+ };
2161
+ }>;
2162
+ } | {
2163
+ or: Array<{
2164
+ property: "id";
2165
+ string: {
2166
+ equals: string;
2167
+ };
2168
+ } | {
2169
+ property: "type";
2170
+ event_type: {
2171
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2172
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2173
+ };
2174
+ } | {
2175
+ property: "sequence";
2176
+ number: {
2177
+ greater_than?: number;
2178
+ greater_than_or_equal_to?: number;
2179
+ less_than?: number;
2180
+ less_than_or_equal_to?: number;
2181
+ };
2182
+ } | {
2183
+ property: "created_at";
2184
+ timestamp: {
2185
+ equals?: string;
2186
+ before?: string;
2187
+ after?: string;
2188
+ on_or_before?: string;
2189
+ on_or_after?: string;
2190
+ };
2191
+ }>;
2192
+ }>;
2193
+ }>;
2194
+ } | {
2195
+ or: Array<{
2196
+ property: "id";
2197
+ string: {
2198
+ equals: string;
2199
+ };
2200
+ } | {
2201
+ property: "type";
2202
+ event_type: {
2203
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2204
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2205
+ };
2206
+ } | {
2207
+ property: "sequence";
2208
+ number: {
2209
+ greater_than?: number;
2210
+ greater_than_or_equal_to?: number;
2211
+ less_than?: number;
2212
+ less_than_or_equal_to?: number;
2213
+ };
2214
+ } | {
2215
+ property: "created_at";
2216
+ timestamp: {
2217
+ equals?: string;
2218
+ before?: string;
2219
+ after?: string;
2220
+ on_or_before?: string;
2221
+ on_or_after?: string;
2222
+ };
2223
+ } | {
2224
+ and: Array<{
2225
+ property: "id";
2226
+ string: {
2227
+ equals: string;
2228
+ };
2229
+ } | {
2230
+ property: "type";
2231
+ event_type: {
2232
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2233
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2234
+ };
2235
+ } | {
2236
+ property: "sequence";
2237
+ number: {
2238
+ greater_than?: number;
2239
+ greater_than_or_equal_to?: number;
2240
+ less_than?: number;
2241
+ less_than_or_equal_to?: number;
2242
+ };
2243
+ } | {
2244
+ property: "created_at";
2245
+ timestamp: {
2246
+ equals?: string;
2247
+ before?: string;
2248
+ after?: string;
2249
+ on_or_before?: string;
2250
+ on_or_after?: string;
2251
+ };
2252
+ } | {
2253
+ and: Array<{
2254
+ property: "id";
2255
+ string: {
2256
+ equals: string;
2257
+ };
2258
+ } | {
2259
+ property: "type";
2260
+ event_type: {
2261
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2262
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2263
+ };
2264
+ } | {
2265
+ property: "sequence";
2266
+ number: {
2267
+ greater_than?: number;
2268
+ greater_than_or_equal_to?: number;
2269
+ less_than?: number;
2270
+ less_than_or_equal_to?: number;
2271
+ };
2272
+ } | {
2273
+ property: "created_at";
2274
+ timestamp: {
2275
+ equals?: string;
2276
+ before?: string;
2277
+ after?: string;
2278
+ on_or_before?: string;
2279
+ on_or_after?: string;
2280
+ };
2281
+ }>;
2282
+ } | {
2283
+ or: Array<{
2284
+ property: "id";
2285
+ string: {
2286
+ equals: string;
2287
+ };
2288
+ } | {
2289
+ property: "type";
2290
+ event_type: {
2291
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2292
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2293
+ };
2294
+ } | {
2295
+ property: "sequence";
2296
+ number: {
2297
+ greater_than?: number;
2298
+ greater_than_or_equal_to?: number;
2299
+ less_than?: number;
2300
+ less_than_or_equal_to?: number;
2301
+ };
2302
+ } | {
2303
+ property: "created_at";
2304
+ timestamp: {
2305
+ equals?: string;
2306
+ before?: string;
2307
+ after?: string;
2308
+ on_or_before?: string;
2309
+ on_or_after?: string;
2310
+ };
2311
+ }>;
2312
+ }>;
2313
+ } | {
2314
+ or: Array<{
2315
+ property: "id";
2316
+ string: {
2317
+ equals: string;
2318
+ };
2319
+ } | {
2320
+ property: "type";
2321
+ event_type: {
2322
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2323
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2324
+ };
2325
+ } | {
2326
+ property: "sequence";
2327
+ number: {
2328
+ greater_than?: number;
2329
+ greater_than_or_equal_to?: number;
2330
+ less_than?: number;
2331
+ less_than_or_equal_to?: number;
2332
+ };
2333
+ } | {
2334
+ property: "created_at";
2335
+ timestamp: {
2336
+ equals?: string;
2337
+ before?: string;
2338
+ after?: string;
2339
+ on_or_before?: string;
2340
+ on_or_after?: string;
2341
+ };
2342
+ } | {
2343
+ and: Array<{
2344
+ property: "id";
2345
+ string: {
2346
+ equals: string;
2347
+ };
2348
+ } | {
2349
+ property: "type";
2350
+ event_type: {
2351
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2352
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2353
+ };
2354
+ } | {
2355
+ property: "sequence";
2356
+ number: {
2357
+ greater_than?: number;
2358
+ greater_than_or_equal_to?: number;
2359
+ less_than?: number;
2360
+ less_than_or_equal_to?: number;
2361
+ };
2362
+ } | {
2363
+ property: "created_at";
2364
+ timestamp: {
2365
+ equals?: string;
2366
+ before?: string;
2367
+ after?: string;
2368
+ on_or_before?: string;
2369
+ on_or_after?: string;
2370
+ };
2371
+ }>;
2372
+ } | {
2373
+ or: Array<{
2374
+ property: "id";
2375
+ string: {
2376
+ equals: string;
2377
+ };
2378
+ } | {
2379
+ property: "type";
2380
+ event_type: {
2381
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2382
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2383
+ };
2384
+ } | {
2385
+ property: "sequence";
2386
+ number: {
2387
+ greater_than?: number;
2388
+ greater_than_or_equal_to?: number;
2389
+ less_than?: number;
2390
+ less_than_or_equal_to?: number;
2391
+ };
2392
+ } | {
2393
+ property: "created_at";
2394
+ timestamp: {
2395
+ equals?: string;
2396
+ before?: string;
2397
+ after?: string;
2398
+ on_or_before?: string;
2399
+ on_or_after?: string;
2400
+ };
2401
+ }>;
2402
+ }>;
2403
+ }>;
2404
+ };
2405
+ sorts?: Array<{
2406
+ property: "sequence" | "created_at";
2407
+ direction: "ascending" | "descending";
2408
+ }>;
2409
+ start_cursor?: string | null;
2410
+ page_size?: number;
2411
+ };
2412
+ export type QuerySessionEventsParameters = QuerySessionEventsPathParameters & QuerySessionEventsBodyParameters;
2413
+ export type QuerySessionEventsResponse = {
2414
+ object: "list";
2415
+ type: "session_event";
2416
+ session_event: Record<string, never>;
2417
+ results: Array<{
2418
+ object: "session_event";
2419
+ id: string;
2420
+ session_id: string;
2421
+ sequence: number;
2422
+ created_at: string;
2423
+ type: "user.message";
2424
+ content: Array<{
2425
+ type: "text";
2426
+ text: string;
2427
+ } | {
2428
+ type: "file";
2429
+ name: string;
2430
+ content_type: string;
2431
+ url: string;
2432
+ expiry_time?: string;
2433
+ }>;
2434
+ created_by: {
2435
+ id: string;
2436
+ type: "user" | "bot";
2437
+ } | null;
2438
+ metadata: Record<string, string> | null;
2439
+ } | {
2440
+ object: "session_event";
2441
+ id: string;
2442
+ session_id: string;
2443
+ sequence: number;
2444
+ created_at: string;
2445
+ type: "agent.message";
2446
+ content: Array<{
2447
+ type: "text";
2448
+ text: string;
2449
+ } | {
2450
+ type: "file";
2451
+ name: string;
2452
+ content_type: string;
2453
+ url: string;
2454
+ expiry_time?: string;
2455
+ }>;
2456
+ created_by: {
2457
+ id: string;
2458
+ type: "user" | "bot";
2459
+ } | null;
2460
+ metadata: {
2461
+ model: string;
2462
+ } | null;
2463
+ } | {
2464
+ object: "session_event";
2465
+ id: string;
2466
+ session_id: string;
2467
+ sequence: number;
2468
+ created_at: string;
2469
+ type: "agent.thinking";
2470
+ content: Array<{
2471
+ type: "text";
2472
+ text: string;
2473
+ }>;
2474
+ } | {
2475
+ object: "session_event";
2476
+ id: string;
2477
+ session_id: string;
2478
+ sequence: number;
2479
+ created_at: string;
2480
+ type: "agent.tool_use";
2481
+ tool_name: string;
2482
+ } | {
2483
+ object: "session_event";
2484
+ id: string;
2485
+ session_id: string;
2486
+ sequence: number;
2487
+ created_at: string;
2488
+ type: "agent.tool_result";
2489
+ tool_use_id: string;
2490
+ tool_name: string;
2491
+ is_error: boolean;
2492
+ } | {
2493
+ object: "session_event";
2494
+ id: string;
2495
+ session_id: string;
2496
+ sequence: number;
2497
+ created_at: string;
2498
+ type: "session.status";
2499
+ status: "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2500
+ required_actions?: Array<{
2501
+ action_id: string;
2502
+ title: string;
2503
+ options: Array<{
2504
+ id: "approve" | "reject";
2505
+ label: string;
2506
+ }>;
2507
+ }>;
2508
+ error?: {
2509
+ code: string;
2510
+ message: string;
2511
+ retryable: boolean;
2512
+ };
2513
+ }>;
2514
+ has_more: boolean;
2515
+ next_cursor: string | null;
2516
+ };
2517
+ /**
2518
+ * Query session events
2519
+ */
2520
+ export declare const querySessionEvents: {
2521
+ readonly method: "post";
2522
+ readonly pathParams: readonly ["session_id"];
2523
+ readonly queryParams: readonly [];
2524
+ readonly bodyParams: readonly ["filter", "sorts", "start_cursor", "page_size"];
2525
+ readonly path: (p: QuerySessionEventsPathParameters) => string;
2526
+ };
2527
+ type QuerySessionsBodyParameters = {
2528
+ query?: string;
2529
+ filter?: {
2530
+ property: "id";
2531
+ string: {
2532
+ equals: string;
2533
+ };
2534
+ } | {
2535
+ property: "agent_id";
2536
+ string: {
2537
+ equals: string;
2538
+ };
2539
+ } | {
2540
+ property: "status";
2541
+ status: {
2542
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2543
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2544
+ };
2545
+ } | {
2546
+ property: "created_at" | "updated_at";
2547
+ timestamp: {
2548
+ before?: string;
2549
+ after?: string;
2550
+ on_or_before?: string;
2551
+ on_or_after?: string;
2552
+ };
2553
+ } | {
2554
+ and: Array<{
2555
+ property: "id";
2556
+ string: {
2557
+ equals: string;
2558
+ };
2559
+ } | {
2560
+ property: "agent_id";
2561
+ string: {
2562
+ equals: string;
2563
+ };
2564
+ } | {
2565
+ property: "status";
2566
+ status: {
2567
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2568
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2569
+ };
2570
+ } | {
2571
+ property: "created_at" | "updated_at";
2572
+ timestamp: {
2573
+ before?: string;
2574
+ after?: string;
2575
+ on_or_before?: string;
2576
+ on_or_after?: string;
2577
+ };
2578
+ } | {
2579
+ and: Array<{
2580
+ property: "id";
2581
+ string: {
2582
+ equals: string;
2583
+ };
2584
+ } | {
2585
+ property: "agent_id";
2586
+ string: {
2587
+ equals: string;
2588
+ };
2589
+ } | {
2590
+ property: "status";
2591
+ status: {
2592
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2593
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2594
+ };
2595
+ } | {
2596
+ property: "created_at" | "updated_at";
2597
+ timestamp: {
2598
+ before?: string;
2599
+ after?: string;
2600
+ on_or_before?: string;
2601
+ on_or_after?: string;
2602
+ };
2603
+ }>;
2604
+ } | {
2605
+ or: Array<{
2606
+ property: "id";
2607
+ string: {
2608
+ equals: string;
2609
+ };
2610
+ } | {
2611
+ property: "agent_id";
2612
+ string: {
2613
+ equals: string;
2614
+ };
2615
+ } | {
2616
+ property: "status";
2617
+ status: {
2618
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2619
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2620
+ };
2621
+ } | {
2622
+ property: "created_at" | "updated_at";
2623
+ timestamp: {
2624
+ before?: string;
2625
+ after?: string;
2626
+ on_or_before?: string;
2627
+ on_or_after?: string;
2628
+ };
2629
+ }>;
2630
+ }>;
2631
+ } | {
2632
+ or: Array<{
2633
+ property: "id";
2634
+ string: {
2635
+ equals: string;
2636
+ };
2637
+ } | {
2638
+ property: "agent_id";
2639
+ string: {
2640
+ equals: string;
2641
+ };
2642
+ } | {
2643
+ property: "status";
2644
+ status: {
2645
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2646
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2647
+ };
2648
+ } | {
2649
+ property: "created_at" | "updated_at";
2650
+ timestamp: {
2651
+ before?: string;
2652
+ after?: string;
2653
+ on_or_before?: string;
2654
+ on_or_after?: string;
2655
+ };
2656
+ } | {
2657
+ and: Array<{
2658
+ property: "id";
2659
+ string: {
2660
+ equals: string;
2661
+ };
2662
+ } | {
2663
+ property: "agent_id";
2664
+ string: {
2665
+ equals: string;
2666
+ };
2667
+ } | {
2668
+ property: "status";
2669
+ status: {
2670
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2671
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2672
+ };
2673
+ } | {
2674
+ property: "created_at" | "updated_at";
2675
+ timestamp: {
2676
+ before?: string;
2677
+ after?: string;
2678
+ on_or_before?: string;
2679
+ on_or_after?: string;
2680
+ };
2681
+ }>;
2682
+ } | {
2683
+ or: Array<{
2684
+ property: "id";
2685
+ string: {
2686
+ equals: string;
2687
+ };
2688
+ } | {
2689
+ property: "agent_id";
2690
+ string: {
2691
+ equals: string;
2692
+ };
2693
+ } | {
2694
+ property: "status";
2695
+ status: {
2696
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2697
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2698
+ };
2699
+ } | {
2700
+ property: "created_at" | "updated_at";
2701
+ timestamp: {
2702
+ before?: string;
2703
+ after?: string;
2704
+ on_or_before?: string;
2705
+ on_or_after?: string;
2706
+ };
2707
+ }>;
2708
+ }>;
2709
+ };
2710
+ sorts?: Array<{
2711
+ property: "created_at" | "updated_at";
2712
+ direction: "ascending" | "descending";
2713
+ }>;
2714
+ start_cursor?: string | null;
2715
+ page_size?: number;
2716
+ };
2717
+ export type QuerySessionsParameters = QuerySessionsBodyParameters;
2718
+ export type QuerySessionsResponse = {
2719
+ object: "list";
2720
+ type: "session";
2721
+ session: Record<string, never>;
2722
+ results: Array<{
2723
+ object: "session";
2724
+ id: string;
2725
+ agent_id: string;
2726
+ title: string;
2727
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2728
+ created_by: {
2729
+ id: string;
2730
+ type: "user" | "bot";
2731
+ };
2732
+ agent_version: {
2733
+ id: string;
2734
+ number: number;
2735
+ published_at: string;
2736
+ } | null;
2737
+ models: {
2738
+ type: "auto";
2739
+ } | {
2740
+ type: "pinned";
2741
+ ids: Array<string | null>;
2742
+ };
2743
+ created_at: string;
2744
+ updated_at: string;
2745
+ required_actions?: Array<{
2746
+ action_id: string;
2747
+ title: string;
2748
+ options: Array<{
2749
+ id: "approve" | "reject";
2750
+ label: string;
2751
+ }>;
2752
+ }>;
2753
+ error?: {
2754
+ code: string;
2755
+ message: string;
2756
+ retryable: boolean;
2757
+ };
2758
+ trigger_type?: string;
2759
+ type_labels?: Array<string> | null;
2760
+ chat_user_emails?: Array<string> | null;
2761
+ tool_types?: Array<string> | null;
2762
+ tool_call_count?: number | null;
2763
+ credits_used?: number | null;
2764
+ runs_completed?: number | null;
2765
+ message_count?: number | null;
2766
+ }>;
2767
+ has_more: boolean;
2768
+ next_cursor: string | null;
2769
+ };
2770
+ /**
2771
+ * Query sessions
2772
+ */
2773
+ export declare const querySessions: {
2774
+ readonly method: "post";
2775
+ readonly pathParams: readonly [];
2776
+ readonly queryParams: readonly [];
2777
+ readonly bodyParams: readonly ["query", "filter", "sorts", "start_cursor", "page_size"];
2778
+ readonly path: () => string;
2779
+ };
2780
+ type QueryThreadMessagesPathParameters = {
2781
+ thread_id: IdRequest;
2782
+ };
2783
+ type QueryThreadMessagesBodyParameters = {
2784
+ verbose?: boolean;
2785
+ start_cursor?: string | null;
2786
+ page_size?: number;
2787
+ };
2788
+ export type QueryThreadMessagesParameters = QueryThreadMessagesPathParameters & QueryThreadMessagesBodyParameters;
2789
+ export type QueryThreadMessagesResponse = {
2790
+ object: "list";
2791
+ type: "thread_message";
2792
+ results: Array<{
2793
+ object: "thread_message";
2794
+ id: IdResponse;
2795
+ role: "user" | "agent";
2796
+ content: string;
2797
+ created_time: string;
2798
+ parent: {
2799
+ type: "thread";
2800
+ id: IdResponse;
2801
+ };
2802
+ attachments?: Array<{
2803
+ name: string;
2804
+ content_type: string;
2805
+ url: string;
2806
+ expiry_time?: string;
2807
+ }>;
2808
+ content_parts?: Array<{
2809
+ type: "text";
2810
+ text: string;
2811
+ } | {
2812
+ type: "thinking";
2813
+ text: string;
2814
+ } | {
2815
+ type: "tool_call";
2816
+ tool_call_id: string | null;
2817
+ tool_name: string;
2818
+ input: string;
2819
+ results?: Array<{
2820
+ id: IdResponse;
2821
+ agent_step_id: IdResponse | null;
2822
+ tool_call_id: string | null;
2823
+ tool_name: string;
2824
+ tool_type: string;
2825
+ state: string;
2826
+ input: Record<string, never> | null;
2827
+ output: Record<string, never> | null;
2828
+ error: string | null;
2829
+ started_at: number;
2830
+ finished_at: number | null;
2831
+ duration_ms: number | null;
2832
+ }>;
2833
+ } | {
2834
+ type: "follow_ups";
2835
+ follow_ups: Array<{
2836
+ label: string;
2837
+ message: string;
2838
+ }>;
2839
+ } | {
2840
+ type: "custom_agent_template_picker";
2841
+ }>;
2842
+ pending_user_actions?: Array<{
2843
+ id: IdResponse;
2844
+ type: "tool_confirmation";
2845
+ title: string;
2846
+ requirements: Array<{
2847
+ type: "general";
2848
+ } | {
2849
+ type: "manage_workers";
2850
+ } | {
2851
+ type: "url_safety";
2852
+ urls: Array<string>;
2853
+ required_by_workspace_policy?: boolean;
2854
+ } | {
2855
+ type: "permission_escalation";
2856
+ destination_title?: string;
2857
+ source_titles?: Array<string>;
2858
+ } | {
2859
+ type: "delete_content";
2860
+ page_count: number;
2861
+ database_count: number;
2862
+ meeting_notes_block_count?: number;
2863
+ } | {
2864
+ type: "connect_integration";
2865
+ integration_type: string;
2866
+ integration_name: string;
2867
+ handoff_url: string;
2868
+ } | {
2869
+ type: "admin_mode";
2870
+ explanation?: string;
2871
+ }>;
2872
+ options: Array<{
2873
+ id: "approve";
2874
+ label: string;
2875
+ } | {
2876
+ id: "reject";
2877
+ label: string;
2878
+ } | {
2879
+ id: "use_connection";
2880
+ label: string;
2881
+ input: {
2882
+ type: "connection_id";
2883
+ required: true;
2884
+ };
2885
+ }>;
2886
+ }>;
2887
+ }>;
2888
+ has_more: boolean;
2889
+ next_cursor: string | null;
2890
+ };
2891
+ /**
2892
+ * Query thread messages
2893
+ */
2894
+ export declare const queryThreadMessages: {
2895
+ readonly method: "post";
2896
+ readonly pathParams: readonly ["thread_id"];
2897
+ readonly queryParams: readonly [];
2898
+ readonly bodyParams: readonly ["verbose", "start_cursor", "page_size"];
2899
+ readonly path: (p: QueryThreadMessagesPathParameters) => string;
2900
+ };
2901
+ type QueryThreadsPathParameters = {
2902
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
2903
+ };
2904
+ type QueryThreadsBodyParameters = {
2905
+ query?: string;
2906
+ filter?: {
2907
+ id?: IdRequest;
2908
+ status?: Array<"all" | "pending" | "in_progress" | "failed" | "success">;
2909
+ created_by?: Array<IdRequest | "me">;
2910
+ last_used_by?: Array<IdRequest | "me">;
2911
+ message_time?: {
2912
+ start?: string;
2913
+ end?: string;
2914
+ };
2915
+ };
2916
+ sorts?: Array<{
2917
+ timestamp: "created_time" | "last_used_time";
2918
+ direction: "ascending" | "descending";
2919
+ }>;
2920
+ start_cursor?: string | null;
2921
+ page_size?: number;
2922
+ };
2923
+ export type QueryThreadsParameters = QueryThreadsPathParameters & QueryThreadsBodyParameters;
2924
+ export type QueryThreadsResponse = {
2925
+ object: "list";
2926
+ type: "thread";
2927
+ results: Array<{
2928
+ object: "thread";
2929
+ id: IdResponse;
2930
+ title: string;
2931
+ status: "pending" | "requires_action" | "completed" | "failed";
2932
+ created_time: string;
2933
+ last_edited_time: string;
2934
+ created_by: {
2935
+ id: IdResponse;
2936
+ type: "bot" | "user";
2937
+ };
2938
+ agent_version: {
2939
+ id: IdResponse;
2940
+ number: number;
2941
+ published_at: string;
2942
+ } | null;
2943
+ models: {
2944
+ type: "auto";
2945
+ } | {
2946
+ type: "pinned";
2947
+ ids: Array<string | null>;
2948
+ };
2949
+ error?: string;
2950
+ trigger_type?: string;
2951
+ type_labels?: Array<string> | null;
2952
+ chat_user_emails?: Array<string> | null;
2953
+ tool_types?: Array<string> | null;
2954
+ tool_call_count?: number | null;
2955
+ credits_used?: number | null;
2956
+ runs_completed?: number | null;
2957
+ pending_user_actions?: Array<{
2958
+ id: IdResponse;
2959
+ type: "tool_confirmation";
2960
+ title: string;
2961
+ requirements: Array<{
2962
+ type: "general";
2963
+ } | {
2964
+ type: "manage_workers";
2965
+ } | {
2966
+ type: "url_safety";
2967
+ urls: Array<string>;
2968
+ required_by_workspace_policy?: boolean;
2969
+ } | {
2970
+ type: "permission_escalation";
2971
+ destination_title?: string;
2972
+ source_titles?: Array<string>;
2973
+ } | {
2974
+ type: "delete_content";
2975
+ page_count: number;
2976
+ database_count: number;
2977
+ meeting_notes_block_count?: number;
2978
+ } | {
2979
+ type: "connect_integration";
2980
+ integration_type: string;
2981
+ integration_name: string;
2982
+ handoff_url: string;
2983
+ } | {
2984
+ type: "admin_mode";
2985
+ explanation?: string;
2986
+ }>;
2987
+ options: Array<{
2988
+ id: "approve";
2989
+ label: string;
2990
+ } | {
2991
+ id: "reject";
2992
+ label: string;
2993
+ } | {
2994
+ id: "use_connection";
2995
+ label: string;
2996
+ input: {
2997
+ type: "connection_id";
2998
+ required: true;
2999
+ };
3000
+ }>;
3001
+ }>;
3002
+ }>;
3003
+ has_more: boolean;
3004
+ next_cursor: string | null;
3005
+ };
3006
+ /**
3007
+ * Query threads
3008
+ */
3009
+ export declare const queryThreads: {
3010
+ readonly method: "post";
3011
+ readonly pathParams: readonly ["agent_id"];
3012
+ readonly queryParams: readonly [];
3013
+ readonly bodyParams: readonly ["query", "filter", "sorts", "start_cursor", "page_size"];
3014
+ readonly path: (p: QueryThreadsPathParameters) => string;
3015
+ };
3016
+ type RetrieveSessionPathParameters = {
3017
+ session_id: IdRequest;
3018
+ };
3019
+ export type RetrieveSessionParameters = RetrieveSessionPathParameters;
3020
+ export type RetrieveSessionResponse = {
3021
+ object: "session";
3022
+ id: string;
3023
+ agent_id: string;
3024
+ title: string;
3025
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
3026
+ created_at: string;
3027
+ updated_at: string;
3028
+ created_by: {
3029
+ id: string;
3030
+ type: "user" | "bot";
3031
+ };
3032
+ agent_version: {
3033
+ id: string;
3034
+ number: number;
3035
+ published_at: string;
3036
+ } | null;
3037
+ models: {
3038
+ type: "auto";
3039
+ } | {
3040
+ type: "pinned";
3041
+ ids: Array<string | null>;
3042
+ };
3043
+ required_actions?: Array<{
3044
+ action_id: string;
3045
+ title: string;
3046
+ options: Array<{
3047
+ id: "approve" | "reject";
3048
+ label: string;
3049
+ }>;
3050
+ }>;
3051
+ error?: {
3052
+ code: string;
3053
+ message: string;
3054
+ retryable: boolean;
3055
+ };
3056
+ trigger_type?: string;
3057
+ type_labels?: Array<string> | null;
3058
+ chat_user_emails?: Array<string> | null;
3059
+ tool_types?: Array<string> | null;
3060
+ tool_call_count?: number | null;
3061
+ credits_used?: number | null;
3062
+ runs_completed?: number | null;
3063
+ message_count?: number | null;
3064
+ };
3065
+ /**
3066
+ * Retrieve a session
3067
+ */
3068
+ export declare const retrieveSession: {
3069
+ readonly method: "get";
3070
+ readonly pathParams: readonly ["session_id"];
3071
+ readonly queryParams: readonly [];
3072
+ readonly bodyParams: readonly [];
3073
+ readonly path: (p: RetrieveSessionPathParameters) => string;
3074
+ };
3075
+ type SendExternalAgentStubSessionMessagePathParameters = {
3076
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
3077
+ session_id: IdRequest;
3078
+ };
3079
+ type SendExternalAgentStubSessionMessageBodyParameters = {
3080
+ message: string;
3081
+ client_message_id?: string;
3082
+ };
3083
+ export type SendExternalAgentStubSessionMessageParameters = SendExternalAgentStubSessionMessagePathParameters & SendExternalAgentStubSessionMessageBodyParameters;
3084
+ export type SendExternalAgentStubSessionMessageResponse = {
3085
+ accepted: boolean;
3086
+ run_id?: string;
3087
+ };
3088
+ /**
3089
+ * Send external agent stub session message
3090
+ */
3091
+ export declare const sendExternalAgentStubSessionMessage: {
3092
+ readonly method: "post";
3093
+ readonly pathParams: readonly ["agent_id", "session_id"];
3094
+ readonly queryParams: readonly [];
3095
+ readonly bodyParams: readonly ["message", "client_message_id"];
3096
+ readonly path: (p: SendExternalAgentStubSessionMessagePathParameters) => string;
3097
+ };
3098
+ type StartExternalAgentStubSessionPathParameters = {
3099
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
3100
+ };
3101
+ type StartExternalAgentStubSessionBodyParameters = {
3102
+ spec_version?: "v1";
3103
+ client_reference_id?: string;
3104
+ configs?: {
3105
+ mcp_servers: Array<{
3106
+ name: string;
3107
+ server_url: string;
3108
+ credential: {
3109
+ type: "vault";
3110
+ vault_id: string;
3111
+ } | {
3112
+ type: "none";
3113
+ };
3114
+ }>;
3115
+ };
3116
+ model?: string;
3117
+ cwd?: string;
3118
+ locale?: string;
3119
+ system_prompt?: string;
3120
+ };
3121
+ export type StartExternalAgentStubSessionParameters = StartExternalAgentStubSessionPathParameters & StartExternalAgentStubSessionBodyParameters;
3122
+ export type StartExternalAgentStubSessionResponse = {
3123
+ session_id: string;
3124
+ model?: string;
3125
+ cwd?: string;
3126
+ last_active_at?: string;
3127
+ };
3128
+ /**
3129
+ * Start external agent stub session
3130
+ */
3131
+ export declare const startExternalAgentStubSession: {
3132
+ readonly method: "post";
3133
+ readonly pathParams: readonly ["agent_id"];
3134
+ readonly queryParams: readonly [];
3135
+ readonly bodyParams: readonly ["spec_version", "client_reference_id", "configs", "model", "cwd", "locale", "system_prompt"];
3136
+ readonly path: (p: StartExternalAgentStubSessionPathParameters) => string;
3137
+ };
3138
+ type UpdateAgentCreditLimitPathParameters = {
3139
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
3140
+ };
3141
+ type UpdateAgentCreditLimitBodyParameters = {
3142
+ credit_limit: number | null;
3143
+ };
3144
+ export type UpdateAgentCreditLimitParameters = UpdateAgentCreditLimitPathParameters & UpdateAgentCreditLimitBodyParameters;
3145
+ export type UpdateAgentCreditLimitResponse = {
3146
+ agent_id: IdResponse;
3147
+ credit_limit: number | null;
3148
+ last_edited_time: string;
3149
+ };
3150
+ /**
3151
+ * Update agent credit limit
3152
+ */
3153
+ export declare const updateAgentCreditLimit: {
3154
+ readonly method: "patch";
3155
+ readonly pathParams: readonly ["agent_id"];
3156
+ readonly queryParams: readonly [];
3157
+ readonly bodyParams: readonly ["credit_limit"];
3158
+ readonly path: (p: UpdateAgentCreditLimitPathParameters) => string;
3159
+ };
3160
+ type UpdateAgentStatusPathParameters = {
3161
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
3162
+ };
3163
+ type UpdateAgentStatusBodyParameters = {
3164
+ status: "active" | "disabled";
3165
+ };
3166
+ export type UpdateAgentStatusParameters = UpdateAgentStatusPathParameters & UpdateAgentStatusBodyParameters;
3167
+ export type UpdateAgentStatusResponse = {
3168
+ agent_id: IdResponse;
3169
+ status: "active" | "disabled" | "deleted";
3170
+ pause_reason: "run_limit" | "credit_limit" | "runaway_credit_usage" | "workspace_credit_limit" | "failure_limit" | "mark_session_failed_autopause" | "disabled_from_workspace_settings" | "disabled_from_api" | "disabled_from_agent_settings" | "disabled_due_to_no_members_with_access" | "disabled_due_to_lack_of_editors" | "disabled_by_notion" | "internal_error" | "needs_user_review" | "tool_unavailable" | null;
3171
+ last_edited_time: string;
3172
+ };
3173
+ /**
3174
+ * Update agent status
3175
+ */
3176
+ export declare const updateAgentStatus: {
3177
+ readonly method: "patch";
3178
+ readonly pathParams: readonly ["agent_id"];
3179
+ readonly queryParams: readonly [];
3180
+ readonly bodyParams: readonly ["status"];
3181
+ readonly path: (p: UpdateAgentStatusPathParameters) => string;
3182
+ };
3183
+ type UpdateSessionBodyParameters = {
3184
+ message: string;
3185
+ agent_id?: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
3186
+ session_id?: IdRequest;
3187
+ attachments?: Array<{
3188
+ file_upload: {
3189
+ id: string;
3190
+ };
3191
+ type?: "file_upload";
3192
+ name?: string;
3193
+ }>;
3194
+ metadata?: Record<string, string>;
3195
+ prompt_context?: string;
3196
+ } | {
3197
+ session_id: IdRequest;
3198
+ actions: Array<{
3199
+ action_id: IdRequest;
3200
+ option_id: "approve" | "reject";
3201
+ }>;
3202
+ metadata?: Record<string, string>;
3203
+ } | {
3204
+ session_id: IdRequest;
3205
+ continue_from: string;
3206
+ };
3207
+ export type UpdateSessionParameters = UpdateSessionBodyParameters;
3208
+ export type UpdateSessionResponse = {
3209
+ object: "session";
3210
+ id: string;
3211
+ agent_id: string;
3212
+ title: string;
3213
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
3214
+ created_at: string;
3215
+ updated_at: string;
3216
+ required_actions?: Array<{
3217
+ action_id: string;
3218
+ title: string;
3219
+ options: Array<{
3220
+ id: "approve" | "reject";
3221
+ label: string;
3222
+ }>;
3223
+ }>;
3224
+ error?: {
3225
+ code: string;
3226
+ message: string;
3227
+ retryable: boolean;
3228
+ };
3229
+ };
3230
+ /**
3231
+ * Update a session
3232
+ */
3233
+ export declare const updateSession: {
3234
+ readonly method: "post";
3235
+ readonly pathParams: readonly [];
3236
+ readonly queryParams: readonly [];
3237
+ readonly bodyParams: readonly ["message", "agent_id", "session_id", "attachments", "metadata", "prompt_context", "actions", "continue_from"];
3238
+ readonly path: () => string;
3239
+ };
3240
+ export {};
3241
+ //# sourceMappingURL=agents.d.ts.map