This website requires JavaScript.
Coupons
Ship to
Blog

Under the Hood: How AI Agents Actually Drive EasyEDA Pro PCB Design

Published Dec 02, 2026, updated Dec 02, 2026

15 min

Table of Contents
  • The AI PCB design pipeline, layer by layer
  • The object model: how a design is addressed
  • Geometry: coordinates, grids and hotspots
  • Electrical semantics: how nets are actually built
  • The AI side: why the skill matters more than the model
  • Limits and honest constraints
  • FAQ about AI Agents and EasyEDA Pro
  • Conclusion on AI Agents Driving EasyEDA Pro

Key Takeaways

  • The agent does not “place a resistor”. It emits JavaScript against the EasyEDA Pro extension API, so every action in a session is inspectable and replayable.
  • Three layers do the work: code generation, a local Node bridge (HTTP in, WebSocket out) and the extension runtime inside the editor.
  • Documents use UUIDs, objects use 16-hex primitive IDs. Querying without an active page context silently targets the wrong document.
  • Connectivity is geometry: a wire endpoint must land exactly on a pin hotspot, or the net is open no matter how attached it looks.
  • Nets come from contact, same-name labels and global power flags — then get verified against a queryable netlist.

Most AI PCB design demos stop at the wow moment: you type a sentence and a schematic appears. This article goes the other direction. We dissect the actual machinery — the execution protocol, the object model, the geometry rules and the electrical-connection semantics — that lets an AI agent such as Claude Code or Codex operate EasyEDA Pro for AI-assisted PCB design as reliably as a human clicking the mouse. If you are an engineer who wants to know why it works before trusting it with a real design, this is for you.

The AI PCB design pipeline, layer by layer

Everything between the AI's text and a symbol appearing on your canvas passes through three well-defined layers. Each layer has one job, one contract and one characteristic failure mode.

ai-agent-three-layer-execution-stack

Figure 1 — The three-layer execution stack: the agent generates JavaScript, a local bridge forwards it over a WebSocket, and the extension runtime evaluates it inside EasyEDA Pro.

Layer 1 — The AI agent emits JavaScript, not commands

The agent never sends semantic instructions like “place a resistor”. It emits executable JavaScript targeting the EasyEDA Pro extension API:

const comp = await eda.sch_PrimitiveComponent.create(
  { libraryUuid: "0819f05c...", uuid: "f6d2a89f..." },  // library + symbol UUID
  60, 320,        // position in schematic grid units
  undefined, 0,   // subpart, rotation
  false,          // mirror
  true, true      // add into canvas, select
);

This is the key architectural decision: the AI is a code generator, not a macro player. Code is composable (loops place component arrays), self-checking (if (!comp) retry) and inspectable — every action the AI takes is a line of JavaScript you can read, log and replay. It is also why results differ so much between agents: a grounded agent that has been given the API reference behaves very differently from one that is guessing, as the Claude Code PCB design test on a real three-page schematic shows.

Layer 2 — The bridge server: HTTP in, WebSocket out

The bridge is a small local Node server with a deliberately thin contract:

POST http://localhost:49620/execute    # first free port in 49620-49629
Content-Type: application/json
{
  "code": "return await eda.sch_Net.getAllNetsName();"
}

Internally it does exactly one thing: forward the code string over a persistent WebSocket to whichever EasyEDA window is connected, await the result, and serialize it back:

{ "success": true, "result": ["GND", "3V3", "5V", "SDA", "SCL"], "windowId": "e8161ef6-..." }

Its health endpoint exposes the session state that matters for debugging:

{ "status": "ok", "edaConnected": true, "edaWindowCount": 1, "activeWindowId": "e8161ef6-..." }

Two engineering implications are worth internalizing:

  • The connection is stateful and window-scoped. The bridge binds the first free port in 49620–49629 and the extension scans that range on startup, so 49620 is a starting point rather than a fixed address. windowId identifies the specific EasyEDA editor window holding the WebSocket; open a second project or restart the bridge and the session drops. The extension then re-scans the range and reconnects on its own, backing off from 3 s to 30 s, with the Reconnect menu item as the manual fallback once retries stop. The bridge tracks pendingRequests because execution is serialized — one snippet at a time per window.
  • Failure modes are explicit. edaConnected: false with a healthy bridge means the editor side disconnected, not the server — a distinction that saves real debugging time.

Layer 3 — The extension runtime inside EasyEDA Pro

The Run API Gateway extension receives the code string and evaluates it inside EasyEDA Pro's extension sandbox, where the eda.* API namespace is injected. The result is JSON.stringify-ed and returned. That is the entire loop — roughly: HTTP → WS → eval in extension context → WS → HTTP.

Because the code runs inside the editor, it has the same powers a native extension has: full read/write access to the open document, the component libraries and the editor control surface.

LayerWhat it contributesCharacteristic failure
AI agentTurns intent into JavaScript that calls the real APIHallucinated method names when the API reference is missing
Local bridgeCarries code and results over a persistent WebSocketBridge restarted or window switched: stale windowId, no session
Extension runtimeEvaluates code with full editor and library accessNo active page context: queries hit the wrong document

The object model: how a design is addressed

Every entity in an EasyEDA project is addressable, and the addressing scheme is what makes scripted design deterministic. Get it wrong and nothing else in the pipeline will save you.

easyeda-document-uuid-primitive-id

Figure 2 — Addressing a design: documents and pages use UUIDs, while objects on a page use 16-hex primitive IDs that only resolve inside an active page context.

Documents use UUIDs, objects use primitive IDs

Project (uuid)
└── Schematic (uuid)          e.g. a1f8a045...
    └── Page (uuid)          e.g. df9d0901...   ← the canvas you draw on
        └── Primitive (primitiveId, 16-hex)    ← components, wires, labels
            └── Pin (pinNumber, coordinates)  ← electrical connection points

Note the deliberate split: documents and pages use UUIDs, while objects on a page use shorter primitive IDs. The reason is scoping — primitive IDs are only meaningful within an active page context. This is why scripted workflows always follow the pattern open, wait, then query:

await eda.dmt_EditorControl.openDocument(pageUuid);       // establish context
const all = await eda.sch_PrimitiveComponent.getAll();    // THEN query
const u1  = all.find(c => c.getState_Designator() === "U1");

Querying without an active page context does not error — it silently queries the wrong document, or none at all. This is the single most common failure mode for AI-driven sessions, and the reason well-written skill documentation insists on “open, wait, then verify”. The same discipline underpins any serious schematic capture workflow, whether the person at the keyboard is human or a model.

State accessors: the getState_* convention

Component state is exposed through a uniform accessor family — getState_Designator(), getState_X(), getState_PrimitiveId(). The getState_ prefix is a contract: it reads the committed editor state, not a cached snapshot. An agent that places a component and immediately reads back its designator is verifying against ground truth, which is what makes closed-loop automation possible:

// place → verify → proceed (the read-verify-write loop)
const comp = await eda.sch_PrimitiveComponent.create({...}, x, y, ...);
await eda.sch_PrimitiveComponent.modify(comp.getState_PrimitiveId(), { designator: "U5" });
const check = (await eda.sch_PrimitiveComponent.getAll())
  .find(c => c.getState_PrimitiveId() === comp.getState_PrimitiveId());
// check.getState_Designator() === "U5" must hold before continuing

Geometry: coordinates, grids and hotspots

Schematic coordinates in EasyEDA Pro are measured in 10-mil units, and connectivity depends on exact coordinates, not visual proximity. A component's position is its origin; its pins sit at coordinates the API reports — and those coordinates do not always land on the wiring grid. Half-grid values such as 698.5 are normal.

wire-pin-coordinate-equality

Figure 3 — Coordinate equality: the wire on the left uses the exact coordinate the API reported for the pin and joins the net; the wire on the right is rounded to a grid point, stops half a unit short and leaves the net open.

const pins = await eda.sch_PrimitiveComponent.getAllPinsByPrimitiveId(id);
// → [{ pinNumber: "1", x: 15, y: 415 }, ...]   absolute canvas coords
// use these values as-is: pins may sit at half-grid values such as 698.5

Why a wire that looks attached can be electrically open

The pin coordinate is not decoration — it is the electrical hotspot, the exact coordinate where the pin participates in connectivity. A wire that looks attached but terminates even half a grid unit away is electrically open. This is the fact that separates EDA from drawing tools, and it is equally binding on AI agents and humans.

What this means for scripted placement

Placement code should read each pin's coordinates back with getAllPinsByPrimitiveId() once the component exists, then reuse those values verbatim for wires and net labels. Computing pin positions from the component origin and rounding them to the grid is exactly what produces orphan wire stubs and open nets. The rule is equality, not resemblance: a wire endpoint or net label must match a reported pin coordinate. Readers new to the topic will find the symbol, wire and net conventions in this guide to reading and creating PCB schematics a useful companion to this section.

Electrical semantics: how nets are actually built

This is the least documented and most important part of the model. EasyEDA builds the netlist from geometry, through three mechanisms.

net-creation-union-find-mechanisms

Figure 4 — Direct contact, same-name net labels and global power flags all resolve into one union-find equivalence class that the netlist query reports back.

Three ways a net is created

  1. Direct contact. Wire endpoints and pin hotspots sharing a grid point are joined.
  2. Net labels / ports. A NetPort placed exactly on a hotspot assigns that point a name; all points carrying the same name are merged into one net, with no wire required.
  3. Power flags. NetFlag objects (Power, Ground) are global-name injectors — every GND flag anywhere on any page joins the same GND net.
await eda.sch_PrimitiveComponent.createNetFlag("Power", "5V", 500, 560, 0, false);
await eda.sch_PrimitiveComponent.createNetPort("BI", "P206", 500, 640, 0, false);

Under the hood this is essentially a union-find over named and unnamed connection points: same-name points union together, wire-touching points union together, and the resulting equivalence classes are the nets — which is exactly what eda.sch_Net.getAllNetsName() reports back.

Net labels are precise instruments, not annotations

A label floating 10 mils off a hotspot names nothing. This is why an auto-routing pass can “succeed” with zero wires created: the labels existed, but none were on-grid with a pin, so there was nothing to connect. The fix is always geometric, never semantic.

The netlist is the source of truth, and it is queryable

An agent can diff “nets I intended” against the getAllNetsName() output and catch its own placement errors — the same verify step a human does visually, done programmatically. From there the design moves into the checks every board needs before fabrication: running a design rule check (DRC), then transferring the schematic to layout.

The AI side: why the skill matters more than the model

Given the above, the hard problem for the AI is not intelligence — it is grounding. The model must know the real API names, the real conventions (open-then-query, hotspot geometry, union-by-name) and the real library UUIDs. That is what the API Skill provides: versioned API reference docs plus working scripts, loaded into the agent's context at session start.

ai-agent-read-verify-write-loop

Figure 5 — The read–verify–write loop, and the four session states an AI agent has to detect and recover from during a long PCB design session.

Grounding beats guessing

The quality difference is stark. An ungrounded model guesses method names and fails opaquely. A grounded one enumerates first, then acts, then verifies — unprompted:

// enumerate first (never assume), then act, then verify
const pages = await eda.dmt_Schematic.getAllSchematicsInfo();
const target = pages[0].page[0].uuid;
await eda.dmt_EditorControl.openDocument(target);
await new Promise(r => setTimeout(r, 1200));   // let the editor settle
const ids = await eda.sch_PrimitiveComponent.getAllPrimitiveId();

The read–verify–write loop

You will notice the defensive setTimeout — the editor's document-switch is asynchronous relative to the API call completing. The skill encodes dozens of these small empirical truths (reconnect after bridge restart, wait after openDocument, verify counts after batch placement), and they are the difference between a demo and a tool. The same instinct explains why teams compare agents on identical tasks rather than on benchmarks: the current field of AI tools for PCB design differs far more in grounding than in raw model quality.

Limits and honest constraints

A deep dive should end with the edges. These are not flaws so much as the honest physics of driving a live editor — the same constraints bind any macro, any extension and any human at the mouse.

ConstraintWhat happensHow to work with it
Serialized executionOne snippet at a time per window; no transaction or rollbackBatch operations are fast, but verify state after each mutation
Local file-model gapsSome project-management APIs target cloud and team workflowsCreate the project shell manually, then let the agent work inside it
Library fidelityThe agent places exactly what is in the libraries it can searchPut an LCSC part number or a known symbol UUID in the prompt
Session fragilityBridge restart or window switch drops the control channelReconnect, re-open the page, and read the health endpoint first

A vague part name invites a plausible-but-wrong symbol; an exact LCSC part number eliminates the ambiguity. The verification habit that catches the rest is the same one described in this PCB design verification guide, applied to a script instead of a netlist review.

Simplify Your PCB Production with JLCPCB

Your one-stop supplier for PCB fabrication, assembly, and components. From instant quoting to fast delivery, streamline your workflow, cut back-and-forth, and keep every build moving smoothly—prototype to production.

Get Instant Quote >

FAQ about AI Agents and EasyEDA Pro

Q: Why does the bridge execute raw JavaScript instead of exposing a typed REST or RPC interface?

Because the editor's API surface is huge and still evolving. A typed schema would lag behind the extension API and constrain what callers can express. Passing code through keeps the bridge permanently thin — one endpoint, zero schema maintenance — while giving callers the full composability of a real language: loops, conditionals, error handling and read-verify-write logic in a single round trip.

Q: How is concurrency handled?

It is not — deliberately. Execution is serialized per editor window, with the bridge tracking pending requests so one snippet completes before the next begins. There are no transactions and no rollback; well-behaved agents compensate by verifying state after each mutation.

Q: What exactly breaks when the bridge restarts?

The WebSocket session between the bridge and the editor window. The windowId and any in-flight requests die with it, which is why edaConnected flips to false. The extension re-scans 49620–49629 and reconnects automatically, backing off from 3 s to 30 s; reach for the Reconnect menu item only once those retries have stopped. Your design data is untouched — only the control channel resets.

Q: How does the agent avoid hallucinating API method names?

Through grounding, not luck. The skill injects the versioned API reference into the agent's context at session start, so method names, parameter shapes and conventions (open-then-query, hotspot geometry) come from documentation rather than the model's imagination. The read-verify-write loop then catches residual errors empirically.

Q: Can I drive the bridge without any AI at all?

Absolutely — an underappreciated use case. The bridge is just POST /execute with a code string, so you can script it from Python, curl or CI to automate repetitive design work. The AI layer is a generator of convenience sitting on top of an interface that stands alone.

Q: What is the security model?

Localhost binding, explicit opt-in at two levels (enabling the extension, then enabling “Allow interact with external”), and full inspectability — every executed snippet is visible JavaScript. The trust model is identical to installing any editor extension: you execute code you chose to allow.

Q: Is there an undo or rollback mechanism for scripted operations?

The API itself is not transactional, but the editor's normal undo history captures scripted edits as ordinary operations. For batch work, the practical pattern is snapshot-then-modify: enumerate state first, and restore from that record if a pass goes wrong.

Q: Does this require desktop EasyEDA Pro, or does it also run in the browser edition?

Desktop only, today. The gateway hangs on a native-extension capability: hosting a WebSocket and evaluating code inside the editor sandbox. The browser edition does not expose an equivalent extension host, so the pipeline targets a locally installed EasyEDA Pro. If you want to see what the full workflow produces end to end, this walkthrough of a 44 × 34 mm board designed by GPT-6 Astra in EasyEDA Pro is the closest thing to a benchmark.

Conclusion on AI Agents Driving EasyEDA Pro

The AI is not drawing circuits — it is executing the same editor API your extensions use, through a local, inspectable, replayable channel. The designs it produces are native EasyEDA documents: real UUIDs, real hotspots, real netlists, real LCSC-mapped BOMs — ready for ERC, layout and one-click fabrication with JLCPCB.

Once you see the stack for what it is — code generation → local bridge → extension runtime — the magic disappears, and what remains is better than magic: a programmable editor, driven by intent.

Start here: Download EasyEDA Pro · Install the Run API Gateway extension · Load the EasyEDA API Skill · Fabricate with JLCPCB

Keep Learning