Variables in Sysprompt let you add dynamic placeholders within your prompts, so you can customize content without manually editing text every time. Instead of hard-coding values (e.g., specific names, budgets, or products), you can insert placeholders like {{variable_name}}
. At runtime, Sysprompt (or the SDK) will replace these placeholders with the actual values you provide.
Variables allow you to transform a single prompt into a flexible template that can adapt to various scenarios on the fly. By swapping out different values rather than rewriting the prompt itself, you can speed up your development workflow, keep your text cleaner, and enable collaboration across technical and non-technical teams. Below are the main benefits of using variables:
To include variables when fetching your prompt through the Python SDK, simply pass them as key-value pairs in the compile()
method:
prompt_messages = sysprompt.compile(
"my_prompt_id",
{
"client_name": "Acme Corp",
"budget": "100000"
}
)
Sysprompt replaces all {{variable_name}}
placeholders in your prompt with the values you provide, returning a fully rendered prompt. For more details on installing, configuring, and using the SDK, visit our official SDK Documentation.
Using variables effectively in your prompts is essential for clarity, security, and ease of collaboration. By following the guidelines below, you can ensure that your prompts remain organized and scalable as your projects evolve:
{{product_name}}
, {{start_date}}
) so collaborators immediately know what data the variable represents.