Skip to main content
An agent proposes data. Floorkit checks that data and builds the geometry. Your app then lets people edit the same project. This guide shows that boundary without choosing an AI provider.

Before you start

  • Complete the quickstart in a browser app on localhost.
  • Your app supplies the AI model, parses its response as JSON, and treats the result as unknown.
  • Give the agent the building model contract and the requested dimensions, in metres.
Start the geometry kernel once when your app starts:
A deployed app also needs a valid key before views and exports. See Licensing.

Ask for building data

For the room in the quickstart, give your agent a request such as:
The quickstart supplies a complete valid document for this request. Use it as a known example before connecting your model provider.

Return validation feedback

Validate the parsed result. Send the returned issues to your agent if the document is invalid.
Each issue has a path, a code, and a message. For example, an opening that extends past its wall is rejected. Ask the agent to correct the reported fields and validate again. Limit retries in your app and show unresolved errors to the person. Do not accept a TypeScript cast as validation. Do not invent missing IDs, change units, or remove an invalid element silently to make the document pass.

Open the proposed project

After initialization, this function checks unknown input and creates a project with a plan of its first storey:
A document that passes validation can still fail to build its geometry. Catch the error from openCandidate and keep the previous project open until the new one succeeds. A BmBuildError includes a path and a code; other build failures can be ordinary errors. Add manager.root to your Three.js scene. For a plan that people can edit, call await manager.mountPlanEditor(container, 'agent-plan'). The container needs a width and height. See Add a plan editor.

Apply a small edit proposal

Keep the current manager when the user asks to move a door. Your app chooses the door target from the current model or selection. The agent proposes only the new offset:
Capture manager.revision before you send the request to the agent. Pass that number back when the response arrives. The host checks it before applying the edit:
For the quickstart model, the target is building, ground, outer-walls, and front-door. The offset is measured in metres along that wall from its first point. Floorkit checks that the door fits between the joints of the wall and does not overlap another opening. A refused move has an opening-does-not-fit issue with the offsets where the door fits. If a door of the opened model does not fit at its saved offset, manager.session.currentBuild.warnings has an opening-does-not-fit warning with the same numbers. Give the agent its openingFit.nearestOffset; do not compute the fit in your app. The revision comparison above belongs to your host application: ProjectManager.apply takes one command, not an expected revision argument. There is no await between the comparison and the edit. If you use BuildingSession directly, its apply takes the originating session revision. See Editing and history. An accepted proposal is one step in the manager’s history. Use manager.undo() and manager.redo() for that same history. A rejected command leaves the saved model unchanged. Use the error’s path and code when available; do not replace the whole project to hide a rejected edit.

Save and reopen

Save on a user action or a timer, rather than after every frame:
Your app stores the text. Reopening needs the kernel to be initialized and starts a new undo history. Before closing a project, remove its root from your scene and call manager.dispose(). To produce drawings, compose a sheet and export a PDF. A GLB or PDF does not preserve the editable building document; keep the project file too.

Let people continue editing

The plan and 3D editors use the same project as the agent. Both change the building through commands, so the person can inspect, adjust, undo, and save the result. This existing example shows the plan editor you can connect to the workflow. It does not call an AI model. For agent documentation access, see Build with agents. For other application routes, see What you can build.
Last modified on October 16, 2026