Reflection Loop — Agent Self-Improvement
The reflection loop: a worker drafts, a critic reviews the draft against the brief and the orchestrator only approves once the revision closes every gap.
Legacy executor, LLM-as-judge evaluator and next-gen consumer: an evaluator scores the full trajectory, rejects structural sloppiness and forwards only validated payloads.
Copy and paste the following FlowZap code into a project in your FlowZap account to see this template diagram.
executor { # Agent Executor (Legacy)
n1: rectangle label:"Generate payload v1"
n2: rectangle label:"Reflexion: learn from review"
n3: rectangle label:"Regenerate payload v2"
n1.handle(right) -> evaluator.n4.handle(left) [label="Payload (25 tokens)"]
evaluator.n6.handle(left) -> n2.handle(right) [label="REJECTED - score 2/10"]
n2.handle(right) -> n3.handle(left)
n3.handle(right) -> evaluator.n4.handle(left) [label="Payload (9 tokens)"]
evaluator.n8.handle(left) -> n3.handle(right) [label="ACCEPTED - score 8/10"]
}
evaluator { # Agent Evaluator (LLM-as-Judge)
n4: rectangle label:"Analyze full trajectory"
n5: rectangle label:"Score 3 criteria"
n6: rectangle label:"Issue REJECTION"
n7: diamond label:"Meets taste threshold?"
n8: rectangle label:"Issue ACCEPTANCE"
n4.handle(right) -> n5.handle(left)
n5.handle(right) -> n7.handle(left)
n7.handle(bottom) -> n6.handle(top) [label="No"]
n7.handle(right) -> n8.handle(left) [label="Yes"]
n8.handle(right) -> consumer.n9.handle(left) [label="Forward validated"]
}
consumer { # Agent Consumer (Next-Gen)
n9: rectangle label:"Process without friction"
}
Install the MCP packagenpm install -g flowzap-mcpMCP documentation
The reflection loop: a worker drafts, a critic reviews the draft against the brief and the orchestrator only approves once the revision closes every gap.
The memory loop: before planning, the planner queries the memory store for similar past lessons, then writes the new lesson back once the task is closed.
The evolution loop: an optimizer benchmarks candidate agents against the production baseline, keeps the best score and confirms persistence before promotion.
Shared host, per-client profiles and tool boundaries: how external clients reach their own Hermes workspaces without seeing another tenant's tools or data.
Option 1 of the Hermes multi-tenant setup: one external actor, one gateway, one isolated workspace inside an execution sandbox, and a single client profile.
Option 2: one client with several entry points, a prefix router that maps /eng or /support to a mode, and a single unified Hermes profile behind the gateway.