---
title: Prompt
seo:
  title: Prompt — Python SDK
  description: A versioned prompt template with variable substitution. (Python SDK)
description: A versioned prompt template with variable substitution.
---

Prompts are stored and versioned on the Judgment platform. Use
`{{variable}}` placeholders in the template, then call `.compile()`
to substitute values at runtime. Each version gets a unique `commit_id`
and can be tagged (e.g. `"production"`, `"staging"`).

```python
prompt = client.prompts.get(name="system-prompt", tag="production")
text = prompt.compile(product="Acme Search", tone="friendly")
print(text)
```

## Attributes

| Prop | Type | Default | Description |
| - | - | - | - |
| `name?` | `str` | - | Prompt name. |
| `prompt?` | `str` | - | The template string with {{variable}} placeholders. |
| `created_at?` | `str` | - | ISO-8601 creation timestamp. |
| `tags?` | `List[str]` | - | Tags on this version (e.g. ["production"]). |
| `commit_id?` | `str` | - | Unique identifier for this version. |
| `parent_commit_id?` | `Optional[str]` | `None` | The previous version's commit ID. |
| `metadata?` | `Dict[str, str]` | `field(default_factory=dict)` | Creator information. |

***

## compile()

Fill in template variables and return the final prompt string.

**ValueError**: If a required variable is not provided.

```python
prompt = client.prompts.get(name="system-prompt", tag="production")
# Template: "You are a {{tone}} assistant for {{product}}."
text = prompt.compile(tone="helpful", product="Acme Search")
# "You are a helpful assistant for Acme Search."
```

```python
def compile(**kwargs) -> str:
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `kwargs?` | `Any` | `{}` | |

### Returns

`str` - The prompt with all variables substituted.
