-
Notifications
You must be signed in to change notification settings - Fork 5
feat: update Google AI model options and refactor imports across agents #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,32 +4,17 @@ import { | |
| createToxicityScorer, | ||
| } from '@mastra/evals/scorers/prebuilt' | ||
|
|
||
| import { googleAIFlashLite } from '../config/google' | ||
| import { log } from '../config/logger' | ||
| import { pgMemory } from '../config/pg-storage' | ||
|
|
||
| import type { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google' | ||
| import { google, type GoogleLanguageModelOptions } from '@ai-sdk/google' | ||
| import { InternalSpans } from '@mastra/core/observability' | ||
| import { | ||
| codeArchitectAgent, | ||
| codeReviewerAgent, | ||
| refactoringAgent, | ||
| testEngineerAgent, | ||
| } from '../agents/codingAgents' | ||
| import { | ||
| checkFileExists, | ||
| createDirectory, | ||
| createSandbox, | ||
| deleteFile, | ||
| getFileInfo, | ||
| getFileSize, | ||
| listFiles, | ||
| runCode, | ||
| runCommand, | ||
| watchDirectory, | ||
| writeFile, | ||
| writeFiles, | ||
| } from '../tools/e2b' | ||
| import { automatedReportingWorkflow } from '../workflows/automated-reporting-workflow' | ||
| import { dataAnalysisWorkflow } from '../workflows/data-analysis-workflow' | ||
| import { financialReportWorkflow } from '../workflows/financial-report-workflow' | ||
|
|
@@ -197,11 +182,11 @@ When a user's request requires prolonged, structured work across multiple subtas | |
| }, | ||
| mediaResolution: 'MEDIA_RESOLUTION_MEDIUM', | ||
| responseModalities: ['TEXT', 'IMAGE'], | ||
| } satisfies GoogleGenerativeAIProviderOptions, | ||
| } satisfies GoogleLanguageModelOptions, | ||
| }, | ||
| } | ||
| }, | ||
| model: googleAIFlashLite, | ||
| model: 'google/gemini-3.1-flash-preview', | ||
| memory: pgMemory, | ||
|
|
||
| agents: { | ||
|
|
@@ -222,18 +207,9 @@ When a user's request requires prolonged, structured work across multiple subtas | |
| automatedReportingWorkflow, | ||
| }, | ||
| tools: { | ||
| createSandbox, | ||
| writeFile, | ||
| writeFiles, | ||
| listFiles, | ||
| deleteFile, | ||
| createDirectory, | ||
| getFileInfo, | ||
| checkFileExists, | ||
| getFileSize, | ||
| watchDirectory, | ||
| runCommand, | ||
| runCode, | ||
| google_search: google.tools.googleSearch({}), | ||
| url_context: google.tools.urlContext({}), | ||
| code_execution: google.tools.codeExecution({}), | ||
| }, | ||
|
Comment on lines
209
to
213
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. E2B sandbox tools replaced with Google tools, but instructions still reference E2B extensively. The
The This mismatch will cause the coordinator to generate plans referencing unavailable tools. 🐛 Instructions need significant updates to reflect new tool capabilitiesKey sections to update:
The instructions should document what 🤖 Prompt for AI Agents |
||
| maxRetries: 5, | ||
| options: { | ||
|
|
@@ -244,11 +220,11 @@ When a user's request requires prolonged, structured work across multiple subtas | |
|
|
||
| scorers: { | ||
| relevancy: { | ||
| scorer: createAnswerRelevancyScorer({ model: googleAIFlashLite }), | ||
| scorer: createAnswerRelevancyScorer({ model: 'google/gemini-3.1-flash-lite-preview' }), | ||
| sampling: { type: 'ratio', rate: 0.4 }, | ||
| }, | ||
| safety: { | ||
| scorer: createToxicityScorer({ model: googleAIFlashLite }), | ||
| scorer: createToxicityScorer({ model: 'google/gemini-3.1-flash-lite-preview' }), | ||
| sampling: { type: 'ratio', rate: 0.3 }, | ||
| }, | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,39 +1,20 @@ | ||||||||||||||
| import { Agent } from '@mastra/core/agent' | ||||||||||||||
|
|
||||||||||||||
| import type { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google' | ||||||||||||||
| import type { GoogleGenerativeAIProviderOptions, GoogleLanguageModelOptions } from '@ai-sdk/google' | ||||||||||||||
| import { | ||||||||||||||
| TokenLimiterProcessor | ||||||||||||||
| } from '@mastra/core/processors' | ||||||||||||||
| import { | ||||||||||||||
| createAnswerRelevancyScorer, | ||||||||||||||
| createToxicityScorer, | ||||||||||||||
| } from '@mastra/evals/scorers/prebuilt' | ||||||||||||||
| import { | ||||||||||||||
| google3, | ||||||||||||||
| googleAI3, | ||||||||||||||
| googleAIFlashLite, | ||||||||||||||
| } from '../config/google' | ||||||||||||||
| import { log } from '../config/logger' | ||||||||||||||
|
|
||||||||||||||
| import { InternalSpans } from '@mastra/core/observability' | ||||||||||||||
| import { pgMemory } from '../config/pg-storage' | ||||||||||||||
| import { codeAnalysisTool } from '../tools/code-analysis.tool' | ||||||||||||||
| import { codeSearchTool } from '../tools/code-search.tool' | ||||||||||||||
| import { diffReviewTool } from '../tools/diff-review.tool' | ||||||||||||||
| import { | ||||||||||||||
| checkFileExists, | ||||||||||||||
| createDirectory, | ||||||||||||||
| createSandbox, | ||||||||||||||
| deleteFile, | ||||||||||||||
| getFileInfo, | ||||||||||||||
| getFileSize, | ||||||||||||||
| listFiles, | ||||||||||||||
| runCode, | ||||||||||||||
| runCommand, | ||||||||||||||
| watchDirectory, | ||||||||||||||
| writeFile, | ||||||||||||||
| writeFiles, | ||||||||||||||
| } from '../tools/e2b' | ||||||||||||||
| import { findReferencesTool } from '../tools/find-references.tool' | ||||||||||||||
| import { findSymbolTool } from '../tools/find-symbol.tool' | ||||||||||||||
| import { | ||||||||||||||
|
|
@@ -87,34 +68,13 @@ const codeReviewerTools = { | |||||||||||||
| const testEngineerTools = { | ||||||||||||||
| codeAnalysisTool, | ||||||||||||||
| testGeneratorTool, | ||||||||||||||
| createSandbox, | ||||||||||||||
| runCommand, | ||||||||||||||
| runCode, | ||||||||||||||
| writeFile, | ||||||||||||||
| writeFiles, | ||||||||||||||
| deleteFile, | ||||||||||||||
| listFiles, | ||||||||||||||
| getFileInfo, | ||||||||||||||
| getFileSize, | ||||||||||||||
| checkFileExists, | ||||||||||||||
|
|
||||||||||||||
|
||||||||||||||
| codeSearchTool, | |
| multiStringEditTool, | |
| searchCode, | |
| getFileContent, | |
| getRepositoryInfo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't remove the execution backend while these agents still promise sandbox verification.
Both tool maps now omit every execution/sandbox primitive, but testEngineerAgent still instructs the model to createSandbox, writeFiles, and runCommand, refactoringAgent still tells it to verify changes in a sandbox, and src/mastra/a2a/codingA2ACoordinator.ts:103-119,135-141 still routes work assuming those capabilities exist. After this change, the agents can generate tests/diffs, but they can no longer perform the verification step they advertise.
Either wire in the replacement execution tool in this PR or remove the sandbox-verification promises from the prompts/coordinator in the same pass.
Also applies to: 74-81
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/mastra/agents/codingAgents.ts` around lines 68 - 72, The agents advertise
sandbox verification but the tool map testEngineerTools no longer exposes any
execution primitives; either re-add or wire a replacement execution tool (e.g.,
an ExecutionTool/TestRunner with methods createSandbox, writeFiles, runCommand)
into testEngineerTools alongside codeAnalysisTool and testGeneratorTool and
update testEngineerAgent and refactoringAgent to call that tool’s methods, or
remove all sandbox-verification wording and coordinator routing that expects
createSandbox/writeFiles/runCommand from testEngineerAgent, refactoringAgent and
the coordinator logic so prompts and routing match the available tools. Ensure
references to createSandbox, writeFiles and runCommand in testEngineerAgent,
refactoringAgent and the coordinator are made consistent with whichever approach
you choose.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,9 @@ import { Agent } from '@mastra/core/agent' | |
| import { pgMemory } from '../config/pg-storage' | ||
| import { | ||
| scrapingSchedulerTool, | ||
| webScraperTool, | ||
| } from '../tools/web-scraper-tool' | ||
|
|
||
| import type { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google' | ||
| import { google, type GoogleGenerativeAIProviderOptions } from '@ai-sdk/google' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent type and thinking config compared to other agents. This agent imports ♻️ Suggested fix for consistency-import { google, type GoogleGenerativeAIProviderOptions } from '@ai-sdk/google'
+import { google, type GoogleLanguageModelOptions } from '@ai-sdk/google' providerOptions: {
google: {
thinkingConfig: {
includeThoughts: true,
- thinkingBudget: -1,
+ thinkingLevel: 'medium',
},
mediaResolution: 'MEDIA_RESOLUTION_MEDIUM',
responseModalities: ['TEXT'],
- } satisfies GoogleGenerativeAIProviderOptions,
+ } satisfies GoogleLanguageModelOptions,
},Also applies to: 132-141 🤖 Prompt for AI Agents |
||
| import { InternalSpans } from '@mastra/core/observability' | ||
| import { TokenLimiterProcessor } from '@mastra/core/processors' | ||
| import { | ||
|
|
@@ -19,6 +18,7 @@ import { | |
| createToneScorer, | ||
| } from '../evals/scorers/prebuilt' | ||
| import { chartSupervisorTool } from '../tools/financial-chart-tools' | ||
| import { fetchTool } from '../tools/fetch.tool' | ||
|
|
||
| const STAGGERED_OUTPUT_CONTEXT_KEY = 'staggeredOutput' as const | ||
| const SECTION_COUNT_CONTEXT_KEY = 'sectionCount' as const | ||
|
|
@@ -79,9 +79,11 @@ function getBackupDataToolsFromContext(requestContext: { | |
| } | ||
|
|
||
| const contentStrategistTools = { | ||
| webScraperTool, | ||
| fetchTool, | ||
| chartSupervisorTool, | ||
| scrapingSchedulerTool, | ||
| google_search: google.tools.googleSearch({}), | ||
| url_context: google.tools.urlContext({}), | ||
| } | ||
|
Comment on lines
81
to
87
|
||
|
|
||
| export const contentStrategistAgent = new Agent({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This coordinator’s instructions heavily emphasize using E2B sandbox tools, but the
toolsmap now only exposes Google tools (google_search,url_context,code_execution). Update the instructions to reflect the available execution mechanism, or re-add the sandbox tools so the coordinator can actually perform the described verification steps.