Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions agents/template/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ def generate(spec: dict) -> bytes:

Args:
spec: Problem specification dict. Key fields:
spec["constraints"]["load_n"] — load in Newtons
spec["constraints"]["load_point_mm"] — [x, y, z] load point
spec["constraints"]["build_volume_mm"] — [x, y, z] bounding box
spec["constraints"]["bolt_pattern_mm"] — [[y, z], ...] bolt centers
spec["constraints"]["load_newtons"] — load in Newtons
spec["constraints"]["load_point_mm"] — [x, y, z] load point
spec["constraints"]["build_volume_mm"] — [x, y, z] bounding box
spec["constraints"]["bolt_pattern_mm"] — [[y, z], ...] bolt centers
spec["constraints"]["bolt_diameter_clearance_mm"] — hole clearance
spec["constraints"]["min_wall_thickness_mm"] — minimum wall
spec["constraints"]["max_overhang_deg"] — max printable overhang
spec["material"] — material name
spec["safety_factor"] — FEA stress safety factor
spec["scoring"]["metric"] — "mass_grams" | "volume_mm3" | ...
spec["constraints"]["min_wall_thickness_mm"] — minimum wall
spec["constraints"]["max_overhang_deg"] — max printable overhang
spec["constraints"]["safety_factor"] — FEA stress safety factor
spec["material"] — material name
spec["scoring"]["metric"] — "mass_grams" | "stiffness_to_weight" | "deflection_mm"

Returns:
STEP file as raw bytes (AP214IS schema required).
Expand All @@ -53,7 +53,7 @@ def generate(spec: dict) -> bytes:
constraints = spec["constraints"]

# TODO: read the constraints you need
# load_n = constraints["load_n"]
# load_n = constraints["load_newtons"]
# load_point = constraints["load_point_mm"] # [x, y, z]
# build_vol = constraints["build_volume_mm"] # [x, y, z] max box
# bolt_pattern = constraints["bolt_pattern_mm"] # [[y, z], ...]
Expand Down
6 changes: 4 additions & 2 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,8 @@ def _run_evaluate(agent_path: str, spec_path: str, verbose: bool) -> dict:
stress = result.get("fea_stress_mpa", "?")
allowable = result.get("fea_allowable_mpa", "?")
elapsed = result.get("elapsed_seconds", "?")
score_str = f"{score:.2f}g" if isinstance(score, (int, float)) else str(score)
metric = result.get("score_metric", "mass_grams")
score_str = _fmt_score(score, metric) if isinstance(score, (int, float)) else str(score)
elapsed_str = f"{elapsed:.1f}s" if isinstance(elapsed, (int, float)) else str(elapsed)
_ok(f"score={score_str} stress={stress}/{allowable} MPa t={elapsed_str}")
else:
Expand All @@ -635,7 +636,8 @@ def _print_summary_table(results: list[dict]) -> None:
spec = r.get("spec", "?")
passed = r.get("passed", False)
status_str = f"{GREEN}PASS{RESET}" if passed else f"{RED}FAIL{RESET}"
score = f"{r['score']:.2f}g" if passed and r.get("score") else "—"
metric = r.get("score_metric", "mass_grams")
score = _fmt_score(r["score"], metric) if passed and r.get("score") else "—"
reason = "" if passed else r.get("reason", "")[:30]
print(f" {spec:<20} {status_str} {score:>8} {reason}")
print(f"{'─' * 64}\n")
Expand Down
Loading