PrompticPromptic

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.

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-4.1-nano"
        print(prompt["provider"])        # e.g., "openai"
        print(prompt["score"])           # Best iteration score

Multi-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>