()
| 462 | } |
| 463 | |
| 464 | func (s *Server) buildLoopDemo() (workflow.Agent, error) { |
| 465 | critic := NewLLMWorkflowAgent("Critic", "评估当前方案", s.deps) |
| 466 | improver := NewLLMWorkflowAgent("Improver", "提出改进建议", s.deps) |
| 467 | |
| 468 | return workflow.NewLoopAgent(workflow.LoopConfig{ |
| 469 | Name: "OptimizationLoop", |
| 470 | SubAgents: []workflow.Agent{critic, improver}, |
| 471 | MaxIterations: 3, |
| 472 | StopCondition: func(ev *session.Event) bool { |
| 473 | if ev == nil || ev.Metadata == nil { |
| 474 | return false |
| 475 | } |
| 476 | if score, ok := ev.Metadata["quality_score"].(int); ok { |
| 477 | return score >= 90 |
| 478 | } |
| 479 | return false |
| 480 | }, |
| 481 | }) |
| 482 | } |
| 483 | |
| 484 | func (s *Server) buildNestedDemo() (workflow.Agent, error) { |
| 485 | dataCollectors := []workflow.Agent{ |
no test coverage detected