@virajmishra1/bench-mastra
v0.1.0
Published
Auto-instrument Mastra agents with @virajmishra1/bench-sdk. One line: wrapAgent(agent, bench).
Maintainers
Readme
@virajmishra1/bench-mastra
Auto-instrument Mastra agents with Bench. One line — every .generate() becomes a Bench task, every tool execution becomes a subtask.
npm i @virajmishra1/bench-mastra @virajmishra1/bench-sdkQuickstart
import { Agent } from "@mastra/core";
import { observe } from "@virajmishra1/bench-sdk";
import { wrapAgent } from "@virajmishra1/bench-mastra";
const bench = observe({
apiKey: process.env.BENCH_KEY!,
agent: "my-mastra-agent",
});
const researcher = wrapAgent(
new Agent({
name: "researcher",
instructions: "You research things.",
model: { provider: "OPEN_AI", name: "gpt-4o" },
tools: { search: searchTool, fetch: fetchTool },
}),
bench,
);
// Every call shows up live in your Bench dashboard.
const result = await researcher.generate("research the OTLP spec");Pricing
Mastra doesn't bundle per-model pricing. Pass pricePerMTok to capture cost:
wrapAgent(myAgent, bench, {
pricePerMTok: { input: 2.5, output: 10 }, // gpt-4o per 1M tokens
});Wrap a tool directly
import { wrapTool } from "@virajmishra1/bench-mastra";
const tracedSearch = wrapTool(searchTool, bench, "google-search");License
MIT
