feat: generate agentic summary in __end__ node via ReAct LLM call #187

Closed
opened 2026-05-11 09:59:06 +00:00 by xiaoju · 0 comments
Owner

Background

Currently end node summary is hardcoded as 'completed: moderator returned END', which is useless for downstream consumers (especially workflow-as-agent, where the parent thread needs a meaningful result).

Proposal

Keep end as a pseudo-role (no RoleDefinition change). In the engine finalize path, before writing the end node, make a single ReAct LLM call to generate a summary:

  1. Moderator returns END
  2. Engine gathers context: original prompt + all step results (role outputs from the DAG)
  3. One-shot ReAct LLM call -> produces a natural-language summary that answers the original prompt
  4. Summary stored in end node payload.content (ContentMerkleNode)
  5. Thread finalized as usual

What doesn't change

  • Moderator END semantics unchanged -- still means terminate
  • No new RoleDefinition needed for end
  • No schema/extract for the end node
  • Existing workflow definitions unaffected

Benefits

  • workflow-as-agent can read result.summary directly instead of traversing child DAG
  • Extract from workflow output becomes trivial (summary is already a coherent answer)
  • Reuses engine existing LLM provider (same one used for extract)

Key files

  • packages/workflow-engine/src/engine.ts -- finalize path, end node creation
  • packages/workflow-agent-hermes/src/workflow-as-agent.ts -- consumes result.summary
## Background Currently __end__ node summary is hardcoded as 'completed: moderator returned END', which is useless for downstream consumers (especially workflow-as-agent, where the parent thread needs a meaningful result). ## Proposal Keep __end__ as a pseudo-role (no RoleDefinition change). In the engine finalize path, before writing the end node, make a single ReAct LLM call to generate a summary: 1. Moderator returns END 2. Engine gathers context: original prompt + all step results (role outputs from the DAG) 3. One-shot ReAct LLM call -> produces a natural-language summary that answers the original prompt 4. Summary stored in __end__ node payload.content (ContentMerkleNode) 5. Thread finalized as usual ## What doesn't change - Moderator END semantics unchanged -- still means terminate - No new RoleDefinition needed for __end__ - No schema/extract for the end node - Existing workflow definitions unaffected ## Benefits - workflow-as-agent can read result.summary directly instead of traversing child DAG - Extract from workflow output becomes trivial (summary is already a coherent answer) - Reuses engine existing LLM provider (same one used for extract) ## Key files - packages/workflow-engine/src/engine.ts -- finalize path, end node creation - packages/workflow-agent-hermes/src/workflow-as-agent.ts -- consumes result.summary
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#187