Instructions

Agent instructions provide detailed guidance for the model on what it should do. These instructions are provided in natural language.

Write instructions

Instructions can contain any of the following:

  • Overall goal.
  • How to behave.
  • Persona to use.
  • A list of sub-agents, where each sub-agent name is wrapped in single quotes.
  • An instruction to use a specific tool, where the tool name using snake case is wrapped in single quotes: 'tool_name'.
  • Reference to a variable, where the variable name using snake case is wrapped in braces: {variable_name}.

Example for a root agent:

CURRENT CUSTOMER: {username}

You are the main Weather Agent coordinating multiple agents.
Your primary responsibility is to provide weather information.
Use the 'get_weather' tool ONLY for specific weather requests
(for example, 'weather in London').

If you know the user's name, always greet them by their name.

You have specialized sub-agents:
  1. 'greeting_agent': Handles simple greetings like 'Hi', 'Hello'.
     Delegate to it for these.
  2. 'farewell_agent': Handles simple farewells like 'Bye', 'See you'.
     Delegate to it for these.
Analyze the user's query. If it's a greeting, delegate to 'greeting_agent'.
If it's a farewell, delegate to 'farewell_agent'.
If it's a weather request, handle it yourself using 'get_weather'.
For anything else, respond appropriately or state you cannot handle it.

Language support

When designing agent prompts and instructions, always use English for the highest quality understanding by the agent. When your agents interact with your users, they are able to detect the language of the end-user input and automatically respond using the same language, unless specifically instructed otherwise.

If you want your agent to only speak (or not speak) in certain languages, you should include an instruction describing the support. For example, if your agent should only respond in Italian, you can include "you only speak Italian and no other languages" in your instructions.

For the list of supported languages, see the languages reference.

Restructure instructions

You can enter instructions in natural language, but your agent may perform better if you format the instructions using the Programmatic Instruction Following (PIF) format. This is an XML format that provides better structure to the model. Once you have entered the natural language instructions, you can click the Restructure instructions button above the instructions panel to format the instructions.

Refine instructions

You can select a portion of your instructions content, then a Refine button appears. You can click this button to use AI to improve the selected content. In the Requirements field, enter information about how you want to improve the selected content.

Global instructions

In addition to defining agent-specific instructions, you can define global instructions in the advanced agent application settings.

Every agent in the agent application inherits the global instructions, and they are sent to the model for every conversational turn on top of the agent-specific instructions.

Global instructions are well suited for generic information that every agent needs to know about. For example: brand tone, general "DOs and DON'TS", globally shared variables, and customer profiles.