Let's use the AI Agent in Design mode to create a photonic component from scratch. The agent will guide you through specifying your design, writing the Python code, building it, and verifying the result in the GDS viewer.
Open the Agent and Select Design Mode¶
Click the wand button in the top-left toolbar of the GF+ sidebar to open the agent. At the top of the chat, click the Design chip to toggle it on.

Describe What You Want to Build¶
Click the Build a component quick action, or describe what you need. For example:
I want to build a Mach-Zehnder interferometer with two 50/50 MMI couplers connected by waveguides of different lengths. The path length difference should be 100 microns.

Tip
Be specific. The more detail you provide upfront, the better the result. Include information about:
- Which sub-components to use (e.g., specific coupler type, waveguide cross-section)
- Port names and how components connect
- Key dimensions and parameters
- Any constraints from your PDK
Answer the Agent's Questions¶
The agent will ask clarifying questions before it starts writing code. This is the discovery phase — the agent needs to understand your requirements fully before building.
For example, it might ask:
Which PDK are you using? Should I use
mmi1x2ormmi2x2for the couplers? Do you want the arm length difference to be configurable as a parameter?
Warning
Be thorough in your answers. The agent uses your responses to write a specification before it starts coding. Vague answers lead to components that don't match what you had in mind. If you're unsure about something, say so — the agent can look up available cells in your PDK and suggest options.

Warning
Always review the code the agent writes. The agent can make mistakes — check that the generated component matches your design intent, uses the correct cross-sections, and follows your PDK's conventions before building.
Review the Specification¶
Before writing any code, the agent produces a component specification summarizing:
- Component name and parameters
- Sub-components and their settings
- Port definitions
- Connection plan
- Build order
Review this carefully. If anything looks wrong, tell the agent and it will adjust the spec before proceeding.

Iterate on the Design¶
Once the component builds successfully, you can ask the agent to refine it:
- "Make the arm length difference a parameter" — add configurability
- "The ports look wrong, can you check?" — the agent inspects port positions and fixes issues
- "Run DRC on this" — switch to Verification mode to check design rules
The agent works iteratively: build, inspect, fix, rebuild — until you're satisfied with the result.
Using Other AI Assistants¶
You can also design components using any MCP-compatible AI assistant (Claude Code, Claude Desktop, Cursor) through the gfp-mcp server. It provides the same design tools — building cells, exploring the PDK, running verification — but in your preferred environment.
Install it with one command:
The MCP server auto-discovers your running GDSFactory+ projects. Ask your AI assistant to "list available cells" or "build an MZI component" and it will use the same GDSFactory+ tools under the hood.
See the AI Agent — MCP Server section for setup instructions for other assistants.
Next Steps¶
Now that you've built a component with the agent, explore further:
- Add verification: Toggle on Verification mode and ask the agent to run DRC or connectivity checks
- Explore the PDK: Ask the agent to list available cells and show their ports and settings
- Build hierarchical designs: Ask the agent to compose multiple cells into a larger component
For the full reference on agent features, see AI Agent.