config.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. """
  2. 运行配置 — 自动化投放 Agent 系统
  3. """
  4. from pathlib import Path
  5. from agent.core.runner import RunConfig, KnowledgeConfig
  6. # ===== 工具白名单 =====
  7. # 只暴露业务工具,避免 LLM 误调 IM/知识库/浏览器等非业务工具
  8. ANALYSIS_TOOLS = [
  9. # 预算出价
  10. "account_evaluate",
  11. "budget_calculate_from_data",
  12. # 数据查询
  13. "data_query",
  14. "data_aggregate",
  15. "get_ad_current_status",
  16. # 广告 API(只读)
  17. "account_get_info",
  18. "ad_get_list",
  19. "ad_get_report",
  20. "creative_get_report",
  21. "asset_get_list",
  22. "audience_get_list",
  23. # 人群定向
  24. "audience_build_targeting",
  25. "audience_recommend_targeting",
  26. # 监控
  27. "monitor_check_metrics",
  28. ]
  29. EXECUTION_TOOLS = ANALYSIS_TOOLS + [
  30. # 执行类工具(仅执行 Agent 使用)
  31. "execute_adjustment_plan",
  32. "bid_adjustment_execute",
  33. "ad_create",
  34. "ad_update",
  35. "ad_batch_update_status",
  36. "creative_create",
  37. "creative_update",
  38. "monitor_circuit_break",
  39. ]
  40. # ===== 分析 Agent 配置(默认,只输出方案不执行) =====
  41. RUN_CONFIG = RunConfig(
  42. model="qwen/qwen3.5-plus-02-15",
  43. temperature=0.3,
  44. max_iterations=50,
  45. name="自动化投放系统",
  46. tools=ANALYSIS_TOOLS,
  47. skills=["planning", "ad_domain", "budget_strategy"],
  48. extra_llm_params={"extra_body": {"enable_thinking": True}},
  49. knowledge=KnowledgeConfig(
  50. enable_extraction=False,
  51. enable_completion_extraction=False,
  52. enable_injection=False,
  53. owner="ad_placement_team",
  54. ),
  55. )
  56. # ===== 执行 Agent 配置 =====
  57. EXECUTE_CONFIG = RunConfig(
  58. model="qwen/qwen3.5-plus-02-15",
  59. temperature=0.1, # 执行Agent更低温度,减少随机性
  60. max_iterations=30,
  61. name="投放执行系统",
  62. tools=EXECUTION_TOOLS,
  63. skills=["planning", "ad_domain", "budget_strategy", "monitor_rules"],
  64. extra_llm_params={"extra_body": {"enable_thinking": True}},
  65. knowledge=KnowledgeConfig(
  66. enable_extraction=False,
  67. enable_completion_extraction=False,
  68. enable_injection=False,
  69. owner="ad_placement_team",
  70. ),
  71. )
  72. # 基础设施配置
  73. SKILLS_DIR = str(Path(__file__).parent / "skills")
  74. TRACE_STORE_PATH = ".trace"
  75. LOG_LEVEL = "INFO"
  76. LOG_FILE = None