Open
Conversation
Implement template edge processor for transforming edge payloads using Jinja2 templates. Changes: - Add jinja2>=3.1.0 dependency to pyproject.toml - Create TemplateEdgeProcessorConfig in entity/configs/edge/edge_processor.py - Implement TemplateEdgePayloadProcessor with sandboxed Jinja2 environment - Register 'template' processor type in builtin_types registry - Add comprehensive test suite (17 tests, 100% pass rate) - Include template processor example in yaml_template/ Features: - Variable interpolation: input, environment, extracted - Custom filters: fromjson, tojson - Full Jinja2 control structures (if/for/set) - Safe execution with sandboxed environment - Strict undefined variable checking - Descriptive error messages This enables users to separate data formatting logic from LLM prompts, improving maintainability and reducing hallucination in complex workflows like the hospital simulation report generation. Fixes 14 existing template processor edges in simulation_hospital.yaml that were previously failing silently.
Add template node type that formats input messages using Jinja2 templates and emits rendered output directly to logs (without LLM interaction). Implementation: - entity/configs/node/template.py: Configuration schema with template field - runtime/node/executor/template_executor.py: Executor with sandboxed Jinja2 - runtime/node/builtin_nodes.py: Register template node type - yaml_instance/template_demo.yaml: Enhanced demo showing both edge processors and template nodes Features: - Sandboxed Jinja2 environment with StrictUndefined mode - Custom filters: fromjson, tojson (plus all standard Jinja2 filters) - Template context: input (latest message), environment (execution vars) - Error handling with detailed logging - Supports conditionals, loops, string operations Use case: - Format structured data (JSON) into human-readable reports - Create discharge summaries, dashboards, formatted logs - Deterministic formatting without AI reasoning
Fix template node error where text_content was accessed as a property instead of being called as a method, causing JSON decode error. Error was: 'the JSON object must be str, bytes or bytearray, not method' Changed: latest_input.text_content → latest_input.text_content()
Replace StatusReport agent node with a template node to prevent LLM from adding unwanted commentary to the status message. Issue: StatusReport agent was responding with COVID-19 advice instead of simply acknowledging the formatted status from the edge processor. Solution: Convert to template node that wraps the input in a clean acknowledgment format without AI interpretation. This demonstrates another template node use case: formatting acknowledgments/wrappers around already-formatted data.
Add template node type that formats input messages using Jinja2 templates and emits rendered output directly to logs (without LLM interaction). Implementation: - entity/configs/node/template.py: Configuration schema with template field - runtime/node/executor/template_executor.py: Executor with sandboxed Jinja2 - runtime/node/builtin_nodes.py: Register template node type - yaml_instance/template_demo.yaml: Enhanced demo showing both edge processors and template nodes Features: - Sandboxed Jinja2 environment with StrictUndefined mode - Custom filters: fromjson, tojson (plus all standard Jinja2 filters) - Template context: input (latest message), environment (execution vars) - Error handling with detailed logging - Supports conditionals, loops, string operations Use case: - Format structured data (JSON) into human-readable reports - Create discharge summaries, dashboards, formatted logs - Deterministic formatting without AI reasoning
Fix template node error where text_content was accessed as a property instead of being called as a method, causing JSON decode error. Error was: 'the JSON object must be str, bytes or bytearray, not method' Changed: latest_input.text_content → latest_input.text_content()
Replace StatusReport agent node with a template node to prevent LLM from adding unwanted commentary to the status message. Issue: StatusReport agent was responding with COVID-19 advice instead of simply acknowledging the formatted status from the edge processor. Solution: Convert to template node that wraps the input in a clean acknowledgment format without AI interpretation. This demonstrates another template node use case: formatting acknowledgments/wrappers around already-formatted data.
- Add LoopTimerConfig with duration units support (seconds/minutes/hours) - Implement LoopTimerNodeExecutor with standard and passthrough modes - Register loop_timer node type in builtin_nodes.py - Update documentation (execution_logic.md, YAML_FORMAT_QUICK_GUIDE.md) - Add demo workflows for both modes Closes: add-loop-timer change proposal
- Merge demo_loop_timer.yaml and demo_loop_timer_passthrough.yaml into single comprehensive demo - Create dual-branch workflow demonstrating both standard and passthrough modes side-by-side - Increase duration from 5 seconds to 2 minutes for better demonstration - Update YAML_FORMAT_QUICK_GUIDE.md with detailed mode explanations and demo reference - Update tasks.md in add-loop-timer proposal to reflect demo improvements - Remove duplicate demo_loop_timer_passthrough.yaml file
- Remove invalid 'version' field - Restructure to match DevAll YAML schema (graph at top level) - Move start/end nodes to end of graph block - Validation now passes: 'Workflow OK. Design is valid.'
Key fixes: - Add proper trigger edges: Critic -> Timer Gate with trigger=true - Add feedback loop: Timer Gate -> Writer with trigger=true - Remove incorrect Writer -> Critic -> Timer Gate -> Writer pattern - Follow ChatDev_v1 loop pattern: input -> gate (trigger) -> gate -> output (trigger) - Start both branches simultaneously in start nodes This ensures the timer gates are properly triggered and loops execute correctly.
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add Jinja2 template node and template edge processor for flexible message formatting in multi-agent workflows.
New template node type with
TemplateNodeExecutor— formats input messages using Jinja2 templates in a sandboxed environment with{{ input }}and{{ environment }}context variablesNew
TemplateEdgeProcessorConfigfor Jinja2-based payload transformation on edgesCustom
fromjson/tojsonfilters; strict undefined-variable checksConfig, executor, and registration in
builtin_nodes.py