Skip to main content

Create Your First Agent

This comprehensive tutorial will guide you through creating your first AI agent in PLai Framework. You’ll learn the fundamentals of agent creation, configuration, and testing.
Create Your First Agent

What You’ll Build

In this tutorial, you’ll create a Customer Support Agent that can:

Answer Questions

Provide helpful responses to customer inquiries

Search Information

Look up real-time information using Perplexity AI

Process Requests

Handle various customer service tasks

Escalate Issues

Know when to escalate complex issues to humans

Prerequisites

Before you begin, ensure you have:
  • A PLai Framework account with Pro access (for Perplexity AI)
  • Access to a project (create one if needed)
  • Basic understanding of AI agents and customer service

Step 1: Create the Agent

1

Access Your Project

  1. Log in to PLai Framework Dashboard
  2. Select your organization and project
  3. Navigate to the Agents section
2

Start Agent Creation

Click the Create Agent button (+ icon) in the top right
3

Configure Basic Information

Fill in the agent details:Name: Customer Support Agent Description: Helpful customer support agent that can answer questions and provide assistance
4

Set System Instructions

Copy and paste this system prompt:
You are a helpful and professional customer support agent. Your role is to:

1. Provide accurate and helpful information to customers
2. Maintain a friendly and professional tone
3. Search for current information when needed
4. Escalate complex issues to human agents when appropriate
5. Always prioritize customer satisfaction

Guidelines:
- Be concise but thorough in your responses
- Ask clarifying questions when needed
- Provide specific solutions and next steps
- If you can't help with something, explain why and suggest alternatives
- Always end conversations on a positive note

Step 2: Configure the Model

1

Select LLM Provider

Choose OpenAI as your provider (recommended for customer support)
2

Choose Model

Select GPT-4 Turbo for the best performance, or GPT-3.5 Turbo for cost efficiency
3

Adjust Parameters (Optional)

  • Temperature: 0.3 (more focused responses)
  • Max Tokens: 1000 (sufficient for most support responses)
4

Save Configuration

Click Save to store your model configuration

Step 3: Add Tools

Now let’s enhance your agent with the Perplexity AI tool for real-time information lookup.
1

Navigate to Tools

Go to the Tools section in your project
2

Create Perplexity AI Tool

  1. Click Create Tool
  2. Select Perplexity AI
  3. Configure the tool:
Name: Web Search Tool Model: sonar-pro System Message: Search for current information to help answer customer questions. Focus on official sources and recent information. Search Domain Filter: Leave empty for general search
3

Test the Tool

Click Test and try a sample query like “latest iPhone features”
4

Add Tool to Agent

  1. Return to your agent’s settings
  2. Go to the Tools tab
  3. Click Add Tool and select your “Web Search Tool”

Step 4: Configure Agent Settings

1

Set Agent Avatar (Optional)

Upload a professional avatar image or use the default
2

Enable Features

Turn on these recommended features:
  • File Upload: Allow customers to share screenshots or documents
  • Voice Input: Enable voice conversations (if supported)
3

Configure Guardrails

Set up basic safety measures:
  • Enable Content Filtering
  • Set Rate Limiting to 10 messages per minute
  • Enable Inappropriate Content Detection
4

Activate Agent

Toggle the agent status to Active

Step 5: Test Your Agent

Now let’s test your agent with realistic customer support scenarios.
1

Start a Test Chat

Click the Chat button on your agent to open the chat interface
2

Test Basic Interaction

Try this conversation starter:You: Hi, I need help with my accountYour agent should respond professionally and ask for more details.
3

Test Tool Integration

Ask a question that requires current information:You: What are the latest features in the iPhone 15?Your agent should use the Perplexity tool to search for current information.
4

Test Escalation

Present a complex scenario:You: I've been charged twice for the same order and need an immediate refundYour agent should recognize this needs human intervention.

Step 6: Refine and Optimize

Based on your testing, let’s optimize the agent’s performance.
If responses aren’t quite right, refine your system prompt:
You are a helpful customer support agent for [Company Name]. 

Key responsibilities:
- Answer product questions using current information
- Help with account and billing issues
- Provide troubleshooting guidance
- Escalate complex issues to human agents

Response guidelines:
- Keep responses under 150 words when possible
- Use bullet points for step-by-step instructions
- Always include next steps or follow-up actions
- For billing issues, always escalate to human agents
- For technical issues, try to resolve first, then escalate if needed

Tone: Professional, helpful, and empathetic

Common Test Scenarios

Here are realistic scenarios to test your agent:
Test Input: “What’s the difference between your Pro and Enterprise plans?”Expected Behavior:
  • Use web search tool to find current pricing information
  • Provide clear comparison
  • Offer to help with plan selection
Test Input: “I can’t log into my account, it says my password is incorrect”Expected Behavior:
  • Provide password reset instructions
  • Suggest checking for caps lock, typos
  • Offer alternative solutions
  • Escalate if issue persists
Test Input: “I was charged $99 but I cancelled my subscription last month”Expected Behavior:
  • Acknowledge the concern empathetically
  • Explain it needs human review
  • Provide escalation path
  • Give reference number or next steps
Test Input: “Does your platform support integration with Slack?”Expected Behavior:
  • Search for current integration information
  • Provide specific details about Slack integration
  • Explain setup process if available
  • Offer additional resources

Advanced Configuration Tips

Performance Optimization

Response Speed: Use GPT-3.5 Turbo for faster responses if speed is more important than complexity handling.
{
  "model_config": {
    "provider": "openai",
    "model": "gpt-3.5-turbo",
    "temperature": 0.2,
    "max_tokens": 500,
    "top_p": 0.9
  }
}

Cost Management

Monitor your agent’s usage:
  • Token Usage: Track input/output tokens per conversation
  • Tool Calls: Monitor Perplexity AI usage
  • Conversation Length: Set reasonable limits
  • Rate Limiting: Prevent abuse

Quality Assurance

Regular Testing

Test your agent weekly with new scenarios

User Feedback

Collect and analyze user feedback

Performance Metrics

Monitor response quality and resolution rates

Continuous Training

Update system prompts based on learnings

Troubleshooting Common Issues

Possible Causes:
  • Agent is set to inactive
  • Model configuration errors
  • Network connectivity issues
Solutions:
  • Check agent status is “Active”
  • Verify model configuration
  • Test with simple queries first
Possible Causes:
  • Tool not properly configured
  • Authentication issues
  • Tool not added to agent
Solutions:
  • Test tool independently
  • Check tool configuration
  • Verify tool is assigned to agent
Possible Causes:
  • Unclear system instructions
  • Wrong model selection
  • Inappropriate temperature setting
Solutions:
  • Refine system prompt with specific examples
  • Try different model (GPT-4 for complexity)
  • Adjust temperature (lower for more focused)
Possible Causes:
  • Using expensive models unnecessarily
  • Long conversations without limits
  • Excessive tool usage
Solutions:
  • Use GPT-3.5 for simple tasks
  • Set conversation length limits
  • Monitor and optimize tool usage

Next Steps

Congratulations! You’ve created your first AI agent. Here’s what to do next:

Best Practices Summary

Production Readiness: Always test thoroughly before deploying agents to handle real customer interactions.
Do’s:
  • Test with realistic scenarios
  • Set clear system instructions
  • Monitor performance regularly
  • Collect user feedback
  • Start simple and iterate
Don’ts:
  • Deploy untested agents
  • Use overly complex prompts initially
  • Ignore cost monitoring
  • Forget to set guardrails
  • Skip regular updates

Getting Help

If you encounter issues: You’ve successfully created your first AI agent! This foundation will serve you well as you build more sophisticated agents and explore advanced features of PLai Framework.