> ## Documentation Index
> Fetch the complete documentation index at: https://iso-topology.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# How to create and revise an architecture diagram with an AI agent

> A runnable CLI and MCP workflow: create a service diagram, add a cache, preserve current source and layout, inspect the result, and export an editable project.

**Give the agent a small architecture model, then keep the returned source and layout state for every revision.** iso-topology renders and edits that model locally. Your coding agent supplies the reasoning; the renderer does not call a model or infer a system from a prompt by itself.

This worked example starts with **Client → API → Database**, then adds **API → Cache**. It is an illustrative service, not a claim about your application's architecture. For a real repository, first [collect evidence for each component and connection](https://iso-topology.mintlify.site/guides/architecture-diagrams-from-code.md).

[Install and open Studio](https://iso-topology.mintlify.site/quickstart.md) · [Download starter YAML](../assets/readme-starter.yaml) · [Download the cache revision](../assets/service-with-cache.yaml)

New to the CLI? The [architecture diagram quickstart](https://iso-topology.mintlify.site/quickstart.md) covers installation, your first render and a local Studio edit. If you already have a Mermaid graph, use the [three Mermaid-to-isometric examples](https://iso-topology.mintlify.site/articles/mermaid-to-isometric-architecture-diagrams.md) to re-author its nodes and connections before starting this revision workflow.

## What you will make

![A small service with a Client, API and Database, rendered from the downloadable starter](https://mintcdn.com/iso-topology/JRs3a6ALtsht9_pA/assets/readme-starter.svg?fit=max\&auto=format\&n=JRs3a6ALtsht9_pA\&q=85\&s=e188e160d459943dc1aabe425a5c8260)

You will keep three things: the architectural description, its current placement, and the SVG used in your README or design review. A screenshot alone cannot carry the editable model into the next turn.

## 1. Make the first drawing

Install the current CLI if you do not have it:

```bash theme={"system"}
go install github.com/NexusFox88/iso-topology/cmd/isotopo@main
```

This requires Go and its binary directory on your PATH; see [installation](https://iso-topology.mintlify.site/getting-started/01-install.md) for alternatives. For repeatable team builds, record the engine revision and use the same binary for subsequent renders.

Save the starter as `architecture.yaml`. It needs only components and relationships:

```yaml theme={"system"}
# Architecture only. The engine supplies presentation and layout.
nodes:
  scene:
    shape: composite
    parts:
      - {id: user, shape: rectangle, label: "Client"}
      - {id: api, shape: rectangle, label: "API"}
      - {id: db, shape: cylinder, label: "Database"}
    connectors:
      - {from: user, to: api, routing: orthogonal}
      - {from: api, to: db, routing: orthogonal}
```

```bash theme={"system"}
isotopo design architecture.yaml out/first
```

Open `out/first/topology.svg` and inspect `out/first/report.json`. The directory also contains `source.yaml`, `layout-state.json`, and `project.isotopo.json`. The project bundles source and placement; keep it for editing and reopening.

An agent with terminal access can run these commands. For MCP, [connect the server](https://iso-topology.mintlify.site/agent/MCP.md) and ask it to call `iso_capabilities`, then `iso_design` with `format: "yaml"` and `dsl` containing the file. A subsequent `iso_design` call must pass the earlier `layout_state` as `previous`. `iso_design` returns the project and report alongside the drawing; do not discard them between turns.

## 2. Ask for one specific revision

Give the agent this task:

```text theme={"system"}
Read architecture.yaml and out/first/layout-state.json from disk.
Add a cylinder component with ID cache and label Cache.
Add an API-to-Cache connection. Keep the existing IDs, labels,
connections and comments. Do not invent any other services.
Save the revised source to architecture.yaml.
Run isotopo design --state out/first/layout-state.json architecture.yaml out/cache.
Inspect the returned report and the actual SVG, including every arrow.
Return source, SVG and project paths and any remaining issues.
```

Without an agent, download the supplied cache revision as `architecture.yaml` and run the same command:

```bash theme={"system"}
isotopo design --state out/first/layout-state.json architecture.yaml out/cache
```

![The service extended with a Cache and an API-to-Cache connection](https://mintcdn.com/iso-topology/1P24m62q86nq3AQH/assets/service-with-cache.svg?fit=max\&auto=format\&n=1P24m62q86nq3AQH\&q=85\&s=be7981beefa6c0a551324b98c350dec5)

The illustrations show fresh compositions of the two downloadable templates. A state-preserving revision can have a different arrangement because it retains your previous placement. The component and connection changes should match.

In the maintained small-example check, this command retains the existing positions and reopening the resulting project reproduces its SVG. The report can still include `iso-route-clearance-unresolved` with the message `non-convex opaque body coverage`; inspect the actual routes rather than treating a completed render as a clean report.

Keep `user`, `api` and `db` as IDs. Changing a label is an edit to the same component; changing an ID makes it a different layout identity. The engine can preserve earlier positions while finding space for the new component, but a successful render is not a promise that every larger graph is readable.

## 3. Make a human edit, then continue

```bash theme={"system"}
isotopo serve out/cache/project.isotopo.json
```

Open the URL printed by the command. Rename API to **Public API**, drag it if needed, and save the project in Studio. Then ask the agent to **read that saved project**, retain its current source and `layout_state`, and make the next change. Do not feed it the stale YAML from before your Studio edit.

For a full drag → agent revision → reopen procedure, use [preserve a diagram's layout](https://iso-topology.mintlify.site/guides/preserve-diagram-layout.md).

## 4. Check and publish the same revision

* **Meaning:** does each arrow represent a verified request, dependency or data transfer? The renderer cannot verify application behavior.
* **Source:** do labels, comments and IDs still contain the human edits?
* **Drawing:** can you follow every connector and read labels at the intended display width? Inspect the SVG as well as the report.
* **Reopen:** open the saved project in Studio before handing it off. It should contain the latest source and placement.

Copy the final `topology.svg` to `docs/architecture.svg` in your application repository, keep its source/state or project beside it, and add:

```markdown theme={"system"}
![Service architecture](docs/architecture.svg)
```

Follow the [publishing guide](https://iso-topology.mintlify.site/getting-started/05-publishing.md) for CI rendering. If you automate a design with saved layout, keep passing the matching state; a fresh render from YAML alone is a different workflow.

## Common questions

### Can I use Codex or Claude Code?

Yes, through terminal commands or an MCP configuration supported by your client. The renderer has no built-in LLM. See the [tested client setup and tool contracts](https://iso-topology.mintlify.site/agent/MCP.md); client behavior and model quality are separate from diagram rendering.

### Why did the second version lose my changes?

Check which source and state the agent read. Reusing the original prompt or an earlier YAML snapshot can discard human edits. Treat the most recently saved project as the handoff, and keep an earlier project for rollback.

### Can it generate the diagram directly from a repository?

The agent can read code and author a model; iso-topology does not automatically reverse-engineer the repository. Use the [code-to-diagram evidence workflow](https://iso-topology.mintlify.site/guides/architecture-diagrams-from-code.md) to avoid plausible-looking invented connections.

### Does a valid report mean the architecture is correct?

No. It checks properties of the supplied drawing and source. A person still needs to confirm the architecture and inspect the output. [Recorded agent evaluations](https://iso-topology.mintlify.site/agent/evaluation.md) document specific runs and limitations, not a guarantee for your model or repository.

[Keep manual layout edits](https://iso-topology.mintlify.site/guides/preserve-diagram-layout.md) · [Studio guide](https://iso-topology.mintlify.site/guides/studio.md) · [CLI design contract](https://iso-topology.mintlify.site/reference/cli.md)

For a more detailed authored composition, [open the six-component service project and repeat a checked rename–render–reopen cycle](https://iso-topology.mintlify.site/articles/mermaid-to-isometric-architecture-diagrams.md#try-a-second-edit-then-reopen-it). The same page includes editable RAG and DuckDB projects.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.