feat: finalize demo loop timer

This commit is contained in:
laansdole 2026-02-08 17:15:13 +07:00
parent 9031b4d9ee
commit 9c3df14fa7

View File

@ -1,40 +1,65 @@
version: 0.4.0
version: 0.0.0
graph:
start:
- Writer
end:
- Finalizer
id: loop_timer_demo
description: LoopTimer demo that releases output after 30 seconds.
description: LoopTimer demo that releases output after 10 seconds of agent iterations.
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.
type: agent
config:
content: Please revise again
role: user
- id: Loop Gate
type: loop_timer
description: Tracks elapsed time, only granting passage after 30 seconds.
name: ${MODEL_NAME}
provider: openai
role: You are a critic. Provide brief feedback (1 sentence) to improve the draft.
base_url: ${BASE_URL}
api_key: ${API_KEY}
params: {}
tooling: []
thinking: null
memories: []
retry: null
description: Reviews the draft and provides feedback for improvement.
context_window: 0
log_output: true
- id: Writer
type: agent
config:
max_duration: 30
duration_unit: seconds
reset_on_emit: true
message: Loop finished after 30 seconds
name: ${MODEL_NAME}
provider: openai
role: You are a technical writer. Generate a brief draft (1 sentence).
base_url: ${BASE_URL}
api_key: ${API_KEY}
params: {}
tooling: []
thinking: null
memories: []
retry: null
description: Drafts content based on feedback.
context_window: 0
log_output: true
- id: Finalizer
type: literal
description: Receives the release signal from Loop Gate and outputs the final statement.
config:
content: Final summary released
role: assistant
description: Receives the release signal from Loop Gate and outputs the final statement.
context_window: 0
log_output: true
- id: Loop Gate
type: loop_timer
config:
max_duration: 20
duration_unit: seconds
reset_on_emit: true
message: Time limit reached - loop automatically terminated
passthrough: false
description: Tracks elapsed time, only granting passage after 10 seconds.
context_window: 0
log_output: true
edges:
- from: Writer
to: Critic
@ -43,7 +68,7 @@ graph:
- from: Critic
to: Loop Gate
- from: Loop Gate
to: Writer # keep Loop Gate inside the cycle
to: Writer
- from: Loop Gate
to: Finalizer
- from: Loop Gate
@ -53,3 +78,5 @@ graph:
carry_data: true
keep_message: false
process: null
vars:
MODEL_NAME: qwen/qwen3-8b