Skip to main content

Prompt Management

The core workflow of the SDK is: fetch a prompt version then render it with variables.

Fetching Prompt Versions​

By name (production label)​

By default, get_prompt_version returns the production version:

version = client.get_prompt_version("greeting")

By label​

Fetch a specific label — "production" (default) or "latest":

# Latest version (may be a draft)
version = client.get_prompt_version("greeting", label="latest")

# Explicitly request production
version = client.get_prompt_version("greeting", label="production")

By specific version ID​

Pin to an exact version when you need deterministic behavior:

version = client.get_prompt_version("greeting", version="v_01ABC123")

Rendering Templates​

Prompt content uses {{variable}} placeholders. Call render to substitute them:

version = client.get_prompt_version("greeting")
# version.content => "Hello, {{name}}! Welcome to {{app}}."
# version.variables => ["name", "app"]

rendered = version.render(name="Alice", app="Scope")
# "Hello, Alice! Welcome to Scope."

Shorthand with render_prompt​

Fetch and render in a single call:

rendered = client.render_prompt(
"greeting",
{"name": "Alice", "app": "Scope"},
label="production",
)

PromptVersion Properties​

After fetching a prompt version, you can inspect the following properties:

PropertyTypeDescription
idstringUnique version identifier
prompt_idstringParent prompt identifier
version_numberintegerSequential version number
contentstringPrompt content with {{variable}} placeholders
variableslist of stringsDeclared variable names
statusstring"draft", "published", or "archived"
is_productionbooleanWhether this is the production version
typestringPrompt type — "text" or "chat"
metadatadict/hashArbitrary key-value metadata
created_atstringISO 8601 creation timestamp
updated_atstringISO 8601 last-update timestamp

Accessing Metadata​

Prompt versions can carry arbitrary metadata (e.g., the model name, temperature, or max tokens):

version = client.get_prompt_version("summarize")

model = version.get_metadata("model") # "claude-sonnet-4-5-20250514"
temperature = version.get_metadata("temperature", 0.7) # default if missing

Status Helpers​

version.is_draft       # True if status == "draft"
version.is_published # True if status == "published"
version.is_archived # True if status == "archived"
version.is_production # True if this is the production version
Was this page helpful?