> ## Documentation Index
> Fetch the complete documentation index at: https://08ce946-archee-studio.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://08ce946-archee-studio.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://08ce946-archee-studio.manicule.dev/api/mcp.
> Every agent surface: https://08ce946-archee-studio.manicule.dev/.well-known/llms-manifest.json

# The agentcad command (/cli/agentcad)

<!-- agent-signals: reading_time_min: 3 · est_tokens: 1229 · updated: 2026-12-05 -->
Related: [Connect your computer](/cli/connect.md), [Commands](/cli/commands.md), [Archee CLI troubleshooting](/cli/troubleshooting.md)

> 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](/arql/overview) |
| `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`](/arc/overview) 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:

```bash
agentcad search guide
agentcad search guide:arql
```

The topics are `index`, `search`, `arql`, `execute`, `calculate` and `cad`.

## search

```bash
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`, `DEFINE` or `RULE` is ARQL. It reads the one `.dxf` in the folder, a `SHEET.dxf` you name first, or a facts `.json`.
* `--limit N` sets the rows per page and `--offset N` takes the next page. The result ends with `next_offset` while more rows exist.
* `proved:` lists the calculation ops that carry a proof.

## execute

```bash
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 DIR` sets the output folder, `.` by default.
* `--timeout SECS` limits one script, 120 by default and 300 at most.

## calculate

```bash
agentcad calculate key.check d_mm=80 T_Nmm=1641610.9 lm_mm=110 load=light_shock
```

Inputs 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

```bash
agentcad cad
agentcad cad autocad:Plate.dwg --since 12
agentcad cad autocad:Plate.dwg --out plate.dxf
agentcad cad autocad:Plate.dwg --apply edits.json
```

With 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

```bash
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](/arc/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_HOME` points to a writable folder for the engine's cache.
* `AGENTCAD_PYTHON` points to a Python that has the `agentcad` package.
