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.
The evolution loop: an optimizer benchmarks candidate agents against the production baseline, keeps the best score and confirms persistence before promotion.
Copy and paste the following FlowZap code into a project in your FlowZap account to see this template diagram.
product { # Product Team
n1: circle label:"Start benchmark run"
n2: rectangle label:"Submit eval set"
n3: rectangle label:"Receive run acknowledgement"
n4: rectangle label:"Receive upgraded prompt pack"
n1.handle(right) -> n2.handle(left)
n2.handle(bottom) -> optimizer.n5.handle(top) [label="Eval set"]
}
optimizer { # Optimizer
n5: rectangle label:"Acknowledge benchmark"
n6: rectangle label:"Create prompt candidate"
n7: rectangle label:"Receive run traces"
n8: rectangle label:"Request scoring"
n9: rectangle label:"Receive score"
n10: diamond label:"Score high enough?"
n11: rectangle label:"Mutate prompt"
n12: rectangle label:"Log winning config"
n13: rectangle label:"Receive log confirmation"
n14: rectangle label:"Publish winner"
n5.handle(top) -> product.n3.handle(bottom) [label="Ack"]
n5.handle(right) -> n6.handle(left)
n6.handle(bottom) -> candidate.n15.handle(top) [label="Prompt candidate"]
n7.handle(right) -> n8.handle(left)
n8.handle(bottom) -> evaluator.n19.handle(top) [label="Score traces"]
n9.handle(right) -> n10.handle(left)
n10.handle(bottom) -> n11.handle(top) [label="No"]
n11.handle(bottom) -> candidate.n17.handle(top) [label="New candidate"]
n10.handle(right) -> n12.handle(left) [label="Yes"]
n12.handle(bottom) -> metrics.n23.handle(top) [label="Log winner"]
n13.handle(right) -> n14.handle(left)
n14.handle(top) -> product.n4.handle(bottom) [label="Winning pack"]
}
candidate { # Candidate Agent
n15: rectangle label:"Run benchmark tasks"
n16: rectangle label:"Return execution traces"
n17: rectangle label:"Run mutated candidate"
n18: rectangle label:"Return new traces"
n15.handle(right) -> n16.handle(left)
n16.handle(top) -> optimizer.n7.handle(bottom) [label="Traces"]
n17.handle(right) -> n18.handle(left)
n18.handle(top) -> evaluator.n21.handle(bottom) [label="New traces"]
}
evaluator { # Eval Harness
n19: rectangle label:"Score first candidate"
n20: rectangle label:"Return score"
n21: rectangle label:"Score mutated candidate"
n22: rectangle label:"Return improved score"
n19.handle(right) -> n20.handle(left)
n20.handle(top) -> optimizer.n9.handle(bottom) [label="Score"]
n21.handle(right) -> n22.handle(left)
n22.handle(top) -> optimizer.n12.handle(bottom) [label="Best score"]
}
metrics { # Metrics Store
n23: rectangle label:"Persist winning config"
n24: rectangle label:"Confirm persistence"
n23.handle(right) -> n24.handle(left)
n24.handle(top) -> optimizer.n13.handle(bottom) [label="Logged"]
}
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.
Legacy executor, LLM-as-judge evaluator and next-gen consumer: an evaluator scores the full trajectory, rejects structural sloppiness and forwards only validated payloads.
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.