test_planning_agent.py 710 B

123456789101112131415161718192021222324
  1. from hello_agents import HelloAgentsLLM
  2. from agents.react_agent import NewReActAgent
  3. from agents.agent_prompts import PLAN_AGENT_PROMPT
  4. from tools.data_exploration import create_data_exploration_registry
  5. if __name__ == "__main__":
  6. llm = HelloAgentsLLM()
  7. registry = create_data_exploration_registry()
  8. planning_agent = NewReActAgent(
  9. name="PlanningAgent",
  10. llm=llm,
  11. custom_prompt=PLAN_AGENT_PROMPT,
  12. tool_registry=registry,
  13. max_steps=5
  14. )
  15. question = "请开始分析"
  16. try:
  17. plan_result = planning_agent.run(question)
  18. print(f"任务规划: {plan_result}")
  19. except Exception as e:
  20. print(f"执行过程中出现错误: {e}")