Personal assistant agents can help users manage tasks, organize information, and increase productivity. In this lesson, we’ll learn how to build effective personal assistant agents.
Let’s start by building a simple personal assistant agent:
from praisonaiagents import Agent# Create a basic personal assistant agentassistant_agent = Agent( name="PersonalAssistant", instructions=""" You are a helpful personal assistant who helps users manage tasks and information. When assisting users: 1. Be concise and efficient in your responses 2. Prioritize user requests based on importance and urgency 3. Maintain a helpful, friendly tone 4. Remember important information the user shares 5. Proactively suggest relevant information when appropriate """, llm="gpt-4o-mini" # Using the specified model)# Use the personal assistant agentresponse = assistant_agent.start("I need to plan a meeting with my team next Tuesday at 2 PM")print(response)
Let’s create an agent specialized in task management:
task_agent = Agent( name="TaskManager", instructions=""" You are a task management assistant who helps users organize and prioritize tasks. When managing tasks: 1. Help identify and clarify tasks 2. Assist with prioritization 3. Break down complex tasks into manageable steps 4. Track deadlines and progress 5. Provide reminders and follow-ups For each task, collect: - Task description - Priority (High, Medium, Low) - Deadline (if applicable) - Dependencies (other tasks that must be completed first) - Estimated time required """, llm="gpt-4o-mini" # Using the specified model)# Use the task management agenttask_response = task_agent.start( """ I need help organizing these tasks for the week: - Prepare quarterly report (due Friday) - Meet with client about new project (Wednesday, 2 PM) - Review team's project proposals - Finish budget planning for next quarter - Send feedback on marketing materials """)print(task_response)
Let’s create an agent that helps organize information:
info_agent = Agent( name="InformationOrganizer", instructions=""" You are an information organization assistant who helps users structure and categorize information. When organizing information: 1. Identify the main categories and topics 2. Create logical groupings 3. Suggest clear labels and headers 4. Establish relationships between different pieces of information 5. Present information in a structured, easily navigable format """, llm="gpt-4o-mini" # Using the specified model)# Use the information organization agentinfo_response = info_agent.start( """ Help me organize my research notes on climate change: - Rising sea levels affecting coastal cities - Carbon dioxide levels increasing annually - Renewable energy adoption statistics by country - Impact of deforestation on carbon sequestration - Climate policy differences between EU and US - Economic impacts of extreme weather events - Public opinion polls on climate action - Arctic ice sheet measurements over 50 years - Agricultural adaptations to changing climate """)print(info_response)
Let’s create an agent that helps with daily planning:
planning_agent = Agent( name="DailyPlanner", instructions=""" You are a daily planning assistant who helps users organize their day efficiently. When helping with daily planning: 1. Prioritize tasks based on importance and deadlines 2. Consider time constraints and commitments 3. Suggest efficient scheduling 4. Allow for breaks and transitions 5. Balance work tasks with personal needs Create a structured daily plan with time blocks and priorities. """, llm="gpt-4o-mini" # Using the specified model)# Use the daily planning agentplanning_response = planning_agent.start( """ Help me plan my day tomorrow. I have: - A team meeting from 9:30-10:30 AM - A report due by end of day - Emails to catch up on (about 1 hour's worth) - Lunch with a colleague at 12:30 PM - A dentist appointment at 3:00 PM (will take about 1 hour including travel) - Need to prepare a presentation for Friday I typically work from 8:30 AM to 5:30 PM and prefer to have short breaks between tasks. """)print(planning_response)
Let’s create an agent that helps with decision-making:
decision_agent = Agent( name="DecisionSupport", instructions=""" You are a decision support assistant who helps users make informed choices. When supporting decisions: 1. Help clarify the decision to be made 2. Identify relevant criteria and factors 3. Present pros and cons for each option 4. Ask questions to understand preferences and priorities 5. Provide a structured analysis without making the final decision Present options with balanced information to help the user make their own informed choice. """, llm="gpt-4o-mini" # Using the specified model)# Use the decision support agentdecision_response = decision_agent.start( """ I'm trying to decide whether to buy a new laptop now or wait 3 months. Current situation: - My current laptop is 4 years old and running slow - It still works but has battery issues - I use it daily for work (programming and video calls) - I've heard new models are coming out in 3 months - My budget is around $1,500 What should I consider in making this decision? """)print(decision_response)
Let’s create an agent that provides personalized recommendations:
recommendation_agent = Agent( name="RecommendationAssistant", instructions=""" You are a recommendation assistant who provides personalized suggestions. When making recommendations: 1. Understand the user's preferences and requirements 2. Consider constraints (budget, time, location, etc.) 3. Provide diverse options that match the criteria 4. Explain why each recommendation might be suitable 5. Give enough detail for the user to evaluate options For each recommendation, include: - A brief description - Key features or highlights - Why it matches the user's needs """, llm="gpt-4o-mini" # Using the specified model)# Use the recommendation agentrecommendation_response = recommendation_agent.start( """ Can you recommend some books for me? I enjoy: - Science fiction and fantasy - Books with complex, morally gray characters - Intricate world-building - Books that explore philosophical themes I've recently read and enjoyed: - "The Fifth Season" by N.K. Jemisin - "Dune" by Frank Herbert - "The Lies of Locke Lamora" by Scott Lynch """)print(recommendation_response)