The agentcad command
Search, run, calculate, read CAD drawings and check .arc files with the AgentCAD engine from your terminal.
agentcad is the command line of the AgentCAD engine. Every command reads and writes files in the working folder and never prompts, so a person or an agent runs it the same way. Each command prints compact text by default and lossless JSON with --json.
| Command | Use it to |
|---|---|
agentcad search QUERY | Find functions, calculation ops and guides by words, or ask a drawing in ARQL |
agentcad execute FILE | Run Python scripts against the AgentCAD library |
agentcad calculate OP NAME=VALUE | Run one cited calculation |
agentcad cad [APP:DOCUMENT] | List CAD applications, or read, export and edit a drawing open in one |
agentcad arc fmt FILE | Format .arc files |
agentcad arc check DIR | Parse, type-check and evaluate a folder of .arc files |
agentcad mcp | Serve search and execute over MCP on stdio |
Help for people and agents
agentcad --help and agentcad COMMAND --help show the purpose, usage, runnable examples, every flag with its type and default, the exit codes and the next command to run. --help --json returns the same content as data.
An embedded guide is one search away:
agentcad search guide
agentcad search guide:arqlThe topics are index, search, arql, execute, calculate and cad.
search
agentcad search 'tapered roller bearing life' --limit 5
agentcad search SHEET.dxf 'MATCH (b:bearing)-[:coaxial]-(s:shaft) RETURN b.id, s.id'
echo 'key check' | agentcad search -- Words in English or Vietnamese (accents optional) find library functions, calculation ops, rule packs and guide sections.
- A query that starts with
MATCH,DEFINEorRULEis ARQL. It reads the one.dxfin the folder, aSHEET.dxfyou name first, or a facts.json. --limit Nsets the rows per page and--offset Ntakes the next page. The result ends withnext_offsetwhile more rows exist.proved:lists the calculation ops that carry a proof.
execute
agentcad execute draw_plate.py --out delivery
agentcad execute a.py b.py c.py --out candidates --timeout 60
echo 'print(1 + 1)' | agentcad execute -- Up to nine scripts run in parallel. With several files, each writes into
DIR/STEM. --out DIRsets the output folder,.by default.--timeout SECSlimits one script, 120 by default and 300 at most.
calculate
agentcad calculate key.check d_mm=80 T_Nmm=1641610.9 lm_mm=110 load=light_shockInputs carry their unit in the name (d_mm) or as a literal (d=80mm). Each result line keeps the citation of its value. A failing check is a result, not an error: the command exits 0 and the first line says FAILED.
cad
agentcad cad
agentcad cad autocad:Plate.dwg --since 12
agentcad cad autocad:Plate.dwg --out plate.dxf
agentcad cad autocad:Plate.dwg --apply edits.jsonWith no target it lists the CAD applications it finds. With a target it reads the drawing as facts. --since REV returns what a person changed after a revision, --out FILE exports (the extension picks the format) and --apply FILE writes edits the person has allowed.
arc
agentcad arc fmt rec/shaft2.arc
agentcad arc fmt rec/shaft2.arc --check
agentcad arc check rec/arc fmt --check leaves files alone and exits 1 when one differs from canonical form. See Diagnostics for what arc check reports.
Exit codes
| Code | Meaning |
|---|---|
0 | Success |
1 | Failed |
2 | Usage error |
3 | Revision conflict: read the target again and redo the edit |
75 | Busy: run the same command again |
Errors go to stderr as a record with a code, whether it is retryable and a hint that names the next command.
Environment
AGENTCAD_HOMEpoints to a writable folder for the engine’s cache.AGENTCAD_PYTHONpoints to a Python that has theagentcadpackage.