text stringlengths 0 59.1k |
|---|
Build an intelligent AI agent for recipe recommendations that creates personalized cooking suggestions based on available ingredients, dietary preferences, and time constraints. This example demonstrates how to build an AI agent using VoltAgent framework with MCP (Model Context Protocol) integration to access external ... |
Try these prompts to interact with your recipe AI agent: |
- "Whatβs a one-pan dinner I can make with salmon, zucchini, and quinoa?β |
- βSuggest a low-carb lunch using eggs, avocado, and spinach.β |
- βI need a gluten-free dinner with beef, peppers, and rice.β |
- βShow me a no-bake dessert with peanut butter and oats.β |
- βI only have 15 minutesβwhat can I make with eggs, cheese, and bread? |
## Usage |
### 1. Create a new VoltAgent AI agent app |
Initialize a new AI agent project with the recipe creator example. |
```bash |
npm create voltagent-app@latest -- --example with-recipe-generator |
``` |
You can find the source code of this example [here](https://github.com/VoltAgent/voltagent/tree/main/examples/with-recipe-generator). |
### 2. Configure API keys |
After signing up for Exa, get your API key from [dashboard.exa.ai/api-keys](https://dashboard.exa.ai/api-keys). |
Create a `.env` file in your project root: |
```env |
OPENAI_API_KEY=your-openai-api-key |
EXA_API_KEY=your-exa-api-key |
``` |
### 3. Run the agent |
Start the development server. |
```bash |
cd my-agent-app && npm run dev |
``` |
Once your server starts successfully, you'll see the following output in your terminal: |
```bash |
ββββββββββββββββββββββββββββββββββββββββββββ |
VOLTAGENT SERVER STARTED SUCCESSFULLY |
ββββββββββββββββββββββββββββββββββββββββββββ |
β HTTP Server: http://localhost:3141 |
VoltOps Platform: https://console.voltagent.dev |
ββββββββββββββββββββββββββββββββββββββββββββ |
[VoltAgent] All packages are up to date |
``` |
The [VoltOps Platform](https://console.voltagent.dev) link will open automatically in your browser where you can interact with your AI agent. |
## Code |
```typescript |
import path from "node:path"; |
import { openai } from "@ai-sdk/openai"; |
import { Agent, MCPConfiguration, VoltAgent } from "@voltagent/core"; |
import { createPinoLogger } from "@voltagent/logger"; |
const mcpConfig = new MCPConfiguration({ |
servers: { |
exa: { |
type: "stdio", |
command: "npx", |
args: ["-y", "mcp-remote", "https://mcp.exa.ai/mcp?exaApiKey=<YOUR-API-KEY>"], |
}, |
}, |
}); |
const agent = new Agent({ |
name: "Recipe Assistant", |
description: `You are a culinary expert AI assistant. Help users create delicious recipes. |
Core Capabilities: |
β’ Analyze available ingredients and suggest recipes |
β’ Account for dietary preferences and restrictions |
β’ Optimize for preparation time and complexity |
β’ Provide detailed nutritional information |
β’ Suggest ingredient substitutions |
Recipe Process: |
1. Ingredient Analysis - Review what's available |
2. Recipe Search - Find matching recipes using Exa |
3. Customization - Adapt to user preferences |
4. Instructions - Provide clear, step-by-step guidance |
Output Format: |
β’ Recipe name and cuisine type |
β’ Prep and cook times |
β’ Ingredient list with measurements |
β’ Numbered cooking steps |
β’ Nutritional facts per serving |
β’ Storage and reheating tips |
Special Indicators: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.