Quickstart

Author a prompt in Trodo, then fetch and compile it from Node or Python.

You'll create a prompt, label a version production, and fetch it from your app. Five minutes.

1. Create the prompt

Open Prompts in the sidebar and click New prompt. Give it a name your app will fetch by, say refund-agent. Names are slug-ish (a-z, 0-9, -, _, .).

In the Messages editor, write a system message and a user message. Use {{double braces}} for anything filled at runtime:

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

Open the Model config section and set a provider and model as JSON, e.g. { "provider": "openai", "model": "gpt-4o" }. Open the Variables section, company and question were auto-detected; optionally give company a default like your company.

Click Save version, and in the dialog apply the production label. You've shipped v1.

2. Fetch it from your app

Install the SDK if you haven't:

npm install trodo-node@^2.23.4
pip install trodo-python

Then fetch and compile. get follows the production label by default; compile fills the variables and returns a ready-to-send payload:

import trodo from 'trodo-node';
trodo.init({ siteId: process.env.TRODO_SITE_ID! });

const prompt = await trodo.prompts.get('refund-agent');

const { messages, model } = prompt.compile({
  company: 'Acme',
  question: 'where is my order?',
});

const answer = await openai.chat.completions.create({
  model: model.model ?? 'gpt-4o',
  temperature: model.temperature ?? 0.2,
  messages,
});
import trodo
trodo.init(site_id=os.environ["TRODO_SITE_ID"])

prompt = trodo.get_prompt("refund-agent")

compiled = prompt.compile(
    company="Acme",
    question="where is my order?",
)

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

get hands you the whole prompt with its messages still holding {{company}} and {{question}}; compile(values) fills those in and returns { messages, model, tools, response_format }, with the messages array already in the shape providers expect: you don't rebuild it. (model / tools / response_format are carried straight through from the prompt.) See Concepts for the exact split.

3. Ship a change

Edit the prompt, Save version, and move production to the new version. Your running app picks it up within one cache window (60s by default), no redeploy.

Next

On this page