Guides
Modeling agent
Model by describing what you want, with your own language model key.
The agent panel (beta) on the right (open the first time; AGENT opens or closes it) is where you ask, in plain words, for what you want to model; an LLM runs Cota for you with the same commands you would type (as scripts), looks at what it built and answers. It needs your own API key (Anthropic, OpenAI, Google Gemini, DeepSeek, Kimi, GLM, OpenRouter —for many others— or any OpenAI-compatible API; see Providers); Cota has none. The key goes only from your browser to that provider. The first time, Cota asks whether to remember it in this browser, explaining the risk, and keeps that choice.
Ask before running (default) shows each batch of commands, with a preview in the view, and runs it only when you press Run; Run automatically lets the agent work alone. A whole turn of the agent is one undo step (see Review and undo).
Conversations are kept in the browser and listed at the top of the panel, where you can rename, export and delete them.
Closed, it leaves a narrow Agents tab at the right edge to open it again; Options ▸ User Preferences hides the tab. Whether it is open, and the tab, are saved with your preferences (in your account when signed in).
The bar shows how much of the model's context is used; Compact (or the COMPACT command) replaces the conversation with a summary to free it.
External agent: an agent on your computer (OpenCode, Claude Code, Codex…) can work on the open drawing with its own model, through the Cota bridge (⚙ ▸ External agent). See external agents.
With the optional server (Docker) and signed in, the panel uses it: your key is saved on the server for your account (encrypted, it never comes back to the browser), the server calls the model with pydantic-ai, and the conversations are stored in its database. The commands still run in your browser, on the open drawing.
PROMPT (alias
AI) asks for your request and opens the agent panel with it written in the message box, so you can review it and press Send.
Providers#
Pick the provider in the agent settings (⚙); each one fills in its default model and links to the page where you get a key.
| Provider | Default model | Notes |
|---|---|---|
| Anthropic | claude-sonnet-5-5 | |
| OpenAI | gpt-5 | Optional base URL. |
| Google Gemini | gemini-3.5-flash | Free tier with the Flash models. |
| DeepSeek | deepseek-flash (V4) | Text only: the agent gets a note instead of the view capture. |
| Kimi (Moonshot) | kimi-k3 | Keys at platform.kimi.ai. K3 and K2.5 see images; K2 and moonshot-v1-* are text only. |
| GLM (Z.ai) | glm-4.7-flash | Free tier with the Flash models. glm-4.7-flash is text only; use glm-4.6v-flash (also free) to send the view capture. |
| OpenRouter | deepseek/deepseek-chat | One key for many models, with no CORS problems. |
| OpenAI-compatible | — | Any API that speaks the OpenAI format, at the base URL you type. |
- The Base URL field only shows, and only counts, for OpenAI-compatible and OpenAI; the other presets always use their own base.
- Z.ai lets the browser in only some of the time (its CORS answer is intermittent), so with GLM a call that does
not reach the provider is retried a few times with short waits, and the settings warn about it. If it keeps
failing, use the optional server or OpenRouter. Z.ai's Coding Plan uses another base URL
(
https://api.z.ai/api/coding/paas/v4): choose OpenAI-compatible and type it there. - With the optional server, the server calls the provider, so CORS does not matter; the administrator has to allow the provider's base URL (see self-hosting).
Review and undo#
- Preview: in Ask before running, each batch is tried first on a copy of the drawing and shown in the view as a ghost: green for what it would create or how a changed object would end up, red for what it would delete or move away. Run (Enter) runs it; Reject (Esc) leaves no trace: no undo step, no command line output, and the selection, the saved state, the system variables and the remembered values stay as they were. Long batches, drawings of more than 20,000 objects, batches that touch more than 2,000 objects and commands that act outside the drawing or on the view (save, export, view, UCS…) are shown only as text, with the reason.
- Turn card: at the end of each turn the agent leaves a card with what it created, changed and deleted (by type), the geometry warnings that remain, model calls, tokens and time («2 calls · 1.4 s · 1,160 tokens»; its tooltip splits input and output tokens). Show selects and highlights what it touched; Undo turn undoes the whole turn in one step («Undo: AGENT turn.»). It is disabled, with the reason, once the drawing changed after the turn. Cards are kept only in this session.
- Conversations: Rename gives a conversation a name; Export downloads it as JSON, without API keys (it
includes a draft evaluation case); Delete removes it (the drawing keeps what was built). With the optional
server, deleting removes it from your account too (
DELETE /agent/conversations/{id}). - The agent's text is shown with minimal, safe formatting (paragraphs, lists, code, bold and italics); HTML is never rendered.
Geometry checks#
After each batch of commands, Cota checks what the agent created or changed: coordinates that are not finite, zero length, radius or area, invalid or empty solids, exact duplicates, sizes or positions out of scale, objects on layers that are off or frozen, and text of height 0. These are warnings, not errors: they go back to the model, which fixes them in its next step (or says why it left them), and the panel lists them under Geometry warnings. When the turn ends, everything it touched is checked again and anything left appears under Still to review at the end of the turn.
The agent also has two tools to verify its work before it answers:
check_geometryruns the same checks on the objects it names, or on the whole current space.measuregives the bounding box, length, area, surface and volume of objects, and their totals.
External agents connected through the bridge get the same checks and tools.
When something goes wrong#
The panel says what happened and offers the button that fixes it:
| Problem | What to do |
|---|---|
| The provider rejected the API key | Settings: check the key or get a new one, then send again. |
| Rate limit or quota reached | Wait the time shown (when the provider gives one) and press Continue, or switch model. |
| The server's agent usage limit was reached (optional server) | Wait the time shown and press Continue; see Safety and limits. |
| The conversation no longer fits in the model's context | Compact summarizes it so you can go on. |
| The provider could not be reached | Check the connection and press Continue; if the provider blocks browsers, use OpenRouter or the optional server. |
| The provider answered with an error or an empty answer | Continue tries again, or switch model. |
| The agent reached 30 steps in one turn | It pauses; Continue lets it go on without a new message. |
| The agent repeated the same failing call 3 times | It stops; rephrase the request or fix the drawing. |
Tool calls with invalid arguments are not run: the model gets the problem and corrects the call. Provider messages are shortened; with the optional server, the browser only gets the kind of problem, never the provider's message.
Reporting a problem with a turn: TRACEBACK (Help menu) also records the agent's turns: where each one starts
(provider, model, mode and your message) and ends (model calls, tokens, time and what it created, changed and
deleted), the first line of each tool result, the kind of error and Undo turn. Each batch of commands is in the
file with its text, so tools/replay-traceback.mjs replays the turn on the same drawing, as one undo step, without
calling the model. API keys are never logged. See TRACEBACK.
Safety and limits#
- Sensitive commands: the agent can never run AGENT, AGENTBOX, COMPACT, PROMPT, SCRIPT, TRACEBACK, OPTIONS, LOGIN, CLOUD or OPENFOLDER (a batch that uses one stops with «… is not allowed for the agent»). Commands that act outside the drawing or cannot be undone (NEW, OPEN, CLOSE, SAVE, EXPORT, SOLIDEXPORT, IMPORT, PLOT, PUBLISH, PURGE, TEMPLATE, IMAGE and the clipboard) always wait for your OK, also in Run automatically and for external agents; the card says which command and why. Aliases count as the command they stand for.
- Text in the drawing is data: texts, dimension overrides, block, image and attribute names reach the model marked as ⟦…⟧, and the agent is told never to follow instructions written there, even if they claim to come from you or from Cota; it mentions them to you instead.
- What is sent: a notice at the top of the panel says it once: your messages, the parts of the drawing the agent reads (descriptions and texts) and pictures of the view go to the AI provider you chose (through the server in server mode). The free tiers of some providers may use requests for training. Got it hides the notice; it never blocks the panel.
- Limits in server mode: the optional server limits the agent's model calls per user and minute and, if the administrator sets one, the tokens per user and day; reaching a limit pauses the turn with the wait and Continue. It also caps the conversations saved per user: the panel says so and asks you to delete old ones. The agent settings (⚙) show your usage on the server (steps and tokens today and in the last 30 days) and its limits. See self-hosting.
Context boxes#
On a large drawing the agent does not need to read everything. Context boxes limit what it sees to some parts of the drawing; they never limit what its commands do (ALL, W and C still reach the whole drawing).
- AGENTBOX adds a box: pick two corners, or press Enter (Selected) for a box around the selected objects (with objects already selected it takes them without asking). List shows the boxes and Clear removes them.
- The panel shows one chip per box (
B1,B2…, up to 8) with its ✕, Limit to selection (one box around the selected objects, replacing the others) and Clear. Without boxes the bar says the agent sees the whole drawing. - The view draws the boxes as dashed outlines over the drawing. They belong to the open conversation and are saved with it, so they come back when you open it again.
- With boxes, the drawing summary (
get_drawing) describes what touches them and counts what is outside, object queries (query_objects) and pictures of the view (capture_view) stay inside them, and each batch lists only what it touched inside. - The agent can set its own boxes with the
set_context_boxestool. On a large drawing (from 1000 objects) it is told to calllist_regionsfirst (the drawing in a 4 × 4 grid with object counts and layers) and to work on the region it needs. The drawing summary and the region list are kept within about 2000 tokens, andquery_objectspages long lists (offset). - AGENTBOX is yours only: the agent cannot run it. External agents connected through the bridge see the same boxes and get the same tools.
Context window#
The panel's context bar shows how much of the model's context is used. Cota knows the window of common models (128k tokens for unknown ones); set Context window (tokens) in the agent settings to override it. When the conversation reaches 85 % of the window, the next message compacts it first.
See also: External agents · AGENT · AGENTBOX