ChatDev/yaml_instance/demo_loop_counter.yaml
2026-01-07 16:24:01 +08:00

55 lines
1.4 KiB
YAML
Executable File

version: 0.4.0
graph:
start:
- Writer
end:
- Finalizer
id: loop_counter_demo
description: LoopCounter demo that releases output on the third iteration.
is_majority_voting: false
log_level: INFO
nodes:
- id: Writer
type: literal
description: Responsible for outputting a fixed draft.
config:
content: Draft iteration from Writer
role: assistant
- id: Critic
type: literal
description: Simulates human feedback, always requesting further revisions.
config:
content: Please revise again
role: user
- id: Loop Gate
type: loop_counter
description: Counts the number of entries, only granting passage on the 3rd time.
config:
max_iterations: 3
reset_on_emit: true
message: Loop finished after three passes
- id: Finalizer
type: literal
description: Receives the release signal from Loop Gate and outputs the final statement.
config:
content: Final summary released
role: assistant
edges:
- from: Writer
to: Critic
- from: Critic
to: Writer
- from: Critic
to: Loop Gate
- from: Loop Gate
to: Writer # keep Loop Gate inside the cycle
- from: Loop Gate
to: Finalizer
- from: Loop Gate
to: Writer
trigger: true
condition: 'true'
carry_data: true
keep_message: false
process: null