Prompt Content
Using Mastra AI, define a primary `ProductivityOptimizerAgent`. This agent should be capable of:
1. Retrieving documents from a RAG system.
2. Analyzing structured and unstructured data using an LLM (Phi-3).
3. Triggering external automation workflows via Lyzr.
Provide the TypeScript code for the Mastra AI agent initialization, including defining these tool interfaces. Assume Phi-3 is accessible via `phi3.generate(prompt)` and Lyzr tools are accessible via a `lyzrClient.triggerWorkflow(name, params)`.
```typescript
import { createAgent, createTool } from '@mastra-ai/core';
const phi3Tool = createTool('phi3_analyzer', {
description: 'Analyzes data using the Phi-3 LLM.',
input: { type: 'string', name: 'prompt' },
output: { type: 'string' },
handler: async ({ prompt }) => {
// Simulate Phi-3 API call via Oracle OCI Generative AI
return `Analysis result for: ${prompt} (simulated by Phi-3)`;
},
});
const ragTool = createTool('rag_retriever', {
description: 'Retrieves relevant documents from a vector database.',
input: { type: 'string', name: 'query' },
output: { type: 'array', items: { type: 'string' } },
handler: async ({ query }) => {
// Simulate RAG query to Pinecone/Chroma
return [`Doc related to ${query}`];
},
});
const lyzrWorkflowTool = createTool('lyzr_workflow_trigger', {
description: 'Triggers an automation workflow in Lyzr.',
input: {
type: 'object',
properties: {
workflowName: { type: 'string' },
parameters: { type: 'object' },
},
},
output: { type: 'boolean' },
handler: async ({ workflowName, parameters }) => {
// Simulate Lyzr API call
console.log(`Triggering Lyzr workflow: ${workflowName} with params:`, parameters);
return true;
},
});
const ProductivityOptimizerAgent = createAgent({
id: 'productivity_optimizer',
model: 'phi-3',
tools: [phi3Tool, ragTool, lyzrWorkflowTool],
// ... define initial state and goals
});
export { ProductivityOptimizerAgent };
```Try this prompt
Open the workspace to execute this prompt with free credits, or use your own API keys for unlimited usage.
Related Prompts
Explore similar prompts from our community
Usage Tips
Copy the prompt and paste it into your preferred AI tool (Claude, ChatGPT, Gemini)
Customize placeholder values with your specific requirements and context
For best results, provide clear examples and test different variations