Deployment
After a prompt optimization experiment completes, deploy the best prompt to make it available at runtime. Your application fetches the deployed prompt from Promptic instead of hardcoding it.
Deployment applies to prompt components. Tool Optimization produces descriptions you copy back to your stack.
Before deploying
Confirm that the selected iteration:
- meets the held-out quality threshold;
- has been reviewed on case-level failures;
- uses an allowed model and provider;
- has acceptable latency and projected cost;
- contains no unintended instructions or exposed dataset content.
Deploy an experiment
Using the SDK
from promptic_sdk import PrompticClient
with PrompticClient() as client:
client.deploy(
component_id="comp_...",
experiment_id="exp_...",
)Using the CLI
promptic deployments deploy <component-id> --experiment <experiment-id>Using the API
curl -X POST https://promptic.eu/api/v1/components/COMPONENT_ID/deployment \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"experimentId": "EXPERIMENT_ID"}'Fetch the deployed prompt
Use get_deployed_prompt to retrieve the currently deployed prompt at runtime:
from promptic_sdk import PrompticClient
with PrompticClient() as client:
prompt = client.get_deployed_prompt("comp_...")
if prompt:
print(prompt["prompt"]) # The prompt text
print(prompt["model"]) # e.g., "gpt-5.6-luna"
print(prompt["provider"]) # e.g., "openai"
print(prompt["score"]) # Best iteration scoreMulti-message prompts
For prompts with system/user/assistant messages:
prompt = client.get_deployed_prompt("comp_...")
if prompt and prompt["promptFormat"] == "multi_message":
for msg in prompt["promptMessages"]:
print(f"{msg['role']}: {msg['content']}")Using the deployed prompt with OpenAI
from openai import OpenAI
from promptic_sdk import PrompticClient
openai_client = OpenAI()
with PrompticClient() as client:
deployed = client.get_deployed_prompt("comp_...")
if deployed:
messages = [{"role": m["role"], "content": m["content"]}
for m in deployed["promptMessages"]]
messages.append({"role": "user", "content": user_input})
response = openai_client.chat.completions.create(
model=deployed["model"],
messages=messages,
)Check deployment status
with PrompticClient() as client:
deployment = client.get_deployment("comp_...")
if deployment:
print(f"Experiment: {deployment['experimentId']}")
else:
print("No active deployment")Remove a deployment
with PrompticClient() as client:
client.undeploy("comp_...")Or via CLI:
promptic deployments undeploy <component-id>Runtime behavior
Treat the deployed prompt endpoint as configuration infrastructure:
- cache only as long as your rollout can tolerate stale configuration;
- define application behavior when no deployment exists or the fetch fails;
- keep a known-good local fallback for critical paths;
- record the component and experiment IDs with application release metadata;
- validate variable interpolation before sending the prompt to a model.
Deploying another completed experiment replaces the component’s active deployment. To roll back, deploy the previous known-good experiment again. Removing a deployment makes the runtime endpoint return no active prompt; it does not delete the experiment.