* fix(shellcheck): declare and assign separately in router.sh (SC2155) * feat(plugin): enhance context management and skill invocation - Update .context-manifest.json to include profile and detailed source information. - Revise context-scout.md to clarify context root discovery and navigation. - Modify commands to replace deprecated skills with updated ones (brainstorming → approach, systematic-debugging → debugger). - Streamline install-context.md for clarity and remove interactive profile selection. - Improve oac-status.md to provide a more comprehensive status report. - Add OAC system paths to session-start.sh for better context management. - Remove obsolete skills and improve documentation for existing commands.
1.3 KiB
1.3 KiB
Concept: Mastra Agents & Tools
Purpose: Reusable units of logic and LLM-powered entities.
Last Updated: 2026-01-09
Core Idea
Agents are specialized LLM configurations that use Tools to interact with external systems or perform specific logic. Tools are the building blocks that provide functionality to both agents and workflows.
Key Points
- Agents: Defined with a
name,instructions, andmodel. They can be assigned a set oftools. - Tools: Defined with
id,inputSchema,outputSchema, and anexecutefunction. - Type Safety: Both agents and tools use Zod for schema validation.
- Standalone Use: Tools can be executed independently of agents, making them highly reusable.
Quick Example
// Tool
const myTool = createTool({
id: 'my-tool',
inputSchema: z.object({ query: z.string() }),
execute: async ({ inputData }) => ({ result: `Processed ${inputData.query}` }),
});
// Agent
const myAgent = new Agent({
name: 'My Agent',
instructions: 'Use my-tool to process queries.',
model: { provider: 'OPEN_AI', name: 'gpt-4o' },
tools: { myTool },
});
Reference: src/mastra/agents/, src/mastra/tools/
Related:
- concepts/core.md
- concepts/workflows.md