import { Agent } from "@mastra/core/agent";
import { RuntimeContext } from "@mastra/core/runtime-context";
const fileExplorerAgent = new Agent({
model: "mistral/ministral-3b-latest",
instructions: `
You are a file explorer agent.
Answer user questions about a folder.
You are provided tools to scan the folder, list files, dive into nested folders.
Use the appropriate tools to answer questions.
`,
name: "file-explorer",
tools: [scanFolder],
defaultGenerateOptions: {
maxSteps: 10
}
})
const runtimeContext = new RuntimeContext<{ rootFolder: string }>()
runtimeContext.set("rootFolder", rootFolder)
const msg = await fileExplorerAgent.generate([
{
role: "user",
content: prompt
},
], { runtimeContext })
console.log("File Explorer says:", msg.text, msg.toolCalls)
import { Agent } from "@mastra/core/agent";
import { RuntimeContext } from "@mastra/core/runtime-context";
const fileExplorerAgent = new Agent({
model: "mistral/ministral-3b-latest",
instructions: `
You are a file explorer agent.
Answer user questions about a folder.
You are provided tools to scan the folder, list files, dive into nested folders.
Use the appropriate tools to answer questions.
`,
name: "file-explorer",
tools: [scanFolder],
defaultGenerateOptions: {
maxSteps: 10
}
})
const runtimeContext = new RuntimeContext<{ rootFolder: string }>()
runtimeContext.set("rootFolder", rootFolder)
const msg = await fileExplorerAgent.generate([
{
role: "user",
content: prompt
},
], { runtimeContext })
console.log("File Explorer says:", msg.text, msg.toolCalls)