@mastra/server 0.20.2-alpha.0 → 0.20.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @mastra/server
2
2
 
3
+ ## 0.20.2-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Pass through input/output processors to the server agent endpoints ([#8546](https://github.com/mastra-ai/mastra/pull/8546))
8
+
9
+ - Updated dependencies [[`07eaf25`](https://github.com/mastra-ai/mastra/commit/07eaf25aada9e42235dbf905854de53da4d8121b), [`68b1111`](https://github.com/mastra-ai/mastra/commit/68b11118a1303f93e9c0c157850c0751309304c5)]:
10
+ - @mastra/core@0.20.2-alpha.1
11
+
3
12
  ## 0.20.2-alpha.0
4
13
 
5
14
  ### Patch Changes
@@ -22,6 +22,7 @@ chunkO7I5CWRX_cjs.__export(agents_exports, {
22
22
  getLiveEvalsByAgentIdHandler: () => getLiveEvalsByAgentIdHandler,
23
23
  getProvidersHandler: () => getProvidersHandler,
24
24
  getSerializedAgentTools: () => getSerializedAgentTools,
25
+ getSerializedProcessors: () => getSerializedProcessors,
25
26
  reorderAgentModelListHandler: () => reorderAgentModelListHandler,
26
27
  streamGenerateHandler: () => streamGenerateHandler,
27
28
  streamGenerateLegacyHandler: () => streamGenerateLegacyHandler,
@@ -36,17 +37,17 @@ async function getSerializedAgentTools(tools) {
36
37
  const toolId = _tool.id ?? `tool-${key}`;
37
38
  let inputSchemaForReturn = void 0;
38
39
  if (_tool.inputSchema) {
39
- if (_tool.inputSchema?.jsonSchema) {
40
+ if (_tool.inputSchema && typeof _tool.inputSchema === "object" && "jsonSchema" in _tool.inputSchema) {
40
41
  inputSchemaForReturn = chunkGU4EWMZB_cjs.stringify(_tool.inputSchema.jsonSchema);
41
- } else {
42
+ } else if (_tool.inputSchema) {
42
43
  inputSchemaForReturn = chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(_tool.inputSchema));
43
44
  }
44
45
  }
45
46
  let outputSchemaForReturn = void 0;
46
47
  if (_tool.outputSchema) {
47
- if (_tool.outputSchema?.jsonSchema) {
48
+ if (_tool.outputSchema && typeof _tool.outputSchema === "object" && "jsonSchema" in _tool.outputSchema) {
48
49
  outputSchemaForReturn = chunkGU4EWMZB_cjs.stringify(_tool.outputSchema.jsonSchema);
49
- } else {
50
+ } else if (_tool.outputSchema) {
50
51
  outputSchemaForReturn = chunkGU4EWMZB_cjs.stringify(zodToJson.zodToJsonSchema(_tool.outputSchema));
51
52
  }
52
53
  }
@@ -59,6 +60,13 @@ async function getSerializedAgentTools(tools) {
59
60
  return acc;
60
61
  }, {});
61
62
  }
63
+ function getSerializedProcessors(processors) {
64
+ return processors.map((processor) => {
65
+ return {
66
+ name: processor.name || processor.constructor.name
67
+ };
68
+ });
69
+ }
62
70
  async function getSerializedAgentDefinition({
63
71
  agent,
64
72
  runtimeContext
@@ -66,12 +74,15 @@ async function getSerializedAgentDefinition({
66
74
  let serializedAgentAgents = {};
67
75
  if ("listAgents" in agent) {
68
76
  const agents = await agent.listAgents({ runtimeContext });
69
- serializedAgentAgents = Object.entries(agents || {}).reduce((acc, [key, agent2]) => {
70
- return {
71
- ...acc,
72
- [key]: { id: agent2.id, name: agent2.name }
73
- };
74
- }, {});
77
+ serializedAgentAgents = Object.entries(agents || {}).reduce(
78
+ (acc, [key, agent2]) => {
79
+ return {
80
+ ...acc,
81
+ [key]: { id: agent2.id, name: agent2.name }
82
+ };
83
+ },
84
+ {}
85
+ );
75
86
  }
76
87
  return serializedAgentAgents;
77
88
  }
@@ -96,7 +107,7 @@ async function formatAgentList({
96
107
  return {
97
108
  ...acc,
98
109
  [key]: {
99
- name: workflow.name
110
+ name: workflow.name || "Unnamed workflow"
100
111
  }
101
112
  };
102
113
  }, {});
@@ -105,6 +116,10 @@ async function formatAgentList({
105
116
  }
106
117
  }
107
118
  const serializedAgentAgents = await getSerializedAgentDefinition({ agent, runtimeContext });
119
+ const inputProcessors = await agent.getInputProcessors(runtimeContext);
120
+ const outputProcessors = await agent.getOutputProcessors(runtimeContext);
121
+ const serializedInputProcessors = getSerializedProcessors(inputProcessors);
122
+ const serializedOutputProcessors = getSerializedProcessors(outputProcessors);
108
123
  const model = llm?.getModel();
109
124
  const models = await agent.getModelList(runtimeContext);
110
125
  const modelList = models?.map((md) => ({
@@ -122,6 +137,8 @@ async function formatAgentList({
122
137
  agents: serializedAgentAgents,
123
138
  tools: serializedAgentTools,
124
139
  workflows: serializedAgentWorkflows,
140
+ inputProcessors: serializedInputProcessors,
141
+ outputProcessors: serializedOutputProcessors,
125
142
  provider: llm?.getProvider(),
126
143
  modelId: llm?.getModelId(),
127
144
  modelVersion: model?.specificationVersion,
@@ -130,7 +147,10 @@ async function formatAgentList({
130
147
  modelList
131
148
  };
132
149
  }
133
- async function getAgentsHandler({ mastra, runtimeContext }) {
150
+ async function getAgentsHandler({
151
+ mastra,
152
+ runtimeContext
153
+ }) {
134
154
  try {
135
155
  const agents = mastra.getAgents();
136
156
  const serializedAgentsMap = await Promise.all(
@@ -164,65 +184,74 @@ async function formatAgent({
164
184
  return {
165
185
  ...acc,
166
186
  [key]: {
167
- name: workflow.name,
168
- steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
169
- return {
170
- ...acc2,
171
- [key2]: {
172
- id: step.id,
173
- description: step.description
174
- }
175
- };
176
- }, {})
187
+ name: workflow.name || "Unnamed workflow",
188
+ steps: Object.entries(workflow.steps).reduce(
189
+ (acc2, [key2, step]) => {
190
+ return {
191
+ ...acc2,
192
+ [key2]: {
193
+ id: step.id,
194
+ description: step.description
195
+ }
196
+ };
197
+ },
198
+ {}
199
+ )
177
200
  }
178
201
  };
179
202
  }, {});
180
203
  } catch (error) {
181
204
  logger.error("Error getting workflows for agent", { agentName: agent.name, error });
182
205
  }
183
- let proxyRuntimeContext = runtimeContext;
184
- if (isPlayground) {
185
- proxyRuntimeContext = new Proxy(runtimeContext, {
186
- get(target, prop) {
187
- if (prop === "get") {
188
- return function(key) {
189
- const value = target.get(key);
190
- return value ?? `<${key}>`;
191
- };
192
- }
193
- return Reflect.get(target, prop);
206
+ }
207
+ let proxyRuntimeContext = runtimeContext;
208
+ if (isPlayground) {
209
+ proxyRuntimeContext = new Proxy(runtimeContext, {
210
+ get(target, prop) {
211
+ if (prop === "get") {
212
+ return function(key) {
213
+ const value = target.get(key);
214
+ return value ?? `<${key}>`;
215
+ };
194
216
  }
195
- });
196
- }
197
- const instructions = await agent.getInstructions({ runtimeContext: proxyRuntimeContext });
198
- const llm = await agent.getLLM({ runtimeContext });
199
- const defaultGenerateOptions = await agent.getDefaultGenerateOptions({ runtimeContext: proxyRuntimeContext });
200
- const defaultStreamOptions = await agent.getDefaultStreamOptions({ runtimeContext: proxyRuntimeContext });
201
- const model = llm?.getModel();
202
- const models = await agent.getModelList(runtimeContext);
203
- const modelList = models?.map((md) => ({
204
- ...md,
205
- model: {
206
- modelId: md.model.modelId,
207
- provider: md.model.provider,
208
- modelVersion: md.model.specificationVersion
217
+ return Reflect.get(target, prop);
209
218
  }
210
- }));
211
- const serializedAgentAgents = await getSerializedAgentDefinition({ agent, runtimeContext: proxyRuntimeContext });
212
- return {
213
- name: agent.name,
214
- instructions,
215
- tools: serializedAgentTools,
216
- agents: serializedAgentAgents,
217
- workflows: serializedAgentWorkflows,
218
- provider: llm?.getProvider(),
219
- modelId: llm?.getModelId(),
220
- modelVersion: model?.specificationVersion,
221
- modelList,
222
- defaultGenerateOptions,
223
- defaultStreamOptions
224
- };
219
+ });
225
220
  }
221
+ const instructions = await agent.getInstructions({ runtimeContext: proxyRuntimeContext });
222
+ const llm = await agent.getLLM({ runtimeContext });
223
+ const defaultGenerateOptions = await agent.getDefaultGenerateOptions({ runtimeContext: proxyRuntimeContext });
224
+ const defaultStreamOptions = await agent.getDefaultStreamOptions({ runtimeContext: proxyRuntimeContext });
225
+ const model = llm?.getModel();
226
+ const models = await agent.getModelList(runtimeContext);
227
+ const modelList = models?.map((md) => ({
228
+ ...md,
229
+ model: {
230
+ modelId: md.model.modelId,
231
+ provider: md.model.provider,
232
+ modelVersion: md.model.specificationVersion
233
+ }
234
+ }));
235
+ const serializedAgentAgents = await getSerializedAgentDefinition({ agent, runtimeContext: proxyRuntimeContext });
236
+ const inputProcessors = await agent.getInputProcessors(proxyRuntimeContext);
237
+ const outputProcessors = await agent.getOutputProcessors(proxyRuntimeContext);
238
+ const serializedInputProcessors = getSerializedProcessors(inputProcessors);
239
+ const serializedOutputProcessors = getSerializedProcessors(outputProcessors);
240
+ return {
241
+ name: agent.name,
242
+ instructions,
243
+ tools: serializedAgentTools,
244
+ agents: serializedAgentAgents,
245
+ workflows: serializedAgentWorkflows,
246
+ inputProcessors: serializedInputProcessors,
247
+ outputProcessors: serializedOutputProcessors,
248
+ provider: llm?.getProvider(),
249
+ modelId: llm?.getModelId(),
250
+ modelVersion: model?.specificationVersion,
251
+ modelList,
252
+ defaultGenerateOptions,
253
+ defaultStreamOptions
254
+ };
226
255
  }
227
256
  async function getAgentByIdHandler({
228
257
  mastra,
@@ -641,6 +670,7 @@ exports.getEvalsByAgentIdHandler = getEvalsByAgentIdHandler;
641
670
  exports.getLiveEvalsByAgentIdHandler = getLiveEvalsByAgentIdHandler;
642
671
  exports.getProvidersHandler = getProvidersHandler;
643
672
  exports.getSerializedAgentTools = getSerializedAgentTools;
673
+ exports.getSerializedProcessors = getSerializedProcessors;
644
674
  exports.reorderAgentModelListHandler = reorderAgentModelListHandler;
645
675
  exports.streamGenerateHandler = streamGenerateHandler;
646
676
  exports.streamGenerateLegacyHandler = streamGenerateLegacyHandler;
@@ -648,5 +678,5 @@ exports.streamNetworkHandler = streamNetworkHandler;
648
678
  exports.streamUIMessageHandler = streamUIMessageHandler;
649
679
  exports.updateAgentModelHandler = updateAgentModelHandler;
650
680
  exports.updateAgentModelInModelListHandler = updateAgentModelInModelListHandler;
651
- //# sourceMappingURL=chunk-PH7LGWKN.cjs.map
652
- //# sourceMappingURL=chunk-PH7LGWKN.cjs.map
681
+ //# sourceMappingURL=chunk-3Q7FKRVX.cjs.map
682
+ //# sourceMappingURL=chunk-3Q7FKRVX.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server/handlers/agents.ts"],"names":["__export","stringify","zodToJsonSchema","agent","handleError","acc","key","HTTPException","runtimeContext","sanitizeBody","RuntimeContext","validateBody","PROVIDER_REGISTRY"],"mappings":";;;;;;;;;;;;AAAA,IAAA,cAAA,GAAA;AAAAA,0BAAA,CAAA,cAAA,EAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,eAAA,EAAA,MAAA,eAAA;AAAA,EAAA,qBAAA,EAAA,MAAA,qBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,gBAAA,EAAA,MAAA,gBAAA;AAAA,EAAA,wBAAA,EAAA,MAAA,wBAAA;AAAA,EAAA,4BAAA,EAAA,MAAA,4BAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,uBAAA,EAAA,MAAA,uBAAA;AAAA,EAAA,uBAAA,EAAA,MAAA,uBAAA;AAAA,EAAA,4BAAA,EAAA,MAAA,4BAAA;AAAA,EAAA,qBAAA,EAAA,MAAA,qBAAA;AAAA,EAAA,2BAAA,EAAA,MAAA,2BAAA;AAAA,EAAA,oBAAA,EAAA,MAAA,oBAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,uBAAA,EAAA,MAAA,uBAAA;AAAA,EAAA,kCAAA,EAAA,MAAA;AAAA,CAAA,CAAA;AA0EA,eAAsB,wBAAwB,KAAA,EAAyE;AACrH,EAAA,OAAO,MAAA,CAAO,OAAA,CAAQ,KAAA,IAAS,EAAE,CAAA,CAAE,MAAA,CAAuC,CAAC,GAAA,EAAK,CAAC,GAAA,EAAK,IAAI,CAAA,KAAM;AAC9F,IAAA,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AA;AAAA,EACvD;AACF;AAEA,eAAsB,mBAAA,GAAsB;AAC1C,EAAA,IAAI;AACF,IAAA,MAAM,SAAA,GAAY,MAAA,CAAO,OAAA,CAAQQ,qBAAiB,CAAA,CAAE,IAAI,CAAC,CAAC,EAAA,EAAI,QAAQ,CAAA,KAAM;AAE1E,MAAA,MAAM,OAAA,GAAU,KAAA,CAAM,OAAA,CAAQ,QAAA,CAAS,YAAY,IAAI,QAAA,CAAS,YAAA,GAAe,CAAC,QAAA,CAAS,YAAY,CAAA;AACrG,MAAA,MAAM,SAAA,GAAY,QAAQ,KAAA,CAAM,CAAA,MAAA,KAAU,CAAC,CAAC,OAAA,CAAQ,GAAA,CAAI,MAAM,CAAC,CAAA;AAE/D,MAAA,OAAO;AAAA,QACL,EAAA;AAAA,QACA,MAAM,QAAA,CAAS,IAAA;AAAA,QACf,QAAQ,QAAA,CAAS,YAAA;AAAA,QACjB,SAAA;AAAA,QACA,QAAQ,QAAA,CAAS,MAAA;AAAA,QACjB,MAAA,EAAQ,CAAC,GAAG,QAAA,CAAS,MAAM;AAAA;AAAA,OAC7B;AAAA,IACF,CAAC,CAAA;AAED,IAAA,OAAO,EAAE,SAAA,EAAU;AAAA,EACrB,SAAS,KAAA,EAAO;AACd,IAAA,OAAOR,6BAAA,CAAY,OAAO,0BAA0B,CAAA;AAAA,EACtD;AACF","file":"chunk-3Q7FKRVX.cjs","sourcesContent":["import type { Agent, AgentModelManagerConfig } from '@mastra/core/agent';\nimport { PROVIDER_REGISTRY } from '@mastra/core/llm';\nimport type { SystemMessage } from '@mastra/core/llm';\nimport type { InputProcessor, OutputProcessor } from '@mastra/core/processors';\nimport { RuntimeContext } from '@mastra/core/runtime-context';\nimport { zodToJsonSchema } from '@mastra/core/utils/zod-to-json';\nimport { stringify } from 'superjson';\n\nimport type {\n StreamTextOnFinishCallback,\n StreamTextOnStepFinishCallback,\n} from '../../../../core/dist/llm/model/base.types';\nimport { HTTPException } from '../http-exception';\nimport type { Context } from '../types';\n\nimport { handleError } from './error';\nimport { sanitizeBody, validateBody } from './utils';\n\ntype GetBody<\n T extends keyof Agent & { [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never }[keyof Agent],\n> = {\n messages: Parameters<Agent[T]>[0];\n} & Parameters<Agent[T]>[1];\n\ntype GetHITLBody<\n T extends keyof Agent & { [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never }[keyof Agent],\n> = Parameters<Agent[T]>[0];\n\nexport interface SerializedProcessor {\n name: string;\n}\n\nexport interface SerializedTool {\n id: string;\n description?: string;\n inputSchema?: string;\n outputSchema?: string;\n requireApproval?: boolean;\n}\n\nexport interface SerializedWorkflow {\n name: string;\n steps?: Record<string, { id: string; description?: string }>;\n}\n\nexport interface SerializedAgent {\n name: string;\n instructions?: SystemMessage;\n tools: Record<string, SerializedTool>;\n agents: Record<string, SerializedAgentDefinition>;\n workflows: Record<string, SerializedWorkflow>;\n inputProcessors: SerializedProcessor[];\n outputProcessors: SerializedProcessor[];\n provider?: string;\n modelId?: string;\n modelVersion?: string;\n modelList?: Array<\n Omit<AgentModelManagerConfig, 'model'> & {\n model: {\n modelId: string;\n provider: string;\n modelVersion: string;\n };\n }\n >;\n // We can't use the true types here because they are not serializable\n defaultGenerateOptions?: Record<string, unknown>;\n defaultStreamOptions?: Record<string, unknown>;\n}\n\nexport interface SerializedAgentWithId extends SerializedAgent {\n id: string;\n}\n\nexport async function getSerializedAgentTools(tools: Record<string, unknown>): Promise<Record<string, SerializedTool>> {\n return Object.entries(tools || {}).reduce<Record<string, SerializedTool>>((acc, [key, tool]) => {\n const _tool = tool as {\n id?: string;\n description?: string;\n inputSchema?: { jsonSchema?: unknown } | unknown;\n outputSchema?: { jsonSchema?: unknown } | unknown;\n };\n\n const toolId = _tool.id ?? `tool-${key}`;\n\n let inputSchemaForReturn: string | undefined = undefined;\n\n if (_tool.inputSchema) {\n if (_tool.inputSchema && typeof _tool.inputSchema === 'object' && 'jsonSchema' in _tool.inputSchema) {\n inputSchemaForReturn = stringify(_tool.inputSchema.jsonSchema);\n } else if (_tool.inputSchema) {\n inputSchemaForReturn = stringify(zodToJsonSchema(_tool.inputSchema as Parameters<typeof zodToJsonSchema>[0]));\n }\n }\n\n let outputSchemaForReturn: string | undefined = undefined;\n\n if (_tool.outputSchema) {\n if (_tool.outputSchema && typeof _tool.outputSchema === 'object' && 'jsonSchema' in _tool.outputSchema) {\n outputSchemaForReturn = stringify(_tool.outputSchema.jsonSchema);\n } else if (_tool.outputSchema) {\n outputSchemaForReturn = stringify(zodToJsonSchema(_tool.outputSchema as Parameters<typeof zodToJsonSchema>[0]));\n }\n }\n\n acc[key] = {\n ..._tool,\n id: toolId,\n inputSchema: inputSchemaForReturn,\n outputSchema: outputSchemaForReturn,\n };\n return acc;\n }, {});\n}\n\nexport function getSerializedProcessors(processors: (InputProcessor | OutputProcessor)[]): SerializedProcessor[] {\n return processors.map(processor => {\n // Processors are class instances or objects with a name property\n // Use the name property if available, otherwise fall back to constructor name\n return {\n name: processor.name || processor.constructor.name,\n };\n });\n}\n\ninterface SerializedAgentDefinition {\n id: string;\n name: string;\n}\n\nasync function getSerializedAgentDefinition({\n agent,\n runtimeContext,\n}: {\n agent: Agent;\n runtimeContext: RuntimeContext;\n}): Promise<Record<string, SerializedAgentDefinition>> {\n let serializedAgentAgents: Record<string, SerializedAgentDefinition> = {};\n\n if ('listAgents' in agent) {\n const agents = await agent.listAgents({ runtimeContext });\n serializedAgentAgents = Object.entries(agents || {}).reduce<Record<string, SerializedAgentDefinition>>(\n (acc, [key, agent]) => {\n return {\n ...acc,\n [key]: { id: agent.id, name: agent.name },\n };\n },\n {},\n );\n }\n return serializedAgentAgents;\n}\n\nasync function formatAgentList({\n id,\n mastra,\n agent,\n runtimeContext,\n}: {\n id: string;\n mastra: Context['mastra'];\n agent: Agent;\n runtimeContext: RuntimeContext;\n}): Promise<SerializedAgentWithId> {\n const instructions = await agent.getInstructions({ runtimeContext });\n const tools = await agent.getTools({ runtimeContext });\n const llm = await agent.getLLM({ runtimeContext });\n const defaultGenerateOptions = await agent.getDefaultGenerateOptions({ runtimeContext });\n const defaultStreamOptions = await agent.getDefaultStreamOptions({ runtimeContext });\n const serializedAgentTools = await getSerializedAgentTools(tools);\n\n let serializedAgentWorkflows: Record<\n string,\n { name: string; steps?: Record<string, { id: string; description?: string }> }\n > = {};\n\n if ('getWorkflows' in agent) {\n const logger = mastra.getLogger();\n try {\n const workflows = await agent.getWorkflows({ runtimeContext });\n serializedAgentWorkflows = Object.entries(workflows || {}).reduce<\n Record<string, { name: string; steps?: Record<string, { id: string; description?: string }> }>\n >((acc, [key, workflow]) => {\n return {\n ...acc,\n [key]: {\n name: workflow.name || 'Unnamed workflow',\n },\n };\n }, {});\n } catch (error) {\n logger.error('Error getting workflows for agent', { agentName: agent.name, error });\n }\n }\n\n const serializedAgentAgents = await getSerializedAgentDefinition({ agent, runtimeContext });\n\n // Get and serialize processors\n const inputProcessors = await agent.getInputProcessors(runtimeContext);\n const outputProcessors = await agent.getOutputProcessors(runtimeContext);\n const serializedInputProcessors = getSerializedProcessors(inputProcessors);\n const serializedOutputProcessors = getSerializedProcessors(outputProcessors);\n\n const model = llm?.getModel();\n const models = await agent.getModelList(runtimeContext);\n const modelList = models?.map(md => ({\n ...md,\n model: {\n modelId: md.model.modelId,\n provider: md.model.provider,\n modelVersion: md.model.specificationVersion,\n },\n }));\n\n return {\n id,\n name: agent.name,\n instructions,\n agents: serializedAgentAgents,\n tools: serializedAgentTools,\n workflows: serializedAgentWorkflows,\n inputProcessors: serializedInputProcessors,\n outputProcessors: serializedOutputProcessors,\n provider: llm?.getProvider(),\n modelId: llm?.getModelId(),\n modelVersion: model?.specificationVersion,\n defaultGenerateOptions,\n defaultStreamOptions,\n modelList,\n };\n}\n\n// Agent handlers\nexport async function getAgentsHandler({\n mastra,\n runtimeContext,\n}: Context & { runtimeContext: RuntimeContext }): Promise<Record<string, SerializedAgent>> {\n try {\n const agents = mastra.getAgents();\n\n const serializedAgentsMap = await Promise.all(\n Object.entries(agents).map(async ([id, agent]) => {\n return formatAgentList({ id, mastra, agent, runtimeContext });\n }),\n );\n\n const serializedAgents = serializedAgentsMap.reduce<\n Record<string, Omit<(typeof serializedAgentsMap)[number], 'id'>>\n >((acc, { id, ...rest }) => {\n acc[id] = rest;\n return acc;\n }, {});\n\n return serializedAgents;\n } catch (error) {\n return handleError(error, 'Error getting agents');\n }\n}\n\nasync function formatAgent({\n mastra,\n agent,\n runtimeContext,\n isPlayground,\n}: {\n mastra: Context['mastra'];\n agent: Agent;\n runtimeContext: RuntimeContext;\n isPlayground: boolean;\n}): Promise<SerializedAgent> {\n const tools = await agent.getTools({ runtimeContext });\n\n const serializedAgentTools = await getSerializedAgentTools(tools);\n\n let serializedAgentWorkflows: Record<\n string,\n { name: string; steps: Record<string, { id: string; description?: string }> }\n > = {};\n\n if ('getWorkflows' in agent) {\n const logger = mastra.getLogger();\n try {\n const workflows = await agent.getWorkflows({ runtimeContext });\n\n serializedAgentWorkflows = Object.entries(workflows || {}).reduce<\n Record<string, { name: string; steps: Record<string, { id: string; description?: string }> }>\n >((acc, [key, workflow]) => {\n return {\n ...acc,\n [key]: {\n name: workflow.name || 'Unnamed workflow',\n steps: Object.entries(workflow.steps).reduce<Record<string, { id: string; description?: string }>>(\n (acc, [key, step]) => {\n return {\n ...acc,\n [key]: {\n id: step.id,\n description: step.description,\n },\n };\n },\n {},\n ),\n },\n };\n }, {});\n } catch (error) {\n logger.error('Error getting workflows for agent', { agentName: agent.name, error });\n }\n }\n\n let proxyRuntimeContext = runtimeContext;\n if (isPlayground) {\n proxyRuntimeContext = new Proxy(runtimeContext, {\n get(target, prop) {\n if (prop === 'get') {\n return function (key: string) {\n const value = target.get(key);\n return value ?? `<${key}>`;\n };\n }\n return Reflect.get(target, prop);\n },\n });\n }\n\n const instructions = await agent.getInstructions({ runtimeContext: proxyRuntimeContext });\n const llm = await agent.getLLM({ runtimeContext });\n const defaultGenerateOptions = await agent.getDefaultGenerateOptions({ runtimeContext: proxyRuntimeContext });\n const defaultStreamOptions = await agent.getDefaultStreamOptions({ runtimeContext: proxyRuntimeContext });\n\n const model = llm?.getModel();\n const models = await agent.getModelList(runtimeContext);\n const modelList = models?.map(md => ({\n ...md,\n model: {\n modelId: md.model.modelId,\n provider: md.model.provider,\n modelVersion: md.model.specificationVersion,\n },\n }));\n\n const serializedAgentAgents = await getSerializedAgentDefinition({ agent, runtimeContext: proxyRuntimeContext });\n\n // Get and serialize processors\n const inputProcessors = await agent.getInputProcessors(proxyRuntimeContext);\n const outputProcessors = await agent.getOutputProcessors(proxyRuntimeContext);\n const serializedInputProcessors = getSerializedProcessors(inputProcessors);\n const serializedOutputProcessors = getSerializedProcessors(outputProcessors);\n\n return {\n name: agent.name,\n instructions,\n tools: serializedAgentTools,\n agents: serializedAgentAgents,\n workflows: serializedAgentWorkflows,\n inputProcessors: serializedInputProcessors,\n outputProcessors: serializedOutputProcessors,\n provider: llm?.getProvider(),\n modelId: llm?.getModelId(),\n modelVersion: model?.specificationVersion,\n modelList,\n defaultGenerateOptions,\n defaultStreamOptions,\n };\n}\n\nexport async function getAgentByIdHandler({\n mastra,\n runtimeContext,\n agentId,\n isPlayground = false,\n}: Context & { isPlayground?: boolean; runtimeContext: RuntimeContext; agentId: string }): Promise<\n SerializedAgent | ReturnType<typeof handleError>\n> {\n try {\n const agent = mastra.getAgent(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n return formatAgent({ mastra, agent, runtimeContext, isPlayground });\n } catch (error) {\n return handleError(error, 'Error getting agent');\n }\n}\n\nexport async function getEvalsByAgentIdHandler({\n mastra,\n runtimeContext,\n agentId,\n}: Context & { runtimeContext: RuntimeContext; agentId: string }) {\n try {\n const agent = mastra.getAgent(agentId);\n const evals = (await mastra.getStorage()?.getEvalsByAgentName?.(agent.name, 'test')) || [];\n const instructions = await agent.getInstructions({ runtimeContext });\n return {\n id: agentId,\n name: agent.name,\n instructions,\n evals,\n };\n } catch (error) {\n return handleError(error, 'Error getting test evals');\n }\n}\n\nexport async function getLiveEvalsByAgentIdHandler({\n mastra,\n runtimeContext,\n agentId,\n}: Context & { runtimeContext: RuntimeContext; agentId: string }) {\n try {\n const agent = mastra.getAgent(agentId);\n const evals = (await mastra.getStorage()?.getEvalsByAgentName?.(agent.name, 'live')) || [];\n const instructions = await agent.getInstructions({ runtimeContext });\n\n return {\n id: agentId,\n name: agent.name,\n instructions,\n evals,\n };\n } catch (error) {\n return handleError(error, 'Error getting live evals');\n }\n}\n\nexport async function generateLegacyHandler({\n mastra,\n runtimeContext,\n agentId,\n body,\n abortSignal,\n}: Context & {\n runtimeContext: RuntimeContext;\n agentId: string;\n body: GetBody<'generate'> & {\n // @deprecated use resourceId\n resourceid?: string;\n runtimeContext?: Record<string, unknown>;\n };\n abortSignal?: AbortSignal;\n}) {\n try {\n const agent = mastra.getAgent(agentId);\n\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n\n // UI Frameworks may send \"client tools\" in the body,\n // but it interferes with llm providers tool handling, so we remove them\n sanitizeBody(body, ['tools']);\n\n const { messages, resourceId, resourceid, runtimeContext: agentRuntimeContext, ...rest } = body;\n // Use resourceId if provided, fall back to resourceid (deprecated)\n const finalResourceId = resourceId ?? resourceid;\n\n const finalRuntimeContext = new RuntimeContext<Record<string, unknown>>([\n ...Array.from(runtimeContext.entries()),\n ...Array.from(Object.entries(agentRuntimeContext ?? {})),\n ]);\n\n validateBody({ messages });\n\n const result = await agent.generateLegacy(messages, {\n ...rest,\n abortSignal,\n // @ts-expect-error TODO fix types\n resourceId: finalResourceId,\n runtimeContext: finalRuntimeContext,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error generating from agent');\n }\n}\n\nexport async function generateHandler({\n mastra,\n runtimeContext,\n agentId,\n body,\n abortSignal,\n}: Context & {\n runtimeContext: RuntimeContext;\n agentId: string;\n body: GetBody<'generate'> & {\n runtimeContext?: Record<string, unknown>;\n format?: 'mastra' | 'aisdk';\n };\n abortSignal?: AbortSignal;\n}): Promise<ReturnType<Agent['generate']>> {\n try {\n const agent = mastra.getAgent(agentId);\n\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n\n // UI Frameworks may send \"client tools\" in the body,\n // but it interferes with llm providers tool handling, so we remove them\n sanitizeBody(body, ['tools']);\n\n const { messages, runtimeContext: agentRuntimeContext, ...rest } = body;\n\n const finalRuntimeContext = new RuntimeContext<Record<string, unknown>>([\n ...Array.from(runtimeContext.entries()),\n ...Array.from(Object.entries(agentRuntimeContext ?? {})),\n ]);\n\n validateBody({ messages });\n\n const result = await agent.generate(messages, {\n ...rest,\n runtimeContext: finalRuntimeContext,\n format: rest.format || 'mastra',\n abortSignal,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error generating from agent');\n }\n}\n\nexport async function streamGenerateLegacyHandler({\n mastra,\n runtimeContext,\n agentId,\n body,\n abortSignal,\n}: Context & {\n runtimeContext: RuntimeContext;\n agentId: string;\n body: GetBody<'stream'> & {\n // @deprecated use resourceId\n resourceid?: string;\n runtimeContext?: string;\n };\n abortSignal?: AbortSignal;\n}): Promise<Response | undefined> {\n try {\n const agent = mastra.getAgent(agentId);\n\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n\n const { messages, resourceId, resourceid, runtimeContext: agentRuntimeContext, ...rest } = body;\n // Use resourceId if provided, fall back to resourceid (deprecated)\n const finalResourceId = resourceId ?? resourceid;\n\n const finalRuntimeContext = new RuntimeContext<Record<string, unknown>>([\n ...Array.from(runtimeContext.entries()),\n ...Array.from(Object.entries(agentRuntimeContext ?? {})),\n ]);\n\n validateBody({ messages });\n\n const streamResult = await agent.streamLegacy(messages, {\n ...rest,\n abortSignal,\n // @ts-expect-error TODO fix types\n resourceId: finalResourceId,\n runtimeContext: finalRuntimeContext,\n });\n\n const streamResponse = rest.output\n ? streamResult.toTextStreamResponse({\n headers: {\n 'Transfer-Encoding': 'chunked',\n },\n })\n : streamResult.toDataStreamResponse({\n sendUsage: true,\n sendReasoning: true,\n getErrorMessage: (error: any) => {\n return `An error occurred while processing your request. ${error instanceof Error ? error.message : JSON.stringify(error)}`;\n },\n headers: {\n 'Transfer-Encoding': 'chunked',\n },\n });\n\n return streamResponse;\n } catch (error) {\n return handleError(error, 'error streaming agent response');\n }\n}\n\nexport function streamGenerateHandler({\n mastra,\n runtimeContext,\n agentId,\n body,\n abortSignal,\n}: Context & {\n runtimeContext: RuntimeContext;\n agentId: string;\n body: GetBody<'stream'> & {\n runtimeContext?: string;\n format?: 'aisdk' | 'mastra';\n };\n abortSignal?: AbortSignal;\n}): ReturnType<Agent['stream']> {\n try {\n const agent = mastra.getAgent(agentId);\n\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n\n // UI Frameworks may send \"client tools\" in the body,\n // but it interferes with llm providers tool handling, so we remove them\n sanitizeBody(body, ['tools']);\n\n const { messages, runtimeContext: agentRuntimeContext, ...rest } = body;\n const finalRuntimeContext = new RuntimeContext<Record<string, unknown>>([\n ...Array.from(runtimeContext.entries()),\n ...Array.from(Object.entries(agentRuntimeContext ?? {})),\n ]);\n\n validateBody({ messages });\n\n const streamResult = agent.stream(messages, {\n ...rest,\n runtimeContext: finalRuntimeContext,\n abortSignal,\n format: body.format ?? 'mastra',\n });\n\n return streamResult;\n } catch (error) {\n return handleError(error, 'error streaming agent response');\n }\n}\n\nexport function approveToolCallHandler({\n mastra,\n runtimeContext,\n agentId,\n body,\n abortSignal,\n}: Context & {\n runtimeContext: RuntimeContext;\n agentId: string;\n body: GetHITLBody<'approveToolCall'> & {\n runtimeContext?: string;\n format?: 'aisdk' | 'mastra';\n };\n abortSignal?: AbortSignal;\n}): ReturnType<Agent['approveToolCall']> {\n try {\n const agent = mastra.getAgent(agentId);\n\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n\n // UI Frameworks may send \"client tools\" in the body,\n // but it interferes with llm providers tool handling, so we remove them\n sanitizeBody(body, ['tools']);\n\n const { runId, runtimeContext: agentRuntimeContext, ...rest } = body;\n\n const finalRuntimeContext = new RuntimeContext<Record<string, unknown>>([\n ...Array.from(runtimeContext.entries()),\n ...Array.from(Object.entries(agentRuntimeContext ?? {})),\n ]);\n\n const streamResult = agent.approveToolCall({\n ...rest,\n runId,\n runtimeContext: finalRuntimeContext,\n abortSignal,\n format: body.format ?? 'mastra',\n });\n\n return streamResult;\n } catch (error) {\n return handleError(error, 'error streaming agent response');\n }\n}\n\nexport function declineToolCallHandler({\n mastra,\n runtimeContext,\n agentId,\n body,\n abortSignal,\n}: Context & {\n runtimeContext: RuntimeContext;\n agentId: string;\n body: GetHITLBody<'declineToolCall'> & {\n runtimeContext?: string;\n format?: 'aisdk' | 'mastra';\n };\n abortSignal?: AbortSignal;\n}): ReturnType<Agent['declineToolCall']> {\n try {\n const agent = mastra.getAgent(agentId);\n\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n\n // UI Frameworks may send \"client tools\" in the body,\n // but it interferes with llm providers tool handling, so we remove them\n sanitizeBody(body, ['tools']);\n\n const { runId, runtimeContext: agentRuntimeContext, ...rest } = body;\n\n const finalRuntimeContext = new RuntimeContext<Record<string, unknown>>([\n ...Array.from(runtimeContext.entries()),\n ...Array.from(Object.entries(agentRuntimeContext ?? {})),\n ]);\n\n const streamResult = agent.declineToolCall({\n ...rest,\n runId,\n runtimeContext: finalRuntimeContext,\n abortSignal,\n format: body.format ?? 'mastra',\n });\n\n return streamResult;\n } catch (error) {\n return handleError(error, 'error streaming agent response');\n }\n}\n\nexport function streamNetworkHandler({\n mastra,\n runtimeContext,\n agentId,\n body,\n // abortSignal,\n}: Context & {\n runtimeContext: RuntimeContext;\n agentId: string;\n body: GetBody<'network'> & {\n thread?: string;\n resourceId?: string;\n };\n // abortSignal?: AbortSignal;\n}): ReturnType<Agent['network']> {\n try {\n const agent = mastra.getAgent(agentId);\n\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n\n // UI Frameworks may send \"client tools\" in the body,\n // but it interferes with llm providers tool handling, so we remove them\n sanitizeBody(body, ['tools']);\n\n const { messages, runtimeContext: agentRuntimeContext, ...rest } = body;\n const finalRuntimeContext = new RuntimeContext<Record<string, unknown>>([\n ...Array.from(runtimeContext.entries()),\n ...Array.from(Object.entries(agentRuntimeContext ?? {})),\n ]);\n\n validateBody({ messages });\n\n const streamResult = agent.network(messages, {\n ...rest,\n memory: {\n thread: rest.thread ?? '',\n resource: rest.resourceId ?? '',\n },\n runtimeContext: finalRuntimeContext,\n });\n\n return streamResult;\n } catch (error) {\n return handleError(error, 'error streaming agent loop response');\n }\n}\n\nexport async function streamUIMessageHandler({\n mastra,\n runtimeContext,\n agentId,\n body,\n abortSignal,\n}: Context & {\n runtimeContext: RuntimeContext;\n agentId: string;\n body: GetBody<'stream'> & {\n runtimeContext?: string;\n onStepFinish?: StreamTextOnStepFinishCallback<any>;\n onFinish?: StreamTextOnFinishCallback<any>;\n output?: undefined;\n };\n abortSignal?: AbortSignal;\n}): Promise<Response | undefined> {\n try {\n const agent = mastra.getAgent(agentId);\n\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n\n // UI Frameworks may send \"client tools\" in the body,\n // but it interferes with llm providers tool handling, so we remove them\n sanitizeBody(body, ['tools']);\n\n const { messages, runtimeContext: agentRuntimeContext, ...rest } = body;\n const finalRuntimeContext = new RuntimeContext<Record<string, unknown>>([\n ...Array.from(runtimeContext.entries()),\n ...Array.from(Object.entries(agentRuntimeContext ?? {})),\n ]);\n\n validateBody({ messages });\n\n const streamResult = await agent.stream(messages, {\n ...rest,\n runtimeContext: finalRuntimeContext,\n abortSignal,\n format: 'aisdk',\n });\n\n return streamResult.toUIMessageStreamResponse();\n } catch (error) {\n return handleError(error, 'error streaming agent response');\n }\n}\n\nexport async function updateAgentModelHandler({\n mastra,\n agentId,\n body,\n}: Context & {\n agentId: string;\n body: {\n modelId: string;\n provider: string;\n };\n}): Promise<{ message: string }> {\n try {\n const agent = mastra.getAgent(agentId);\n\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n\n const { modelId, provider } = body;\n\n // Use the universal Mastra router format: provider/model\n const newModel = `${provider}/${modelId}`;\n\n agent.__updateModel({ model: newModel });\n\n return { message: 'Agent model updated' };\n } catch (error) {\n return handleError(error, 'error updating agent model');\n }\n}\n\nexport async function reorderAgentModelListHandler({\n mastra,\n agentId,\n body,\n}: Context & {\n agentId: string;\n body: {\n reorderedModelIds: Array<string>;\n };\n}): Promise<{ message: string }> {\n try {\n const agent = mastra.getAgent(agentId);\n\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n\n const modelList = await agent.getModelList();\n if (!modelList || modelList.length === 0) {\n throw new HTTPException(400, { message: 'Agent model list is not found or empty' });\n }\n\n agent.reorderModels(body.reorderedModelIds);\n\n return { message: 'Model list reordered' };\n } catch (error) {\n return handleError(error, 'error reordering model list');\n }\n}\n\nexport async function updateAgentModelInModelListHandler({\n mastra,\n agentId,\n modelConfigId,\n body,\n}: Context & {\n agentId: string;\n modelConfigId: string;\n body: {\n model?: {\n modelId: string;\n provider: string;\n };\n maxRetries?: number;\n enabled?: boolean;\n };\n}): Promise<{ message: string }> {\n try {\n const agent = mastra.getAgent(agentId);\n\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n const { model: bodyModel, maxRetries, enabled } = body;\n\n if (!modelConfigId) {\n throw new HTTPException(400, { message: 'Model id is required' });\n }\n\n const modelList = await agent.getModelList();\n if (!modelList || modelList.length === 0) {\n throw new HTTPException(400, { message: 'Agent model list is not found or empty' });\n }\n\n const modelToUpdate = modelList.find(m => m.id === modelConfigId);\n if (!modelToUpdate) {\n throw new HTTPException(400, { message: 'Model to update is not found in agent model list' });\n }\n\n let model: string | undefined;\n if (bodyModel) {\n const { modelId, provider } = bodyModel;\n // Use the universal Mastra router format: provider/model\n model = `${provider}/${modelId}`;\n }\n\n agent.updateModelInModelList({ id: modelConfigId, model, maxRetries, enabled });\n\n return { message: 'Model list updated' };\n } catch (error) {\n return handleError(error, 'error updating model list');\n }\n}\n\nexport async function getProvidersHandler() {\n try {\n const providers = Object.entries(PROVIDER_REGISTRY).map(([id, provider]) => {\n // Check if the provider is connected by checking for its API key env var(s)\n const envVars = Array.isArray(provider.apiKeyEnvVar) ? provider.apiKeyEnvVar : [provider.apiKeyEnvVar];\n const connected = envVars.every(envVar => !!process.env[envVar]);\n\n return {\n id,\n name: provider.name,\n envVar: provider.apiKeyEnvVar,\n connected,\n docUrl: provider.docUrl,\n models: [...provider.models], // Convert readonly array to regular array\n };\n });\n\n return { providers };\n } catch (error) {\n return handleError(error, 'error fetching providers');\n }\n}\n"]}
@@ -20,6 +20,7 @@ __export(agents_exports, {
20
20
  getLiveEvalsByAgentIdHandler: () => getLiveEvalsByAgentIdHandler,
21
21
  getProvidersHandler: () => getProvidersHandler,
22
22
  getSerializedAgentTools: () => getSerializedAgentTools,
23
+ getSerializedProcessors: () => getSerializedProcessors,
23
24
  reorderAgentModelListHandler: () => reorderAgentModelListHandler,
24
25
  streamGenerateHandler: () => streamGenerateHandler,
25
26
  streamGenerateLegacyHandler: () => streamGenerateLegacyHandler,
@@ -34,17 +35,17 @@ async function getSerializedAgentTools(tools) {
34
35
  const toolId = _tool.id ?? `tool-${key}`;
35
36
  let inputSchemaForReturn = void 0;
36
37
  if (_tool.inputSchema) {
37
- if (_tool.inputSchema?.jsonSchema) {
38
+ if (_tool.inputSchema && typeof _tool.inputSchema === "object" && "jsonSchema" in _tool.inputSchema) {
38
39
  inputSchemaForReturn = stringify(_tool.inputSchema.jsonSchema);
39
- } else {
40
+ } else if (_tool.inputSchema) {
40
41
  inputSchemaForReturn = stringify(zodToJsonSchema(_tool.inputSchema));
41
42
  }
42
43
  }
43
44
  let outputSchemaForReturn = void 0;
44
45
  if (_tool.outputSchema) {
45
- if (_tool.outputSchema?.jsonSchema) {
46
+ if (_tool.outputSchema && typeof _tool.outputSchema === "object" && "jsonSchema" in _tool.outputSchema) {
46
47
  outputSchemaForReturn = stringify(_tool.outputSchema.jsonSchema);
47
- } else {
48
+ } else if (_tool.outputSchema) {
48
49
  outputSchemaForReturn = stringify(zodToJsonSchema(_tool.outputSchema));
49
50
  }
50
51
  }
@@ -57,6 +58,13 @@ async function getSerializedAgentTools(tools) {
57
58
  return acc;
58
59
  }, {});
59
60
  }
61
+ function getSerializedProcessors(processors) {
62
+ return processors.map((processor) => {
63
+ return {
64
+ name: processor.name || processor.constructor.name
65
+ };
66
+ });
67
+ }
60
68
  async function getSerializedAgentDefinition({
61
69
  agent,
62
70
  runtimeContext
@@ -64,12 +72,15 @@ async function getSerializedAgentDefinition({
64
72
  let serializedAgentAgents = {};
65
73
  if ("listAgents" in agent) {
66
74
  const agents = await agent.listAgents({ runtimeContext });
67
- serializedAgentAgents = Object.entries(agents || {}).reduce((acc, [key, agent2]) => {
68
- return {
69
- ...acc,
70
- [key]: { id: agent2.id, name: agent2.name }
71
- };
72
- }, {});
75
+ serializedAgentAgents = Object.entries(agents || {}).reduce(
76
+ (acc, [key, agent2]) => {
77
+ return {
78
+ ...acc,
79
+ [key]: { id: agent2.id, name: agent2.name }
80
+ };
81
+ },
82
+ {}
83
+ );
73
84
  }
74
85
  return serializedAgentAgents;
75
86
  }
@@ -94,7 +105,7 @@ async function formatAgentList({
94
105
  return {
95
106
  ...acc,
96
107
  [key]: {
97
- name: workflow.name
108
+ name: workflow.name || "Unnamed workflow"
98
109
  }
99
110
  };
100
111
  }, {});
@@ -103,6 +114,10 @@ async function formatAgentList({
103
114
  }
104
115
  }
105
116
  const serializedAgentAgents = await getSerializedAgentDefinition({ agent, runtimeContext });
117
+ const inputProcessors = await agent.getInputProcessors(runtimeContext);
118
+ const outputProcessors = await agent.getOutputProcessors(runtimeContext);
119
+ const serializedInputProcessors = getSerializedProcessors(inputProcessors);
120
+ const serializedOutputProcessors = getSerializedProcessors(outputProcessors);
106
121
  const model = llm?.getModel();
107
122
  const models = await agent.getModelList(runtimeContext);
108
123
  const modelList = models?.map((md) => ({
@@ -120,6 +135,8 @@ async function formatAgentList({
120
135
  agents: serializedAgentAgents,
121
136
  tools: serializedAgentTools,
122
137
  workflows: serializedAgentWorkflows,
138
+ inputProcessors: serializedInputProcessors,
139
+ outputProcessors: serializedOutputProcessors,
123
140
  provider: llm?.getProvider(),
124
141
  modelId: llm?.getModelId(),
125
142
  modelVersion: model?.specificationVersion,
@@ -128,7 +145,10 @@ async function formatAgentList({
128
145
  modelList
129
146
  };
130
147
  }
131
- async function getAgentsHandler({ mastra, runtimeContext }) {
148
+ async function getAgentsHandler({
149
+ mastra,
150
+ runtimeContext
151
+ }) {
132
152
  try {
133
153
  const agents = mastra.getAgents();
134
154
  const serializedAgentsMap = await Promise.all(
@@ -162,65 +182,74 @@ async function formatAgent({
162
182
  return {
163
183
  ...acc,
164
184
  [key]: {
165
- name: workflow.name,
166
- steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
167
- return {
168
- ...acc2,
169
- [key2]: {
170
- id: step.id,
171
- description: step.description
172
- }
173
- };
174
- }, {})
185
+ name: workflow.name || "Unnamed workflow",
186
+ steps: Object.entries(workflow.steps).reduce(
187
+ (acc2, [key2, step]) => {
188
+ return {
189
+ ...acc2,
190
+ [key2]: {
191
+ id: step.id,
192
+ description: step.description
193
+ }
194
+ };
195
+ },
196
+ {}
197
+ )
175
198
  }
176
199
  };
177
200
  }, {});
178
201
  } catch (error) {
179
202
  logger.error("Error getting workflows for agent", { agentName: agent.name, error });
180
203
  }
181
- let proxyRuntimeContext = runtimeContext;
182
- if (isPlayground) {
183
- proxyRuntimeContext = new Proxy(runtimeContext, {
184
- get(target, prop) {
185
- if (prop === "get") {
186
- return function(key) {
187
- const value = target.get(key);
188
- return value ?? `<${key}>`;
189
- };
190
- }
191
- return Reflect.get(target, prop);
204
+ }
205
+ let proxyRuntimeContext = runtimeContext;
206
+ if (isPlayground) {
207
+ proxyRuntimeContext = new Proxy(runtimeContext, {
208
+ get(target, prop) {
209
+ if (prop === "get") {
210
+ return function(key) {
211
+ const value = target.get(key);
212
+ return value ?? `<${key}>`;
213
+ };
192
214
  }
193
- });
194
- }
195
- const instructions = await agent.getInstructions({ runtimeContext: proxyRuntimeContext });
196
- const llm = await agent.getLLM({ runtimeContext });
197
- const defaultGenerateOptions = await agent.getDefaultGenerateOptions({ runtimeContext: proxyRuntimeContext });
198
- const defaultStreamOptions = await agent.getDefaultStreamOptions({ runtimeContext: proxyRuntimeContext });
199
- const model = llm?.getModel();
200
- const models = await agent.getModelList(runtimeContext);
201
- const modelList = models?.map((md) => ({
202
- ...md,
203
- model: {
204
- modelId: md.model.modelId,
205
- provider: md.model.provider,
206
- modelVersion: md.model.specificationVersion
215
+ return Reflect.get(target, prop);
207
216
  }
208
- }));
209
- const serializedAgentAgents = await getSerializedAgentDefinition({ agent, runtimeContext: proxyRuntimeContext });
210
- return {
211
- name: agent.name,
212
- instructions,
213
- tools: serializedAgentTools,
214
- agents: serializedAgentAgents,
215
- workflows: serializedAgentWorkflows,
216
- provider: llm?.getProvider(),
217
- modelId: llm?.getModelId(),
218
- modelVersion: model?.specificationVersion,
219
- modelList,
220
- defaultGenerateOptions,
221
- defaultStreamOptions
222
- };
217
+ });
223
218
  }
219
+ const instructions = await agent.getInstructions({ runtimeContext: proxyRuntimeContext });
220
+ const llm = await agent.getLLM({ runtimeContext });
221
+ const defaultGenerateOptions = await agent.getDefaultGenerateOptions({ runtimeContext: proxyRuntimeContext });
222
+ const defaultStreamOptions = await agent.getDefaultStreamOptions({ runtimeContext: proxyRuntimeContext });
223
+ const model = llm?.getModel();
224
+ const models = await agent.getModelList(runtimeContext);
225
+ const modelList = models?.map((md) => ({
226
+ ...md,
227
+ model: {
228
+ modelId: md.model.modelId,
229
+ provider: md.model.provider,
230
+ modelVersion: md.model.specificationVersion
231
+ }
232
+ }));
233
+ const serializedAgentAgents = await getSerializedAgentDefinition({ agent, runtimeContext: proxyRuntimeContext });
234
+ const inputProcessors = await agent.getInputProcessors(proxyRuntimeContext);
235
+ const outputProcessors = await agent.getOutputProcessors(proxyRuntimeContext);
236
+ const serializedInputProcessors = getSerializedProcessors(inputProcessors);
237
+ const serializedOutputProcessors = getSerializedProcessors(outputProcessors);
238
+ return {
239
+ name: agent.name,
240
+ instructions,
241
+ tools: serializedAgentTools,
242
+ agents: serializedAgentAgents,
243
+ workflows: serializedAgentWorkflows,
244
+ inputProcessors: serializedInputProcessors,
245
+ outputProcessors: serializedOutputProcessors,
246
+ provider: llm?.getProvider(),
247
+ modelId: llm?.getModelId(),
248
+ modelVersion: model?.specificationVersion,
249
+ modelList,
250
+ defaultGenerateOptions,
251
+ defaultStreamOptions
252
+ };
224
253
  }
225
254
  async function getAgentByIdHandler({
226
255
  mastra,
@@ -628,6 +657,6 @@ async function getProvidersHandler() {
628
657
  }
629
658
  }
630
659
 
631
- export { agents_exports, approveToolCallHandler, declineToolCallHandler, generateHandler, generateLegacyHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, getProvidersHandler, getSerializedAgentTools, reorderAgentModelListHandler, streamGenerateHandler, streamGenerateLegacyHandler, streamNetworkHandler, streamUIMessageHandler, updateAgentModelHandler, updateAgentModelInModelListHandler };
632
- //# sourceMappingURL=chunk-PAX7DVQQ.js.map
633
- //# sourceMappingURL=chunk-PAX7DVQQ.js.map
660
+ export { agents_exports, approveToolCallHandler, declineToolCallHandler, generateHandler, generateLegacyHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, getProvidersHandler, getSerializedAgentTools, getSerializedProcessors, reorderAgentModelListHandler, streamGenerateHandler, streamGenerateLegacyHandler, streamNetworkHandler, streamUIMessageHandler, updateAgentModelHandler, updateAgentModelInModelListHandler };
661
+ //# sourceMappingURL=chunk-LV66LYKV.js.map
662
+ //# sourceMappingURL=chunk-LV66LYKV.js.map