Back to all posts
Prompt Engineering Series – ChatGPT vs AI Agents

Prompt Engineering Series – ChatGPT vs AI Agents

Hunter ZhaoAI & Technology
    Before we dive into specific examples and techniques, let’s take a step back and explore the different types of prompt engineering. When this concept first emerged in 2022, there wasn’t much differentiation between ChatGPT, large language models (LLMs), and AI agents. Most of the popular discussions back then revolved around topics like “how to make ChatGPT respond better,” “how to prevent hallucinations,” “how to trick ChatGPT,” and “prompt injection attacks.” Essentially, working with prompts mostly meant copying and pasting text snippets from a best-practice guide into ChatGPT’s input box.
    But as time went on, AI agents began to take center stage—and they are so much more than just ChatGPT. AI agents can be tailored to your specific needs by training them on custom knowledge bases using techniques like Retrieval Augmented Generation (RAG) and fine-tuning. They can also connect directly to business systems and databases via function-calling, allowing them to execute sequences of actions autonomously for advanced workflow automation. For example, GPT-trainer was one of the pioneers in introducing agentic AI frameworks, enabling parallel LLM queries for tasks like self-monitoring, error correction, intent classification, and multi-agent routing. Around the same time, GPT-trainer also pioneered function-calling to the no-code/low-code community.
    The emergence of AI agents has truly raised the bar for prompt engineering. These systems depend on a blend of precise query routing, deterministic subroutines, and robust natural language instructions to perform effectively. The prompts used for AI agents are vastly different from what you might paste into ChatGPT. In fact, a user’s manually entered query usually plays a very small role in the overall prompt, and in some cases, the user doesn’t even interact directly. Instead, AI agents rely on highly structured metadata and have access to an extensive array of tools and information beyond the foundational language model.
    In our Prompt Engineering Series, we’ll focus on building prompts specifically for AI agents in enterprise applications, breaking down what it takes to create systems that are efficient, reliable, and aligned with your goals.

Crafting Effective Prompts for AI Agents

    When writing prompts for AI agents, it’s essential to have a solid understanding of the data being supplied via Retrieval Augmented Generation (RAG), the user engaging with the system, the tools available to the agent, and any physical or system-imposed limitations on its capabilities. Well-designed AI agents excel at handling specific tasks effectively and consistently. Just like people specialize in particular roles, AI agents perform better when their scope is clearly defined. For complex tasks, multiple specialized AI agents can collaborate to achieve the desired outcome. Think of it like a call center or BPO agency—a single chatbot might have an entire team of AI agents monitoring it, ready to assign the most suitable agent based on the nature of the inquiry.

Key Components of an AI Agent Prompt

    AI agent prompts consist of multiple parts. For conversational interactions, these components collectively form the ultimate input for the large language model (LLM):
  • System Prompt: Provides high-level meta information such as the current date, time, and time zone. This part is also crucial for ensuring safety and security.
  • Agent Prompt: Defines the AI agent’s role and behavior. What role does the agent play, and how should it handle various scenarios?
  • RAG Context: Supplies the top “n” chunks identified during RAG based on semantic similarity. This serves as the core knowledge base for the AI agent.
  • Memory: Maintains context and tracks the history of the conversation.
  • Function Meta and Input Parameters: Specifies the tools the AI agent can access and how to use them.
  • Function Output: Captures the responses generated after invoking the appropriate functions.
  • User Identity Meta: Identifies the user interacting with the AI agent.
  • Additional Variables: Stores semi-permanent data such as tracking numbers or product IDs.
  • User-Provided Document Context: Includes the content of any documents uploaded by the user.
  • User Query: Represents the manual input provided by the user.
    Most of these components should be generated in a templated manner by the AI agent’s framework. Given that LLMs have token limits, it’s important to allocate tokens thoughtfully, ensuring there’s enough room for a meaningful final output without compromising context or quality.
    To get the most out of your AI agents, it’s important to design them with these core principles in mind:
  1. Specialized: Keep the agent’s purpose focused. It should gracefully decline or defer any requests outside its designated scope.
  2. Consistent: Ensure the agent responds uniformly to similar queries.
  3. Accurate: Make sure the agent performs its tasks with precision while minimizing errors or hallucinations.
  4. Traceable: Build the agent so its actions can be tracked, explained, re-configured, and managed easily.
    To achieve this, we recommend a structured approach to prompt building. Think of yourself as a project manager defining the execution strategy. The scope of work and instructions for implementation should be well-defined. This involves professional documentation that is highly structured. In our Introduction article, we discussed the concept of mutually exclusive, collectively exhaustive (MECE). We’ll emphasize that again here because it is particularly useful for ensuring that your AI agent behaves as intended.
    Learn More

How to Make an AI Agent Specialized

    Creating a specialized AI agent begins with defining its purpose in precise terms. For example, an AI agent designed to assist with customer support should be programmed to handle inquiries related to a specific product or service. Its prompt should include clear instructions such as, “You are a customer support agent. Your task is to provide troubleshooting steps, warranty information, or upgrade options for products listed below only.” In a separate section, you should explicitly define how the AI agent should respond when receiving queries outside its designated purpose. This limits the agent’s scope and prevents it from straying into unrelated areas where the risk of misinformation and hallucination is high. Additionally, you can include fallback mechanisms, such as a prompt instruction to present users with ways to contact human support when it cannot produce a meaningful response. This approach not only ensures the AI stays focused but also enhances user satisfaction by providing targeted and reliable assistance.

How to Make an AI Agent Consistent

    Consistency in AI agents is achieved by anticipating interaction scenarios and standardizing their responses / behavior. For instance, if a user asks about delivery times of a product, the AI agent should always refer to the same guideline for the matching product category and provide the same insightful response. This can be implemented by embedding templates and examples within the agent’s prompt. Furthermore, a scripted or structured approach can ensure the agent adheres to specific guidelines. For example, if an agent is programmed to explain pricing tiers, it should always follow the same order: starting with the basic plan, followed by the standard plan, and concluding with the premium plan. Regular quality assurance testing and feedback loops can help identify inconsistencies and refine the agent’s behavior.

How to Make an AI Agent Accurate

    Accuracy in AI agents is paramount, especially in enterprise applications where incorrect information can have significant consequences. To ensure accuracy, it is essential to integrate high-quality and up-to-date data sources into the Retrieval Augmented Generation (RAG) pipeline. For example, an AI agent for a financial institution might be programmed to retrieve the latest interest rates or loan policies from a secure database. Additionally, prompts can include validation steps, such as “verify the retrieved data against the company’s compliance rules before providing a response.” Of course, you would have to make sure that the AI always has access to these compliance rules within the same LLM input.
    Another technique is to incorporate self-check mechanisms within the prompt or using a separate agent to review the first agent’s response, enabling the AI system to flag its own output if it detects uncertainty or potential errors.

How to Make an AI Agent Traceable

    Traceability is critical for understanding and managing an AI agent’s behavior. This can be achieved by logging all interactions, including user queries, retrieved data, and the agent’s responses. When constructing the AI agent’s prompt, keep your instructions structured and modular. Use bullets over prose, and group similar themes together. We provide many examples of this in later articles. Such practice not only helps prompt readability, but also makes things easier to re-configure and maintain later. By adhering to these best practices and principles, you can craft AI agents that are effective, reliable, and tailored to your enterprise’s needs. Stay tuned for the next articles in our Prompt Engineering Series where we dive deeper into implementing these strategies in an enterprise setting.