0
0
Agentic_aiml~5 mins

Personal assistant agent patterns in Agentic Ai

Choose your learning style8 modes available
Introduction
Personal assistant agent patterns help design smart helpers that understand and assist with daily tasks easily.
When building a chatbot that schedules meetings for you.
When creating a voice assistant that answers questions and controls smart devices.
When automating reminders and to-do lists based on your habits.
When designing an app that helps manage emails and messages automatically.
When developing a system that learns your preferences to suggest actions.
Syntax
Agentic_ai
class PersonalAssistantAgent:
    def __init__(self, skills):
        self.skills = skills

    def listen(self, user_input):
        # Understand user request
        pass

    def decide(self, parsed_input):
        # Choose the right skill to use
        pass

    def act(self, decision):
        # Perform the action
        pass

    def run(self, user_input):
        parsed = self.listen(user_input)
        decision = self.decide(parsed)
        return self.act(decision)
This pattern splits the assistant's work into listening, deciding, and acting steps.
Skills are small modules that handle specific tasks like setting reminders or answering questions.
Examples
Create an assistant with skills to manage calendar, check weather, and handle emails.
Agentic_ai
skills = ['calendar', 'weather', 'email']
agent = PersonalAssistantAgent(skills)
A simple listen method that breaks user input into words for easier understanding.
Agentic_ai
def listen(self, user_input):
    return user_input.lower().split()
Decide which skill to use based on keywords in the user's request.
Agentic_ai
def decide(self, parsed_input):
    if 'meeting' in parsed_input:
        return 'calendar'
    elif 'weather' in parsed_input:
        return 'weather'
    else:
        return 'default'
Perform the action based on the chosen skill.
Agentic_ai
def act(self, decision):
    if decision == 'calendar':
        return 'Scheduling your meeting.'
    elif decision == 'weather':
        return 'Fetching weather info.'
    else:
        return 'Sorry, I cannot help with that.'
Sample Program
This program creates a simple personal assistant that listens to user input, decides which skill to use, and acts accordingly.
Agentic_ai
class PersonalAssistantAgent:
    def __init__(self, skills):
        self.skills = skills

    def listen(self, user_input):
        return user_input.lower().split()

    def decide(self, parsed_input):
        if 'meeting' in parsed_input:
            return 'calendar'
        elif 'weather' in parsed_input:
            return 'weather'
        else:
            return 'default'

    def act(self, decision):
        if decision == 'calendar':
            return 'Scheduling your meeting.'
        elif decision == 'weather':
            return 'Fetching weather info.'
        else:
            return 'Sorry, I cannot help with that.'

    def run(self, user_input):
        parsed = self.listen(user_input)
        decision = self.decide(parsed)
        return self.act(decision)

agent = PersonalAssistantAgent(['calendar', 'weather'])

print(agent.run('Can you set a meeting for tomorrow?'))
print(agent.run('What is the weather today?'))
print(agent.run('Play some music'))
OutputSuccess
Important Notes
Start simple: build small skills and add more as you go.
Use clear keywords to decide which skill to activate.
Keep the listening, deciding, and acting steps separate for easier debugging.
Summary
Personal assistant agents work by listening, deciding, and acting.
Skills are small task helpers inside the assistant.
This pattern helps build smart helpers for daily tasks.