text stringlengths 0 59.1k |
|---|
prompts: true, |
promptCache: { |
enabled: true, |
ttl: 300, |
}, |
}); |
const supportAgent = new Agent({ |
name: "SupportAgent", |
model: openai("gpt-4o-mini"), |
instructions: async ({ prompts, context }) => { |
const environment = process.env.NODE_ENV === "production" ? "production" : "development"; |
try { |
return await prompts.getPrompt({ |
promptName: "customer-support-agent", |
label: environment, |
variables: { |
companyName: "VoltAgent Corp", |
userName: context.get("userName") || "Guest", |
tier: context.get("subscriptionTier") || "free", |
supportHours: "9 AM - 6 PM EST", |
}, |
}); |
} catch (error) { |
console.error("Failed to fetch prompt:", error); |
return "You are a helpful customer support agent. Assist users with their questions."; |
} |
}, |
}); |
new VoltAgent({ |
agents: { supportAgent }, |
voltOpsClient: voltOpsClient, |
}); |
``` |
## API Reference |
### getPrompt Options |
| Option | Type | Required | Description | |
| ------------- | ------ | -------- | --------------------------------------------- | |
| `promptName` | string | Yes | Name of the prompt to fetch | |
| `label` | string | No | Environment label (production, staging, etc.) | |
| `variables` | object | No | Key-value pairs for template substitution | |
| `promptCache` | object | No | Per-request cache configuration | |
| `timeout` | number | No | Request timeout in milliseconds | |
### PromptCache Options |
| Option | Type | Default | Description | |
| --------- | ------- | ------- | ----------------------- | |
| `enabled` | boolean | true | Enable/disable caching | |
| `ttl` | number | 300 | Time-to-live in seconds | |
| `maxSize` | number | 100 | Maximum cached entries | |
<|endoftext|> |
# source: VoltAgent__voltagent/website/prompt-engineering-docs/import-export.md type: docs |
--- |
title: Import & Export |
--- |
# Import & Export |
Backup, share, and version control your prompts with import and export functionality. |
## Exporting Prompts |
Export prompts as Markdown files for backup or version control: |
1. Click **Export** on the prompt list page to export all prompts |
2. Or click **Export Markdown** on a specific prompt's detail page |
Exported files include frontmatter with metadata: |
```markdown |
--- |
name: customer-support-agent |
description: Main support agent prompt |
type: text |
version: 5 |
labels: |
- production |
- latest |
--- |
You are a helpful customer support agent... |
``` |
## Export via REST API |
Use project public and secret keys to export prompts without the dashboard. |
Headers: |
- `x-public-key` |
- `x-secret-key` |
Export all prompts (zip when multiple): |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.