@copilotkit/runtime 0.0.0-fix-debug-infosys-20251107151227 → 0.0.0-fix-restore-handle-method-node-http-20251222114321

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 (142) hide show
  1. package/CHANGELOG.md +259 -3
  2. package/dist/index.d.ts +1493 -28
  3. package/dist/index.js +2568 -5467
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +5429 -99
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/{lib/index.d.ts → langgraph.d.ts} +104 -32
  8. package/dist/langgraph.js +211 -0
  9. package/dist/langgraph.js.map +1 -0
  10. package/dist/{chunk-XPALJ76U.mjs → langgraph.mjs} +57 -26
  11. package/dist/langgraph.mjs.map +1 -0
  12. package/dist/v2/index.d.ts +2 -0
  13. package/dist/v2/index.js +22 -0
  14. package/dist/v2/index.js.map +1 -0
  15. package/dist/v2/index.mjs +5 -0
  16. package/dist/v2/index.mjs.map +1 -0
  17. package/package.json +64 -20
  18. package/src/graphql/message-conversion/agui-to-gql.test.ts +1263 -0
  19. package/src/graphql/message-conversion/agui-to-gql.ts +333 -0
  20. package/src/graphql/message-conversion/gql-to-agui.test.ts +1580 -0
  21. package/src/graphql/message-conversion/gql-to-agui.ts +278 -0
  22. package/src/graphql/message-conversion/index.ts +2 -0
  23. package/src/graphql/message-conversion/roundtrip-conversion.test.ts +526 -0
  24. package/src/graphql/resolvers/copilot.resolver.ts +3 -51
  25. package/src/graphql/resolvers/state.resolver.ts +3 -2
  26. package/src/graphql/types/converted/index.ts +32 -6
  27. package/src/graphql/types/enums.ts +2 -2
  28. package/src/graphql/types/message-status.type.ts +3 -1
  29. package/src/langgraph.ts +1 -0
  30. package/src/lib/index.ts +42 -1
  31. package/src/lib/integrations/nextjs/app-router.ts +12 -11
  32. package/src/lib/integrations/nextjs/pages-router.ts +4 -11
  33. package/src/lib/integrations/node-http/index.ts +10 -5
  34. package/src/lib/integrations/shared.ts +1 -1
  35. package/src/lib/observability.ts +87 -0
  36. package/src/lib/runtime/{langgraph/langgraph-agent.ts → agent-integrations/langgraph/agent.ts} +10 -30
  37. package/src/lib/runtime/agent-integrations/langgraph/consts.ts +34 -0
  38. package/src/lib/runtime/agent-integrations/langgraph/index.ts +2 -0
  39. package/src/lib/runtime/copilot-runtime.ts +387 -1360
  40. package/src/lib/runtime/telemetry-agent-runner.ts +139 -0
  41. package/src/lib/runtime/types.ts +49 -0
  42. package/src/lib/runtime/utils.ts +87 -0
  43. package/src/lib/telemetry-client.ts +6 -5
  44. package/src/service-adapters/anthropic/anthropic-adapter.ts +21 -4
  45. package/src/service-adapters/bedrock/bedrock-adapter.ts +10 -2
  46. package/src/service-adapters/empty/empty-adapter.ts +3 -0
  47. package/src/service-adapters/events.ts +0 -254
  48. package/src/service-adapters/experimental/ollama/ollama-adapter.ts +7 -2
  49. package/src/service-adapters/google/google-genai-adapter.ts +33 -7
  50. package/src/service-adapters/groq/groq-adapter.ts +21 -4
  51. package/src/service-adapters/langchain/langchain-adapter.ts +8 -3
  52. package/src/service-adapters/langchain/langserve.ts +2 -1
  53. package/src/service-adapters/openai/openai-adapter.ts +22 -4
  54. package/src/service-adapters/openai/openai-assistant-adapter.ts +30 -11
  55. package/src/service-adapters/service-adapter.ts +3 -0
  56. package/src/service-adapters/unify/unify-adapter.ts +9 -2
  57. package/src/v2/index.ts +3 -0
  58. package/tsup.config.ts +6 -2
  59. package/dist/chunk-27JKTS6P.mjs +0 -1704
  60. package/dist/chunk-27JKTS6P.mjs.map +0 -1
  61. package/dist/chunk-2DHC2YFK.mjs +0 -6026
  62. package/dist/chunk-2DHC2YFK.mjs.map +0 -1
  63. package/dist/chunk-2OZAGFV3.mjs +0 -43
  64. package/dist/chunk-2OZAGFV3.mjs.map +0 -1
  65. package/dist/chunk-5HHH4SZ3.mjs +0 -25
  66. package/dist/chunk-5HHH4SZ3.mjs.map +0 -1
  67. package/dist/chunk-AMUJQ6IR.mjs +0 -50
  68. package/dist/chunk-AMUJQ6IR.mjs.map +0 -1
  69. package/dist/chunk-FHD4JECV.mjs +0 -33
  70. package/dist/chunk-FHD4JECV.mjs.map +0 -1
  71. package/dist/chunk-FVG3IQG7.mjs +0 -25
  72. package/dist/chunk-FVG3IQG7.mjs.map +0 -1
  73. package/dist/chunk-QU2FLIQB.mjs +0 -80
  74. package/dist/chunk-QU2FLIQB.mjs.map +0 -1
  75. package/dist/chunk-SHBDMA63.mjs +0 -141
  76. package/dist/chunk-SHBDMA63.mjs.map +0 -1
  77. package/dist/chunk-XPALJ76U.mjs.map +0 -1
  78. package/dist/chunk-XWBDEXDA.mjs +0 -153
  79. package/dist/chunk-XWBDEXDA.mjs.map +0 -1
  80. package/dist/graphql/types/base/index.d.ts +0 -6
  81. package/dist/graphql/types/base/index.js +0 -63
  82. package/dist/graphql/types/base/index.js.map +0 -1
  83. package/dist/graphql/types/base/index.mjs +0 -8
  84. package/dist/graphql/types/base/index.mjs.map +0 -1
  85. package/dist/graphql/types/converted/index.d.ts +0 -2
  86. package/dist/graphql/types/converted/index.js +0 -200
  87. package/dist/graphql/types/converted/index.js.map +0 -1
  88. package/dist/graphql/types/converted/index.mjs +0 -19
  89. package/dist/graphql/types/converted/index.mjs.map +0 -1
  90. package/dist/groq-adapter-c8aec5c5.d.ts +0 -321
  91. package/dist/index-96b330da.d.ts +0 -119
  92. package/dist/langserve-0c6100e3.d.ts +0 -257
  93. package/dist/lib/cloud/index.d.ts +0 -6
  94. package/dist/lib/cloud/index.js +0 -18
  95. package/dist/lib/cloud/index.js.map +0 -1
  96. package/dist/lib/cloud/index.mjs +0 -1
  97. package/dist/lib/cloud/index.mjs.map +0 -1
  98. package/dist/lib/index.js +0 -7849
  99. package/dist/lib/index.js.map +0 -1
  100. package/dist/lib/index.mjs +0 -76
  101. package/dist/lib/index.mjs.map +0 -1
  102. package/dist/lib/integrations/index.d.ts +0 -34
  103. package/dist/lib/integrations/index.js +0 -3055
  104. package/dist/lib/integrations/index.js.map +0 -1
  105. package/dist/lib/integrations/index.mjs +0 -37
  106. package/dist/lib/integrations/index.mjs.map +0 -1
  107. package/dist/lib/integrations/nest/index.d.ts +0 -15
  108. package/dist/lib/integrations/nest/index.js +0 -2962
  109. package/dist/lib/integrations/nest/index.js.map +0 -1
  110. package/dist/lib/integrations/nest/index.mjs +0 -14
  111. package/dist/lib/integrations/nest/index.mjs.map +0 -1
  112. package/dist/lib/integrations/node-express/index.d.ts +0 -15
  113. package/dist/lib/integrations/node-express/index.js +0 -2962
  114. package/dist/lib/integrations/node-express/index.js.map +0 -1
  115. package/dist/lib/integrations/node-express/index.mjs +0 -14
  116. package/dist/lib/integrations/node-express/index.mjs.map +0 -1
  117. package/dist/lib/integrations/node-http/index.d.ts +0 -15
  118. package/dist/lib/integrations/node-http/index.js +0 -2948
  119. package/dist/lib/integrations/node-http/index.js.map +0 -1
  120. package/dist/lib/integrations/node-http/index.mjs +0 -13
  121. package/dist/lib/integrations/node-http/index.mjs.map +0 -1
  122. package/dist/service-adapters/index.d.ts +0 -162
  123. package/dist/service-adapters/index.js +0 -1787
  124. package/dist/service-adapters/index.js.map +0 -1
  125. package/dist/service-adapters/index.mjs +0 -34
  126. package/dist/service-adapters/index.mjs.map +0 -1
  127. package/dist/service-adapters/shared/index.d.ts +0 -9
  128. package/dist/service-adapters/shared/index.js +0 -72
  129. package/dist/service-adapters/shared/index.js.map +0 -1
  130. package/dist/service-adapters/shared/index.mjs +0 -8
  131. package/dist/service-adapters/shared/index.mjs.map +0 -1
  132. package/dist/shared-0a7346ce.d.ts +0 -466
  133. package/dist/utils/index.d.ts +0 -65
  134. package/dist/utils/index.js +0 -175
  135. package/dist/utils/index.js.map +0 -1
  136. package/dist/utils/index.mjs +0 -12
  137. package/dist/utils/index.mjs.map +0 -1
  138. package/src/lib/runtime/__tests__/remote-action-constructors.test.ts +0 -246
  139. package/src/lib/runtime/agui-action.ts +0 -180
  140. package/src/lib/runtime/remote-action-constructors.ts +0 -331
  141. package/src/lib/runtime/remote-actions.ts +0 -217
  142. package/src/lib/runtime/remote-lg-action.ts +0 -1006
package/dist/index.d.ts CHANGED
@@ -1,28 +1,1493 @@
1
- export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from './groq-adapter-c8aec5c5.js';
2
- export { e as CommonConfig, C as CopilotRequestContextProperties, k as CopilotRuntime, j as CopilotRuntimeConstructorParams, f as CopilotRuntimeLogger, i as CopilotRuntimeRequest, b as CreateCopilotRuntimeServerOptions, G as GraphQLContext, L as LogLevel, o as MCPClient, p as MCPEndpointConfig, M as MCPTool, a as addCustomHeaderPlugin, d as buildSchema, s as convertMCPToolsToActions, m as copilotKitEndpoint, c as createContext, h as createLogger, q as extractParametersFromSchema, l as flattenToolCallsNoDuplicates, t as generateMcpToolInstructions, g as getCommonConfig, n as langGraphPlatformEndpoint, r as resolveEndpointType } from './shared-0a7346ce.js';
3
- export { CopilotRuntimeServerInstance, config, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint } from './lib/integrations/index.js';
4
- export { copilotRuntimeNodeHttpEndpoint } from './lib/integrations/node-http/index.js';
5
- export { copilotRuntimeNodeExpressEndpoint } from './lib/integrations/node-express/index.js';
6
- export { copilotRuntimeNestEndpoint } from './lib/integrations/nest/index.js';
7
- export { CustomEventNames, LangGraphAgent, PredictStateTool, TextMessageEvents, ToolCallEvents } from './lib/index.js';
8
- export { GuardrailsValidationFailureResponse, MessageStreamInterruptedResponse, UnknownErrorResponse } from './utils/index.js';
9
- export { C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse, b as CopilotServiceAdapter, c as RemoteChain, R as RemoteChainParameters } from './langserve-0c6100e3.js';
10
- export { convertServiceAdapterError } from './service-adapters/shared/index.js';
11
- export { AnthropicAdapter, AnthropicAdapterParams, AnthropicPromptCachingConfig, BedrockAdapter, BedrockAdapterParams, EmptyAdapter, ExperimentalEmptyAdapter, ExperimentalOllamaAdapter } from './service-adapters/index.js';
12
- export { LangGraphHttpAgent } from '@ag-ui/langgraph';
13
- import 'openai';
14
- import '@langchain/core/messages';
15
- import '@langchain/core/tools';
16
- import '@langchain/core/utils/stream';
17
- import 'groq-sdk';
18
- import 'graphql';
19
- import 'pino';
20
- import 'graphql-yoga';
21
- import '@copilotkit/shared';
22
- import './index-96b330da.js';
23
- import './graphql/types/base/index.js';
24
- import './lib/cloud/index.js';
25
- import '@ag-ui/client';
26
- import 'rxjs';
27
- import '@langchain/langgraph-sdk/dist/types.messages';
28
- import '@anthropic-ai/sdk';
1
+ import { ReplaySubject } from 'rxjs';
2
+ import { Parameter, Action, CopilotKitLowLevelError, CopilotErrorHandler, PartialBy, MaybePromise, NonEmptyRecord } from '@copilotkit/shared';
3
+ import OpenAI from 'openai';
4
+ import { BaseMessageChunk, AIMessage, AIMessageChunk, BaseMessage } from '@langchain/core/messages';
5
+ import { DynamicStructuredTool } from '@langchain/core/tools';
6
+ import { IterableReadableStream, IterableReadableStreamInterface } from '@langchain/core/utils/stream';
7
+ import { Groq } from 'groq-sdk';
8
+ import Anthropic from '@anthropic-ai/sdk';
9
+ import * as graphql from 'graphql';
10
+ import * as pino from 'pino';
11
+ import { YogaInitialContext, createYoga } from 'graphql-yoga';
12
+ import { CopilotRuntimeOptions, CopilotRuntime as CopilotRuntime$1, AgentRunner } from '@copilotkitnext/runtime';
13
+ import { AbstractAgent } from '@ag-ui/client';
14
+ import * as hono_dist_types_context from 'hono/dist/types/context';
15
+
16
+ declare enum MessageRole {
17
+ assistant = "assistant",
18
+ developer = "developer",
19
+ system = "system",
20
+ tool = "tool",
21
+ user = "user"
22
+ }
23
+ declare enum ActionInputAvailability {
24
+ disabled = "disabled",
25
+ enabled = "enabled",
26
+ remote = "remote"
27
+ }
28
+
29
+ declare class BaseMessageInput {
30
+ id: string;
31
+ createdAt: Date;
32
+ }
33
+
34
+ declare class MessageInput extends BaseMessageInput {
35
+ textMessage?: TextMessageInput;
36
+ actionExecutionMessage?: ActionExecutionMessageInput;
37
+ resultMessage?: ResultMessageInput;
38
+ agentStateMessage?: AgentStateMessageInput;
39
+ imageMessage?: ImageMessageInput;
40
+ }
41
+ declare class TextMessageInput {
42
+ content: string;
43
+ parentMessageId?: string;
44
+ role: MessageRole;
45
+ }
46
+ declare class ActionExecutionMessageInput {
47
+ name: string;
48
+ arguments: string;
49
+ parentMessageId?: string;
50
+ scope?: String;
51
+ }
52
+ declare class ResultMessageInput {
53
+ actionExecutionId: string;
54
+ actionName: string;
55
+ parentMessageId?: string;
56
+ result: string;
57
+ }
58
+ declare class AgentStateMessageInput {
59
+ threadId: string;
60
+ agentName: string;
61
+ role: MessageRole;
62
+ state: string;
63
+ running: boolean;
64
+ nodeName: string;
65
+ runId: string;
66
+ active: boolean;
67
+ }
68
+ declare class ImageMessageInput {
69
+ format: string;
70
+ bytes: string;
71
+ parentMessageId?: string;
72
+ role: MessageRole;
73
+ }
74
+
75
+ declare enum MessageStatusCode {
76
+ Pending = "pending",
77
+ Success = "success",
78
+ Failed = "failed"
79
+ }
80
+ declare class BaseMessageStatus {
81
+ code: MessageStatusCode;
82
+ }
83
+ declare class PendingMessageStatus extends BaseMessageStatus {
84
+ code: MessageStatusCode;
85
+ }
86
+ declare class SuccessMessageStatus extends BaseMessageStatus {
87
+ code: MessageStatusCode;
88
+ }
89
+ declare class FailedMessageStatus extends BaseMessageStatus {
90
+ code: MessageStatusCode;
91
+ reason: string;
92
+ }
93
+ declare const MessageStatusUnion: PendingMessageStatus | SuccessMessageStatus | FailedMessageStatus;
94
+ type MessageStatus = typeof MessageStatusUnion;
95
+
96
+ declare enum ResponseStatusCode {
97
+ Pending = "pending",
98
+ Success = "success",
99
+ Failed = "failed"
100
+ }
101
+ declare abstract class BaseResponseStatus {
102
+ code: ResponseStatusCode;
103
+ }
104
+ declare enum FailedResponseStatusReason {
105
+ GUARDRAILS_VALIDATION_FAILED = "GUARDRAILS_VALIDATION_FAILED",
106
+ MESSAGE_STREAM_INTERRUPTED = "MESSAGE_STREAM_INTERRUPTED",
107
+ UNKNOWN_ERROR = "UNKNOWN_ERROR"
108
+ }
109
+ declare class FailedResponseStatus extends BaseResponseStatus {
110
+ code: ResponseStatusCode;
111
+ reason: FailedResponseStatusReason;
112
+ details?: Record<string, any>;
113
+ }
114
+
115
+ /**
116
+ * The extensions response is used to receive additional information from the copilot runtime, specific to a
117
+ * service adapter or agent framework.
118
+ *
119
+ * Next time a request to the runtime is made, the extensions response will be included in the request as input.
120
+ */
121
+ declare class ExtensionsResponse {
122
+ openaiAssistantAPI?: OpenAIApiAssistantAPIResponse;
123
+ }
124
+ declare class OpenAIApiAssistantAPIResponse {
125
+ runId?: string;
126
+ threadId?: string;
127
+ }
128
+
129
+ declare abstract class BaseMessageOutput {
130
+ id: string;
131
+ createdAt: Date;
132
+ status: typeof MessageStatusUnion;
133
+ }
134
+
135
+ type MessageType = "TextMessage" | "ActionExecutionMessage" | "ResultMessage" | "AgentStateMessage" | "ImageMessage";
136
+ declare class Message {
137
+ type: MessageType;
138
+ id: BaseMessageOutput["id"];
139
+ createdAt: BaseMessageOutput["createdAt"];
140
+ status: MessageStatus;
141
+ constructor(props: any);
142
+ isTextMessage(): this is TextMessage;
143
+ isActionExecutionMessage(): this is ActionExecutionMessage;
144
+ isResultMessage(): this is ResultMessage;
145
+ isAgentStateMessage(): this is AgentStateMessage;
146
+ isImageMessage(): this is ImageMessage;
147
+ }
148
+ type MessageConstructorOptions = Partial<Message>;
149
+ type TextMessageConstructorOptions = MessageConstructorOptions & TextMessageInput;
150
+ declare class TextMessage extends Message implements TextMessageConstructorOptions {
151
+ content: TextMessageInput["content"];
152
+ parentMessageId: TextMessageInput["parentMessageId"];
153
+ role: TextMessageInput["role"];
154
+ type: "TextMessage";
155
+ constructor(props: TextMessageConstructorOptions);
156
+ }
157
+ declare class ActionExecutionMessage extends Message implements Omit<ActionExecutionMessageInput, "arguments" | "scope"> {
158
+ type: MessageType;
159
+ name: string;
160
+ arguments: Record<string, any>;
161
+ parentMessageId?: string;
162
+ }
163
+ declare class ResultMessage extends Message implements ResultMessageInput {
164
+ type: MessageType;
165
+ actionExecutionId: string;
166
+ actionName: string;
167
+ result: string;
168
+ static encodeResult(result: any, error?: {
169
+ code: string;
170
+ message: string;
171
+ } | string | Error): string;
172
+ static decodeResult(result: string): {
173
+ error?: {
174
+ code: string;
175
+ message: string;
176
+ };
177
+ result: string;
178
+ };
179
+ hasError(): boolean;
180
+ getError(): {
181
+ code: string;
182
+ message: string;
183
+ } | undefined;
184
+ }
185
+ declare class AgentStateMessage extends Message implements Omit<AgentStateMessageInput, "state"> {
186
+ type: MessageType;
187
+ threadId: string;
188
+ agentName: string;
189
+ nodeName: string;
190
+ runId: string;
191
+ active: boolean;
192
+ role: MessageRole;
193
+ state: any;
194
+ running: boolean;
195
+ }
196
+ declare class ImageMessage extends Message implements ImageMessageInput {
197
+ type: MessageType;
198
+ format: string;
199
+ bytes: string;
200
+ role: MessageRole;
201
+ parentMessageId?: string;
202
+ }
203
+
204
+ declare enum RuntimeEventTypes {
205
+ TextMessageStart = "TextMessageStart",
206
+ TextMessageContent = "TextMessageContent",
207
+ TextMessageEnd = "TextMessageEnd",
208
+ ActionExecutionStart = "ActionExecutionStart",
209
+ ActionExecutionArgs = "ActionExecutionArgs",
210
+ ActionExecutionEnd = "ActionExecutionEnd",
211
+ ActionExecutionResult = "ActionExecutionResult",
212
+ AgentStateMessage = "AgentStateMessage",
213
+ MetaEvent = "MetaEvent",
214
+ RunError = "RunError"
215
+ }
216
+ declare enum RuntimeMetaEventName {
217
+ LangGraphInterruptEvent = "LangGraphInterruptEvent",
218
+ LangGraphInterruptResumeEvent = "LangGraphInterruptResumeEvent",
219
+ CopilotKitLangGraphInterruptEvent = "CopilotKitLangGraphInterruptEvent"
220
+ }
221
+ type RunTimeMetaEvent = {
222
+ type: RuntimeEventTypes.MetaEvent;
223
+ name: RuntimeMetaEventName.LangGraphInterruptEvent;
224
+ value: string;
225
+ } | {
226
+ type: RuntimeEventTypes.MetaEvent;
227
+ name: RuntimeMetaEventName.CopilotKitLangGraphInterruptEvent;
228
+ data: {
229
+ value: string;
230
+ messages: (TextMessage | ActionExecutionMessage | ResultMessage)[];
231
+ };
232
+ } | {
233
+ type: RuntimeEventTypes.MetaEvent;
234
+ name: RuntimeMetaEventName.LangGraphInterruptResumeEvent;
235
+ data: string;
236
+ };
237
+ type RuntimeErrorEvent = {
238
+ type: RuntimeEventTypes.RunError;
239
+ message: string;
240
+ code?: string;
241
+ };
242
+ type RuntimeEvent = {
243
+ type: RuntimeEventTypes.TextMessageStart;
244
+ messageId: string;
245
+ parentMessageId?: string;
246
+ } | {
247
+ type: RuntimeEventTypes.TextMessageContent;
248
+ messageId: string;
249
+ content: string;
250
+ } | {
251
+ type: RuntimeEventTypes.TextMessageEnd;
252
+ messageId: string;
253
+ } | {
254
+ type: RuntimeEventTypes.ActionExecutionStart;
255
+ actionExecutionId: string;
256
+ actionName: string;
257
+ parentMessageId?: string;
258
+ } | {
259
+ type: RuntimeEventTypes.ActionExecutionArgs;
260
+ actionExecutionId: string;
261
+ args: string;
262
+ } | {
263
+ type: RuntimeEventTypes.ActionExecutionEnd;
264
+ actionExecutionId: string;
265
+ } | {
266
+ type: RuntimeEventTypes.ActionExecutionResult;
267
+ actionName: string;
268
+ actionExecutionId: string;
269
+ result: string;
270
+ } | {
271
+ type: RuntimeEventTypes.AgentStateMessage;
272
+ threadId: string;
273
+ agentName: string;
274
+ nodeName: string;
275
+ runId: string;
276
+ active: boolean;
277
+ role: string;
278
+ state: string;
279
+ running: boolean;
280
+ } | RunTimeMetaEvent | RuntimeErrorEvent;
281
+ type EventSourceCallback = (eventStream$: RuntimeEventSubject) => Promise<void>;
282
+ declare class RuntimeEventSubject extends ReplaySubject<RuntimeEvent> {
283
+ constructor();
284
+ sendTextMessageStart({ messageId, parentMessageId, }: {
285
+ messageId: string;
286
+ parentMessageId?: string;
287
+ }): void;
288
+ sendTextMessageContent({ messageId, content }: {
289
+ messageId: string;
290
+ content: string;
291
+ }): void;
292
+ sendTextMessageEnd({ messageId }: {
293
+ messageId: string;
294
+ }): void;
295
+ sendTextMessage(messageId: string, content: string): void;
296
+ sendActionExecutionStart({ actionExecutionId, actionName, parentMessageId, }: {
297
+ actionExecutionId: string;
298
+ actionName: string;
299
+ parentMessageId?: string;
300
+ }): void;
301
+ sendActionExecutionArgs({ actionExecutionId, args, }: {
302
+ actionExecutionId: string;
303
+ args: string;
304
+ }): void;
305
+ sendActionExecutionEnd({ actionExecutionId }: {
306
+ actionExecutionId: string;
307
+ }): void;
308
+ sendActionExecution({ actionExecutionId, actionName, args, parentMessageId, }: {
309
+ actionExecutionId: string;
310
+ actionName: string;
311
+ args: string;
312
+ parentMessageId?: string;
313
+ }): void;
314
+ sendActionExecutionResult({ actionExecutionId, actionName, result, error, }: {
315
+ actionExecutionId: string;
316
+ actionName: string;
317
+ result?: string;
318
+ error?: {
319
+ code: string;
320
+ message: string;
321
+ };
322
+ }): void;
323
+ sendAgentStateMessage({ threadId, agentName, nodeName, runId, active, role, state, running, }: {
324
+ threadId: string;
325
+ agentName: string;
326
+ nodeName: string;
327
+ runId: string;
328
+ active: boolean;
329
+ role: string;
330
+ state: string;
331
+ running: boolean;
332
+ }): void;
333
+ }
334
+ declare class RuntimeEventSource {
335
+ private eventStream$;
336
+ private callback;
337
+ private errorHandler?;
338
+ private errorContext?;
339
+ constructor(params?: {
340
+ errorHandler?: (error: any, context: any) => Promise<void>;
341
+ errorContext?: any;
342
+ });
343
+ stream(callback: EventSourceCallback): Promise<void>;
344
+ }
345
+
346
+ declare class ActionInput {
347
+ name: string;
348
+ description: string;
349
+ jsonSchema: string;
350
+ available?: ActionInputAvailability;
351
+ }
352
+
353
+ declare class ForwardedParametersInput {
354
+ model?: string;
355
+ maxTokens?: number;
356
+ stop?: string[];
357
+ toolChoice?: String;
358
+ toolChoiceFunctionName?: string;
359
+ temperature?: number;
360
+ }
361
+
362
+ /**
363
+ * The extensions input is used to pass additional information to the copilot runtime, specific to a
364
+ * service adapter or agent framework.
365
+ */
366
+ declare class ExtensionsInput {
367
+ openaiAssistantAPI?: OpenAIApiAssistantAPIInput;
368
+ }
369
+ declare class OpenAIApiAssistantAPIInput {
370
+ runId?: string;
371
+ threadId?: string;
372
+ }
373
+
374
+ declare class AgentSessionInput {
375
+ agentName: string;
376
+ threadId?: string;
377
+ nodeName?: string;
378
+ }
379
+
380
+ declare class AgentStateInput {
381
+ agentName: string;
382
+ state: string;
383
+ config?: string;
384
+ }
385
+
386
+ interface CopilotRuntimeChatCompletionRequest {
387
+ eventSource: RuntimeEventSource;
388
+ messages: Message[];
389
+ actions: ActionInput[];
390
+ model?: string;
391
+ threadId?: string;
392
+ runId?: string;
393
+ forwardedParameters?: ForwardedParametersInput;
394
+ extensions?: ExtensionsInput;
395
+ agentSession?: AgentSessionInput;
396
+ agentStates?: AgentStateInput[];
397
+ }
398
+ interface CopilotRuntimeChatCompletionResponse {
399
+ threadId: string;
400
+ runId?: string;
401
+ extensions?: ExtensionsResponse;
402
+ }
403
+ interface CopilotServiceAdapter {
404
+ provider?: string;
405
+ model?: string;
406
+ process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
407
+ name?: string;
408
+ }
409
+
410
+ /**
411
+ * Copilot Runtime adapter for OpenAI.
412
+ *
413
+ * ## Example
414
+ *
415
+ * ```ts
416
+ * import { CopilotRuntime, OpenAIAdapter } from "@copilotkit/runtime";
417
+ * import OpenAI from "openai";
418
+ *
419
+ * const copilotKit = new CopilotRuntime();
420
+ *
421
+ * const openai = new OpenAI({
422
+ * organization: "<your-organization-id>", // optional
423
+ * apiKey: "<your-api-key>",
424
+ * });
425
+ *
426
+ * return new OpenAIAdapter({ openai });
427
+ * ```
428
+ *
429
+ * ## Example with Azure OpenAI
430
+ *
431
+ * ```ts
432
+ * import { CopilotRuntime, OpenAIAdapter } from "@copilotkit/runtime";
433
+ * import OpenAI from "openai";
434
+ *
435
+ * // The name of your Azure OpenAI Instance.
436
+ * // https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/create-resource?pivots=web-portal#create-a-resource
437
+ * const instance = "<your instance name>";
438
+ *
439
+ * // Corresponds to your Model deployment within your OpenAI resource, e.g. my-gpt35-16k-deployment
440
+ * // Navigate to the Azure OpenAI Studio to deploy a model.
441
+ * const model = "<your model>";
442
+ *
443
+ * const apiKey = process.env["AZURE_OPENAI_API_KEY"];
444
+ * if (!apiKey) {
445
+ * throw new Error("The AZURE_OPENAI_API_KEY environment variable is missing or empty.");
446
+ * }
447
+ *
448
+ * const copilotKit = new CopilotRuntime();
449
+ *
450
+ * const openai = new OpenAI({
451
+ * apiKey,
452
+ * baseURL: `https://${instance}.openai.azure.com/openai/deployments/${model}`,
453
+ * defaultQuery: { "api-version": "2024-04-01-preview" },
454
+ * defaultHeaders: { "api-key": apiKey },
455
+ * });
456
+ *
457
+ * return new OpenAIAdapter({ openai });
458
+ * ```
459
+ */
460
+
461
+ interface OpenAIAdapterParams {
462
+ /**
463
+ * An optional OpenAI instance to use. If not provided, a new instance will be
464
+ * created.
465
+ */
466
+ openai?: OpenAI;
467
+ /**
468
+ * The model to use.
469
+ */
470
+ model?: string;
471
+ /**
472
+ * Whether to disable parallel tool calls.
473
+ * You can disable parallel tool calls to force the model to execute tool calls sequentially.
474
+ * This is useful if you want to execute tool calls in a specific order so that the state changes
475
+ * introduced by one tool call are visible to the next tool call. (i.e. new actions or readables)
476
+ *
477
+ * @default false
478
+ */
479
+ disableParallelToolCalls?: boolean;
480
+ /**
481
+ * Whether to keep the role in system messages as "System".
482
+ * By default, it is converted to "developer", which is used by newer OpenAI models
483
+ *
484
+ * @default false
485
+ */
486
+ keepSystemRole?: boolean;
487
+ }
488
+ declare class OpenAIAdapter implements CopilotServiceAdapter {
489
+ model: string;
490
+ provider: string;
491
+ private disableParallelToolCalls;
492
+ private _openai;
493
+ private keepSystemRole;
494
+ get openai(): OpenAI;
495
+ get name(): string;
496
+ constructor(params?: OpenAIAdapterParams);
497
+ private ensureOpenAI;
498
+ process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
499
+ }
500
+
501
+ type LangChainBaseMessageChunkStream = IterableReadableStream<BaseMessageChunk>;
502
+ type LangChainAIMessageChunkStream = IterableReadableStreamInterface<AIMessageChunk>;
503
+ type LangChainReturnType = LangChainBaseMessageChunkStream | LangChainAIMessageChunkStream | BaseMessageChunk | string | AIMessage;
504
+
505
+ /**
506
+ * Copilot Runtime adapter for LangChain.
507
+ *
508
+ * ## Example
509
+ *
510
+ * ```ts
511
+ * import { CopilotRuntime, LangChainAdapter } from "@copilotkit/runtime";
512
+ * import { ChatOpenAI } from "@langchain/openai";
513
+ *
514
+ * const copilotKit = new CopilotRuntime();
515
+ *
516
+ * const model = new ChatOpenAI({
517
+ * model: "gpt-4o",
518
+ * apiKey: "<your-api-key>",
519
+ * });
520
+ *
521
+ * return new LangChainAdapter({
522
+ * chainFn: async ({ messages, tools }) => {
523
+ * return model.bindTools(tools).stream(messages);
524
+ * // or optionally enable strict mode
525
+ * // return model.bindTools(tools, { strict: true }).stream(messages);
526
+ * }
527
+ * });
528
+ * ```
529
+ *
530
+ * The asynchronous handler function (`chainFn`) can return any of the following:
531
+ *
532
+ * - A simple `string` response
533
+ * - A LangChain stream (`IterableReadableStream`)
534
+ * - A LangChain `BaseMessageChunk` object
535
+ * - A LangChain `AIMessage` object
536
+ */
537
+
538
+ interface ChainFnParameters {
539
+ model: string;
540
+ messages: BaseMessage[];
541
+ tools: DynamicStructuredTool[];
542
+ threadId?: string;
543
+ runId?: string;
544
+ }
545
+ interface LangChainAdapterOptions {
546
+ /**
547
+ * A function that uses the LangChain API to generate a response.
548
+ */
549
+ chainFn: (parameters: ChainFnParameters) => Promise<LangChainReturnType>;
550
+ }
551
+ declare class LangChainAdapter implements CopilotServiceAdapter {
552
+ private options;
553
+ /**
554
+ * To use LangChain as a backend, provide a handler function to the adapter with your custom LangChain logic.
555
+ */
556
+ get name(): string;
557
+ constructor(options: LangChainAdapterOptions);
558
+ process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
559
+ }
560
+
561
+ /**
562
+ * Copilot Runtime adapter for Google Generative AI (e.g. Gemini).
563
+ *
564
+ * ## Example
565
+ *
566
+ * ```ts
567
+ * import { CopilotRuntime, GoogleGenerativeAIAdapter } from "@copilotkit/runtime";
568
+ * const { GoogleGenerativeAI } = require("@google/generative-ai");
569
+ *
570
+ * const genAI = new GoogleGenerativeAI(process.env["GOOGLE_API_KEY"]);
571
+ *
572
+ * const copilotKit = new CopilotRuntime();
573
+ *
574
+ * return new GoogleGenerativeAIAdapter({ model: "gemini-2.5-flash", apiVersion: "v1" });
575
+ * ```
576
+ */
577
+
578
+ interface GoogleGenerativeAIAdapterOptions {
579
+ /**
580
+ * A custom Google Generative AI model to use.
581
+ */
582
+ model?: string;
583
+ /**
584
+ * The API version to use (e.g. "v1" or "v1beta"). Defaults to "v1".
585
+ */
586
+ apiVersion?: "v1" | "v1beta";
587
+ /**
588
+ * The API key to use.
589
+ */
590
+ apiKey?: string;
591
+ }
592
+ declare class GoogleGenerativeAIAdapter extends LangChainAdapter {
593
+ provider: string;
594
+ model: string;
595
+ constructor(options?: GoogleGenerativeAIAdapterOptions);
596
+ }
597
+
598
+ /**
599
+ * Copilot Runtime adapter for the OpenAI Assistant API.
600
+ *
601
+ * ## Example
602
+ *
603
+ * ```ts
604
+ * import { CopilotRuntime, OpenAIAssistantAdapter } from "@copilotkit/runtime";
605
+ * import OpenAI from "openai";
606
+ *
607
+ * const copilotKit = new CopilotRuntime();
608
+ *
609
+ * const openai = new OpenAI({
610
+ * organization: "<your-organization-id>",
611
+ * apiKey: "<your-api-key>",
612
+ * });
613
+ *
614
+ * return new OpenAIAssistantAdapter({
615
+ * openai,
616
+ * assistantId: "<your-assistant-id>",
617
+ * codeInterpreterEnabled: true,
618
+ * fileSearchEnabled: true,
619
+ * });
620
+ * ```
621
+ */
622
+
623
+ interface OpenAIAssistantAdapterParams {
624
+ /**
625
+ * The ID of the assistant to use.
626
+ */
627
+ assistantId: string;
628
+ /**
629
+ * An optional OpenAI instance to use. If not provided, a new instance will be created.
630
+ */
631
+ openai?: OpenAI;
632
+ /**
633
+ * Whether to enable code interpretation.
634
+ * @default true
635
+ */
636
+ codeInterpreterEnabled?: boolean;
637
+ /**
638
+ * Whether to enable file search.
639
+ * @default true
640
+ */
641
+ fileSearchEnabled?: boolean;
642
+ /**
643
+ * Whether to disable parallel tool calls.
644
+ * You can disable parallel tool calls to force the model to execute tool calls sequentially.
645
+ * This is useful if you want to execute tool calls in a specific order so that the state changes
646
+ * introduced by one tool call are visible to the next tool call. (i.e. new actions or readables)
647
+ *
648
+ * @default false
649
+ */
650
+ disableParallelToolCalls?: boolean;
651
+ /**
652
+ * Whether to keep the role in system messages as "System".
653
+ * By default, it is converted to "developer", which is used by newer OpenAI models
654
+ *
655
+ * @default false
656
+ */
657
+ keepSystemRole?: boolean;
658
+ }
659
+ declare class OpenAIAssistantAdapter implements CopilotServiceAdapter {
660
+ private _openai;
661
+ private codeInterpreterEnabled;
662
+ private assistantId;
663
+ private fileSearchEnabled;
664
+ private disableParallelToolCalls;
665
+ private keepSystemRole;
666
+ get name(): string;
667
+ constructor(params: OpenAIAssistantAdapterParams);
668
+ private ensureOpenAI;
669
+ process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
670
+ private submitToolOutputs;
671
+ private submitUserMessage;
672
+ private streamResponse;
673
+ }
674
+
675
+ /**
676
+ * CopilotKit Adapter for Unify
677
+ *
678
+ * <RequestExample>
679
+ * ```jsx CopilotRuntime Example
680
+ * const copilotKit = new CopilotRuntime();
681
+ * return copilotKit.response(req, new UnifyAdapter());
682
+ * ```
683
+ * </RequestExample>
684
+ *
685
+ * You can easily set the model to use by passing it to the constructor.
686
+ * ```jsx
687
+ * const copilotKit = new CopilotRuntime();
688
+ * return copilotKit.response(
689
+ * req,
690
+ * new UnifyAdapter({ model: "llama-3-8b-chat@fireworks-ai" }),
691
+ * );
692
+ * ```
693
+ */
694
+
695
+ interface UnifyAdapterParams {
696
+ apiKey?: string;
697
+ model: string;
698
+ }
699
+ declare class UnifyAdapter implements CopilotServiceAdapter {
700
+ private apiKey;
701
+ model: string;
702
+ private start;
703
+ provider: string;
704
+ get name(): string;
705
+ constructor(options?: UnifyAdapterParams);
706
+ process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
707
+ }
708
+
709
+ /**
710
+ * Copilot Runtime adapter for Groq.
711
+ *
712
+ * ## Example
713
+ *
714
+ * ```ts
715
+ * import { CopilotRuntime, GroqAdapter } from "@copilotkit/runtime";
716
+ * import { Groq } from "groq-sdk";
717
+ *
718
+ * const groq = new Groq({ apiKey: process.env["GROQ_API_KEY"] });
719
+ *
720
+ * const copilotKit = new CopilotRuntime();
721
+ *
722
+ * return new GroqAdapter({ groq, model: "<model-name>" });
723
+ * ```
724
+ */
725
+
726
+ interface GroqAdapterParams {
727
+ /**
728
+ * An optional Groq instance to use.
729
+ */
730
+ groq?: Groq;
731
+ /**
732
+ * The model to use.
733
+ */
734
+ model?: string;
735
+ /**
736
+ * Whether to disable parallel tool calls.
737
+ * You can disable parallel tool calls to force the model to execute tool calls sequentially.
738
+ * This is useful if you want to execute tool calls in a specific order so that the state changes
739
+ * introduced by one tool call are visible to the next tool call. (i.e. new actions or readables)
740
+ *
741
+ * @default false
742
+ */
743
+ disableParallelToolCalls?: boolean;
744
+ }
745
+ declare class GroqAdapter implements CopilotServiceAdapter {
746
+ model: string;
747
+ provider: string;
748
+ private disableParallelToolCalls;
749
+ private _groq;
750
+ get groq(): Groq;
751
+ get name(): string;
752
+ constructor(params?: GroqAdapterParams);
753
+ private ensureGroq;
754
+ process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
755
+ }
756
+
757
+ interface RemoteChainParameters {
758
+ name: string;
759
+ description: string;
760
+ chainUrl: string;
761
+ parameters?: Parameter[];
762
+ parameterType?: "single" | "multi";
763
+ }
764
+ declare class RemoteChain {
765
+ name: string;
766
+ description: string;
767
+ chainUrl: string;
768
+ parameters?: Parameter[];
769
+ parameterType: "single" | "multi";
770
+ constructor(options: RemoteChainParameters);
771
+ toAction(): Promise<Action<any>>;
772
+ inferLangServeParameters(): Promise<void>;
773
+ }
774
+
775
+ /**
776
+ * Converts service adapter errors to structured CopilotKitError format using HTTP status codes.
777
+ * This provides consistent error classification across all service adapters.
778
+ */
779
+ declare function convertServiceAdapterError(error: any, adapterName: string): CopilotKitLowLevelError;
780
+
781
+ /**
782
+ * Copilot Runtime adapter for Anthropic.
783
+ *
784
+ * ## Example
785
+ *
786
+ * ```ts
787
+ * import { CopilotRuntime, AnthropicAdapter } from "@copilotkit/runtime";
788
+ * import Anthropic from "@anthropic-ai/sdk";
789
+ *
790
+ * const copilotKit = new CopilotRuntime();
791
+ *
792
+ * const anthropic = new Anthropic({
793
+ * apiKey: "<your-api-key>",
794
+ * });
795
+ *
796
+ * return new AnthropicAdapter({
797
+ * anthropic,
798
+ * promptCaching: {
799
+ * enabled: true,
800
+ * debug: true
801
+ * }
802
+ * });
803
+ * ```
804
+ */
805
+
806
+ interface AnthropicPromptCachingConfig {
807
+ /**
808
+ * Whether to enable prompt caching.
809
+ */
810
+ enabled: boolean;
811
+ /**
812
+ * Whether to enable debug logging for cache operations.
813
+ */
814
+ debug?: boolean;
815
+ }
816
+ interface AnthropicAdapterParams {
817
+ /**
818
+ * An optional Anthropic instance to use. If not provided, a new instance will be
819
+ * created.
820
+ */
821
+ anthropic?: Anthropic;
822
+ /**
823
+ * The model to use.
824
+ */
825
+ model?: string;
826
+ /**
827
+ * Configuration for prompt caching.
828
+ * See: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
829
+ */
830
+ promptCaching?: AnthropicPromptCachingConfig;
831
+ }
832
+ declare class AnthropicAdapter implements CopilotServiceAdapter {
833
+ model: string;
834
+ provider: string;
835
+ private promptCaching;
836
+ private _anthropic;
837
+ get anthropic(): Anthropic;
838
+ get name(): string;
839
+ constructor(params?: AnthropicAdapterParams);
840
+ private ensureAnthropic;
841
+ /**
842
+ * Adds cache control to system prompt
843
+ */
844
+ private addSystemPromptCaching;
845
+ /**
846
+ * Adds cache control to the final message
847
+ */
848
+ private addIncrementalMessageCaching;
849
+ private shouldGenerateFallbackResponse;
850
+ process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
851
+ }
852
+
853
+ interface OllamaAdapterOptions {
854
+ model?: string;
855
+ }
856
+ declare class ExperimentalOllamaAdapter implements CopilotServiceAdapter {
857
+ model: string;
858
+ provider: string;
859
+ get name(): string;
860
+ constructor(options?: OllamaAdapterOptions);
861
+ process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
862
+ }
863
+
864
+ /**
865
+ * Copilot Runtime adapter for AWS Bedrock.
866
+ *
867
+ * ## Example
868
+ *
869
+ * ```ts
870
+ * import { CopilotRuntime, BedrockAdapter } from "@copilotkit/runtime";
871
+ *
872
+ * const copilotKit = new CopilotRuntime();
873
+ *
874
+ * return new BedrockAdapter({
875
+ * model: "amazon.nova-lite-v1:0",
876
+ * region: "us-east-1",
877
+ * credentials: {
878
+ * accessKeyId: process.env.AWS_ACCESS_KEY_ID,
879
+ * secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
880
+ * }
881
+ * });
882
+ * ```
883
+ */
884
+
885
+ interface BedrockAdapterParams {
886
+ /**
887
+ * AWS Bedrock model ID to use.
888
+ * @default "amazon.nova-lite-v1:0"
889
+ */
890
+ model?: string;
891
+ /**
892
+ * AWS region where Bedrock is available.
893
+ * @default "us-east-1"
894
+ */
895
+ region?: string;
896
+ /**
897
+ * AWS credentials for Bedrock access.
898
+ */
899
+ credentials?: {
900
+ accessKeyId?: string;
901
+ secretAccessKey?: string;
902
+ };
903
+ }
904
+ declare class BedrockAdapter extends LangChainAdapter {
905
+ provider: string;
906
+ model: string;
907
+ constructor(options?: BedrockAdapterParams);
908
+ }
909
+
910
+ /**
911
+ * CopilotKit Empty Adapter
912
+ *
913
+ * This adapter is meant to preserve adherence to runtime requirements, while doing nothing
914
+ * Ideal if you don't want to connect an LLM the to the runtime, and only use your LangGraph agent.
915
+ * Be aware that Copilot Suggestions will not work if you use this adapter
916
+ *
917
+ * ## Example
918
+ *
919
+ * ```ts
920
+ * import { CopilotRuntime, EmptyAdapter } from "@copilotkit/runtime";
921
+ *
922
+ * const copilotKit = new CopilotRuntime();
923
+ *
924
+ * return new EmptyAdapter();
925
+ * ```
926
+ */
927
+
928
+ declare class EmptyAdapter implements CopilotServiceAdapter {
929
+ process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
930
+ get name(): string;
931
+ }
932
+ declare const ExperimentalEmptyAdapter: typeof EmptyAdapter;
933
+
934
+ interface BaseEndpointDefinition<TActionType extends EndpointType> {
935
+ type?: TActionType;
936
+ }
937
+ interface CopilotKitEndpoint extends BaseEndpointDefinition<EndpointType.CopilotKit> {
938
+ url: string;
939
+ onBeforeRequest?: ({ ctx }: {
940
+ ctx: GraphQLContext;
941
+ }) => {
942
+ headers?: Record<string, string> | undefined;
943
+ };
944
+ }
945
+ interface LangGraphPlatformAgent {
946
+ name: string;
947
+ description: string;
948
+ assistantId?: string;
949
+ }
950
+ interface LangGraphPlatformEndpoint extends BaseEndpointDefinition<EndpointType.LangGraphPlatform> {
951
+ deploymentUrl: string;
952
+ langsmithApiKey?: string | null;
953
+ agents: LangGraphPlatformAgent[];
954
+ }
955
+ type EndpointDefinition = CopilotKitEndpoint | LangGraphPlatformEndpoint;
956
+ declare enum EndpointType {
957
+ CopilotKit = "copilotKit",
958
+ LangGraphPlatform = "langgraph-platform"
959
+ }
960
+
961
+ interface LLMRequestData {
962
+ threadId?: string;
963
+ runId?: string;
964
+ model?: string;
965
+ messages: any[];
966
+ actions?: any[];
967
+ forwardedParameters?: any;
968
+ timestamp: number;
969
+ provider?: string;
970
+ [key: string]: any;
971
+ }
972
+ interface LLMResponseData {
973
+ threadId: string;
974
+ runId?: string;
975
+ model?: string;
976
+ output: any;
977
+ latency: number;
978
+ timestamp: number;
979
+ provider?: string;
980
+ isProgressiveChunk?: boolean;
981
+ isFinalResponse?: boolean;
982
+ [key: string]: any;
983
+ }
984
+ interface LLMErrorData {
985
+ threadId?: string;
986
+ runId?: string;
987
+ model?: string;
988
+ error: Error | string;
989
+ timestamp: number;
990
+ provider?: string;
991
+ [key: string]: any;
992
+ }
993
+ interface CopilotObservabilityHooks {
994
+ handleRequest: (data: LLMRequestData) => void | Promise<void>;
995
+ handleResponse: (data: LLMResponseData) => void | Promise<void>;
996
+ handleError: (data: LLMErrorData) => void | Promise<void>;
997
+ }
998
+ /**
999
+ * Configuration for CopilotKit logging functionality.
1000
+ *
1001
+ * @remarks
1002
+ * Custom logging handlers require a valid CopilotKit public API key.
1003
+ * Sign up at https://docs.copilotkit.ai/quickstart#get-a-copilot-cloud-public-api-key to get your key.
1004
+ */
1005
+ interface CopilotObservabilityConfig {
1006
+ /**
1007
+ * Enable or disable logging functionality.
1008
+ *
1009
+ * @default false
1010
+ */
1011
+ enabled: boolean;
1012
+ /**
1013
+ * Controls whether logs are streamed progressively or buffered.
1014
+ * - When true: Each token and update is logged as it's generated (real-time)
1015
+ * - When false: Complete responses are logged after completion (batched)
1016
+ *
1017
+ * @default true
1018
+ */
1019
+ progressive: boolean;
1020
+ /**
1021
+ * Custom observability hooks for request, response, and error events.
1022
+ *
1023
+ * @remarks
1024
+ * Using custom observability hooks requires a valid CopilotKit public API key.
1025
+ */
1026
+ hooks: CopilotObservabilityHooks;
1027
+ }
1028
+
1029
+ /**
1030
+ * Represents a tool provided by an MCP server.
1031
+ */
1032
+ interface MCPTool {
1033
+ description?: string;
1034
+ /** Schema defining parameters, mirroring the MCP structure. */
1035
+ schema?: {
1036
+ parameters?: {
1037
+ properties?: Record<string, any>;
1038
+ required?: string[];
1039
+ jsonSchema?: Record<string, any>;
1040
+ };
1041
+ };
1042
+ /** The function to call to execute the tool on the MCP server. */
1043
+ execute(params: any): Promise<any>;
1044
+ }
1045
+ /**
1046
+ * Defines the contract for *any* MCP client implementation the user might provide.
1047
+ */
1048
+ interface MCPClient {
1049
+ /** A method that returns a map of tool names to MCPTool objects available from the connected MCP server. */
1050
+ tools(): Promise<Record<string, MCPTool>>;
1051
+ /** An optional method for cleanup if the underlying client requires explicit disconnection. */
1052
+ close?(): Promise<void>;
1053
+ }
1054
+ /**
1055
+ * Configuration for connecting to an MCP endpoint.
1056
+ */
1057
+ interface MCPEndpointConfig {
1058
+ endpoint: string;
1059
+ apiKey?: string;
1060
+ }
1061
+ /**
1062
+ * Extracts CopilotKit-compatible parameters from an MCP tool schema.
1063
+ * @param toolOrSchema The schema object from an MCPTool or the full MCPTool object.
1064
+ * @returns An array of Parameter objects.
1065
+ */
1066
+ declare function extractParametersFromSchema(toolOrSchema?: MCPTool | MCPTool["schema"]): Parameter[];
1067
+ /**
1068
+ * Converts a map of MCPTools into an array of CopilotKit Actions.
1069
+ * @param mcpTools A record mapping tool names to MCPTool objects.
1070
+ * @param mcpEndpoint The endpoint URL from which these tools were fetched.
1071
+ * @returns An array of Action<any> objects.
1072
+ */
1073
+ declare function convertMCPToolsToActions(mcpTools: Record<string, MCPTool>, mcpEndpoint: string): Action<any>[];
1074
+ /**
1075
+ * Generate better instructions for using MCP tools
1076
+ * This is used to enhance the system prompt with tool documentation
1077
+ */
1078
+ declare function generateMcpToolInstructions(toolsMap: Record<string, MCPTool>): string;
1079
+
1080
+ /**
1081
+ * <Callout type="info">
1082
+ * This is the reference for the `CopilotRuntime` class. For more information and example code snippets, please see [Concept: Copilot Runtime](/concepts/copilot-runtime).
1083
+ * </Callout>
1084
+ *
1085
+ * ## Usage
1086
+ *
1087
+ * ```tsx
1088
+ * import { CopilotRuntime } from "@copilotkit/runtime";
1089
+ *
1090
+ * const copilotKit = new CopilotRuntime();
1091
+ * ```
1092
+ */
1093
+
1094
+ type CreateMCPClientFunction = (config: MCPEndpointConfig) => Promise<MCPClient>;
1095
+ type ActionsConfiguration<T extends Parameter[] | [] = []> = Action<T>[] | ((ctx: {
1096
+ properties: any;
1097
+ url?: string;
1098
+ }) => Action<T>[]);
1099
+ interface OnBeforeRequestOptions {
1100
+ threadId?: string;
1101
+ runId?: string;
1102
+ inputMessages: Message[];
1103
+ properties: any;
1104
+ url?: string;
1105
+ }
1106
+ type OnBeforeRequestHandler = (options: OnBeforeRequestOptions) => void | Promise<void>;
1107
+ interface OnAfterRequestOptions {
1108
+ threadId: string;
1109
+ runId?: string;
1110
+ inputMessages: Message[];
1111
+ outputMessages: Message[];
1112
+ properties: any;
1113
+ url?: string;
1114
+ }
1115
+ type OnAfterRequestHandler = (options: OnAfterRequestOptions) => void | Promise<void>;
1116
+ interface OnStopGenerationOptions {
1117
+ threadId: string;
1118
+ runId?: string;
1119
+ url?: string;
1120
+ agentName?: string;
1121
+ lastMessage: MessageInput;
1122
+ }
1123
+ type OnStopGenerationHandler = (options: OnStopGenerationOptions) => void | Promise<void>;
1124
+ interface Middleware {
1125
+ /**
1126
+ * A function that is called before the request is processed.
1127
+ */
1128
+ /**
1129
+ * @deprecated This middleware hook is deprecated and will be removed in a future version.
1130
+ * Use updated middleware integration methods in CopilotRuntimeVNext instead.
1131
+ */
1132
+ onBeforeRequest?: OnBeforeRequestHandler;
1133
+ /**
1134
+ * A function that is called after the request is processed.
1135
+ */
1136
+ /**
1137
+ * @deprecated This middleware hook is deprecated and will be removed in a future version.
1138
+ * Use updated middleware integration methods in CopilotRuntimeVNext instead.
1139
+ */
1140
+ onAfterRequest?: OnAfterRequestHandler;
1141
+ }
1142
+ interface CopilotRuntimeConstructorParams_BASE<T extends Parameter[] | [] = []> {
1143
+ /**
1144
+ * Middleware to be used by the runtime.
1145
+ *
1146
+ * ```ts
1147
+ * onBeforeRequest: (options: {
1148
+ * threadId?: string;
1149
+ * runId?: string;
1150
+ * inputMessages: Message[];
1151
+ * properties: any;
1152
+ * }) => void | Promise<void>;
1153
+ * ```
1154
+ *
1155
+ * ```ts
1156
+ * onAfterRequest: (options: {
1157
+ * threadId?: string;
1158
+ * runId?: string;
1159
+ * inputMessages: Message[];
1160
+ * outputMessages: Message[];
1161
+ * properties: any;
1162
+ * }) => void | Promise<void>;
1163
+ * ```
1164
+ */
1165
+ /**
1166
+ * @deprecated This middleware hook is deprecated and will be removed in a future version.
1167
+ * Use updated middleware integration methods in CopilotRuntimeVNext instead.
1168
+ */
1169
+ middleware?: Middleware;
1170
+ actions?: ActionsConfiguration<T>;
1171
+ remoteActions?: CopilotKitEndpoint[];
1172
+ remoteEndpoints?: EndpointDefinition[];
1173
+ langserve?: RemoteChainParameters[];
1174
+ agents?: Record<string, AbstractAgent>;
1175
+ delegateAgentProcessingToServiceAdapter?: boolean;
1176
+ /**
1177
+ * Configuration for LLM request/response logging.
1178
+ * Requires publicApiKey from CopilotKit component to be set:
1179
+ *
1180
+ * ```tsx
1181
+ * <CopilotKit publicApiKey="ck_pub_..." />
1182
+ * ```
1183
+ *
1184
+ * Example logging config:
1185
+ * ```ts
1186
+ * logging: {
1187
+ * enabled: true, // Enable or disable logging
1188
+ * progressive: true, // Set to false for buffered logging
1189
+ * logger: {
1190
+ * logRequest: (data) => langfuse.trace({ name: "LLM Request", input: data }),
1191
+ * logResponse: (data) => langfuse.trace({ name: "LLM Response", output: data }),
1192
+ * logError: (errorData) => langfuse.trace({ name: "LLM Error", metadata: errorData }),
1193
+ * },
1194
+ * }
1195
+ * ```
1196
+ */
1197
+ observability_c?: CopilotObservabilityConfig;
1198
+ /**
1199
+ * Configuration for connecting to Model Context Protocol (MCP) servers.
1200
+ * Allows fetching and using tools defined on external MCP-compliant servers.
1201
+ * Requires providing the `createMCPClient` function during instantiation.
1202
+ * @experimental
1203
+ */
1204
+ mcpServers?: MCPEndpointConfig[];
1205
+ /**
1206
+ * A function that creates an MCP client instance for a given endpoint configuration.
1207
+ * This function is responsible for using the appropriate MCP client library
1208
+ * (e.g., `@copilotkit/runtime`, `ai`) to establish a connection.
1209
+ * Required if `mcpServers` is provided.
1210
+ *
1211
+ * ```typescript
1212
+ * import { experimental_createMCPClient } from "ai"; // Import from vercel ai library
1213
+ * // ...
1214
+ * const runtime = new CopilotRuntime({
1215
+ * mcpServers: [{ endpoint: "..." }],
1216
+ * async createMCPClient(config) {
1217
+ * return await experimental_createMCPClient({
1218
+ * transport: {
1219
+ * type: "sse",
1220
+ * url: config.endpoint,
1221
+ * headers: config.apiKey
1222
+ * ? { Authorization: `Bearer ${config.apiKey}` }
1223
+ * : undefined,
1224
+ * },
1225
+ * });
1226
+ * }
1227
+ * });
1228
+ * ```
1229
+ */
1230
+ createMCPClient?: CreateMCPClientFunction;
1231
+ /**
1232
+ * Optional error handler for comprehensive debugging and observability.
1233
+ *
1234
+ * **Requires publicApiKey**: Error handling only works when requests include a valid publicApiKey.
1235
+ * This is a premium Copilot Cloud feature.
1236
+ *
1237
+ * @param errorEvent - Structured error event with rich debugging context
1238
+ *
1239
+ * @example
1240
+ * ```typescript
1241
+ * const runtime = new CopilotRuntime({
1242
+ * onError: (errorEvent) => {
1243
+ * debugDashboard.capture(errorEvent);
1244
+ * }
1245
+ * });
1246
+ * ```
1247
+ */
1248
+ onError?: CopilotErrorHandler;
1249
+ onStopGeneration?: OnStopGenerationHandler;
1250
+ }
1251
+ interface CopilotRuntimeConstructorParams<T extends Parameter[] | [] = []> extends Omit<CopilotRuntimeConstructorParams_BASE<T>, "agents">, Omit<CopilotRuntimeOptions, "agents" | "transcriptionService"> {
1252
+ /**
1253
+ * TODO: un-omit `transcriptionService` above once it's supported
1254
+ *
1255
+ * This satisfies...
1256
+ * – the optional constraint in `CopilotRuntimeConstructorParams_BASE`
1257
+ * – the `MaybePromise<NonEmptyRecord<T>>` constraint in `CopilotRuntimeOptionsVNext`
1258
+ * – the `Record<string, AbstractAgent>` constraint in `both
1259
+ */
1260
+ agents?: MaybePromise<NonEmptyRecord<Record<string, AbstractAgent>>>;
1261
+ }
1262
+ /**
1263
+ * Central runtime object passed to all request handlers.
1264
+ */
1265
+ declare class CopilotRuntime<const T extends Parameter[] | [] = []> {
1266
+ params?: CopilotRuntimeConstructorParams<T>;
1267
+ private observability?;
1268
+ private mcpToolsCache;
1269
+ private runtimeArgs;
1270
+ private _instance;
1271
+ constructor(params?: CopilotRuntimeConstructorParams<T> & PartialBy<CopilotRuntimeOptions, "agents">);
1272
+ get instance(): CopilotRuntime$1;
1273
+ private assignEndpointsToAgents;
1274
+ handleServiceAdapter(serviceAdapter: CopilotServiceAdapter): void;
1275
+ private getToolsFromActions;
1276
+ private assignToolsToAgents;
1277
+ private createOnBeforeRequestHandler;
1278
+ private createOnAfterRequestHandler;
1279
+ /**
1280
+ * Log LLM request if observability is enabled
1281
+ */
1282
+ private logObservabilityBeforeRequest;
1283
+ /**
1284
+ * Log final LLM response after request completes
1285
+ */
1286
+ private logObservabilityAfterRequest;
1287
+ private getToolsFromMCP;
1288
+ }
1289
+ declare function copilotKitEndpoint(config: Omit<CopilotKitEndpoint, "type">): CopilotKitEndpoint;
1290
+ declare function langGraphPlatformEndpoint(config: Omit<LangGraphPlatformEndpoint, "type">): LangGraphPlatformEndpoint;
1291
+ declare function resolveEndpointType(endpoint: EndpointDefinition): EndpointType;
1292
+
1293
+ interface CopilotCloudOptions {
1294
+ baseUrl?: string;
1295
+ publicApiKey?: string;
1296
+ }
1297
+
1298
+ type LogLevel = "debug" | "info" | "warn" | "error";
1299
+ type CopilotRuntimeLogger = ReturnType<typeof createLogger>;
1300
+ declare function createLogger(options?: {
1301
+ level?: LogLevel;
1302
+ component?: string;
1303
+ }): pino.Logger<never>;
1304
+
1305
+ declare const logger: pino.Logger<never>;
1306
+ declare const addCustomHeaderPlugin: {
1307
+ onResponse({ response }: {
1308
+ response: any;
1309
+ }): void;
1310
+ };
1311
+ type AnyPrimitive = string | boolean | number | null;
1312
+ type CopilotRequestContextProperties = Record<string, AnyPrimitive | Record<string, AnyPrimitive>>;
1313
+ type GraphQLContext = YogaInitialContext & {
1314
+ _copilotkit: CreateCopilotRuntimeServerOptions;
1315
+ properties: CopilotRequestContextProperties;
1316
+ logger: typeof logger;
1317
+ };
1318
+ interface CreateCopilotRuntimeServerOptions {
1319
+ runtime: CopilotRuntime<any>;
1320
+ serviceAdapter?: CopilotServiceAdapter;
1321
+ endpoint: string;
1322
+ baseUrl?: string;
1323
+ cloud?: CopilotCloudOptions;
1324
+ properties?: CopilotRequestContextProperties;
1325
+ logLevel?: LogLevel;
1326
+ }
1327
+ declare function createContext(initialContext: YogaInitialContext, copilotKitContext: CreateCopilotRuntimeServerOptions, contextLogger: typeof logger, properties?: CopilotRequestContextProperties): Promise<Partial<GraphQLContext>>;
1328
+ declare function buildSchema(options?: {
1329
+ emitSchemaFile?: string;
1330
+ }): graphql.GraphQLSchema;
1331
+ type CommonConfig = {
1332
+ logging: typeof logger;
1333
+ schema: ReturnType<typeof buildSchema>;
1334
+ plugins: Parameters<typeof createYoga>[0]["plugins"];
1335
+ context: (ctx: YogaInitialContext) => Promise<Partial<GraphQLContext>>;
1336
+ maskedErrors: {
1337
+ maskError: (error: any, message: string, isDev?: boolean) => any;
1338
+ };
1339
+ };
1340
+ declare function getCommonConfig(options: CreateCopilotRuntimeServerOptions): CommonConfig;
1341
+
1342
+ declare function copilotRuntimeNextJSAppRouterEndpoint(options: CreateCopilotRuntimeServerOptions): {
1343
+ handleRequest: (req: Request) => Response | Promise<Response>;
1344
+ };
1345
+
1346
+ declare const config: {
1347
+ api: {
1348
+ bodyParser: boolean;
1349
+ };
1350
+ };
1351
+
1352
+ declare function copilotRuntimeNextJSPagesRouterEndpoint(options: CreateCopilotRuntimeServerOptions): (request: Request, Env?: unknown, executionCtx?: hono_dist_types_context.ExecutionContext) => Response | Promise<Response>;
1353
+
1354
+ declare function copilotRuntimeNodeHttpEndpoint(options: CreateCopilotRuntimeServerOptions): (request: Request, Env?: unknown, executionCtx?: hono_dist_types_context.ExecutionContext) => Response | Promise<Response>;
1355
+
1356
+ declare function copilotRuntimeNodeExpressEndpoint(options: CreateCopilotRuntimeServerOptions): (request: Request, Env?: unknown, executionCtx?: hono_dist_types_context.ExecutionContext) => Response | Promise<Response>;
1357
+
1358
+ declare function copilotRuntimeNestEndpoint(options: CreateCopilotRuntimeServerOptions): (request: Request, Env?: unknown, executionCtx?: hono_dist_types_context.ExecutionContext) => Response | Promise<Response>;
1359
+
1360
+ /**
1361
+ * TelemetryAgentRunner - A wrapper around AgentRunner that adds telemetry
1362
+ * for agent execution streams.
1363
+ *
1364
+ * This captures the following telemetry events:
1365
+ * - oss.runtime.agent_execution_stream_started - when an agent execution starts
1366
+ * - oss.runtime.agent_execution_stream_ended - when an agent execution completes
1367
+ * - oss.runtime.agent_execution_stream_errored - when an agent execution fails
1368
+ */
1369
+
1370
+ /**
1371
+ * Configuration options for TelemetryAgentRunner
1372
+ */
1373
+ interface TelemetryAgentRunnerConfig {
1374
+ /**
1375
+ * The underlying runner to delegate to
1376
+ * If not provided, defaults to InMemoryAgentRunner
1377
+ */
1378
+ runner?: AgentRunner;
1379
+ /**
1380
+ * Optional LangSmith API key (will be hashed for telemetry)
1381
+ */
1382
+ langsmithApiKey?: string;
1383
+ }
1384
+ /**
1385
+ * An AgentRunner wrapper that adds telemetry tracking for agent executions.
1386
+ *
1387
+ * Usage:
1388
+ * ```ts
1389
+ * const runtime = new CopilotRuntime({
1390
+ * runner: new TelemetryAgentRunner(),
1391
+ * // or with custom runner:
1392
+ * runner: new TelemetryAgentRunner({ runner: customRunner }),
1393
+ * });
1394
+ * ```
1395
+ */
1396
+ declare class TelemetryAgentRunner implements AgentRunner {
1397
+ private readonly _runner;
1398
+ private readonly hashedLgcKey;
1399
+ constructor(config?: TelemetryAgentRunnerConfig);
1400
+ /**
1401
+ * Runs an agent with telemetry tracking.
1402
+ * Wraps the underlying runner's Observable stream with telemetry events.
1403
+ */
1404
+ run(...args: Parameters<AgentRunner["run"]>): ReturnType<AgentRunner["run"]>;
1405
+ /**
1406
+ * Delegates to the underlying runner's connect method
1407
+ */
1408
+ connect(...args: Parameters<AgentRunner["connect"]>): ReturnType<AgentRunner["connect"]>;
1409
+ /**
1410
+ * Delegates to the underlying runner's isRunning method
1411
+ */
1412
+ isRunning(...args: Parameters<AgentRunner["isRunning"]>): ReturnType<AgentRunner["isRunning"]>;
1413
+ /**
1414
+ * Delegates to the underlying runner's stop method
1415
+ */
1416
+ stop(...args: Parameters<AgentRunner["stop"]>): ReturnType<AgentRunner["stop"]>;
1417
+ }
1418
+
1419
+ /**
1420
+ * @deprecated LangGraphAgent import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
1421
+ */
1422
+ declare class LangGraphAgent {
1423
+ constructor();
1424
+ }
1425
+ /**
1426
+ * @deprecated LangGraphHttpAgent import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
1427
+ */
1428
+ declare class LangGraphHttpAgent {
1429
+ constructor();
1430
+ }
1431
+ /**
1432
+ * @deprecated TextMessageEvents import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
1433
+ */
1434
+ type TextMessageEvents = any;
1435
+ /**
1436
+ * @deprecated ToolCallEvents import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
1437
+ */
1438
+ type ToolCallEvents = any;
1439
+ /**
1440
+ * @deprecated CustomEventNames import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
1441
+ */
1442
+ type CustomEventNames = any;
1443
+ /**
1444
+ * @deprecated PredictStateTool import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
1445
+ */
1446
+ type PredictStateTool = any;
1447
+
1448
+ declare class GuardrailsValidationFailureResponse extends FailedResponseStatus {
1449
+ reason: FailedResponseStatusReason;
1450
+ details: {
1451
+ guardrailsReason: string;
1452
+ };
1453
+ constructor({ guardrailsReason }: {
1454
+ guardrailsReason: any;
1455
+ });
1456
+ }
1457
+ declare class MessageStreamInterruptedResponse extends FailedResponseStatus {
1458
+ reason: FailedResponseStatusReason;
1459
+ details: {
1460
+ messageId: string;
1461
+ description: string;
1462
+ };
1463
+ constructor({ messageId }: {
1464
+ messageId: string;
1465
+ });
1466
+ }
1467
+ declare class UnknownErrorResponse extends FailedResponseStatus {
1468
+ reason: FailedResponseStatusReason;
1469
+ details: {
1470
+ description?: string;
1471
+ originalError?: {
1472
+ code?: string;
1473
+ statusCode?: number;
1474
+ severity?: string;
1475
+ visibility?: string;
1476
+ originalErrorType?: string;
1477
+ extensions?: any;
1478
+ };
1479
+ };
1480
+ constructor({ description, originalError, }: {
1481
+ description?: string;
1482
+ originalError?: {
1483
+ code?: string;
1484
+ statusCode?: number;
1485
+ severity?: string;
1486
+ visibility?: string;
1487
+ originalErrorType?: string;
1488
+ extensions?: any;
1489
+ };
1490
+ });
1491
+ }
1492
+
1493
+ export { AnthropicAdapter, AnthropicAdapterParams, AnthropicPromptCachingConfig, BedrockAdapter, BedrockAdapterParams, CommonConfig, CopilotRequestContextProperties, CopilotRuntime, CopilotRuntimeChatCompletionRequest, CopilotRuntimeChatCompletionResponse, CopilotRuntimeConstructorParams_BASE, CopilotRuntimeLogger, CopilotServiceAdapter, CreateCopilotRuntimeServerOptions, CustomEventNames, EmptyAdapter, ExperimentalEmptyAdapter, ExperimentalOllamaAdapter, GoogleGenerativeAIAdapter, GraphQLContext, GroqAdapter, GroqAdapterParams, GuardrailsValidationFailureResponse, LangChainAdapter, LangGraphAgent, LangGraphHttpAgent, LogLevel, MCPClient, MCPEndpointConfig, MCPTool, MessageStreamInterruptedResponse, OpenAIAdapter, OpenAIAdapterParams, OpenAIAssistantAdapter, OpenAIAssistantAdapterParams, PredictStateTool, RemoteChain, RemoteChainParameters, TelemetryAgentRunner, TelemetryAgentRunnerConfig, TextMessageEvents, ToolCallEvents, UnifyAdapter, UnifyAdapterParams, UnknownErrorResponse, addCustomHeaderPlugin, buildSchema, config, convertMCPToolsToActions, convertServiceAdapterError, copilotKitEndpoint, copilotRuntimeNestEndpoint, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint, copilotRuntimeNodeExpressEndpoint, copilotRuntimeNodeHttpEndpoint, createContext, createLogger, extractParametersFromSchema, generateMcpToolInstructions, getCommonConfig, langGraphPlatformEndpoint, resolveEndpointType };