Prompts

Quickstart

Create a prompt in Trodo, mark it production, fetch and compile it from Node or Python, and ship a change without a deploy.

You'll create a prompt, mark its first version production, and fetch it from your app.

1. Create the prompt

Open Develop → Prompts and click New prompt. Give it a Name, say refund-agent, and an optional Description, then Continue.

The name is the key your code fetches the prompt by, and it can't change once saved. It takes letters, numbers, ., _ and -; a space becomes a dash and anything else is dropped.

The New prompt dialog: Name (fixed once saved) set to refund-agent, an optional Description, and Cancel and Continue.

The editor opens on an unsaved draft with one System message: nothing is created until you save. Write it, add a User message with Add message → User, and use {{double braces}} for anything your code fills in:

System
You are a refund support agent for {{company}}.
Be concise and never promise a refund you can't confirm.
User
{{question}}

Under the messages, Variables lists company and question (give company a default, say our company), and Model config picks a provider and model.

Click Create prompt. In the dialog, write What changed if you like, choose production under Label, and click Create and push to production.

2. Fetch it from your app

Install the SDK, set TRODO_SITE_ID (from Settings → General), then fetch and compile. get returns the version labelled production. compile fills in the variables and gives you the messages and settings to send.

npm install trodo-node@^3
import trodo from 'trodo-node';
import OpenAI from 'openai';

trodo.init({ siteId: process.env.TRODO_SITE_ID! });
const openai = new OpenAI();

const prompt = await trodo.prompts.get('refund-agent');
const { messages, model } = prompt.compile({
  company: 'Acme',
  question: 'Where is my refund?',
});

const answer = await openai.chat.completions.create({
  model: model.model ?? 'gpt-4o',
  temperature: model.temperature,
  messages,
});
pip install "trodo-python>=3"
import os
import trodo
from openai import OpenAI

trodo.init(site_id=os.environ["TRODO_SITE_ID"])
openai = OpenAI()

prompt = trodo.get_prompt("refund-agent")
compiled = prompt.compile(company="Acme", question="Where is my refund?")

answer = openai.chat.completions.create(
    model=compiled.model.get("model", "gpt-4o"),
    temperature=compiled.model.get("temperature"),
    messages=compiled.messages,
)

compile returns messages, model, tools and response_format. Trodo never calls the model: you pass these to your provider's client yourself.

Call it inside your agent's run (wrapAgent / wrap_agent) and each model call's span records the prompt and version it ran. See Traceability.

3. Ship a change

Edit the prompt and click Save. The dialog shows the line diff since the version you loaded. Choose production under Label and click Save and push to production; since production is on another version, confirm with Confirm and push to production.

Your running app picks up the new version within one cache window, 60 seconds by default. To roll back, move production back to the old version. See Concepts & versions.

Get the code for any prompt

⋯ → Use in code in the editor writes the setup and the fetch-and-compile code for the prompt you have open, with its own variables, in Node or Python. Copy as prompt copies it as instructions for a coding agent.

The Use this prompt dialog for deep/plan: the Node.js setup, then fetch with the production label, compile with its two variables, and what the compiled result holds.

On this page