Creating sequences with AI

From SweepMe! Wiki
Jump to navigation Jump to search

AI assistants can help you to create new sequences or to change existing ones. This page describes how this works in SweepMe! 1.6.1.7 and what you should check before you run a sequence that an assistant has written.

Overview

There are two ways to work with an AI assistant:

  • Writing a sequence file: sequences are saved as JSON files (.seq), which an assistant can read and write like any other text file. The structure is described in Sequence file format. This works with every assistant that can work with files on your computer, e.g. Claude Code, OpenAI Codex, GitHub Copilot or Cursor. With a chat-only assistant, you can copy the JSON text into a file yourself.
  • Controlling SweepMe! via MCP: with the MCP server (SweepMe! Pro), the assistant can load a sequence, start and stop a measurement, read measured values and the debug log. See AI applications for how to connect an assistant and MCP tool reference for all tools.

In SweepMe! 1.6.1.7, the MCP server has no tools to edit the loaded sequence, e.g. to add modules or to change fields. The assistant changes the .seq file and loads it again with load_sequence.

Workflow

  1. Prepare a template. Configure the modules that you need in SweepMe!, select the drivers of your instruments and save the sequence as .seq. You can also start from an example (Sequences → Load Example) and save it as .seq. A template shows the assistant the exact field names and option texts of your module and driver versions.
  2. Describe the measurement. Tell the assistant which instruments it should use, the sweep ranges and steps, delays, and the limits that must not be exceeded, e.g. the compliance of a source or a maximum temperature.
  3. Let the assistant write a new file. Ask for a new file name, so that your template is not overwritten.
  4. Load the sequence. Load it via Sequences → Load Sequence, or let the assistant call load_sequence with the full file path. If the file is not valid, SweepMe! shows the reason and load_sequence returns an error, so that the assistant can correct the file.
  5. Check the sequence in SweepMe! Check the structure of the Sequencer, the selected drivers and ports, and all fields of each module before you start a measurement.
  6. Test without risk. If possible, run the sequence first with Simulation drivers or without a device under test.
  7. Run the measurement. Start it yourself, or let the assistant use start_run, wait_for_completion and get_all_measurement_values.

Working with the MCP server

Useful tools for working with sequences are:

  • load_sequence: loads a .seq or .set file. Only possible while no measurement is running.
  • get_current_setting and get_instance_info: the file path of the loaded sequence. The assistant cannot read the content of the sequence via MCP, but it can read the file if it has access to your files. Save your changes in SweepMe! first, so that the file is up to date.
  • get_debug_log: the last lines of the debug log, e.g. to find the reason for an error during a run.
  • list_measurement_parameters: the parameter keys of the loaded sequence.
  • get_driver_version, set_driver_version and the same tools for modules: check or select the versions that are used.

Save your own changes in SweepMe! before an assistant loads another sequence.

Good practice

  • Start from a working sequence or an example instead of an empty file. Assistants that guess field names or option texts produce sequences that do not load or do not behave as expected.
  • Keep the limits of your instruments and samples. The assistant does not know your setup. Give it the safe ranges, and check compliance, ranges and set values in SweepMe! before you run the sequence.
  • Check in SweepMe! before running. Do not let an assistant start a measurement with real instruments before you have reviewed the sequence.
  • Review the changes. Compare the new file with your template, e.g. with a diff tool or a version control system such as git.
  • Keep versions. Save each new version under a new name, so that you can go back to a working sequence.
  • Consider which data is shared. The language model receives the content of the files and the results of the tools, e.g. file paths, driver names and measured values. Follow the rules of your organization, see AI applications.

See also