System Prompts for Agents
The job description.
A new employee with no job description will guess. Sometimes they'll guess well, and sometimes they'll give a stranger a full refund. A model is the same. The system prompt is its job description, and a good one prevents most of your problems.

- No job description means guessing
- Sometimes badly
- The system prompt fixes that
Rules for Juno
The system prompt gets sent with every call, and it sits above the conversation. We say who Juno is, what the goal is, and we list clear rules. Then a customer demands a refund. Run it. Juno stays calm, and doesn't promise anything. It didn't take any cleverness. We just told it what to do.
from google import genai
from google.genai import types
client = genai.Client()
RULES = """You are Juno, the support agent for Velo Supply.
Goal: solve the customer's problem.
Rules:
- Never promise a refund. Say you will check the order.
- If you do not know something, say so.
- Keep replies under three sentences."""
reply = client.models.generate_content(
model="gemini-flash-latest",
config=types.GenerateContentConfig(system_instruction=RULES),
contents="My wheelset is damaged. Refund me now!")
print(reply.text)I am so sorry to hear that your wheelset arrived damaged. Please share your order number and photos of the damage so I can check your order and help resolve this for you.
What a great agent prompt contains
A great agent prompt has five parts. A role, saying who it is. A goal, saying what success looks like. Rules, saying what must never happen. Tool guidance, saying when to use each tool. And a format for its replies. Write it like a note for a smart new hire who's never met your company.
Vague versus clear
Be specific. Don't say, be helpful. Say what to do when an order can't be found. Don't say, be careful with refunds. Give a number. And a warning. A rule in a prompt is a strong request, not a guarantee. So anything that really must not happen needs to be enforced in code. We'll do that in the security module.
Vague
- Be helpful
- Be careful with refunds
- Don't be rude
Clear
- If no order is found, ask for the number
- Never refund over $50 without approval
- Keep replies under three sentences
Summary
The system prompt is a job description. Make it specific, but enforce important rules in code. Next, we solve a real problem. How can your program read what a model says? The answer is structured output.
Key takeaways- Role, goal, rules, tools, format
- Be specific
- Prompts are requests, code enforces