Once you have an LLM ready, the immediate next step is to tell it what you want it to do. This isn't just about asking a single question, as you might with a standard LLM interface. For an agent, we need to provide a more comprehensive set of directions that define its character, its purpose, and how it should operate. Think of it like giving a new team member their job description and initial onboarding instructions; the clearer these are, the more effectively they can start contributing. These initial instructions are often the very first "message" your agent processes, and they play a significant part in shaping its subsequent behavior and decision-making.
When we talk about "instructing" your agent in this context, we're primarily referring to the art of crafting a powerful initial prompt. In many LLM systems, particularly when using APIs, this is often called a "system prompt" or a "pre-prompt." It's a special message that sets the stage before any specific user queries come in. This prompt is much more than a simple command. It's a carefully constructed piece of text that can include:
This initial instruction acts as the agent's guiding principles. It's the foundation upon which all its future actions and interactions will be built. For your first agent, getting this right, even in a simple form, can make a noticeable difference in its performance and predictability.
To make your instructions effective, you'll want to consider a few important elements. While you don't need to write an essay, a little detail can go a long way.
Giving your agent a persona helps the LLM adopt a consistent tone and style. It tells the LLM "who" it is supposed to be.
You are an efficient To-Do List Manager.
This simple statement immediately tells the LLM to focus on tasks related to managing lists and to adopt an efficient, perhaps concise, demeanor.What is the agent generally supposed to achieve? This is a high-level overview of its purpose.
Your primary function is to help users create, view, and manage their tasks.
This clarifies the agent's main area of responsibility.Are there specific things the agent should always do, or perhaps, never do? Are there particular ways it should handle information?
You must always ask for confirmation before deleting a task.
(A safety constraint)Do not offer opinions or engage in conversations outside of to-do list management.
(A scope constraint)Assume all tasks are for the current user unless specified otherwise.
(Contextual assumption)How should the agent communicate? Should its responses be brief or detailed? Is there a particular format it should use for certain outputs?
Keep your responses clear and to the point.
(Interaction style)When displaying the to-do list, present each item on a new line, numbered.
(Output format)Let's assemble these components into a coherent initial instruction set for our upcoming to-do list agent. This is what you might provide as the system prompt:
You are an efficient To-Do List Manager.
Your primary function is to help users create, view, and manage their tasks.
You can add tasks, remove tasks, and display the current list of tasks.
Instructions for operation:
1. Keep your responses clear and to the point.
2. When displaying the to-do list, present each item on a new line, numbered.
3. You must always ask for confirmation before deleting a task.
4. Do not offer opinions or engage in conversations outside of to-do list management.
Let's break down why this instruction is helpful:
You are an efficient To-Do List Manager.
Sets the tone and general nature.Your primary function is to help users create, view, and manage their tasks.
Clearly states its purpose.You can add tasks, remove tasks, and display the current list of tasks.
Informs the LLM about its allowed actions. While tools will later define these more concretely, this primes the LLM.Keep your responses clear and to the point.
Guides communication style.When displaying the to-do list, present each item on a new line, numbered.
Specifies an output format.You must always ask for confirmation before deleting a task.
Imposes an important safety rule.Do not offer opinions or engage in conversations outside of to-do list management.
Defines the scope of its interactions.This set of instructions provides a solid starting point for our agent. The LLM, acting as the agent's "brain," will use these guidelines to interpret user requests and generate appropriate actions or responses.
Crafting the perfect set of instructions for an agent is rarely a one-shot deal. It's more of an art and an iterative science, often referred to as "prompt engineering." You'll likely find yourself:
This loop of writing, testing, and refining is a fundamental part of developing LLM agents. Don't be discouraged if your first attempt isn't perfect. Each iteration helps you better understand how to guide the LLM.
Even for a basic agent, taking the time to write clear initial instructions is very beneficial. It helps the LLM maintain focus on its designated role, reduces the chances of it generating off-topic or unhelpful responses, and establishes a predictable pattern of behavior. These instructions are the bedrock upon which you'll layer more specific task goals and, eventually, tools and more complex planning mechanisms.
With these foundational instructions in place, your agent has a much better understanding of its role and how to behave. Next, we'll explore how to give your agent a specific task to accomplish by "Specifying the Agent's Goal." This will be the concrete objective it tries to achieve within the operational framework you've just defined.
Was this section helpful?
© 2025 ApX Machine Learning