text stringlengths 0 59.1k |
|---|
pnpm volt prompts pull |
``` |
2. Keep files under `.voltagent/prompts` (default), or pull to a custom directory: |
```bash |
pnpm volt prompts pull --out ./.prompts |
``` |
3. Point the runtime to the same directory: |
```bash |
export VOLTAGENT_PROMPTS_PATH="./.prompts" |
``` |
4. Use prompts the same way in your agent: |
```typescript |
instructions: async ({ prompts }) => { |
return await prompts.getPrompt({ promptName: "customer-support-prompt" }); |
}; |
``` |
### Multiple Versions and Labels (Local) |
To keep more than one version locally, pull specific versions or labels. These are stored as: |
`.voltagent/prompts/<promptName>/<version>.md`. |
```bash |
pnpm volt prompts pull --names support-agent --prompt-version 4 |
pnpm volt prompts pull --names support-agent --label production |
``` |
Then request by version or label: |
```typescript |
instructions: async ({ prompts }) => { |
return await prompts.getPrompt({ |
promptName: "support-agent", |
version: 4, |
}); |
}; |
``` |
```typescript |
instructions: async ({ prompts }) => { |
return await prompts.getPrompt({ |
promptName: "support-agent", |
label: "production", |
}); |
}; |
``` |
If a local prompt is found, it is used first. If not, VoltOps is used as the fallback. |
### Agent-Level VoltOpsClient |
Alternatively, attach the client directly to the agent: |
```typescript |
const agent = new Agent({ |
name: "SupportAgent", |
model: openai("gpt-4o-mini"), |
instructions: async ({ prompts }) => { |
return await prompts.getPrompt({ |
promptName: "customer-support-prompt", |
}); |
}, |
voltOpsClient: voltOpsClient, |
}); |
``` |
### Direct VoltOpsClient Access |
For standalone usage outside of agents: |
```typescript |
const voltOpsClient = new VoltOpsClient({ |
publicKey: process.env.VOLTAGENT_PUBLIC_KEY, |
secretKey: process.env.VOLTAGENT_SECRET_KEY, |
}); |
const content = await voltOpsClient.prompts.getPrompt({ |
promptName: "customer-support-prompt", |
}); |
console.log("Prompt content:", content); |
``` |
## Environment Labels |
Use labels to target specific prompt versions for different environments: |
```typescript |
const agent = new Agent({ |
name: "ProductionAgent", |
model: openai("gpt-4o-mini"), |
instructions: async ({ prompts }) => { |
const label = process.env.NODE_ENV === "production" ? "production" : "development"; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.