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.
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
- Log in to PLai Framework Dashboard
- Select your organization and project
- 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 assistance4
Set System Instructions
Copy and paste this system prompt:
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
- Click Create Tool
- Select Perplexity AI
- Configure the tool:
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 search3
Test the Tool
Click Test and try a sample query like “latest iPhone features”
4
Add Tool to Agent
- Return to your agent’s settings
- Go to the Tools tab
- 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.- Improve System Instructions
- Adjust Tool Configuration
- Add More Tools (Optional)
If responses aren’t quite right, refine your system prompt:
Common Test Scenarios
Here are realistic scenarios to test your agent:Product Information Requests
Product Information Requests
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
Technical Support
Technical Support
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
Billing Issues
Billing Issues
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
Feature Questions
Feature Questions
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
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
Agent Not Responding
Agent Not Responding
Possible Causes:
- Agent is set to inactive
- Model configuration errors
- Network connectivity issues
- Check agent status is “Active”
- Verify model configuration
- Test with simple queries first
Tool Not Working
Tool Not Working
Possible Causes:
- Tool not properly configured
- Authentication issues
- Tool not added to agent
- Test tool independently
- Check tool configuration
- Verify tool is assigned to agent
Poor Response Quality
Poor Response Quality
Possible Causes:
- Unclear system instructions
- Wrong model selection
- Inappropriate temperature setting
- Refine system prompt with specific examples
- Try different model (GPT-4 for complexity)
- Adjust temperature (lower for more focused)
High Costs
High Costs
Possible Causes:
- Using expensive models unnecessarily
- Long conversations without limits
- Excessive tool usage
- 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:Deploy to Production
Learn how to deploy your agent for real users
Add More Tools
Enhance your agent with additional capabilities
Monitor Performance
Set up analytics and monitoring
Advanced Configurations
Explore advanced agent features
Best Practices Summary
✅ Do’s:- Test with realistic scenarios
- Set clear system instructions
- Monitor performance regularly
- Collect user feedback
- Start simple and iterate
- Deploy untested agents
- Use overly complex prompts initially
- Ignore cost monitoring
- Forget to set guardrails
- Skip regular updates
Getting Help
If you encounter issues:Documentation
Review core concepts and features
Community
Join our Discord community
Support
Contact our support team