#24298·mastra

在配置可观察性时,持久代理会默默地跳过评分器

作者: rphansen91创建于 2026年9月17日更新于 2026年9月17日
标签EvalsObservability (AI Telemetry)effort:lowimpact:mediumstatus: auto-triaged

// Repro: do agent-configured scorers run when the agent is wrapped in // createDurableAgent? Core 1.63.0. Compares non-durable vs durable stream. import { Mastra } from '@mastra/core/mastra'; import { Agent } from '@mastra/core/agent'; import { createDurableAgent } from '@mastra/core/agent/durable'; import { InMemoryStore } from '@mastra/core/storage'; import { createScorer } from '@mastra/core/evals'; import { Observability, DefaultExporter } from '@mastra/observability'; import { MockLanguageModelV3, simulateReadableStream } from 'ai/test';

const model = new MockLanguageModelV3({ doStream: async () => ({ stream: simulateReadableStream({ chunks: [ { type: 'text-start', id: '1' }, { type: 'text-delta', id: '1', delta: 'hello' }, { type: 'text-end', id: '1' }, { type: 'finish', finishReason: 'stop', usage: { inputTokens: 1, outputTokens: 1, totalTokens: 2 } }, ], }), }), });

let scorerRuns = 0; const scorer = createScorer({ id: 'repro-scorer', name: 'Repro Scorer', description: 'counts runs', }).generateScore(() => { scorerRuns += 1; return 1; });

async function runCase(label, wrap) { scorerRuns = 0; const agent = new Agent({ id: 'a1', name: 'a1', instructions: 'test', …

内容来源: mastra-ai/mastra