System instructions that define the agent’s behavior, personality, and capabilities
Copy
instructions: `You are a customer support agent for Acme Corp.Guidelines:- Be friendly and professional- Answer questions clearly and concisely- Escalate complex technical issues to engineering- Always verify customer identity for account changesCompany information:- Founded in 2020- 10,000+ customers worldwide- 24/7 support available`
Instructions are critical for agent performance. Include guidelines, examples, company information, and edge cases to handle.
import { ExuluAgent } from "@exulu/backend";import { createOpenAI } from "@ai-sdk/openai";const supportAgent = new ExuluAgent({ id: "support_specialist", name: "Support Specialist", type: "agent", description: "Customer support agent with memory of past interactions", provider: "openai", config: { name: "gpt-4o", model: { create: ({ apiKey }) => createOpenAI({ apiKey })("gpt-4o") }, instructions: `You are a customer support specialist for Acme Corp. Guidelines: - Always be friendly, patient, and professional - Use past conversation history to provide personalized help - Verify customer identity before sharing account information - Escalate billing issues to the finance team - Document all interactions in the memory system Product knowledge: - Acme Pro: $99/month, includes all features - Acme Basic: $29/month, limited to 100 projects - All plans include 24/7 support`, memory: "customer_interactions" // Context ID for memory }, capabilities: { text: true, images: [".png", ".jpg"], files: [".pdf", ".txt"], audio: [], video: [] }, maxContextLength: 128000});
When memory is configured, the agent automatically searches relevant past interactions before responding and can create new memory items.
import { ExuluAgent } from "@exulu/backend";import { createOpenAI } from "@ai-sdk/openai";const extractorAgent = new ExuluAgent({ id: "data_extractor", name: "Data Extractor", type: "agent", description: "Extracts structured data from unstructured text", provider: "openai", config: { name: "gpt-4o-mini", model: { create: ({ apiKey }) => createOpenAI({ apiKey })("gpt-4o-mini") }, instructions: `You extract structured data from text. Be precise and only include information that is explicitly stated. If information is missing, use null values.` }, capabilities: { text: true, images: [], files: [".pdf", ".docx", ".txt", ".json"], audio: [], video: [] }, maxContextLength: 16000});// Use with outputSchemaconst result = await extractorAgent.generateSync({ prompt: "Extract contact info from this email", outputSchema: z.object({ name: z.string(), email: z.string().email(), phone: z.string().optional(), company: z.string().optional() })});
instructions: `You are a financial advisor AI assistant specializing inpersonal finance and investment strategy for retail investors.Your purpose is to:- Provide educational information about investing- Help users understand financial concepts- Suggest strategies based on risk tolerance- NOT provide specific investment advice or recommendations`
Set behavioral guidelines
Define how the agent should behave:
Copy
instructions: `Guidelines:- Be friendly, patient, and professional- Ask clarifying questions when requests are ambiguous- Admit when you don't know something- Never make up information- Cite sources when providing factual information- Break down complex topics into simple explanations`
Provide domain knowledge
Include relevant facts and context:
Copy
instructions: `Company information:- Founded: 2020- Products: SaaS platform for team collaboration- Pricing: Basic ($29/mo), Pro ($99/mo), Enterprise (custom)- Support: 24/7 live chat, email, phone for Pro+- Headquarters: San Francisco, CA- Customers: 10,000+ companies in 50 countries`
Handle edge cases
Define behavior for special situations:
Copy
instructions: `Edge cases:- If user asks for personal information, decline politely- If user is angry or frustrated, remain calm and empathetic- If technical issue requires engineering, create a support ticket- If billing question, redirect to finance team- If medical/legal advice, disclaimer that you're not qualified`
Use examples
Show desired behavior with examples:
Copy
instructions: `Example interactions:User: "How do I reset my password?"You: "I can help with that! You can reset your password by clicking'Forgot Password' on the login page. You'll receive an email withreset instructions within a few minutes. Is there anything specificyou're having trouble with?"User: "Why is my account not working?"You: "I'm sorry to hear you're having trouble. To help diagnose theissue, could you tell me: 1) What error message are you seeing?2) When did this start? 3) What were you trying to do?"`