Agent workflows
CadFlow gives coding agents a deterministic execution and feedback layer without coupling the SDK to one model provider or orchestration framework.
task → Python modeling program → native geometry → structured evidence
↑ ↓
└──────────────── targeted source repair ──────────┘
Prefer explicit public boundaries
Agent-authored programs should:
- use
import cadflow as cad; - start with
cad.Modelorcad.Graph; - call public domain modules for higher-level workflows;
- avoid
cadflow._engine, OCP/OpenCascade objects, private handles, and direct dynamic-library loading; - keep parameters, units, assumptions, and output paths explicit.
This keeps generated programs reviewable and compatible with native migration.
Discover capabilities before acting
with cad.Model() as model:
capabilities = model.capabilities()
print(capabilities)
The report identifies available frontend domains, native operations, selection support, and unit policy. An agent can adapt its plan without probing private implementation details.
Preflight and apply operations
with cad.Model() as model:
base = model.box(80, 50, 8)
outcome = model.apply("shell", base, thickness=-2.0, faces=[1])
if not outcome.report.ok:
print(outcome.report.to_dict())
else:
print(outcome.shape.describe())
OperationReport contains stable fields: operation, status, ok, output, parameters, and diagnostics. Each diagnostic includes severity, code, message, optional hint, and optional structured data.
Repair logic should branch on diagnostic codes rather than matching exception strings.
Ground every delivery claim
A useful agent loop records evidence after meaningful construction steps:
evidence = part.describe()
validation = part.validate().to_dict()
assert validation["ok"]
assert evidence["topology"]["solids"] == 1
assert evidence["volume"] > 0
For final output, verify the file exists, round-trip critical exchange formats, render views, and save a report beside the CAD artifact.
Load only the workflow skill you need
The CadFlow repository includes focused CAD Skills:
| Skill | Use it for |
|---|---|
cadflow-model-part | Rigid mechanical parts |
cadflow-flexible-model | Static cloth, sheet, membrane, garments, and thin shells |
cadflow-step-brep | STEP/BREP inspection, comparison, and reconstruction |
cadflow-validate-export | Final geometry, replay, and artifact validation |
cadflow-contact-simulation | Face properties, contact laws, FEA handoff, and packages |
These skills use progressive disclosure: load the workflow first and read an exact API reference only when an operation signature or file contract is required.
CadFlow versus CadFlowAgent
CadFlowAgent is a separate application that adds LLM harnesses, project workspaces, execution and repair loops, browser viewing, and run records. CadFlow remains responsible for deterministic geometry, measurement, exchange, and Scene compilation.
The experimental agent_dsl/ directory in the CadFlow repository is a compact stateful command wrapper. It is not installed with the core distribution and does not change the public API.