Skip to main content
A well-written prompt is the difference between an agent that sounds robotic and one that handles real conversations naturally. This guide covers the key principles and patterns for writing prompts on OSVI.

Anatomy of a Good System Prompt

Every agent prompt should cover four things:
  1. Identity — who the agent is and who it works for
  2. Goal — what the agent is trying to accomplish in this conversation
  3. Rules — constraints on what the agent can and cannot do
  4. Tone — how the agent should sound

Writing for Voice vs Chat

Voice and chat conversations have different rhythms. Keep these differences in mind:

Single-Prompt Agents

For straightforward workflows, a single prompt is usually enough. Structure it as:
Example — appointment reminder:

Multi-Prompt Agents

Multi-prompt agents let you define distinct states, each with its own prompt and transition conditions. Use this when your flow has meaningful branches. When to use multi-prompt:
  • The conversation has 3+ distinct phases (greeting → qualification → closing)
  • Different parts of the conversation require very different tones or instructions
  • You want explicit control over when the agent moves between topics
State design tips:
  • Name states clearly: greeting, qualification, objection_handling, closing
  • Keep each state prompt focused — it should only describe what happens in that state
  • Define clear transition triggers: “Move to closing when the user agrees to a demo”
Example state structure for a sales agent:

Using additional_data

The additional_data field on POST /call lets you inject runtime context into the agent’s prompt. Reference it with {{variable_name}} syntax. In your API call:
In your system prompt:

Using Jinja for Dynamic System Prompts

OSVI system prompts are rendered as Jinja2 templates before the call begins. This means you can use the full Jinja syntax — not just simple variable substitution — to build prompts that adapt to your data.

Variable Substitution

The most common use. Any key from additional_data (or the top-level person_name) is available as a Jinja variable:

Conditionals

Use {% if %} to include or exclude sections of the prompt based on the data passed in:

Loops

Use {% for %} to enumerate lists — useful when the agent needs to cover multiple items:

Default Values

Use the default filter to guard against missing fields so the prompt doesn’t break if a value isn’t provided:

Filters

Jinja filters let you transform values inline:

Passing Data from the API

All Jinja variables are populated from the additional_data object and the top-level person_name field in your POST /call request:
Keep your Jinja logic simple. Complex template logic is hard to debug and maintain. If you find yourself writing deeply nested conditionals, consider splitting the workflow into multiple agent states instead.

Common Mistakes to Avoid

Bad: “Help the user with their query.”Good: “Help the caller track their order status. Ask for their order number and registered email address to look up the order.”Vague prompts lead to inconsistent behaviour. Be specific about the goal and the steps.
Long lists of rules are hard for the model to follow consistently. Group related rules together, and prioritise the most important ones at the top.
For outbound calls, always define what the agent should do if someone other than the intended contact answers. Example: “If the person who answers is not {{person_name}}, ask them to pass on the message and end the call politely.”
Agents need to know how and when to end a conversation. Always include a closing instruction: “Once you have confirmed the appointment, thank the caller and end the call.”
Markdown, bullet points, and bold text don’t translate to speech. Write voice prompts as plain prose, the way you’d actually say it.

Prompt Testing Checklist

Before deploying an agent, test these scenarios:
  • Happy path — the conversation goes exactly as planned
  • Wrong person answers the call
  • User goes off-topic or asks something unrelated
  • User refuses or says they’re not interested
  • User asks to speak to a human
  • User gives ambiguous or incomplete answers
  • User interrupts the agent mid-sentence