Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(aio): Add config to prompt versions (#74264)

Juraj Majerike655e70f701b
diff --git a/posthog/api/llm_prompt.py b/posthog/api/llm_prompt.py
index 54b6a07a8334..df98c4a8bb4c 100644
--- a/posthog/api/llm_prompt.py
+++ b/posthog/api/llm_prompt.py
@@ -153,10 +153,15 @@ class LLMPromptViewSet(
prompt["outline"] = get_prompt_outline(prompt.get("prompt"))
if content_mode == "none":
prompt.pop("prompt", None)
+ prompt.pop("config", None)
elif content_mode == "preview":
original = prompt.pop("prompt", "")
display_value = original if isinstance(original, str) else json.dumps(original, ensure_ascii=False)
prompt["prompt_preview"] = display_value[:160] + ("..." if len(display_value) > 160 else "")
+ prompt.pop("config", None)
+ else:
+ # .get, not [] — cache entries written before the config field existed lack the key.
+ prompt["config"] = prompt.get("config")
return prompt
def _track_prompt_fetch(self, prompt: dict[str, Any]) -> None:
@@ -169,6 +174,7 @@ class LLMPromptViewSet(
"prompt_label": prompt.get("label"),
"prompt_is_latest": prompt["is_latest"],
"prompt_first_version_created_at": prompt["first_version_created_at"],
+ "prompt_has_config": prompt.get("config") is not None,
}
if not settings.TEST:
try:
@@ -240,6 +246,7 @@ class LLMPromptViewSet(
"prompt_id": str(instance.id),
"prompt_name": instance.name,
"prompt_version": instance.version,
+ "has_config": instance.config is not None,
},
team=self.team,
request=self.request,
@@ -288,6 +295,8 @@ class LLMPromptViewSet(
prompt_name=prompt_name,
prompt_payload=payload.validated_data.get("prompt"),
edits=payload.validated_data.get("edits"),
+ config=payload.validated_data.get("config"),
+ config_provided="config" in payload.validated_data,
base_version=payload.validated_data["base_version"],
version_description=payload.validated_data.get("version_description"),
)
@@ -328,6 +337,8 @@ class LLMPromptViewSet(
"prompt_name": published_prompt.name,
"prompt_version": published_prompt.version,
"base_version": payload.validated_data["base_version"],
+ "config_provided": "config" in payload.validated_data,
+ "has_config": published_prompt.config is not None,
},
team=self.team,
request=request,
diff --git a/posthog/api/llm_prompt_serializers.py b/posthog/api/llm_prompt_serializers.py
index df0e6eb647a7..cc9d98be5ac2 100644
--- a/posthog/api/llm_prompt_serializers.py
+++ b/posthog/api/llm_prompt_serializers.py
@@ -40,16 +40,35 @@ def validate_prompt_name_value(value: str) -> str:
return value
-def validate_prompt_payload_size(prompt_payload: Any) -> Any:
+def validate_prompt_payload_size(prompt_payload: Any, *, field_label: str = "Prompt payload") -> Any:
prompt_payload_bytes = len(json.dumps(prompt_payload, separators=(",", ":"), ensure_ascii=False).encode("utf-8"))
if prompt_payload_bytes > MAX_PROMPT_PAYLOAD_BYTES:
raise serializers.ValidationError(
- f"Prompt payload must be {MAX_PROMPT_PAYLOAD_BYTES} bytes or fewer.",
+ f"{field_label} must be {MAX_PROMPT_PAYLOAD_BYTES} bytes or fewer.",
code="max_size",
)
return prompt_payload
+def validate_prompt_config_value(value: Any) -> Any:
+ if value is None:
+ return None
+ if not isinstance(value, dict):
+ raise serializers.ValidationError(
+ 'Config must be a JSON object, e.g. {"model": "gpt-4o", "temperature": 0}.',
+ code="invalid_config",
+ )
+ return validate_prompt_payload_size(value, field_label="Config")
+
+
+# The API only accepts an object or null for config (validate_prompt_config_value), so the
+# schema says so too — a bare JSONField would generate `unknown` and let generated clients
+# send strings or arrays the API rejects.
+@extend_schema_field({"type": "object", "nullable": True})
+class LLMPromptConfigField(serializers.JSONField):
+ pass
+
+
RESERVED_PROMPT_LABEL_NAMES = {"latest"}
PROMPT_LABEL_NAME_MAX_LENGTH = 128
# Allowlist keeps label names unambiguous everywhere they travel: URL path segments,
@@ -108,7 +127,8 @@ CONTENT_MODE_CHOICES = ["full", "preview", "none"]
CONTENT_MODE_HELP = (
"Controls how much prompt content is included in the response. "
"'full' includes the full prompt, 'preview' includes a short prompt_preview, "
- "and 'none' omits prompt content entirely. The outline field is always included."
+ "and 'none' omits prompt content entirely. The config field is only included with 'full'. "
+ "The outline field is always included."
)
@@ -224,6 +244,16 @@ class LLMPromptPublishSerializer(serializers.Serializer):
"Mutually exclusive with prompt."
),
)
+ config = LLMPromptConfigField(
+ required=False,
+ allow_null=True,
+ help_text=(
+ "JSON object with model parameters or any agent configuration to store with this version. "
+ "If omitted, the current version's config is carried forward; pass null to clear it. "
+ "Can be combined with either prompt or edits. "
+ "Don't store secrets here: config is returned to anyone who can read the prompt."
+ ),
+ )
base_version = serializers.IntegerField(
min_value=1,
help_text="Latest version you are editing from. Used for optimistic concurrency checks.",
@@ -238,6 +268,9 @@ class LLMPromptPublishSerializer(serializers.Serializer):
def validate_prompt(self, value: Any) -> Any:
return validate_prompt_payload_size(value)
+ def validate_config(self, value: Any) -> Any:
+ return validate_prompt_config_value(value)
+
def validate_version_description(self, value: str) -> str | None:
return value.strip() or None
@@ -252,14 +285,23 @@ class LLMPromptPublishSerializer(serializers.Serializer):
if has_prompt and has_edits:
raise serializers.ValidationError("Provide either 'prompt' or 'edits', not both.")
- if not has_prompt and not has_edits:
- raise serializers.ValidationError("Either 'prompt' or 'edits' is required.")
+ if not has_prompt and not has_edits and "config" not in attrs:
+ raise serializers.ValidationError("Either 'prompt', 'edits' or 'config' is required.")
return attrs
class LLMPromptSerializer(serializers.ModelSerializer):
created_by = UserBasicSerializer(read_only=True)
+ config = LLMPromptConfigField(
+ required=False,
+ allow_null=True,
+ help_text=(
+ "Optional JSON object with model parameters or any agent configuration "
+ "(e.g. model, temperature, tools). Versioned with the prompt and returned as-is when fetching it. "
+ "Don't store secrets here: config is returned to anyone who can read the prompt."
+ ),
+ )
is_latest = serializers.SerializerMethodField()
latest_version = serializers.SerializerMethodField()
version_count = serializers.SerializerMethodField()
@@ -274,6 +316,7 @@ class LLMPromptSerializer(serializers.ModelSerializer):
"id",
"name",
"prompt",
+ "config",
"version",
"version_description",
"created_by",
@@ -361,6 +404,9 @@ class LLMPromptSerializer(serializers.ModelSerializer):
def validate_prompt(self, value: Any) -> Any:
return validate_prompt_payload_size(value)
+ def validate_config(self, value: Any) -> Any:
+ return validate_prompt_config_value(value)
+
def validate_version_description(self, value: str | None) -> str | None:
if value is None:
return None
@@ -387,6 +433,12 @@ class LLMPromptSerializer(serializers.ModelSerializer):
code="immutable",
)
+ if "config" in attrs:
+ raise serializers.ValidationError(
+ {"config": "Config is versioned and cannot be updated in place. Create a new version instead."},
+ code="immutable",
+ )
+
return attrs
def create(self, validated_data: dict[str, Any]) -> LLMPrompt:
@@ -435,8 +487,10 @@ class LLMPromptListSerializer(LLMPromptSerializer):
if content_mode == "none":
data.pop("prompt", None)
data.pop("prompt_preview", None)
+ data.pop("config", None)
elif content_mode == "preview":
data.pop("prompt", None)
+ data.pop("config", None)
else:
data.pop("prompt_preview", None)
return data
@@ -476,6 +530,14 @@ class LLMPromptPublicSerializer(serializers.Serializer):
required=False,
help_text="Full prompt content. Omitted when 'content=preview' or 'content=none'.",
)
+ config = LLMPromptConfigField(
+ required=False,
+ allow_null=True,
+ help_text=(
+ "JSON object with model parameters or any agent configuration stored with this version, "
+ "or null when the version has none. Omitted when 'content=preview' or 'content=none'."
+ ),
+ )
prompt_preview = serializers.CharField(
required=False,
help_text="First 160 characters of the prompt. Only present when 'content=preview'.",
diff --git a/posthog/api/services/llm_prompt.py b/posthog/api/services/llm_prompt.py
index de33b50b51d6..7bfeacd07712 100644
--- a/posthog/api/services/llm_prompt.py
+++ b/posthog/api/services/llm_prompt.py
@@ -175,6 +175,8 @@ def publish_prompt_version(
prompt_name: str,
prompt_payload: Any | None = None,
edits: list[dict[str, str]] | None = None,
+ config: Any | None = None,
+ config_provided: bool = False,
base_version: int,
version_description: str | None = None,
) -> LLMPrompt:
@@ -195,14 +197,22 @@ def publish_prompt_version(
if edits is not None:
resolved_payload = apply_prompt_edits(current_latest.prompt, edits)
- else:
+ elif prompt_payload is not None:
resolved_payload = prompt_payload
+ else:
+ # Config-only publish: carry the prompt content forward unchanged.
+ resolved_payload = current_latest.prompt
+
+ # `config_provided` distinguishes "not sent" (carry forward) from an explicit
+ # null (clear) — text-only publishes must not silently drop the config.
+ resolved_config = config if config_provided else current_latest.config
LLMPrompt.objects.filter(pk=current_latest.pk).update(is_latest=False)
published_prompt = LLMPrompt.objects.create(
team=team,
name=current_latest.name,
prompt=resolved_payload,
+ config=resolved_config,
version=current_latest.version + 1,
is_latest=True,
created_by=user,
@@ -222,6 +232,9 @@ def publish_prompt_version(
changes.append(
Change(type="LLMPrompt", action="created", field="version_description", after=version_description)
)
+ if resolved_config != current_latest.config:
+ # No before/after payloads: config contents are never logged, like prompt content.
+ changes.append(Change(type="LLMPrompt", action="changed", field="config"))
log_llm_prompt_activity(
team=team,
user=user,
@@ -276,6 +289,7 @@ def duplicate_prompt(
team=team,
name=new_name,
prompt=source_latest.prompt,
+ config=source_latest.config,
version=1,
is_latest=True,
created_by=user,
diff --git a/posthog/api/test/test_llm_prompt.py b/posthog/api/test/test_llm_prompt.py
index adcf1d078d25..3086a7123678 100644
--- a/posthog/api/test/test_llm_prompt.py
+++ b/posthog/api/test/test_llm_prompt.py
@@ -17,6 +17,7 @@ from posthog.api.llm_prompt_serializers import (
MAX_PROMPT_PAYLOAD_BYTES,
LLMPromptDuplicateSerializer,
LLMPromptListQuerySerializer,
+ LLMPromptPublishSerializer,
validate_prompt_label_name_value,
)
from posthog.api.services.llm_prompt import MAX_PROMPT_VERSION
@@ -32,6 +33,7 @@ class TestLLMPromptAPI(APIBaseTest):
*,
name: str = "my-prompt",
prompt: Any = "Prompt content",
+ config: Any | None = None,
version: int = 1,
is_latest: bool = True,
deleted: bool = False,
@@ -40,6 +42,7 @@ class TestLLMPromptAPI(APIBaseTest):
team=self.team,
name=name,
prompt=prompt,
+ config=config,
version=version,
is_latest=is_latest,
deleted=deleted,
@@ -870,7 +873,9 @@ class TestLLMPromptAPI(APIBaseTest):
def test_duplicate_prompt_creates_new_prompt_with_latest_content(self):
self.create_prompt_version(name="original", version=1, is_latest=False, prompt="v1")
- self.create_prompt_version(name="original", version=2, is_latest=True, prompt="v2-latest")
+ self.create_prompt_version(
+ name="original", version=2, is_latest=True, prompt="v2-latest", config={"model": "gpt-4o"}
+ )
response = self.client.post(
f"/api/environments/{self.team.id}/llm_prompts/name/original/duplicate/",
@@ -882,6 +887,7 @@ class TestLLMPromptAPI(APIBaseTest):
data = response.json()
assert data["name"] == "copy-of-original"
assert data["prompt"] == "v2-latest"
+ assert data["config"] == {"model": "gpt-4o"}
assert data["version"] == 1
assert data["is_latest"] is True
assert data["latest_version"] == 1
@@ -1015,6 +1021,184 @@ class TestLLMPromptAPI(APIBaseTest):
assert len(rows) == 6
+class TestLLMPromptConfigAPI(APIBaseTest):
+ def create_prompt_version(
+ self,
+ *,
+ name: str = "my-prompt",
+ prompt: Any = "Prompt content",
+ config: Any | None = None,
+ version: int = 1,
+ is_latest: bool = True,
+ ) -> LLMPrompt:
+ return LLMPrompt.objects.create(
+ team=self.team,
+ name=name,
+ prompt=prompt,
+ config=config,
+ version=version,
+ is_latest=is_latest,
+ created_by=self.user,
+ )
+
+ def test_create_prompt_with_config_persists_it_and_fetch_returns_it(self):
+ response = self.client.post(
+ f"/api/environments/{self.team.id}/llm_prompts/",
+ data={"name": "with-config", "prompt": "content", "config": {"model": "gpt-4o", "temperature": 0}},
+ format="json",
+ )
+ assert response.status_code == status.HTTP_201_CREATED
+ assert response.json()["config"] == {"model": "gpt-4o", "temperature": 0}
+
+ fetch_response = self.client.get(f"/api/environments/{self.team.id}/llm_prompts/name/with-config/")
+ assert fetch_response.status_code == status.HTTP_200_OK
+ assert fetch_response.json()["config"] == {"model": "gpt-4o", "temperature": 0}
+
+ @parameterized.expand(
+ [
+ ("full", True),
+ ("preview", False),
+ ("none", False),
+ ]
+ )
+ def test_fetch_prompt_by_name_content_mode_controls_config(self, mode: str, has_config: bool):
+ self.create_prompt_version(name="config-prompt", config={"model": "gpt-4o"})
+
+ response = self.client.get(f"/api/environments/{self.team.id}/llm_prompts/name/config-prompt/?content={mode}")
+
+ assert response.status_code == status.HTTP_200_OK
+ assert ("config" in response.json()) is has_config
+ if has_config:
+ assert response.json()["config"] == {"model": "gpt-4o"}
+
+ @parameterized.expand(
+ [
+ ("full_prompt", {"prompt": "v2"}),
+ ("edits", {"edits": [{"old": "v1", "new": "v2"}]}),
+ ]
+ )
+ def test_publish_without_config_key_carries_config_forward(self, _name: str, payload: dict):
+ self.create_prompt_version(name="carry-prompt", prompt="v1", config={"temperature": 0.7})
+
+ response = self.client.patch(
+ f"/api/environments/{self.team.id}/llm_prompts/name/carry-prompt/",
+ data={**payload, "base_version": 1},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json()["config"] == {"temperature": 0.7}
+ published = LLMPrompt.objects.get(team=self.team, name="carry-prompt", version=2)
+ assert published.config == {"temperature": 0.7}
+ assert published.prompt == "v2"
+
+ def test_publish_with_null_config_clears_it(self):
+ self.create_prompt_version(name="clear-prompt", prompt="v1", config={"temperature": 0.7})
+
+ response = self.client.patch(
+ f"/api/environments/{self.team.id}/llm_prompts/name/clear-prompt/",
+ data={"prompt": "v2", "config": None, "base_version": 1},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json()["config"] is None
+ assert LLMPrompt.objects.get(team=self.team, name="clear-prompt", version=2).config is None
+
+ def test_config_only_publish_creates_version_with_prompt_carried_forward(self):
+ self.create_prompt_version(name="config-only", prompt="unchanged", config={"temperature": 0.2})
+
+ response = self.client.patch(
+ f"/api/environments/{self.team.id}/llm_prompts/name/config-only/",
+ data={"config": {"temperature": 0.9}, "base_version": 1},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json()["version"] == 2
+ assert response.json()["config"] == {"temperature": 0.9}
+ published = LLMPrompt.objects.get(team=self.team, name="config-only", version=2)
+ assert published.prompt == "unchanged"
+ assert published.is_latest is True
+
+ def test_publish_rejects_non_object_config(self):
+ self.create_prompt_version(name="bad-config", prompt="v1")
+
+ response = self.client.patch(
+ f"/api/environments/{self.team.id}/llm_prompts/name/bad-config/",
+ data={"prompt": "v2", "config": "gpt-4o", "base_version": 1},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert response.json()["attr"] == "config"
+ assert LLMPrompt.objects.filter(team=self.team, name="bad-config", version=2).count() == 0
+
+ def test_create_rejects_non_object_config(self):
+ response = self.client.post(
+ f"/api/environments/{self.team.id}/llm_prompts/",
+ data={"name": "bad-config", "prompt": "content", "config": ["gpt-4o"]},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert response.json()["attr"] == "config"
+
+ def test_fetch_returns_null_config_for_cache_entries_written_before_config_existed(self):
+ from posthog.storage.llm_prompt_cache import llm_prompts_hypercache
+ from posthog.storage.llm_prompt_cache_keys import prompt_latest_cache_key
+
+ self.create_prompt_version(name="legacy-cached", prompt="v1", config={"model": "gpt-4o"})
+ cache_key = prompt_latest_cache_key(self.team.id, "legacy-cached")
+
+ first_response = self.client.get(f"/api/environments/{self.team.id}/llm_prompts/name/legacy-cached/")
+ assert first_response.status_code == status.HTTP_200_OK
+
+ cached_entry = llm_prompts_hypercache.get_from_cache(cache_key)
+ assert isinstance(cached_entry, dict)
+ legacy_entry = dict(cached_entry)
+ legacy_entry.pop("config", None)
+ llm_prompts_hypercache.set_cache_value(cache_key, legacy_entry)
+
+ response = self.client.get(f"/api/environments/{self.team.id}/llm_prompts/name/legacy-cached/")
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json()["config"] is None
+
+
+class TestLLMPromptConfigValidationNoDB(SimpleTestCase):
+ @parameterized.expand(
+ [
+ ("string", "gpt-4o"),
+ ("array", ["gpt-4o"]),
+ ("number", 42),
+ ("oversized_object", {"x": "a" * (MAX_PROMPT_PAYLOAD_BYTES + 1)}),
+ ]
+ )
+ def test_rejects_invalid_config(self, _name: str, bad_config: Any) -> None:
+ serializer = LLMPromptPublishSerializer(data={"prompt": "v2", "config": bad_config, "base_version": 1})
+ assert not serializer.is_valid()
+ # The error must talk about config, not "Prompt payload" — the size check is shared.
+ assert str(serializer.errors["config"][0]).startswith("Config")
+
+ @parameterized.expand(
+ [
+ ("object", {"model": "gpt-4o", "tools": [{"name": "search"}]}),
+ ("null", None),
+ ]
+ )
+ def test_accepts_object_or_null_config(self, _name: str, good_config: Any) -> None:
+ serializer = LLMPromptPublishSerializer(data={"prompt": "v2", "config": good_config, "base_version": 1})
+ assert serializer.is_valid(), serializer.errors
+
+ def test_config_only_publish_payload_is_valid(self) -> None:
+ serializer = LLMPromptPublishSerializer(data={"config": {"temperature": 0.5}, "base_version": 1})
+ assert serializer.is_valid(), serializer.errors
+
+ def test_payload_without_prompt_edits_or_config_is_rejected(self) -> None:
+ serializer = LLMPromptPublishSerializer(data={"base_version": 1})
+ assert not serializer.is_valid()
+
+
class TestLLMPromptDuplicateSerializerValidationNoDB(SimpleTestCase):
# validate_new_name is a pure regex + reserved-name check (no context, no DB). The duplicate
# endpoint's use of this serializer is guarded by test_duplicate_prompt_rejects_invalid_new_name.
diff --git a/posthog/storage/llm_prompt_cache_payloads.py b/posthog/storage/llm_prompt_cache_payloads.py
index 600f3b7a8e13..6b3603447008 100644
--- a/posthog/storage/llm_prompt_cache_payloads.py
+++ b/posthog/storage/llm_prompt_cache_payloads.py
@@ -24,6 +24,7 @@ def serialize_prompt(prompt: LLMPrompt, *, include_internal: bool = False) -> di
"id": str(prompt.id),
"name": prompt.name,
"prompt": normalize_prompt_to_string(prompt.prompt),
+ "config": prompt.config,
"version": prompt.version,
"created_at": _serialize_timestamp(prompt.created_at),
"updated_at": _serialize_timestamp(prompt.updated_at),
@@ -43,6 +44,7 @@ def serialize_prompt_version(prompt: LLMPrompt, *, include_internal: bool = Fals
"id": str(prompt.id),
"name": prompt.name,
"prompt": normalize_prompt_to_string(prompt.prompt),
+ "config": prompt.config,
"version": prompt.version,
"created_at": _serialize_timestamp(prompt.created_at),
"updated_at": _serialize_timestamp(prompt.updated_at),
diff --git a/posthog/storage/test/test_llm_prompt_cache.py b/posthog/storage/test/test_llm_prompt_cache.py
index 7196556f9659..04963a6b71ef 100644
--- a/posthog/storage/test/test_llm_prompt_cache.py
+++ b/posthog/storage/test/test_llm_prompt_cache.py
@@ -127,6 +127,7 @@ class TestLLMPromptCache(BaseTest):
"id",
"name",
"prompt",
+ "config",
"version",
"created_at",
"updated_at",
diff --git a/products/ai_observability/backend/migrations/0031_llmprompt_config.py b/products/ai_observability/backend/migrations/0031_llmprompt_config.py
new file mode 100644
index 000000000000..f60873f8bfa5
--- /dev/null
+++ b/products/ai_observability/backend/migrations/0031_llmprompt_config.py
@@ -0,0 +1,15 @@
+# Generated by Django 5.2.14 on 2026-07-28 15:07
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [("ai_observability", "0030_evaluationreport_last_attempted_at")]
+
+ operations = [
+ migrations.AddField(
+ model_name="llmprompt",
+ name="config",
+ field=models.JSONField(blank=True, null=True),
+ ),
+ ]
diff --git a/products/ai_observability/backend/migrations/max_migration.txt b/products/ai_observability/backend/migrations/max_migration.txt
index 6ccaaf48b83c..e31781104017 100644
--- a/products/ai_observability/backend/migrations/max_migration.txt
+++ b/products/ai_observability/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0030_evaluationreport_last_attempted_at
+0031_llmprompt_config
diff --git a/products/ai_observability/backend/models/llm_prompt.py b/products/ai_observability/backend/models/llm_prompt.py
index b05102e6bdaf..82123515c9e9 100644
--- a/products/ai_observability/backend/models/llm_prompt.py
+++ b/products/ai_observability/backend/models/llm_prompt.py
@@ -55,6 +55,10 @@ class LLMPrompt(UUIDModel):
# The prompt content as JSON (currently a string, may expand to array of objects)
prompt = models.JSONField()
+ # Schemaless JSON object with model parameters or any agent configuration (e.g. model,
+ # temperature, tools). Versioned with the prompt: immutable per row, changed via publish.
+ config = models.JSONField(null=True, blank=True)
+
version = models.PositiveIntegerField(default=1)
is_latest = models.BooleanField(default=True)
diff --git a/products/ai_observability/frontend/generated/api.schemas.ts b/products/ai_observability/frontend/generated/api.schemas.ts
index e00e548f5d97..e941fd98c023 100644
--- a/products/ai_observability/frontend/generated/api.schemas.ts
+++ b/products/ai_observability/frontend/generated/api.schemas.ts
@@ -2228,12 +2228,23 @@ export interface LLMPromptLabelSummaryApi {
version: number
}
+/**
+ * Optional JSON object with model parameters or any agent configuration (e.g. model, temperature, tools). Versioned with the prompt and returned as-is when fetching it. Don't store secrets here: config is returned to anyone who can read the prompt.
+ * @nullable
+ */
+export type LLMPromptListApiConfig = { [key: string]: unknown } | null
+
export interface LLMPromptListApi {
readonly id: string
/** Unique prompt name using letters, numbers, hyphens, and underscores only. */
readonly name: string
/** Prompt payload as JSON or string data. */
readonly prompt: unknown
+ /**
+ * Optional JSON object with model parameters or any agent configuration (e.g. model, temperature, tools). Versioned with the prompt and returned as-is when fetching it. Don't store secrets here: config is returned to anyone who can read the prompt.
+ * @nullable
+ */
+ config?: LLMPromptListApiConfig
readonly version: number
/**
* Optional note describing what changed in this version. Set when the version is published.
@@ -2267,6 +2278,12 @@ export interface PaginatedLLMPromptListListApi {
results: LLMPromptListApi[]
}
+/**
+ * Optional JSON object with model parameters or any agent configuration (e.g. model, temperature, tools). Versioned with the prompt and returned as-is when fetching it. Don't store secrets here: config is returned to anyone who can read the prompt.
+ * @nullable
+ */
+export type LLMPromptApiConfig = { [key: string]: unknown } | null
+
export interface LLMPromptApi {
readonly id: string
/**
@@ -2276,6 +2293,11 @@ export interface LLMPromptApi {
name: string
/** Prompt payload as JSON or string data. */
prompt: unknown
+ /**
+ * Optional JSON object with model parameters or any agent configuration (e.g. model, temperature, tools). Versioned with the prompt and returned as-is when fetching it. Don't store secrets here: config is returned to anyone who can read the prompt.
+ * @nullable
+ */
+ config?: LLMPromptApiConfig
readonly version: number
/**
* Optional note describing what changed in this version. Set when the version is published.
@@ -2298,11 +2320,22 @@ export interface LLMPromptApi {
readonly activity_item_id: string
}
+/**
+ * JSON object with model parameters or any agent configuration stored with this version, or null when the version has none. Omitted when 'content=preview' or 'content=none'.
+ * @nullable
+ */
+export type LLMPromptPublicApiConfig = { [key: string]: unknown } | null
+
export interface LLMPromptPublicApi {
id: string
name: string
/** Full prompt content. Omitted when 'content=preview' or 'content=none'. */
prompt?: unknown
+ /**
+ * JSON object with model parameters or any agent configuration stored with this version, or null when the version has none. Omitted when 'content=preview' or 'content=none'.
+ * @nullable
+ */
+ config?: LLMPromptPublicApiConfig
/** First 160 characters of the prompt. Only present when 'content=preview'. */
prompt_preview?: string
/** Flat list of markdown headings parsed from the prompt. Useful as a lightweight table of contents. */
@@ -2319,6 +2352,12 @@ export interface LLMPromptPublicApi {
first_version_created_at: string
}
+/**
+ * JSON object with model parameters or any agent configuration to store with this version. If omitted, the current version's config is carried forward; pass null to clear it. Can be combined with either prompt or edits. Don't store secrets here: config is returned to anyone who can read the prompt.
+ * @nullable
+ */
+export type PatchedLLMPromptPublishApiConfig = { [key: string]: unknown } | null
+
export interface LLMPromptEditOperationApi {
/** Text to find in the current prompt. Must match exactly once. */
old: string
@@ -2331,6 +2370,11 @@ export interface PatchedLLMPromptPublishApi {
prompt?: unknown
/** List of find/replace operations to apply to the current prompt version. Each edit's 'old' text must match exactly once. Edits are applied sequentially. Mutually exclusive with prompt. */
edits?: LLMPromptEditOperationApi[]
+ /**
+ * JSON object with model parameters or any agent configuration to store with this version. If omitted, the current version's config is carried forward; pass null to clear it. Can be combined with either prompt or edits. Don't store secrets here: config is returned to anyone who can read the prompt.
+ * @nullable
+ */
+ config?: PatchedLLMPromptPublishApiConfig
/**
* Latest version you are editing from. Used for optimistic concurrency checks.
* @minimum 1
@@ -3026,7 +3070,7 @@ export type LlmAnalyticsTranslateCreate200 = { [key: string]: unknown }
export type LlmPromptsListParams = {
/**
- * Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The outline field is always included.
+ * Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The config field is only included with 'full'. The outline field is always included.
*
* * `full` - full
* * `preview` - preview
@@ -3084,7 +3128,7 @@ export const LlmPromptsListContent = {
export type LlmPromptsNameRetrieveParams = {
/**
- * Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The outline field is always included.
+ * Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The config field is only included with 'full'. The outline field is always included.
*
* * `full` - full
* * `preview` - preview
diff --git a/products/ai_observability/frontend/generated/api.zod.ts b/products/ai_observability/frontend/generated/api.zod.ts
index 6ce6b8f2b52d..cccfbe127577 100644
--- a/products/ai_observability/frontend/generated/api.zod.ts
+++ b/products/ai_observability/frontend/generated/api.zod.ts
@@ -1859,6 +1859,12 @@ export const LlmPromptsCreateBody = /* @__PURE__ */ zod.object({
.max(llmPromptsCreateBodyNameMax)
.describe('Unique prompt name using letters, numbers, hyphens, and underscores only.'),
prompt: zod.unknown().describe('Prompt payload as JSON or string data.'),
+ config: zod
+ .looseObject({})
+ .nullish()
+ .describe(
+ "Optional JSON object with model parameters or any agent configuration (e.g. model, temperature, tools). Versioned with the prompt and returned as-is when fetching it. Don't store secrets here: config is returned to anyone who can read the prompt."
+ ),
version_description: zod
.string()
.max(llmPromptsCreateBodyVersionDescriptionMax)
@@ -1884,6 +1890,12 @@ export const LlmPromptsNamePartialUpdateBody = /* @__PURE__ */ zod.object({
.describe(
"List of find\/replace operations to apply to the current prompt version. Each edit's 'old' text must match exactly once. Edits are applied sequentially. Mutually exclusive with prompt."
),
+ config: zod
+ .looseObject({})
+ .nullish()
+ .describe(
+ "JSON object with model parameters or any agent configuration to store with this version. If omitted, the current version's config is carried forward; pass null to clear it. Can be combined with either prompt or edits. Don't store secrets here: config is returned to anyone who can read the prompt."
+ ),
base_version: zod
.number()
.min(1)
diff --git a/products/ai_observability/mcp/tools.yaml b/products/ai_observability/mcp/tools.yaml
index 44598d3fe7a0..17fa244d1d53 100644
--- a/products/ai_observability/mcp/tools.yaml
+++ b/products/ai_observability/mcp/tools.yaml
@@ -492,10 +492,12 @@ tools:
title: Create prompt
description: >
Create a new LLM prompt for the current team. Requires a unique name and prompt content (string or JSON
- object).
+ object). Optionally pass 'config', a JSON object with model parameters or any agent configuration (e.g.
+ model, temperature, tools) — it is versioned with the prompt and returned as-is when fetching it.
include_params:
- name
- prompt
+ - config
- version_description
llma-prompt-duplicate:
operation: llm_prompts_name_duplicate_create
@@ -530,6 +532,8 @@ tools:
The response always includes `outline`, a flat list of markdown headings parsed from the prompt — useful
as a lightweight table of contents. Pass `content=none` to get the outline without the prompt payload,
or `content=preview` for a short `prompt_preview` snippet instead of the full prompt.
+ With full content the response also includes `config`, the JSON object of model parameters or agent
+ configuration stored with the version (null when the version has none).
llma-prompt-label-delete:
operation: llm_prompts_name_labels_destroy
enabled: true
@@ -601,9 +605,13 @@ tools:
version number as 'base_version'; a stale base_version fails with a 409 conflict. Pass
'version_description' with a short note on what changed and why — it is shown in the prompt's
version history.
+ Pass 'config' (a JSON object) to set model parameters or agent configuration on the new version.
+ If 'config' is omitted the current version's config is carried forward; pass null to clear it.
+ A config-only publish (no 'prompt' or 'edits') keeps the prompt content unchanged.
include_params:
- prompt
- edits
+ - config
- base_version
- version_description
param_overrides:
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index e354ce094586..c30b4436a6dc 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -5107,7 +5107,7 @@
}
},
"llma-prompt-create": {
- "description": "Create a new LLM prompt for the current team. Requires a unique name and prompt content (string or JSON object).",
+ "description": "Create a new LLM prompt for the current team. Requires a unique name and prompt content (string or JSON object). Optionally pass 'config', a JSON object with model parameters or any agent configuration (e.g. model, temperature, tools) — it is versioned with the prompt and returned as-is when fetching it.",
"category": "AI observability",
"feature": "llm_analytics",
"summary": "Create prompt",
@@ -5135,7 +5135,7 @@
}
},
"llma-prompt-get": {
- "description": "Get a specific LLM prompt by name. Requires `prompt_name`, the prompt's exact name — call\nllma-prompt-list to discover valid names; an unknown or guessed name returns a 404.\nUses the cached endpoint for fast retrieval.\nPass `label` (e.g. 'production') to fetch the version that label currently points to, or `version` for an\nexact version number — not both. With neither, the latest version is returned.\nThe response always includes `outline`, a flat list of markdown headings parsed from the prompt — useful\nas a lightweight table of contents. Pass `content=none` to get the outline without the prompt payload,\nor `content=preview` for a short `prompt_preview` snippet instead of the full prompt.",
+ "description": "Get a specific LLM prompt by name. Requires `prompt_name`, the prompt's exact name — call\nllma-prompt-list to discover valid names; an unknown or guessed name returns a 404.\nUses the cached endpoint for fast retrieval.\nPass `label` (e.g. 'production') to fetch the version that label currently points to, or `version` for an\nexact version number — not both. With neither, the latest version is returned.\nThe response always includes `outline`, a flat list of markdown headings parsed from the prompt — useful\nas a lightweight table of contents. Pass `content=none` to get the outline without the prompt payload,\nor `content=preview` for a short `prompt_preview` snippet instead of the full prompt.\nWith full content the response also includes `config`, the JSON object of model parameters or agent\nconfiguration stored with the version (null when the version has none).",
"category": "AI observability",
"feature": "llm_analytics",
"summary": "Get prompt",
@@ -5191,7 +5191,7 @@
}
},
"llma-prompt-update": {
- "description": "Publish a new version of an existing LLM prompt by name. Name is immutable after creation.\nYou can either provide the full prompt content via 'prompt', or use 'edits' for incremental\nfind/replace updates. Each edit must have 'old' (text to find, must match exactly once) and\n'new' (replacement text). Edits are applied sequentially. Only one of 'prompt' or 'edits'\nmay be provided. 'base_version' is required — call llma-prompt-get first and pass its current\nversion number as 'base_version'; a stale base_version fails with a 409 conflict. Pass\n'version_description' with a short note on what changed and why — it is shown in the prompt's\nversion history.",
+ "description": "Publish a new version of an existing LLM prompt by name. Name is immutable after creation.\nYou can either provide the full prompt content via 'prompt', or use 'edits' for incremental\nfind/replace updates. Each edit must have 'old' (text to find, must match exactly once) and\n'new' (replacement text). Edits are applied sequentially. Only one of 'prompt' or 'edits'\nmay be provided. 'base_version' is required — call llma-prompt-get first and pass its current\nversion number as 'base_version'; a stale base_version fails with a 409 conflict. Pass\n'version_description' with a short note on what changed and why — it is shown in the prompt's\nversion history.\nPass 'config' (a JSON object) to set model parameters or agent configuration on the new version.\nIf 'config' is omitted the current version's config is carried forward; pass null to clear it.\nA config-only publish (no 'prompt' or 'edits') keeps the prompt content unchanged.",
"category": "AI observability",
"feature": "llm_analytics",
"summary": "Update prompt",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 29f4a9dc5922..3fe5e8008c76 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -5402,7 +5402,7 @@
}
},
"llma-prompt-create": {
- "description": "Create a new LLM prompt for the current team. Requires a unique name and prompt content (string or JSON object).",
+ "description": "Create a new LLM prompt for the current team. Requires a unique name and prompt content (string or JSON object). Optionally pass 'config', a JSON object with model parameters or any agent configuration (e.g. model, temperature, tools) — it is versioned with the prompt and returned as-is when fetching it.",
"category": "AI observability",
"feature": "llm_analytics",
"summary": "Create prompt",
@@ -5430,7 +5430,7 @@
}
},
"llma-prompt-get": {
- "description": "Get a specific LLM prompt by name. Requires `prompt_name`, the prompt's exact name — call\nllma-prompt-list to discover valid names; an unknown or guessed name returns a 404.\nUses the cached endpoint for fast retrieval.\nPass `label` (e.g. 'production') to fetch the version that label currently points to, or `version` for an\nexact version number — not both. With neither, the latest version is returned.\nThe response always includes `outline`, a flat list of markdown headings parsed from the prompt — useful\nas a lightweight table of contents. Pass `content=none` to get the outline without the prompt payload,\nor `content=preview` for a short `prompt_preview` snippet instead of the full prompt.",
+ "description": "Get a specific LLM prompt by name. Requires `prompt_name`, the prompt's exact name — call\nllma-prompt-list to discover valid names; an unknown or guessed name returns a 404.\nUses the cached endpoint for fast retrieval.\nPass `label` (e.g. 'production') to fetch the version that label currently points to, or `version` for an\nexact version number — not both. With neither, the latest version is returned.\nThe response always includes `outline`, a flat list of markdown headings parsed from the prompt — useful\nas a lightweight table of contents. Pass `content=none` to get the outline without the prompt payload,\nor `content=preview` for a short `prompt_preview` snippet instead of the full prompt.\nWith full content the response also includes `config`, the JSON object of model parameters or agent\nconfiguration stored with the version (null when the version has none).",
"category": "AI observability",
"feature": "llm_analytics",
"summary": "Get prompt",
@@ -5486,7 +5486,7 @@
}
},
"llma-prompt-update": {
- "description": "Publish a new version of an existing LLM prompt by name. Name is immutable after creation.\nYou can either provide the full prompt content via 'prompt', or use 'edits' for incremental\nfind/replace updates. Each edit must have 'old' (text to find, must match exactly once) and\n'new' (replacement text). Edits are applied sequentially. Only one of 'prompt' or 'edits'\nmay be provided. 'base_version' is required — call llma-prompt-get first and pass its current\nversion number as 'base_version'; a stale base_version fails with a 409 conflict. Pass\n'version_description' with a short note on what changed and why — it is shown in the prompt's\nversion history.",
+ "description": "Publish a new version of an existing LLM prompt by name. Name is immutable after creation.\nYou can either provide the full prompt content via 'prompt', or use 'edits' for incremental\nfind/replace updates. Each edit must have 'old' (text to find, must match exactly once) and\n'new' (replacement text). Edits are applied sequentially. Only one of 'prompt' or 'edits'\nmay be provided. 'base_version' is required — call llma-prompt-get first and pass its current\nversion number as 'base_version'; a stale base_version fails with a 409 conflict. Pass\n'version_description' with a short note on what changed and why — it is shown in the prompt's\nversion history.\nPass 'config' (a JSON object) to set model parameters or agent configuration on the new version.\nIf 'config' is omitted the current version's config is carried forward; pass null to clear it.\nA config-only publish (no 'prompt' or 'edits') keeps the prompt content unchanged.",
"category": "AI observability",
"feature": "llm_analytics",
"summary": "Update prompt",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index e619ee4aef2e..bfc7e4588c36 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -37069,6 +37069,12 @@ export namespace Schemas {
models: LLMModelInfo[];
}
+ /**
+ * Optional JSON object with model parameters or any agent configuration (e.g. model, temperature, tools). Versioned with the prompt and returned as-is when fetching it. Don't store secrets here: config is returned to anyone who can read the prompt.
+ * @nullable
+ */
+ export type LLMPromptConfig = { [key: string]: unknown } | null;
+
export interface LLMPromptOutlineEntry {
/**
* Markdown heading level (1-6).
@@ -37089,6 +37095,11 @@ export namespace Schemas {
name: string;
/** Prompt payload as JSON or string data. */
prompt: unknown;
+ /**
+ * Optional JSON object with model parameters or any agent configuration (e.g. model, temperature, tools). Versioned with the prompt and returned as-is when fetching it. Don't store secrets here: config is returned to anyone who can read the prompt.
+ * @nullable
+ */
+ config?: LLMPromptConfig;
readonly version: number;
/**
* Optional note describing what changed in this version. Set when the version is published.
@@ -37145,12 +37156,23 @@ export namespace Schemas {
version: number;
}
+ /**
+ * Optional JSON object with model parameters or any agent configuration (e.g. model, temperature, tools). Versioned with the prompt and returned as-is when fetching it. Don't store secrets here: config is returned to anyone who can read the prompt.
+ * @nullable
+ */
+ export type LLMPromptListConfig = { [key: string]: unknown } | null;
+
export interface LLMPromptList {
readonly id: string;
/** Unique prompt name using letters, numbers, hyphens, and underscores only. */
readonly name: string;
/** Prompt payload as JSON or string data. */
readonly prompt: unknown;
+ /**
+ * Optional JSON object with model parameters or any agent configuration (e.g. model, temperature, tools). Versioned with the prompt and returned as-is when fetching it. Don't store secrets here: config is returned to anyone who can read the prompt.
+ * @nullable
+ */
+ config?: LLMPromptListConfig;
readonly version: number;
/**
* Optional note describing what changed in this version. Set when the version is published.
@@ -37175,11 +37197,22 @@ export namespace Schemas {
readonly all_labels: readonly LLMPromptLabelSummary[];
}
+ /**
+ * JSON object with model parameters or any agent configuration stored with this version, or null when the version has none. Omitted when 'content=preview' or 'content=none'.
+ * @nullable
+ */
+ export type LLMPromptPublicConfig = { [key: string]: unknown } | null;
+
export interface LLMPromptPublic {
id: string;
name: string;
/** Full prompt content. Omitted when 'content=preview' or 'content=none'. */
prompt?: unknown;
+ /**
+ * JSON object with model parameters or any agent configuration stored with this version, or null when the version has none. Omitted when 'content=preview' or 'content=none'.
+ * @nullable
+ */
+ config?: LLMPromptPublicConfig;
/** First 160 characters of the prompt. Only present when 'content=preview'. */
prompt_preview?: string;
/** Flat list of markdown headings parsed from the prompt. Useful as a lightweight table of contents. */
@@ -50418,11 +50451,22 @@ export namespace Schemas {
js_snippet_version?: string | null;
}
+ /**
+ * JSON object with model parameters or any agent configuration to store with this version. If omitted, the current version's config is carried forward; pass null to clear it. Can be combined with either prompt or edits. Don't store secrets here: config is returned to anyone who can read the prompt.
+ * @nullable
+ */
+ export type PatchedLLMPromptPublishConfig = { [key: string]: unknown } | null;
+
export interface PatchedLLMPromptPublish {
/** Full prompt payload to publish as a new version. Mutually exclusive with edits. */
prompt?: unknown;
/** List of find/replace operations to apply to the current prompt version. Each edit's 'old' text must match exactly once. Edits are applied sequentially. Mutually exclusive with prompt. */
edits?: LLMPromptEditOperation[];
+ /**
+ * JSON object with model parameters or any agent configuration to store with this version. If omitted, the current version's config is carried forward; pass null to clear it. Can be combined with either prompt or edits. Don't store secrets here: config is returned to anyone who can read the prompt.
+ * @nullable
+ */
+ config?: PatchedLLMPromptPublishConfig;
/**
* Latest version you are editing from. Used for optimistic concurrency checks.
* @minimum 1
@@ -78583,7 +78627,7 @@ export namespace Schemas {
export type LlmPromptsListParams = {
/**
- * Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The outline field is always included.
+ * Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The config field is only included with 'full'. The outline field is always included.
*
* * `full` - full
* * `preview` - preview
@@ -78642,7 +78686,7 @@ export namespace Schemas {
export type LlmPromptsNameRetrieveParams = {
/**
- * Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The outline field is always included.
+ * Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The config field is only included with 'full'. The outline field is always included.
*
* * `full` - full
* * `preview` - preview
diff --git a/services/mcp/src/generated/ai_observability/api.ts b/services/mcp/src/generated/ai_observability/api.ts
index cdc23f847302..9349cea24b0b 100644
--- a/services/mcp/src/generated/ai_observability/api.ts
+++ b/services/mcp/src/generated/ai_observability/api.ts
@@ -1664,7 +1664,7 @@ export const LlmPromptsListQueryParams = /* @__PURE__ */ zod.object({
.enum(['full', 'preview', 'none'])
.default(llmPromptsListQueryContentDefault)
.describe(
- "Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The outline field is always included.\n\n\* `full` - full\n\* `preview` - preview\n\* `none` - none"
+ "Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The config field is only included with 'full'. The outline field is always included.\n\n\* `full` - full\n\* `preview` - preview\n\* `none` - none"
),
created_by_id: zod.number().optional().describe('Filter prompts by the ID of the user who created them.'),
limit: zod.number().optional().describe('Number of results to return per page.'),
@@ -1697,6 +1697,12 @@ export const LlmPromptsCreateBody = /* @__PURE__ */ zod.object({
.max(llmPromptsCreateBodyNameMax)
.describe('Unique prompt name using letters, numbers, hyphens, and underscores only.'),
prompt: zod.unknown().describe('Prompt payload as JSON or string data.'),
+ config: zod
+ .looseObject({})
+ .nullish()
+ .describe(
+ "Optional JSON object with model parameters or any agent configuration (e.g. model, temperature, tools). Versioned with the prompt and returned as-is when fetching it. Don't store secrets here: config is returned to anyone who can read the prompt."
+ ),
version_description: zod
.string()
.max(llmPromptsCreateBodyVersionDescriptionMax)
@@ -1723,7 +1729,7 @@ export const LlmPromptsNameRetrieveQueryParams = /* @__PURE__ */ zod.object({
.enum(['full', 'preview', 'none'])
.default(llmPromptsNameRetrieveQueryContentDefault)
.describe(
- "Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The outline field is always included.\n\n\* `full` - full\n\* `preview` - preview\n\* `none` - none"
+ "Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The config field is only included with 'full'. The outline field is always included.\n\n\* `full` - full\n\* `preview` - preview\n\* `none` - none"
),
label: zod
.string()
@@ -1769,6 +1775,12 @@ export const LlmPromptsNamePartialUpdateBody = /* @__PURE__ */ zod.object({
.describe(
"List of find\/replace operations to apply to the current prompt version. Each edit's 'old' text must match exactly once. Edits are applied sequentially. Mutually exclusive with prompt."
),
+ config: zod
+ .looseObject({})
+ .nullish()
+ .describe(
+ "JSON object with model parameters or any agent configuration to store with this version. If omitted, the current version's config is carried forward; pass null to clear it. Can be combined with either prompt or edits. Don't store secrets here: config is returned to anyone who can read the prompt."
+ ),
base_version: zod
.number()
.min(1)
diff --git a/services/mcp/src/tools/generated/ai_observability.ts b/services/mcp/src/tools/generated/ai_observability.ts
index 70495d330768..b90077f51df4 100644
--- a/services/mcp/src/tools/generated/ai_observability.ts
+++ b/services/mcp/src/tools/generated/ai_observability.ts
@@ -756,6 +756,9 @@ const llmaPromptCreate = (): ToolBase<typeof LlmaPromptCreateSchema, Schemas.LLM
if (params.prompt !== undefined) {
body['prompt'] = params.prompt
}
+ if (params.config !== undefined) {
+ body['config'] = params.config
+ }
if (params.version_description !== undefined) {
body['version_description'] = params.version_description
}
@@ -891,6 +894,9 @@ const llmaPromptUpdate = (): ToolBase<typeof LlmaPromptUpdateSchema, Schemas.LLM
if (params.edits !== undefined) {
body['edits'] = params.edits
}
+ if (params.config !== undefined) {
+ body['config'] = params.config
+ }
if (params.base_version !== undefined) {
body['base_version'] = params.base_version
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-prompt-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-prompt-create.json
index 484400a32088..6b8d714c29b2 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-prompt-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-prompt-create.json
@@ -1,6 +1,19 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
+ "config": {
+ "anyOf": [
+ {
+ "additionalProperties": {},
+ "properties": {},
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Optional JSON object with model parameters or any agent configuration (e.g. model, temperature, tools). Versioned with the prompt and returned as-is when fetching it. Don't store secrets here: config is returned to anyone who can read the prompt."
+ },
"name": {
"description": "Unique prompt name using letters, numbers, hyphens, and underscores only.",
"maxLength": 255,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-prompt-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-prompt-get.json
index 266a4feaa7a9..e75a3c04175c 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-prompt-get.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-prompt-get.json
@@ -3,7 +3,7 @@
"properties": {
"content": {
"default": "full",
- "description": "Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The outline field is always included.\n\n* `full` - full\n* `preview` - preview\n* `none` - none",
+ "description": "Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The config field is only included with 'full'. The outline field is always included.\n\n* `full` - full\n* `preview` - preview\n* `none` - none",
"enum": ["full", "preview", "none"],
"type": "string"
},
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-prompt-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-prompt-update.json
index c9c8289ec7a2..73c04c8f30b9 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-prompt-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-prompt-update.json
@@ -5,6 +5,19 @@
"minimum": 1,
"type": "number"
},
+ "config": {
+ "anyOf": [
+ {
+ "additionalProperties": {},
+ "properties": {},
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "JSON object with model parameters or any agent configuration to store with this version. If omitted, the current version's config is carried forward; pass null to clear it. Can be combined with either prompt or edits. Don't store secrets here: config is returned to anyone who can read the prompt."
+ },
"edits": {
"description": "List of find/replace operations to apply to the current prompt version. Each edit's 'old' text must match exactly once. Edits are applied sequentially. Mutually exclusive with prompt.",
"items": {