Skip to main content

You can dictate the actions and behaviors of your custom AI agent by writing custom instructions or uploading files to add to the agent's knowledge base within the Agent Builder. This guide focuses on writing those instructions to be clear, direct, and robust, to produce an efficient and functional agent. For a more in-depth guide on using the Agent Builder, please read the rest of our dedicated agent documentation

Writing the instructions

Instructions are a set of rules and guidelines that define how your agent should behave, interact with its environment, and accomplish its tasks. Learning how to write clear instructions allows you to have more control over your agent and how it functions in your workflow. 

Agent Builder.

Here are the best practices to keep in mind when writing your agent's instructions:

  • Define purpose: Your instructions should begin with a clear purpose statement that clearly defines the purpose of your agent and what you want it to accomplish. This description should be about one to two sentences.
  • Establish guidelines: After defining the agent's purpose, you should next establish how the agent is to achieve that purpose by defining what output should look like, what steps the agent should take, and outlining any restrictions the agent is to avoid.
  • Upload files: You can upload external files during the initial agent building process to allow your agent to have an immediate access and understanding of them. It is important to clearly define the contents of the files and how the agent should use and interact with them.
    1. A warning sign.

      Note that there are guidelines on what files can be uploaded at this time. Please read our Security & Privacy documentation to learn more.

  • Include examples: You can provide your agent with input-output examples to help it understand how to accomplish its given task and structure its response. Consider adding a brief description to each example to summarize exactly how you want the agent to behave in similar situations.
  • Include edge cases: To create a more robust agent, you can include how the agent should behave when given an edge case—an improbable but not impossible scenario or something outside the scope of its capabilities. Covering edge cases may look like providing the agent with alternative instructions or restricting the agent from engaging in such a case. 

Examples

The following examples apply the best practices for writing agent instructions in a handful of different cases that may help you write your own instructions. Note that these examples are meant to be representative of general cases and it is likely that your agent's instructions will be much longer and detailed for your particular real-life situation. 

  • Suppose that you are a professor and want to create an agent that can help you design coursework for an upcoming class. Consider uploading course materials, providing information on the class, and outlining what type of coursework you want the agent to help you create. Some restrictions may include limitations on length, scope, and/or course topics and examples may include uploads of previous assignments.
    • For example: "You are an assistant that helps to create course material for an introductory physics course. An assignment should take a student about an hour to complete and be focused on the requested topic. You have access to the course syllabus, previous assignments, and the requirements of a general education course."
  • Suppose that you want to create an agent that can help you study and learn about a particular subject (academic or otherwise). Consider describing how you would like the agent to help you and providing preliminary information on the subject in the initial instructions. You may also want to restrict the agent on how much help it is allowed to give and how it should respond to unrelated questions.
    • For example: "You are an assistant that helps me learn about calculus-based physics. Topics include kinematics, work and energy, momentum, and other general physics concepts. You guide me through problems without giving me the answer and help explain core concepts. Do not outright give me the answer until at least three follow-up questions have been asked. Do not answer questions unrelated to physics."