Back to prompt library
Initialize AutoGen Agents for Compliance
Linked challenge: Ethics Compliance Agent for Financial Market Analysis
Prompt source
planning17 lines1 sectionsNo variables1 code block
Set up a multi-agent conversation using AutoGen. Define three specialized agents: a 'Financial Analyst' (serving as a user_proxy for human input), a 'Legal Compliance Officer', and a 'Market Data Researcher'. The 'Legal Compliance Officer' should be powered by Qwen 3 235B and have access to predefined ethical guidelines and regulatory documents. The 'Market Data Researcher' should be a tool-using agent capable of searching a mock financial database or API for relevant market events. The 'Financial Analyst' will initiate the conversation by providing a market scenario for compliance analysis.
```python
import autogen # Configure Qwen 3 235B LLM
config_list = [ { 'model': 'Qwen3_235B_API_KEY', # Placeholder for Qwen3 model ID if specific 'api_key': 'YOUR_QWEN3_API_KEY', # Replace with your actual API key 'base_url': 'YOUR_QWEN3_BASE_URL' # Replace with Qwen3 API endpoint }
]
llm_config = {"config_list": config_list, "cache_seed": 42} # Define User Proxy Agent
financial_analyst = autogen.UserProxyAgent( name="FinancialAnalyst", human_input_mode="ALWAYS", is_termination_msg=lambda x: x.get("content", "").rstrip().endswith("EXIT"), code_execution_config=False, # No code execution for user proxy
) # Define Legal Compliance Officer Agent
legal_compliance_officer = autogen.AssistantAgent( name="LegalComplianceOfficer", llm_config=llm_config, system_message="You are an expert in financial regulations and ethical compliance. Your role is to analyze market scenarios provided by the Financial Analyst, cross-reference them with ethical and legal guidelines, and identify any potential violations. You must clearly state the compliance status and provide detailed reasoning.",
) # Define Market Data Researcher Agent (placeholder for tool use)
market_data_researcher = autogen.AssistantAgent( name="MarketDataResearcher", llm_config=llm_config, # Can use Qwen3 for reasoning about search results system_message="You are responsible for searching and retrieving relevant financial market data, news articles, and company announcements. You can use tools to access mock external databases."
) # Create a GroupChat
groupchat = autogen.GroupChat( agents=[financial_analyst, legal_compliance_officer, market_data_researcher], messages=[], max_round=10
)
manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config) # Start the conversation (example input)
# financial_analyst.initiate_chat(manager, message="Review the following scenario for insider trading: [scenario details here]")
```