revit-bridge · Guide

How to verify AI-generated Revit code with revit-bridge

Compile a C# snippet, inspect a rolled-back dry run, then test a built add-in in Revit. Learn what each check proves and what still needs acceptance testing.

Verify the code and model result

Verify AI-generated Revit code by checking compilation, model outcome and restoration separately. Use check_code for compilation and dry_run_code for a snippet execution that is rolled back. Use test_addin_command for a built command. Read back the target parameters and affected scope before restoration, then verify restoration separately. Report only checks that actually ran and produced evidence.

Source: framework testing tools · Add-in response fields and restoration behavior

What do the three checks tell you?

revit-bridge connects an AI coding agent to an open Autodesk Revit model through an MCP server and a Windows add-in. It exposes three different checks. A successful compilation establishes that a snippet can compile in that environment; it does not establish that the resulting model is correct.

CheckEvidence returnedWhat remains to verify
check_codeCompilation diagnostics, line numbers, hints and guidance. The snippet is not executed.Runtime behavior and the intended model result.
dry_run_codeSnippet return value, added, modified and deleted element counts by category, warnings and errors. Model changes are rolled back.The built command, its interaction flow and behavior on other models.
test_addin_commandA built DLL command runs in the open model without installation. Results can include the result file, model changes, warnings and read-back evidence.Installer behavior, other Revit releases and final user acceptance.

Dry runs and compiled command tests require revit-bridge-addin 0.5.0 or later. Check the reported capabilities as well as the package version. Model rollback does not undo arbitrary external effects such as files written by your code. Use a test model and controlled output paths.

A testable wall-type change

Suppose the request is to change one selected wall type’s thickness. The following is an acceptance brief you can give an agent, not a test result from a Revit session:

Inspect the selected wall and its type before editing.
Confirm the target thickness and units with me.
List the walls that share the type and explain which will be affected.
Compile the proposed snippet, then dry-run it and report warnings.
Build the command and test it in a disposable model.
Read the resulting type thickness back through the API.
Check cancellation and confirm the test model was restored.
Report evidence and anything you could not verify.
  1. Use get_project_snapshot or a read-only query to establish the actual selection, types and units.
  2. Run check_code. Resolve diagnostics before treating the snippet as executable. A response with checked: false is not a passed compilation check.
  3. Run dry_run_code and inspect the returned values and changes. A plausible element count alone does not prove the requested thickness or affected scope.
  4. Build the DLL, test its command with test_addin_command, and read back the result. Test the cancellation path separately.
  5. Retain model changes only through the confirmed execution flow. For execute_code, plan a read-back check before confirmation, then verify it after execution.

Prepare the view and check what actually ran

Before calling test_addin_command, activate a plan view in the test model, make every element to be picked visible, and keep Revit in the foreground. Run one command test at a time. A command that opens a modeless window while waiting for an element pick is not supported by this test workflow.

Inspect loaded, returned, timed_out, readback_error and the read-back result before judging the command. Check restored_clean separately: it can be true when nothing ran, so it does not establish that the command completed or met the acceptance brief. Keep load failures and timeouts in the test record.

These test prerequisites and response fields were checked against the current add-in documentation on November 23, 2026. This documentation update adds no new Revit runtime test results.

Record the evidence for each check

Use this checklist and record template when running your own test. They contain no new Revit runtime results.

  1. Record the exact Revit build, add-in and framework versions, test model, and dll_sha256 when testing a DLL.
  2. Keep actual compilation diagnostics. Treat checked: false as an unavailable check. A snippet compilation does not establish that the standalone DLL built successfully.
  3. For a command test, inspect loaded, returned, timed_out, errors and warnings. Use readback_code after the command returns and before restoration to check target values and affected element IDs.
  4. Check restoration independently. restored_clean: true can mean that nothing changed; it cannot replace evidence of command completion or correct parameters.
  5. Label an unperformed or unsupported check as not tested or unverified. Record cancellation, other Revit builds and installer testing separately.
Evidence template — NOT RUN
Revit build and test model: TO RECORD
Framework/add-in versions and DLL hash: TO RECORD
Target element IDs, type IDs and scope: TO RECORD
Before value, requested value and units: TO RECORD
Compilation diagnostics: NOT TESTED
Execution status, timeout, errors and warnings: NOT TESTED
Read-back value and affected IDs before restore: UNVERIFIED
Non-target elements unchanged: UNVERIFIED
Model restoration: UNVERIFIED
Cancellation and external file effects: NOT TESTED
Conclusion and evidence file locations: TO RECORD

Source for response fields and readback_code timing · Check the model connection first

When a check is unavailable or restoration fails

no_dry_run and no_addin_test indicate missing add-in capabilities. Including local C# source files in a dry run additionally requires features.dry_run_sources; otherwise the response is no_dry_run_include. Updating only the MCP server does not update the Revit add-in.

Treat dry_run_not_rolled_back or addin_test_not_restored as a failed restoration. Stop the test sequence, inspect the model and preserve the diagnostic output before trying again. Do not report a restored model on the strength of a successful command return value.

What the published evaluation establishes

The published revit-bridge evaluation covered two add-in tasks in one Revit 2026 model. The full configuration met the acceptance bar in 38 of 38 valid runs. The complete study contains 135 valid runs out of 154 attempted runs across its configurations. This supports the tested setup; it does not establish a general success rate for every Revit workflow.

Read the evaluation method and its limitations. For your own add-in, retain the task brief, exact Revit build, input model, diagnostics, read-back results and any missing checks.

Sources and next steps

Technical details checked on November 22, 2026. These references link to the source revisions checked for this article. revit-bridge README · Revit add-in README

Installation and connection · Versions and connection troubleshooting · Diagnose Revit with Journals