[BUG] Inngest 代理程序: 当 Inngest 工作进程与调用者不同时,会丢弃 clientTools 的调用时间
// Terminal 1: npx tsx reproduce.ts worker // Terminal 2: npx inngest-cli dev -u http://127.0.0.1:4869/api/inngest --port 8969 --no-discovery // Terminal 3: npx tsx reproduce.ts caller // Control (worker inside the caller; stop terminal 1 first): npx tsx reproduce.ts same-process import { createServer } from 'node:http'; import { Agent } from '@mastra/core/agent'; import { Mastra } from '@mastra/core/mastra'; import type { ProcessInputStepArgs } from '@mastra/core/processors'; import { createTool } from '@mastra/core/tools'; import { LibSQLStore } from '@mastra/libsql'; import { createInngestAgent, createServe } from '@mastra/inngest'; import { Inngest } from 'inngest'; import { serve } from 'inngest/node'; import { z } from 'zod';
const inngest = new Inngest({ id: 'client-tools-worker', isDev: true, baseUrl: 'http://127.0.0.1:8969' });
const agent = createInngestAgent({
inngest,
agent: new Agent({
id: 'repro',
name: 'Repro',
model: 'OpenAI/GPT-4o-mini',
instructions: 'Call the tool the user asks for exactly once.',
tools: {
// Registered client tool (no execute) — control: this one reaches the worker.
approve_invoice: createTool({ id: 'approve_invoice', description: 'Ask the user to approve an invoice.', inputSchema: z.object({ invoice: z.string() }) }),
},
// Logs which tools each step actually offers the model, and in which process.
inputProcessors: [{
id: 'log-tools',
processInputStep({ tools, stepNumber }: ProcessInputStepArgs) {
console.log([pid ${process.pid}] step ${stepNumber} offers:, Object.keys(tools ?? {}).sort());
return {};
},
}],
}),
});
const mastra = new
内容来源: mastra-ai/mastra