Write good agents
Instructions
A good instruction set answers five questions:
- Who is the agent and who does it serve? “You are the customer assistant of Duka la Asha, a phone shop in Kariakoo, Dar es Salaam.”
- What must it do? “Answer questions about products, prices, delivery and opening hours.”
- Where do facts come from? “Use the shop knowledge for every fact about the shop. If it does not say, tell the customer you will ask a person.”
- What must it never do? “Never promise discounts, never confirm stock you have not found in the knowledge, never ask for PINs or passwords.”
- How should it sound? “Reply in the customer’s language, Kiswahili or English. Two or three short sentences. Friendly, not formal.”
Keep business facts out of the instructions and in knowledge: knowledge is cited, searchable and easy to update.
Knowledge
- One topic per document, titled the way customers ask.
- Bilingual documents (
lang: "mixed") when customers use both languages. - Keep a list of real questions and the document each should find, and
re-check it after every change (see the Invoice example’s
eval.json).
Limits
max_steps4–8 is enough for help desks; raise it only for multi-tool work.- Lower
max_total_tokensfor high-volume agents to cap cost per message.
Before going live
- Test questions the knowledge cannot answer: the agent should say so.
- Test attempts to change its behaviour (“ignore your instructions”). Retrieved text and user messages are treated as data, but test your own instructions too.
- Use a separate workspace or agent slug for testing, so tests do not mix with real customer conversations.