Chat walkthrough · photonics

Chat walkthrough: mark ports → route → drag-to-reroute

Three messages: wire a custom photonic device to a gdsfactory MMI, then drag it and reconnect.

This is a real conversation log. For each user request, klink's AI agent genuinely called the listed tools against a live KLayout — each screenshot is the real view at that moment. For the full version (three ways to get ports + a cautionary example), see the gdsfactory ports tutorial.
User
I drew a custom device with a triangle at each of its two waveguide ends — convert them to standard ports.
klink agent

A hand-drawn triangle is a port marker: apex is orientation, base is width. One call reads the geometry, infers orientation/width/position, marks a standard klink Port, and deletes the raw triangle. Both ends became 0.8 µm edge-attached ports.

recognize_handdrawn_ports(cell="GFPORTS", layer="999/99", port_type="optical") → P0 orient=180° width=0.8 ; P1 orient=0° width=0.8 (attached=True)
The custom device's two waveguide ends become standard ports labelled klink_port.P0 / P1
Turn 1 · hand-drawn triangles → standard Ports (P0 / P1, width exactly 0.8 µm).
User
Connect it to that MMI's input on the right.
klink agent

The device's P0 and the MMI's input o1 are both on net link0 and face each other, so route a waveguide straight across to the 12/0 layer. ok=true, a 40 µm straight waveguide, 0 crossings.

route_gdsfactory_ports(cell="GFLOOP", route_layer="12/0", all_two_port_nets=True) → {ok:true, MMI.o1 → P0, length_um:40, crossings:0}
A straight waveguide connects the custom device to the MMI
Turn 2 · a straight waveguide wires the custom device to the MMI input.
User
I moved the left device up 20 µm — reroute it.
klink agent

Re-run the same route call — it re-reads the live port positions (P0 is now at its new coordinates) and replaces the old route with a waveguide that follows to the new spot. The device moved, the wire caught up with one smooth S-bend, nothing else changed.

route_gdsfactory_ports(cell="GFLOOP", route_layer="12/0", all_two_port_nets=True) → {ok:true, MMI.o1 → P0(new position), length_um:60} # 40µm straight → 60µm S-bend
The moved-up device reconnects to the MMI through a smooth S-shaped waveguide
Turn 3 · one "reroute it" after the drag: the waveguide re-routes to a smooth S-bend following the device.

What this conversation did

Three messages: hand-drawn triangles to standard ports → route to the MMI → reroute after a drag. The core is the "mark ports → route → drag → reroute" loop, and success is judged on the structured returns (width=0.8, length 40→60, crossings=0), not on "looks connected".

Honest recap: all three turns ran live in one throwaway KLayout tab this session; the geometry is synthetic values decided on the spot (not any real process), and the tool names match the .chat-calls above exactly. The full version (standard gdsfactory auto-ports, PDK blackbox harvest, and a "base drawn wrong" cautionary example) is in the gdsfactory ports tutorial.