Skip to content

Commit 7f512ef

Browse files
Andrey Golovanovclaude
andcommitted
Improve generation loop system prompt with concrete YAML example
Sonnet was repeatedly producing invalid YAML (nodes/links at top level instead of under network:, wrong failure policy structure). Added a minimal working example to the system prompt so the LLM has a concrete template to follow. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fdbf36e commit 7f512ef

1 file changed

Lines changed: 29 additions & 7 deletions

File tree

netlab/autoresearch/generation_loop.py

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,38 @@ def _parse_int(s: str) -> int:
166166
output showing what was actually built. Compare it against the original
167167
intent and fix any mismatches.
168168
169-
ngraph YAML format:
170-
- nodes: named hierarchy (e.g., abc1/rsw, bb/abc1/pl1)
171-
- links: source, target, capacity, cost, optional risk_groups and attrs
172-
- risk_groups: named groups with attrs for failure domain modeling
173-
- demands: regex patterns for source/target, volume, mode, flow_policy
174-
- failures: named policies with modes and rules (scope: node/link/risk_group)
175-
- workflow: ordered steps (MaximumSupportedDemand, TrafficMatrixPlacement, etc.)
169+
CRITICAL: The top-level keys must be: seed, network, risk_groups, demands,
170+
failures, workflow. Nodes and links go INSIDE the network key.
171+
172+
Minimal working example:
173+
174+
seed: 42
175+
network:
176+
nodes:
177+
A: {}
178+
B: {}
179+
links:
180+
- source: A
181+
target: B
182+
capacity: 100
183+
cost: 1
184+
demands:
185+
tm:
186+
- source: ^A$
187+
target: ^B$
188+
volume: 10
189+
mode: combine
190+
flow_policy: SHORTEST_PATHS_ECMP
191+
workflow:
192+
- type: MaximumSupportedDemand
193+
name: msd_baseline
194+
demand_set: tm
195+
resolution: 0.1
176196
177197
All links are bidirectional by default (ngraph adds reverse automatically).
178198
Use `risk_groups: [name]` on link definitions to assign to failure domains.
199+
Failure policies use `scope: node|link|risk_group` with `mode: choice` and
200+
`match.conditions` to select targets.
179201
"""
180202

181203
_GENERATION_PROMPT_TEMPLATE = """\

0 commit comments

Comments
 (0)