The Loop: Self-Optimizing Workflows
OSOP GuideExecute .osop → record .osoplog → AI synthesizes better .osop → diff to verify → repeat. Each cycle gets faster, cheaper, more reliable.
Execute the workflow. Agent nodes call real LLMs. API nodes send real HTTP requests. CLI nodes run commands. Human nodes wait for approval.
Execution record produced automatically. Every node: timestamps, duration, cost, tools used, AI model, tokens, human decisions, errors.
Feed multiple .osoplog files to AI. It reads every step, every duration, every failure. Writes an optimized .osop. Slow steps parallelized. Failures handled.
Compare the old .osop against the new one. See what changed: added nodes, removed edges, restructured flows. Then compare execution logs: per-step duration, cost, status deltas.
Review the AI-suggested changes. Accept, modify, or reject. The human decides. The AI recommends.
The optimized .osop becomes the new baseline. Next execution uses this version. The loop continues.
osop_version: "1.0"
id: "osop-the-loop"
name: "The Loop: Self-Optimizing Workflows"
description: "Execute .osop → record .osoplog → AI synthesizes better .osop → diff to verify → repeat. Each cycle gets faster, cheaper, more reliable."
tags: [osop, the-loop, meta, optimize]
nodes:
- id: "execute"
type: "cli"
name: "osop run"
description: "Execute the workflow. Agent nodes call real LLMs. API nodes send real HTTP requests. CLI nodes run commands. Human nodes wait for approval."
runtime:
command: "osop run workflow.osop.yaml --allow-exec --log"
- id: "record"
type: "system"
name: ".osoplog Generated"
description: "Execution record produced automatically. Every node: timestamps, duration, cost, tools used, AI model, tokens, human decisions, errors."
- id: "synthesize"
type: "agent"
subtype: "llm"
name: "osop synthesize"
description: "Feed multiple .osoplog files to AI. It reads every step, every duration, every failure. Writes an optimized .osop. Slow steps parallelized. Failures handled."
runtime:
provider: "anthropic"
model: "claude-sonnet-4-6"
- id: "diff"
type: "cli"
name: "osop diff"
description: "Compare the old .osop against the new one. See what changed: added nodes, removed edges, restructured flows. Then compare execution logs: per-step duration, cost, status deltas."
runtime:
command: "osop diff old.osop.yaml new.osop.yaml"
- id: "review"
type: "human"
subtype: "review"
name: "Human Reviews Optimization"
description: "Review the AI-suggested changes. Accept, modify, or reject. The human decides. The AI recommends."
security:
approval_gate: true
- id: "apply"
type: "mcp"
name: "Apply Optimized .osop"
description: "The optimized .osop becomes the new baseline. Next execution uses this version. The loop continues."
edges:
- from: "execute"
to: "record"
mode: "sequential"
- from: "record"
to: "synthesize"
mode: "sequential"
- from: "synthesize"
to: "diff"
mode: "sequential"
- from: "diff"
to: "review"
mode: "sequential"
- from: "review"
to: "apply"
mode: "sequential"
- from: "apply"
to: "execute"
mode: "loop"
label: "Next cycle"