Back to prompt library
AutoGen Setup and Agent Definition
Linked challenge: Multi-Agent Ad Policy Auditor
Prompt source
planning33 lines8 sectionsNo variables1 code block
Initialize AutoGen and define the core agents for the system: a 'UserTopicAnalyzer' (using Gemini 2.5 Flash), an 'AdStrategist', a 'PrivacyAuditor', and a 'FactChecker'. Configure their roles, system messages, and communication patterns. Consider using `ConversableAgent` for custom logic and `AssistantAgent` for LLM integration.
```python
import autogen
config_list = [
{
"model": "gemini-2.5-flash",
"api_key": "YOUR_GEMINI_API_KEY",
"api_type": "google",
"base_url": "https://generativelanguage.googleapis.com/v1beta",
}
# Add other LLM configurations as needed
]
llm_config = {"config_list": config_list, "temperature": 0.7}
# Define agents
user_proxy = autogen.UserProxyAgent(
name="admin",
human_input_mode="TERMINATE",
max_consecutive_auto_reply=10,
is_termination_msg=lambda x: x.get("content", "").rstrip().endswith("TERMINATE"),
code_execution_config={"last_n_messages": 3, "work_dir": "coding"},
)
user_topic_analyzer = autogen.AssistantAgent(
name="UserTopicAnalyzer",
llm_config=llm_config,
system_message="You are an expert at analyzing user conversation data to extract primary topics and interests. Use Gemini 2.5 Flash to quickly identify key themes for ad targeting.",
)
ad_strategist = autogen.AssistantAgent(
name="AdStrategist",
llm_config=llm_config, # Or a different LLM config
system_message="You are an ad campaign manager. Based on user topics, propose a concise ad strategy, including title, target audience, and key phrases. Await privacy review.",
)
# ... continue defining PrivacyAuditor and FactChecker agents
```