packages/prompts/README.md
Shared prompt templates for elizaOS across TypeScript, Python, and Rust runtimes.
This package provides a single source of truth for all prompt templates used by elizaOS agents. Prompts are stored as .txt files and generated into native formats for each language.
packages/prompts/
├── prompts/ # Source prompt templates (.txt files)
│ ├── reply.txt
│ ├── choose_option.txt
│ ├── image_generation.txt
│ └── ...
├── scripts/ # Build scripts
│ └── generate.js # Generates native code from prompts
├── dist/ # Generated output
│ ├── typescript/ # TypeScript exports
│ ├── python/ # Python module
│ └── rust/ # Rust source
└── package.json
All prompts use Handlebars-style template variables:
{{variableName}} - Simple variable substitution{{#each items}}...{{/each}} - Iteration over arrays{{#if condition}}...{{/if}} - Conditional blocksUse camelCase for all template variables to ensure consistency across languages:
{{agentName}} - The agent's name{{providers}} - Provider context{{recentMessages}} - Recent conversation messages# Build all targets
npm run build
# Build specific target
npm run build:typescript
npm run build:python
npm run build:rust
import { REPLY_TEMPLATE, CHOOSE_OPTION_TEMPLATE } from "@elizaos/prompts";
const prompt = composePrompt({
state: { agentName: "Alice" },
template: REPLY_TEMPLATE,
});
from elizaos.prompts import REPLY_TEMPLATE, CHOOSE_OPTION_TEMPLATE
prompt = compose_prompt(state={'agentName': 'Alice'}, template=REPLY_TEMPLATE)
use elizaos_prompts::{REPLY_TEMPLATE, CHOOSE_OPTION_TEMPLATE};
let prompt = compose_prompt(&state, REPLY_TEMPLATE);
.txt file in prompts/ directorymy_new_action.txt)npm run build to generate native codeMY_NEW_ACTION_TEMPLATE in all languagesPlugins can use the same prompt system! See README-PLUGIN-PROMPTS.md for details on how to set up prompts in your plugin.
The scripts/generate-plugin-prompts.js utility can be used by any plugin to generate TypeScript, Python, and Rust exports from .txt prompt templates.
# Task: to clearly state the objective{{providers}} where provider context should be injectedExample:
# Task: Generate dialog for the character {{agentName}}.
{{providers}}
# Instructions: Write the next message for {{agentName}}.
Respond using XML format like this:
<response>
<thought>Your thought here</thought>
<text>Your message here</text>
</response>
IMPORTANT: Your response must ONLY contain the <response></response> XML block above.
{{apiKey}}, {{userEmail}}) and ensure the runtime injects only the minimum needed.This package includes a conservative scanner that flags prompt templates containing strings that strongly resemble real credentials (or private key material).
Run:
npm run check:secrets
It scans:
packages/prompts/prompts/**/*.txtplugins/**/prompts/**/*.txt