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: graph:
start: start:
- Writer - Writer
end: end:
- Finalizer - Finalizer
id: loop_timer_demo 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 is_majority_voting: false
log_level: INFO log_level: INFO
nodes: nodes:
- id: Writer
type: literal
description: Responsible for outputting a fixed draft.
config:
content: Draft iteration from Writer
role: assistant
- id: Critic - id: Critic
type: literal type: agent
description: Simulates human feedback, always requesting further revisions.
config: config:
content: Please revise again name: ${MODEL_NAME}
role: user provider: openai
- id: Loop Gate role: You are a critic. Provide brief feedback (1 sentence) to improve the draft.
type: loop_timer base_url: ${BASE_URL}
description: Tracks elapsed time, only granting passage after 30 seconds. 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: config:
max_duration: 30 name: ${MODEL_NAME}
duration_unit: seconds provider: openai
reset_on_emit: true role: You are a technical writer. Generate a brief draft (1 sentence).
message: Loop finished after 30 seconds 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 - id: Finalizer
type: literal type: literal
description: Receives the release signal from Loop Gate and outputs the final statement.
config: config:
content: Final summary released content: Final summary released
role: assistant 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: edges:
- from: Writer - from: Writer
to: Critic to: Critic
@ -43,7 +68,7 @@ graph:
- from: Critic - from: Critic
to: Loop Gate to: Loop Gate
- from: Loop Gate - from: Loop Gate
to: Writer # keep Loop Gate inside the cycle to: Writer
- from: Loop Gate - from: Loop Gate
to: Finalizer to: Finalizer
- from: Loop Gate - from: Loop Gate
@ -53,3 +78,5 @@ graph:
carry_data: true carry_data: true
keep_message: false keep_message: false
process: null process: null
vars:
MODEL_NAME: qwen/qwen3-8b