-
Notifications
You must be signed in to change notification settings - Fork 769
Expand file tree
/
Copy pathmarketing_agent.py
More file actions
77 lines (66 loc) · 2.9 KB
/
Copy pathmarketing_agent.py
File metadata and controls
77 lines (66 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from typing import List, Optional
from context.cosmos_memory_kernel import CosmosMemoryContext
from kernel_agents.agent_base import BaseAgent
from kernel_tools.marketing_tools import MarketingTools
from models.messages_kernel import AgentType
from semantic_kernel.functions import KernelFunction
class MarketingAgent(BaseAgent):
"""Marketing agent implementation using Semantic Kernel.
This agent specializes in marketing, campaign management, and analyzing market data.
"""
def __init__(
self,
session_id: str,
user_id: str,
memory_store: CosmosMemoryContext,
tools: Optional[List[KernelFunction]] = None,
system_message: Optional[str] = None,
agent_name: str = AgentType.MARKETING.value,
client=None,
definition=None,
) -> None:
"""Initialize the Marketing Agent.
Args:
kernel: The semantic kernel instance
session_id: The current session identifier
user_id: The user identifier
memory_store: The Cosmos memory context
tools: List of tools available to this agent (optional)
system_message: Optional system message for the agent
agent_name: Optional name for the agent (defaults to "MarketingAgent")
client: Optional client instance
definition: Optional definition instance
"""
# Load configuration if tools not provided
if not tools:
# Get tools directly from MarketingTools class
tools_dict = MarketingTools.get_all_kernel_functions()
tools = [KernelFunction.from_method(func) for func in tools_dict.values()]
# Use system message from config if not explicitly provided
if not system_message:
system_message = self.default_system_message(agent_name)
# Use agent name from config if available
agent_name = AgentType.MARKETING.value
super().__init__(
agent_name=agent_name,
session_id=session_id,
user_id=user_id,
memory_store=memory_store,
tools=tools,
system_message=system_message,
client=client,
definition=definition,
)
@staticmethod
def default_system_message(agent_name=None) -> str:
"""Get the default system message for the agent.
Args:
agent_name: The name of the agent (optional)
Returns:
The default system message for the agent
"""
return "You are a Marketing agent. You specialize in marketing strategy, campaign development, content creation, and market analysis. You help create effective marketing campaigns, analyze market data, and develop promotional content for products and services."
@property
def plugins(self):
"""Get the plugins for the marketing agent."""
return MarketingTools.get_all_kernel_functions()