@zavudev/sdk 0.54.0 → 0.56.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.
Files changed (282) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/client.d.mts +25 -10
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +25 -10
  5. package/client.d.ts.map +1 -1
  6. package/client.js +15 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +15 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/agent-templates.d.mts +97 -0
  12. package/resources/agent-templates.d.mts.map +1 -0
  13. package/resources/agent-templates.d.ts +97 -0
  14. package/resources/agent-templates.d.ts.map +1 -0
  15. package/resources/agent-templates.js +39 -0
  16. package/resources/agent-templates.js.map +1 -0
  17. package/resources/agent-templates.mjs +35 -0
  18. package/resources/agent-templates.mjs.map +1 -0
  19. package/resources/agents/agents.d.mts +462 -0
  20. package/resources/agents/agents.d.mts.map +1 -0
  21. package/resources/agents/agents.d.ts +462 -0
  22. package/resources/agents/agents.d.ts.map +1 -0
  23. package/resources/agents/agents.js +129 -0
  24. package/resources/agents/agents.js.map +1 -0
  25. package/resources/agents/agents.mjs +124 -0
  26. package/resources/agents/agents.mjs.map +1 -0
  27. package/resources/agents/index.d.mts +3 -0
  28. package/resources/agents/index.d.mts.map +1 -0
  29. package/resources/agents/index.d.ts +3 -0
  30. package/resources/agents/index.d.ts.map +1 -0
  31. package/resources/agents/index.js +9 -0
  32. package/resources/agents/index.js.map +1 -0
  33. package/resources/agents/index.mjs +4 -0
  34. package/resources/agents/index.mjs.map +1 -0
  35. package/resources/agents/senders.d.mts +54 -0
  36. package/resources/agents/senders.d.mts.map +1 -0
  37. package/resources/agents/senders.d.ts +54 -0
  38. package/resources/agents/senders.d.ts.map +1 -0
  39. package/resources/agents/senders.js +45 -0
  40. package/resources/agents/senders.js.map +1 -0
  41. package/resources/agents/senders.mjs +41 -0
  42. package/resources/agents/senders.mjs.map +1 -0
  43. package/resources/agents.d.mts +2 -0
  44. package/resources/agents.d.mts.map +1 -0
  45. package/resources/agents.d.ts +2 -0
  46. package/resources/agents.d.ts.map +1 -0
  47. package/resources/agents.js +6 -0
  48. package/resources/agents.js.map +1 -0
  49. package/resources/agents.mjs +3 -0
  50. package/resources/agents.mjs.map +1 -0
  51. package/resources/broadcasts/broadcasts.d.mts +9 -6
  52. package/resources/broadcasts/broadcasts.d.mts.map +1 -1
  53. package/resources/broadcasts/broadcasts.d.ts +9 -6
  54. package/resources/broadcasts/broadcasts.d.ts.map +1 -1
  55. package/resources/broadcasts/broadcasts.js +9 -6
  56. package/resources/broadcasts/broadcasts.js.map +1 -1
  57. package/resources/broadcasts/broadcasts.mjs +9 -6
  58. package/resources/broadcasts/broadcasts.mjs.map +1 -1
  59. package/resources/calls.d.mts +530 -0
  60. package/resources/calls.d.mts.map +1 -0
  61. package/resources/calls.d.ts +530 -0
  62. package/resources/calls.d.ts.map +1 -0
  63. package/resources/calls.js +76 -0
  64. package/resources/calls.js.map +1 -0
  65. package/resources/calls.mjs +72 -0
  66. package/resources/calls.mjs.map +1 -0
  67. package/resources/conversations.d.mts +360 -0
  68. package/resources/conversations.d.mts.map +1 -0
  69. package/resources/conversations.d.ts +360 -0
  70. package/resources/conversations.d.ts.map +1 -0
  71. package/resources/conversations.js +47 -0
  72. package/resources/conversations.js.map +1 -0
  73. package/resources/conversations.mjs +43 -0
  74. package/resources/conversations.mjs.map +1 -0
  75. package/resources/email-domains.d.mts +260 -0
  76. package/resources/email-domains.d.mts.map +1 -0
  77. package/resources/email-domains.d.ts +260 -0
  78. package/resources/email-domains.d.ts.map +1 -0
  79. package/resources/email-domains.js +77 -0
  80. package/resources/email-domains.js.map +1 -0
  81. package/resources/email-domains.mjs +73 -0
  82. package/resources/email-domains.mjs.map +1 -0
  83. package/resources/functions/functions.d.mts +122 -1
  84. package/resources/functions/functions.d.mts.map +1 -1
  85. package/resources/functions/functions.d.ts +122 -1
  86. package/resources/functions/functions.d.ts.map +1 -1
  87. package/resources/functions/functions.js +53 -0
  88. package/resources/functions/functions.js.map +1 -1
  89. package/resources/functions/functions.mjs +53 -0
  90. package/resources/functions/functions.mjs.map +1 -1
  91. package/resources/functions/git-link.d.mts +295 -0
  92. package/resources/functions/git-link.d.mts.map +1 -0
  93. package/resources/functions/git-link.d.ts +295 -0
  94. package/resources/functions/git-link.d.ts.map +1 -0
  95. package/resources/functions/git-link.js +97 -0
  96. package/resources/functions/git-link.js.map +1 -0
  97. package/resources/functions/git-link.mjs +93 -0
  98. package/resources/functions/git-link.mjs.map +1 -0
  99. package/resources/functions/index.d.mts +3 -1
  100. package/resources/functions/index.d.mts.map +1 -1
  101. package/resources/functions/index.d.ts +3 -1
  102. package/resources/functions/index.d.ts.map +1 -1
  103. package/resources/functions/index.js +5 -1
  104. package/resources/functions/index.js.map +1 -1
  105. package/resources/functions/index.mjs +2 -0
  106. package/resources/functions/index.mjs.map +1 -1
  107. package/resources/functions/triggers.d.mts +164 -0
  108. package/resources/functions/triggers.d.mts.map +1 -0
  109. package/resources/functions/triggers.d.ts +164 -0
  110. package/resources/functions/triggers.d.ts.map +1 -0
  111. package/resources/functions/triggers.js +74 -0
  112. package/resources/functions/triggers.js.map +1 -0
  113. package/resources/functions/triggers.mjs +70 -0
  114. package/resources/functions/triggers.mjs.map +1 -0
  115. package/resources/index.d.mts +10 -5
  116. package/resources/index.d.mts.map +1 -1
  117. package/resources/index.d.ts +10 -5
  118. package/resources/index.d.ts.map +1 -1
  119. package/resources/index.js +11 -1
  120. package/resources/index.js.map +1 -1
  121. package/resources/index.mjs +5 -0
  122. package/resources/index.mjs.map +1 -1
  123. package/resources/introspect.d.mts +74 -1
  124. package/resources/introspect.d.mts.map +1 -1
  125. package/resources/introspect.d.ts +74 -1
  126. package/resources/introspect.d.ts.map +1 -1
  127. package/resources/introspect.js +22 -0
  128. package/resources/introspect.js.map +1 -1
  129. package/resources/introspect.mjs +22 -0
  130. package/resources/introspect.mjs.map +1 -1
  131. package/resources/messages.d.mts +123 -1
  132. package/resources/messages.d.mts.map +1 -1
  133. package/resources/messages.d.ts +123 -1
  134. package/resources/messages.d.ts.map +1 -1
  135. package/resources/messages.js +18 -0
  136. package/resources/messages.js.map +1 -1
  137. package/resources/messages.mjs +18 -0
  138. package/resources/messages.mjs.map +1 -1
  139. package/resources/senders/agent/agent.d.mts +4 -3
  140. package/resources/senders/agent/agent.d.mts.map +1 -1
  141. package/resources/senders/agent/agent.d.ts +4 -3
  142. package/resources/senders/agent/agent.d.ts.map +1 -1
  143. package/resources/senders/agent/agent.js +2 -2
  144. package/resources/senders/agent/agent.js.map +1 -1
  145. package/resources/senders/agent/agent.mjs +2 -2
  146. package/resources/senders/agent/agent.mjs.map +1 -1
  147. package/resources/senders/agent/index.d.mts +2 -2
  148. package/resources/senders/agent/index.d.mts.map +1 -1
  149. package/resources/senders/agent/index.d.ts +2 -2
  150. package/resources/senders/agent/index.d.ts.map +1 -1
  151. package/resources/senders/agent/index.js +2 -2
  152. package/resources/senders/agent/index.js.map +1 -1
  153. package/resources/senders/agent/index.mjs +1 -1
  154. package/resources/senders/agent/index.mjs.map +1 -1
  155. package/resources/senders/agent/knowledge-bases/documents.d.mts +56 -1
  156. package/resources/senders/agent/knowledge-bases/documents.d.mts.map +1 -1
  157. package/resources/senders/agent/knowledge-bases/documents.d.ts +56 -1
  158. package/resources/senders/agent/knowledge-bases/documents.d.ts.map +1 -1
  159. package/resources/senders/agent/knowledge-bases/documents.js +33 -0
  160. package/resources/senders/agent/knowledge-bases/documents.js.map +1 -1
  161. package/resources/senders/agent/knowledge-bases/documents.mjs +33 -0
  162. package/resources/senders/agent/knowledge-bases/documents.mjs.map +1 -1
  163. package/resources/senders/agent/knowledge-bases/index.d.mts +1 -1
  164. package/resources/senders/agent/knowledge-bases/index.d.mts.map +1 -1
  165. package/resources/senders/agent/knowledge-bases/index.d.ts +1 -1
  166. package/resources/senders/agent/knowledge-bases/index.d.ts.map +1 -1
  167. package/resources/senders/agent/knowledge-bases/index.js.map +1 -1
  168. package/resources/senders/agent/knowledge-bases/index.mjs.map +1 -1
  169. package/resources/senders/agent/knowledge-bases/knowledge-bases.d.mts +2 -2
  170. package/resources/senders/agent/knowledge-bases/knowledge-bases.d.mts.map +1 -1
  171. package/resources/senders/agent/knowledge-bases/knowledge-bases.d.ts +2 -2
  172. package/resources/senders/agent/knowledge-bases/knowledge-bases.d.ts.map +1 -1
  173. package/resources/senders/agent/knowledge-bases/knowledge-bases.js.map +1 -1
  174. package/resources/senders/agent/knowledge-bases/knowledge-bases.mjs.map +1 -1
  175. package/resources/senders/agent/tools/index.d.mts +3 -0
  176. package/resources/senders/agent/tools/index.d.mts.map +1 -0
  177. package/resources/senders/agent/tools/index.d.ts +3 -0
  178. package/resources/senders/agent/tools/index.d.ts.map +1 -0
  179. package/resources/senders/agent/tools/index.js +9 -0
  180. package/resources/senders/agent/tools/index.js.map +1 -0
  181. package/resources/senders/agent/tools/index.mjs +4 -0
  182. package/resources/senders/agent/tools/index.mjs.map +1 -0
  183. package/resources/senders/agent/tools/tools.d.mts +338 -0
  184. package/resources/senders/agent/tools/tools.d.mts.map +1 -0
  185. package/resources/senders/agent/tools/tools.d.ts +338 -0
  186. package/resources/senders/agent/tools/tools.d.ts.map +1 -0
  187. package/resources/senders/agent/tools/tools.js +163 -0
  188. package/resources/senders/agent/tools/tools.js.map +1 -0
  189. package/resources/senders/agent/tools/tools.mjs +158 -0
  190. package/resources/senders/agent/tools/tools.mjs.map +1 -0
  191. package/resources/senders/agent/tools/webhook.d.mts +28 -0
  192. package/resources/senders/agent/tools/webhook.d.mts.map +1 -0
  193. package/resources/senders/agent/tools/webhook.d.ts +28 -0
  194. package/resources/senders/agent/tools/webhook.d.ts.map +1 -0
  195. package/resources/senders/agent/tools/webhook.js +28 -0
  196. package/resources/senders/agent/tools/webhook.js.map +1 -0
  197. package/resources/senders/agent/tools/webhook.mjs +24 -0
  198. package/resources/senders/agent/tools/webhook.mjs.map +1 -0
  199. package/resources/senders/agent/tools.d.mts +1 -270
  200. package/resources/senders/agent/tools.d.mts.map +1 -1
  201. package/resources/senders/agent/tools.d.ts +1 -270
  202. package/resources/senders/agent/tools.d.ts.map +1 -1
  203. package/resources/senders/agent/tools.js +2 -131
  204. package/resources/senders/agent/tools.js.map +1 -1
  205. package/resources/senders/agent/tools.mjs +1 -129
  206. package/resources/senders/agent/tools.mjs.map +1 -1
  207. package/resources/senders/index.d.mts +2 -1
  208. package/resources/senders/index.d.mts.map +1 -1
  209. package/resources/senders/index.d.ts +2 -1
  210. package/resources/senders/index.d.ts.map +1 -1
  211. package/resources/senders/index.js +3 -1
  212. package/resources/senders/index.js.map +1 -1
  213. package/resources/senders/index.mjs +1 -0
  214. package/resources/senders/index.mjs.map +1 -1
  215. package/resources/senders/senders.d.mts +10 -1
  216. package/resources/senders/senders.d.mts.map +1 -1
  217. package/resources/senders/senders.d.ts +10 -1
  218. package/resources/senders/senders.d.ts.map +1 -1
  219. package/resources/senders/senders.js +4 -0
  220. package/resources/senders/senders.js.map +1 -1
  221. package/resources/senders/senders.mjs +4 -0
  222. package/resources/senders/senders.mjs.map +1 -1
  223. package/resources/senders/telegram.d.mts +48 -0
  224. package/resources/senders/telegram.d.mts.map +1 -0
  225. package/resources/senders/telegram.d.ts +48 -0
  226. package/resources/senders/telegram.d.ts.map +1 -0
  227. package/resources/senders/telegram.js +41 -0
  228. package/resources/senders/telegram.js.map +1 -0
  229. package/resources/senders/telegram.mjs +37 -0
  230. package/resources/senders/telegram.mjs.map +1 -0
  231. package/resources/templates.d.mts +66 -1
  232. package/resources/templates.d.mts.map +1 -1
  233. package/resources/templates.d.ts +66 -1
  234. package/resources/templates.d.ts.map +1 -1
  235. package/resources/templates.js +31 -0
  236. package/resources/templates.js.map +1 -1
  237. package/resources/templates.mjs +31 -0
  238. package/resources/templates.mjs.map +1 -1
  239. package/resources/urls.d.mts +24 -1
  240. package/resources/urls.d.mts.map +1 -1
  241. package/resources/urls.d.ts +24 -1
  242. package/resources/urls.d.ts.map +1 -1
  243. package/resources/urls.js +15 -0
  244. package/resources/urls.js.map +1 -1
  245. package/resources/urls.mjs +15 -0
  246. package/resources/urls.mjs.map +1 -1
  247. package/src/client.ts +129 -0
  248. package/src/resources/agent-templates.ts +128 -0
  249. package/src/resources/agents/agents.ts +603 -0
  250. package/src/resources/agents/index.ts +21 -0
  251. package/src/resources/agents/senders.ts +79 -0
  252. package/src/resources/agents.ts +3 -0
  253. package/src/resources/broadcasts/broadcasts.ts +9 -6
  254. package/src/resources/calls.ts +638 -0
  255. package/src/resources/conversations.ts +472 -0
  256. package/src/resources/email-domains.ts +337 -0
  257. package/src/resources/functions/functions.ts +202 -0
  258. package/src/resources/functions/git-link.ts +398 -0
  259. package/src/resources/functions/index.ts +22 -0
  260. package/src/resources/functions/triggers.ts +227 -0
  261. package/src/resources/index.ts +57 -0
  262. package/src/resources/introspect.ts +105 -0
  263. package/src/resources/messages.ts +146 -0
  264. package/src/resources/senders/agent/agent.ts +23 -17
  265. package/src/resources/senders/agent/index.ts +4 -1
  266. package/src/resources/senders/agent/knowledge-bases/documents.ts +89 -0
  267. package/src/resources/senders/agent/knowledge-bases/index.ts +4 -0
  268. package/src/resources/senders/agent/knowledge-bases/knowledge-bases.ts +8 -0
  269. package/src/resources/senders/agent/tools/index.ts +21 -0
  270. package/src/resources/senders/agent/tools/tools.ts +460 -0
  271. package/src/resources/senders/agent/tools/webhook.ts +40 -0
  272. package/src/resources/senders/agent/tools.ts +1 -364
  273. package/src/resources/senders/index.ts +2 -0
  274. package/src/resources/senders/senders.ts +16 -1
  275. package/src/resources/senders/telegram.ts +73 -0
  276. package/src/resources/templates.ts +80 -0
  277. package/src/resources/urls.ts +35 -0
  278. package/src/version.ts +1 -1
  279. package/version.d.mts +1 -1
  280. package/version.d.ts +1 -1
  281. package/version.js +1 -1
  282. package/version.mjs +1 -1
@@ -0,0 +1,603 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as SendersAPI from './senders';
5
+ import { SenderConnectParams, SenderConnectResponse, SenderDisconnectParams, Senders } from './senders';
6
+ import * as AgentAPI from '../senders/agent/agent';
7
+ import { AgentsCursor } from '../senders/agent/agent';
8
+ import { APIPromise } from '../../core/api-promise';
9
+ import { Cursor, type CursorParams, PagePromise } from '../../core/pagination';
10
+ import { buildHeaders } from '../../internal/headers';
11
+ import { RequestOptions } from '../../internal/request-options';
12
+ import { path } from '../../internal/utils/path';
13
+
14
+ export class Agents extends APIResource {
15
+ senders: SendersAPI.Senders = new SendersAPI.Senders(this._client);
16
+
17
+ /**
18
+ * Create an agent without a sender. It is created disabled; connect a sender and
19
+ * enable it when you are ready for it to answer.
20
+ *
21
+ * **Sub-resources.** An agent's tools, flows and knowledge bases are reachable at
22
+ * `/v1/agents/{agentId}/tools`, `/v1/agents/{agentId}/flows` and
23
+ * `/v1/agents/{agentId}/knowledge-bases`, mirroring the sender-scoped routes
24
+ * documented under `/v1/senders/{senderId}/agent/...` exactly. Use the
25
+ * agent-scoped form while the agent has no sender: the sender-scoped one cannot
26
+ * address it.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const agent = await client.agents.create({
31
+ * model: 'model',
32
+ * name: 'name',
33
+ * provider: 'openai',
34
+ * systemPrompt: 'systemPrompt',
35
+ * });
36
+ * ```
37
+ */
38
+ create(body: AgentCreateParams, options?: RequestOptions): APIPromise<AgentCreateResponse> {
39
+ return this._client.post('/v1/agents', { body, ...options });
40
+ }
41
+
42
+ /**
43
+ * Get an agent
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * const agent = await client.agents.retrieve('agentId');
48
+ * ```
49
+ */
50
+ retrieve(agentID: string, options?: RequestOptions): APIPromise<AgentRetrieveResponse> {
51
+ return this._client.get(path`/v1/agents/${agentID}`, options);
52
+ }
53
+
54
+ /**
55
+ * Update an agent
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const agent = await client.agents.update('agentId');
60
+ * ```
61
+ */
62
+ update(
63
+ agentID: string,
64
+ body: AgentUpdateParams,
65
+ options?: RequestOptions,
66
+ ): APIPromise<AgentUpdateResponse> {
67
+ return this._client.patch(path`/v1/agents/${agentID}`, { body, ...options });
68
+ }
69
+
70
+ /**
71
+ * Every agent in the project, newest first — including agents that are not
72
+ * connected to any sender yet, which the sender-scoped routes cannot reach. Each
73
+ * item carries `senderIds`, the senders the agent answers on.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * // Automatically fetches more pages as needed.
78
+ * for await (const agent of client.agents.list()) {
79
+ * // ...
80
+ * }
81
+ * ```
82
+ */
83
+ list(
84
+ query: AgentListParams | null | undefined = {},
85
+ options?: RequestOptions,
86
+ ): PagePromise<AgentsCursor, AgentAPI.Agent> {
87
+ return this._client.getAPIList('/v1/agents', Cursor<AgentAPI.Agent>, { query, ...options });
88
+ }
89
+
90
+ /**
91
+ * Delete an agent
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * await client.agents.delete('agentId');
96
+ * ```
97
+ */
98
+ delete(agentID: string, options?: RequestOptions): APIPromise<void> {
99
+ return this._client.delete(path`/v1/agents/${agentID}`, {
100
+ ...options,
101
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
102
+ });
103
+ }
104
+
105
+ /**
106
+ * The voices an agent can speak with, for `voice.ttsVoiceId`. Filter by `language`
107
+ * to get the ones that speak it; a voice can still be used with `language: auto`,
108
+ * where the agent follows the caller and keeps the chosen voice.
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * const response = await client.agents.listVoices();
113
+ * ```
114
+ */
115
+ listVoices(
116
+ query: AgentListVoicesParams | null | undefined = {},
117
+ options?: RequestOptions,
118
+ ): APIPromise<AgentListVoicesResponse> {
119
+ return this._client.get('/v1/agents/voices', { query, ...options });
120
+ }
121
+
122
+ /**
123
+ * Run the agent's prompt, model and knowledge base against a message and return
124
+ * the reply instead of delivering it. Writes nothing and charges nothing, so it is
125
+ * safe to call repeatedly while iterating on a prompt.
126
+ *
127
+ * Note that a dry run never **executes** tools — running them would cause real
128
+ * side effects. Live conversations on every channel do call them. When the agent
129
+ * has enabled tools, that gap is reported in `warnings` rather than silently
130
+ * producing an answer that looks like a tool call happened.
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * const response = await client.agents.test('agentId', {
135
+ * message: 'Where is order ORD-12345?',
136
+ * });
137
+ * ```
138
+ */
139
+ test(agentID: string, body: AgentTestParams, options?: RequestOptions): APIPromise<AgentTestResponse> {
140
+ return this._client.post(path`/v1/agents/${agentID}/test`, { body, ...options });
141
+ }
142
+ }
143
+
144
+ export interface AgentCreateResponse {
145
+ /**
146
+ * AI Agent configuration for a sender.
147
+ */
148
+ agent: AgentAPI.Agent;
149
+ }
150
+
151
+ export interface AgentRetrieveResponse {
152
+ /**
153
+ * AI Agent configuration for a sender.
154
+ */
155
+ agent: AgentAPI.Agent;
156
+ }
157
+
158
+ export interface AgentUpdateResponse {
159
+ /**
160
+ * AI Agent configuration for a sender.
161
+ */
162
+ agent: AgentAPI.Agent;
163
+ }
164
+
165
+ export interface AgentListVoicesResponse {
166
+ items: Array<AgentListVoicesResponse.Item>;
167
+
168
+ /**
169
+ * Languages an agent can be pinned to. `auto` follows the caller.
170
+ */
171
+ languages: Array<string>;
172
+
173
+ /**
174
+ * Voices in the catalog, before filtering.
175
+ */
176
+ total?: number;
177
+ }
178
+
179
+ export namespace AgentListVoicesResponse {
180
+ export interface Item {
181
+ /**
182
+ * Value for `voice.ttsVoiceId`.
183
+ */
184
+ id: string;
185
+
186
+ language: string;
187
+
188
+ name: string;
189
+ }
190
+ }
191
+
192
+ export interface AgentTestResponse {
193
+ error: string | null;
194
+
195
+ inputTokens: number;
196
+
197
+ /**
198
+ * Knowledge-base chunks retrieved for this message. Zero means the answer was not
199
+ * grounded in your documents.
200
+ */
201
+ knowledgeChunksUsed: number;
202
+
203
+ latencyMs: number;
204
+
205
+ outputTokens: number;
206
+
207
+ success: boolean;
208
+
209
+ /**
210
+ * What the agent would reply.
211
+ */
212
+ text: string | null;
213
+
214
+ /**
215
+ * Things that are true of this agent but that a dry run cannot prove. Surfaced so
216
+ * a passing dry run is never mistaken for proof that the agent works live.
217
+ *
218
+ * - The agent being disabled.
219
+ * - Enabled tools that were **not offered to the model** here — the model never
220
+ * saw them, so a reply that looks like a lookup was invented. Live conversations
221
+ * on every channel do offer them; running them here would cause real side
222
+ * effects.
223
+ * - An agent whose sender has none of the channels it triggers on, which answers
224
+ * every dry run and no real message.
225
+ * - Contact metadata that exists on a real conversation but not here.
226
+ */
227
+ warnings: Array<string>;
228
+
229
+ /**
230
+ * Tools that actually ran, in order, when the request set `executeTools`. Empty on
231
+ * a normal dry run, where nothing is executed. An entry with `ok: false` means the
232
+ * agent saw an error and answered around it, which is what a customer would have
233
+ * received.
234
+ */
235
+ executedToolCalls?: Array<AgentTestResponse.ExecutedToolCall>;
236
+ }
237
+
238
+ export namespace AgentTestResponse {
239
+ export interface ExecutedToolCall {
240
+ name: string;
241
+
242
+ ok: boolean;
243
+
244
+ error?: string | null;
245
+ }
246
+ }
247
+
248
+ export interface AgentCreateParams {
249
+ model: string;
250
+
251
+ name: string;
252
+
253
+ /**
254
+ * LLM provider for the AI agent.
255
+ */
256
+ provider: AgentAPI.AgentProvider;
257
+
258
+ systemPrompt: string;
259
+
260
+ contextWindowMessages?: number;
261
+
262
+ includeContactMetadata?: boolean;
263
+
264
+ maxTokens?: number;
265
+
266
+ temperature?: number;
267
+
268
+ triggerOnChannels?: Array<string>;
269
+
270
+ triggerOnMessageTypes?: Array<string>;
271
+
272
+ /**
273
+ * Voice Agent configuration on a sender's AI agent. Controls how the agent behaves
274
+ * on inbound and outbound phone calls through Zavu's managed voice pipeline
275
+ * (speech recognition, the agent's LLM, and speech synthesis, with real-time
276
+ * interruption handling). Requires the Voice Agents feature to be enabled for your
277
+ * team.
278
+ */
279
+ voice?: AgentCreateParams.Voice;
280
+ }
281
+
282
+ export namespace AgentCreateParams {
283
+ /**
284
+ * Voice Agent configuration on a sender's AI agent. Controls how the agent behaves
285
+ * on inbound and outbound phone calls through Zavu's managed voice pipeline
286
+ * (speech recognition, the agent's LLM, and speech synthesis, with real-time
287
+ * interruption handling). Requires the Voice Agents feature to be enabled for your
288
+ * team.
289
+ */
290
+ export interface Voice {
291
+ /**
292
+ * Whether the agent handles voice calls. When false, the sender's number is not
293
+ * answered by the voice agent and outbound calls are rejected.
294
+ */
295
+ enabled: boolean;
296
+
297
+ /**
298
+ * Opening line the agent speaks when the call connects. If omitted, the agent
299
+ * waits for the caller to speak first.
300
+ */
301
+ greeting?: string;
302
+
303
+ /**
304
+ * Greeting per language, keyed by language code. Used when the caller's language
305
+ * differs from the one `greeting` is written in.
306
+ */
307
+ greetings?: { [key: string]: string };
308
+
309
+ /**
310
+ * Whether the caller can interrupt the agent while it is speaking (barge-in). When
311
+ * true, the agent stops talking as soon as the caller starts.
312
+ */
313
+ interruptible?: boolean;
314
+
315
+ /**
316
+ * BCP-47 language code used for both speech recognition and speech synthesis (e.g.
317
+ * `en`, `es`, `pt-BR`). Auto-detected from the recipient when omitted.
318
+ */
319
+ language?: string;
320
+
321
+ /**
322
+ * Hard limit on call length in minutes. The call ends automatically when reached.
323
+ */
324
+ maxCallDurationMinutes?: number;
325
+
326
+ /**
327
+ * How long the agent waits during silence before ending the call.
328
+ */
329
+ maxIdleSeconds?: number;
330
+
331
+ /**
332
+ * Model that runs the conversation, co-located in the voice network for lowest
333
+ * latency. Independent of the model used for text messaging. Derived from the
334
+ * agent's text model when omitted.
335
+ */
336
+ model?: string;
337
+
338
+ /**
339
+ * Whether the call audio is recorded.
340
+ */
341
+ recordCalls?: boolean;
342
+
343
+ /**
344
+ * Speech-recognition model. Uses the default when omitted.
345
+ */
346
+ sttModel?: string;
347
+
348
+ /**
349
+ * Speech-recognition provider. Uses the default when omitted.
350
+ */
351
+ sttProvider?: string;
352
+
353
+ /**
354
+ * E.164 phone number the agent can transfer the call to. When set, the agent is
355
+ * given a transfer tool it can use to hand the call to a human.
356
+ */
357
+ transferPhoneNumber?: string;
358
+
359
+ /**
360
+ * Speech-synthesis provider. Uses the default when omitted.
361
+ */
362
+ ttsProvider?: string;
363
+
364
+ /**
365
+ * Identifier of the synthesized voice that speaks. Choose from the voices
366
+ * available in the dashboard. Uses a neutral default when omitted.
367
+ */
368
+ ttsVoiceId?: string;
369
+
370
+ /**
371
+ * What the agent does when an answering machine or voicemail is detected on an
372
+ * outbound call.
373
+ */
374
+ voicemailAction?: 'hangup' | 'leave_message';
375
+
376
+ /**
377
+ * Message spoken when `voicemailAction` is `leave_message`. Falls back to
378
+ * `greeting` when omitted.
379
+ */
380
+ voicemailMessage?: string;
381
+
382
+ /**
383
+ * Speech rate. 1.0 is natural. Only honoured by voices that support rate control;
384
+ * ignored by the others.
385
+ */
386
+ voiceSpeed?: number;
387
+ }
388
+ }
389
+
390
+ export interface AgentUpdateParams {
391
+ apiKey?: string;
392
+
393
+ contextWindowMessages?: number;
394
+
395
+ enabled?: boolean;
396
+
397
+ includeContactMetadata?: boolean;
398
+
399
+ maxTokens?: number | null;
400
+
401
+ model?: string;
402
+
403
+ name?: string;
404
+
405
+ /**
406
+ * LLM provider for the AI agent.
407
+ */
408
+ provider?: AgentAPI.AgentProvider;
409
+
410
+ systemPrompt?: string;
411
+
412
+ temperature?: number | null;
413
+
414
+ triggerOnChannels?: Array<string>;
415
+
416
+ triggerOnMessageTypes?: Array<string>;
417
+
418
+ /**
419
+ * Voice Agent configuration. Patch this object to enable voice, change the
420
+ * greeting, or adjust call limits. Requires the Voice Agents feature to be enabled
421
+ * for your team.
422
+ */
423
+ voice?: AgentUpdateParams.Voice;
424
+ }
425
+
426
+ export namespace AgentUpdateParams {
427
+ /**
428
+ * Voice Agent configuration. Patch this object to enable voice, change the
429
+ * greeting, or adjust call limits. Requires the Voice Agents feature to be enabled
430
+ * for your team.
431
+ */
432
+ export interface Voice {
433
+ /**
434
+ * Whether the agent handles voice calls. When false, the sender's number is not
435
+ * answered by the voice agent and outbound calls are rejected.
436
+ */
437
+ enabled: boolean;
438
+
439
+ /**
440
+ * Opening line the agent speaks when the call connects. If omitted, the agent
441
+ * waits for the caller to speak first.
442
+ */
443
+ greeting?: string;
444
+
445
+ /**
446
+ * Greeting per language, keyed by language code. Used when the caller's language
447
+ * differs from the one `greeting` is written in.
448
+ */
449
+ greetings?: { [key: string]: string };
450
+
451
+ /**
452
+ * Whether the caller can interrupt the agent while it is speaking (barge-in). When
453
+ * true, the agent stops talking as soon as the caller starts.
454
+ */
455
+ interruptible?: boolean;
456
+
457
+ /**
458
+ * BCP-47 language code used for both speech recognition and speech synthesis (e.g.
459
+ * `en`, `es`, `pt-BR`). Auto-detected from the recipient when omitted.
460
+ */
461
+ language?: string;
462
+
463
+ /**
464
+ * Hard limit on call length in minutes. The call ends automatically when reached.
465
+ */
466
+ maxCallDurationMinutes?: number;
467
+
468
+ /**
469
+ * How long the agent waits during silence before ending the call.
470
+ */
471
+ maxIdleSeconds?: number;
472
+
473
+ /**
474
+ * Model that runs the conversation, co-located in the voice network for lowest
475
+ * latency. Independent of the model used for text messaging. Derived from the
476
+ * agent's text model when omitted.
477
+ */
478
+ model?: string;
479
+
480
+ /**
481
+ * Whether the call audio is recorded.
482
+ */
483
+ recordCalls?: boolean;
484
+
485
+ /**
486
+ * Speech-recognition model. Uses the default when omitted.
487
+ */
488
+ sttModel?: string;
489
+
490
+ /**
491
+ * Speech-recognition provider. Uses the default when omitted.
492
+ */
493
+ sttProvider?: string;
494
+
495
+ /**
496
+ * E.164 phone number the agent can transfer the call to. When set, the agent is
497
+ * given a transfer tool it can use to hand the call to a human.
498
+ */
499
+ transferPhoneNumber?: string;
500
+
501
+ /**
502
+ * Speech-synthesis provider. Uses the default when omitted.
503
+ */
504
+ ttsProvider?: string;
505
+
506
+ /**
507
+ * Identifier of the synthesized voice that speaks. Choose from the voices
508
+ * available in the dashboard. Uses a neutral default when omitted.
509
+ */
510
+ ttsVoiceId?: string;
511
+
512
+ /**
513
+ * What the agent does when an answering machine or voicemail is detected on an
514
+ * outbound call.
515
+ */
516
+ voicemailAction?: 'hangup' | 'leave_message';
517
+
518
+ /**
519
+ * Message spoken when `voicemailAction` is `leave_message`. Falls back to
520
+ * `greeting` when omitted.
521
+ */
522
+ voicemailMessage?: string;
523
+
524
+ /**
525
+ * Speech rate. 1.0 is natural. Only honoured by voices that support rate control;
526
+ * ignored by the others.
527
+ */
528
+ voiceSpeed?: number;
529
+ }
530
+ }
531
+
532
+ export interface AgentListParams extends CursorParams {}
533
+
534
+ export interface AgentListVoicesParams {
535
+ /**
536
+ * BCP-47 tag (`en`, `es`, `pt-BR`). Omit, or pass `auto`, for every voice.
537
+ */
538
+ language?: string;
539
+ }
540
+
541
+ export interface AgentTestParams {
542
+ /**
543
+ * What to say to the agent.
544
+ */
545
+ message: string;
546
+
547
+ /**
548
+ * Run the tools the agent calls instead of reporting the choice and stopping.
549
+ *
550
+ * Off by default because a tool handler talks to the outside world: a rehearsal
551
+ * that charges a card is not a rehearsal. Turn it on to exercise the loop that
552
+ * actually matters — the model picks a tool, the handler answers, the model
553
+ * replies with the result — without sending a message to anyone. What ran comes
554
+ * back in `executedToolCalls`.
555
+ */
556
+ executeTools?: boolean;
557
+
558
+ /**
559
+ * Prior turns, oldest first, to exercise multi-turn behaviour without persisting a
560
+ * thread. Trimmed to the agent's context window.
561
+ */
562
+ history?: Array<AgentTestParams.History>;
563
+
564
+ /**
565
+ * Set false to skip retrieval and isolate prompt behaviour from the knowledge
566
+ * base.
567
+ */
568
+ useKnowledgeBase?: boolean;
569
+ }
570
+
571
+ export namespace AgentTestParams {
572
+ export interface History {
573
+ content: string;
574
+
575
+ role: 'user' | 'assistant';
576
+ }
577
+ }
578
+
579
+ Agents.Senders = Senders;
580
+
581
+ export declare namespace Agents {
582
+ export {
583
+ type AgentCreateResponse as AgentCreateResponse,
584
+ type AgentRetrieveResponse as AgentRetrieveResponse,
585
+ type AgentUpdateResponse as AgentUpdateResponse,
586
+ type AgentListVoicesResponse as AgentListVoicesResponse,
587
+ type AgentTestResponse as AgentTestResponse,
588
+ type AgentCreateParams as AgentCreateParams,
589
+ type AgentUpdateParams as AgentUpdateParams,
590
+ type AgentListParams as AgentListParams,
591
+ type AgentListVoicesParams as AgentListVoicesParams,
592
+ type AgentTestParams as AgentTestParams,
593
+ };
594
+
595
+ export {
596
+ Senders as Senders,
597
+ type SenderConnectResponse as SenderConnectResponse,
598
+ type SenderConnectParams as SenderConnectParams,
599
+ type SenderDisconnectParams as SenderDisconnectParams,
600
+ };
601
+ }
602
+
603
+ export { type AgentsCursor };
@@ -0,0 +1,21 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ Agents,
5
+ type AgentCreateResponse,
6
+ type AgentRetrieveResponse,
7
+ type AgentUpdateResponse,
8
+ type AgentListVoicesResponse,
9
+ type AgentTestResponse,
10
+ type AgentCreateParams,
11
+ type AgentUpdateParams,
12
+ type AgentListParams,
13
+ type AgentListVoicesParams,
14
+ type AgentTestParams,
15
+ } from './agents';
16
+ export {
17
+ Senders,
18
+ type SenderConnectResponse,
19
+ type SenderConnectParams,
20
+ type SenderDisconnectParams,
21
+ } from './senders';
@@ -0,0 +1,79 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as AgentAPI from '../senders/agent/agent';
5
+ import { APIPromise } from '../../core/api-promise';
6
+ import { buildHeaders } from '../../internal/headers';
7
+ import { RequestOptions } from '../../internal/request-options';
8
+ import { path } from '../../internal/utils/path';
9
+
10
+ export class Senders extends APIResource {
11
+ /**
12
+ * Make the agent answer on this sender. An agent can serve several senders; a
13
+ * sender answers with at most one agent, so connecting one that is already in use
14
+ * returns `400` naming the agent that holds it.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const response = await client.agents.senders.connect(
19
+ * 'agentId',
20
+ * { senderId: 'senderId' },
21
+ * );
22
+ * ```
23
+ */
24
+ connect(
25
+ agentID: string,
26
+ body: SenderConnectParams,
27
+ options?: RequestOptions,
28
+ ): APIPromise<SenderConnectResponse> {
29
+ return this._client.post(path`/v1/agents/${agentID}/senders`, { body, ...options });
30
+ }
31
+
32
+ /**
33
+ * Stop the agent answering on this sender. The agent's primary sender is part of
34
+ * the agent itself and cannot be disconnected here.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * await client.agents.senders.disconnect('senderId', {
39
+ * agentId: 'agentId',
40
+ * });
41
+ * ```
42
+ */
43
+ disconnect(senderID: string, params: SenderDisconnectParams, options?: RequestOptions): APIPromise<void> {
44
+ const { agentId } = params;
45
+ return this._client.delete(path`/v1/agents/${agentId}/senders/${senderID}`, {
46
+ ...options,
47
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
48
+ });
49
+ }
50
+ }
51
+
52
+ export interface SenderConnectResponse {
53
+ /**
54
+ * AI Agent configuration for a sender.
55
+ */
56
+ agent: AgentAPI.Agent;
57
+ }
58
+
59
+ export interface SenderConnectParams {
60
+ /**
61
+ * Sender to connect.
62
+ */
63
+ senderId: string;
64
+ }
65
+
66
+ export interface SenderDisconnectParams {
67
+ /**
68
+ * Agent ID.
69
+ */
70
+ agentId: string;
71
+ }
72
+
73
+ export declare namespace Senders {
74
+ export {
75
+ type SenderConnectResponse as SenderConnectResponse,
76
+ type SenderConnectParams as SenderConnectParams,
77
+ type SenderDisconnectParams as SenderDisconnectParams,
78
+ };
79
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './agents/index';