Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/agent-core/src/mastra/system-prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Load the generate-media skill before creating or editing an image or generating

const RESEARCH_MODULE = `## Research

Gather sources with search_web / search_web_advanced / search_company / search_web_content, then use search_scrape or search_extract for source retrieval. For an explicit deep-research request, cited report, market analysis, due diligence, or comprehensive investigation of one topic, use research_deep with 3 queries for a concise/narrow report, 4 by default, and 5-6 only when the user explicitly asks for deeper coverage. Use research_fanout when the request compares many entities or independent angles. Call the selected research workflow once per user request; if it fails, explain the failure instead of immediately rerunning it. Those workflows produce the complete cited PDF deliverable automatically, so do not regenerate it with a document tool. After a research workflow succeeds, present its returned report Markdown as the response body without summarizing, restructuring, or appending hidden claim-map data; the PDF is rendered from that same Markdown. Treat search snippets as leads, not sources — open the real pages and cross-check. Cite as you go: attribute each claim to its source inline with the page title and its URL, and make sure every citation resolves. End a research answer with a short Sources list of the URLs you actually used.`;
Gather sources with search_web / search_web_advanced / search_company / search_web_content, then use search_scrape or search_extract for source retrieval. For an explicit deep-research request, cited report, market analysis, due diligence, or comprehensive investigation of one topic, use research_deep with 3 queries for a concise/narrow report, 4 by default, and 5-6 only when the user explicitly asks for deeper coverage. A comparison of a few sources, standards, or recommendations within one topic still uses research_deep. Reserve research_fanout for four or more independent entities or genuinely separate angles, and pass entities as an array of separate short names. Call the selected research workflow once per user request; if it fails, explain the failure instead of immediately rerunning it. Those workflows produce the complete cited PDF deliverable automatically, so do not regenerate it with a document tool. After a research workflow succeeds, present its returned report Markdown as the response body without summarizing, restructuring, or appending hidden claim-map data; the PDF is rendered from that same Markdown. Treat search snippets as leads, not sources — open the real pages and cross-check. Cite as you go: attribute each claim to its source inline with the page title and its URL, and make sure every citation resolves. End a research answer with a short Sources list of the URLs you actually used.`;

/** Compact all-domains pointer for an ambiguous general request — keeps the model aware without the full modules. */
const GENERALIST_MODULE = `## Choosing your approach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export const mastraDeepResearch = createTool({
export const mastraResearchFanout = createTool({
id: "research_fanout",
description:
"Run the Deep Research fan-out workflow across multiple entities or angles. It returns a cited comparison report and saves the complete report as a PDF deliverable in the project.",
"Run Deep Research across four or more independent entities or genuinely separate angles. Pass entities as an array of separate short names. For comparisons of a few sources or standards within one topic, use research_deep. The workflow returns a cited comparison report and saves the complete report as a PDF deliverable in the project.",
inputSchema: DeepResearchFanoutInputSchema,
outputSchema: ResearchReportArtifactSchema,
execute: async (input, context) => {
Expand Down
11 changes: 9 additions & 2 deletions packages/agent-core/src/mastra/workflows/research-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const ResearchReportSchema = z.strictObject({
});

export const ResearchQuerySchema = z.strictObject({
query: z.string().trim().min(1).max(2_000),
query: z.string().trim().min(1).max(1_000),
});

export const DeepResearchInputSchema = z.strictObject({
Expand All @@ -65,7 +65,14 @@ export const DeepResearchInputSchema = z.strictObject({
});

export const DeepResearchFanoutInputSchema = z.strictObject({
entities: z.array(z.string().trim().min(1).max(200)).min(1).max(12).optional(),
entities: z
.array(z.string().trim().min(1).max(200))
.min(1)
.max(12)
.optional()
.describe(
"Optional array of separate short entity names; never combine entities into one string.",
),
goal: z.string().trim().min(1).max(2_000),
maxQueries: z.number().int().min(1).max(12).default(10),
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const MAX_RESEARCH_QUERY_CHARACTERS = 2_000;
const MAX_RESEARCH_QUERY_CHARACTERS = 1_000;

export function buildDeepResearchQueries(
topic: string,
Expand Down