On this page
Script Coding Agent
The Script Coding Agent helps you create and improve reusable automation scripts directly in the PCB-Investigator Script Engine. Describe the task in its chat, inspect the generated script, review proposed changes and decide when to compile or run it.
The example below builds an XLSX netlist export and then changes its displayed texts to German. For connection setup, use Configuration; for general script collections and editor operation, see Script Engine.
Click a screenshot to open its full-size image.
Create a Script
Use the Coding Agent inside PCB-Investigator Script to create or improve a reusable automation script. Open the Script Engine from PCB-Investigator and describe your task in the chat at the lower right.
Prepare the connection and design
Open AI Settings from the gear icon in the main AI Assistant chat, and configure the visible pcbi_coding_agent role as described in AI Settings. This is separate from the main chat's AI Assistant role; the two can use the same connection or different ones. The Script Engine and required functions must be available under your installation and licenses.
Open the design and activate the intended step. For changes to an existing script, open and select its editor tab. For a new script, you can begin without an open script tab, as in the first screenshot.
At first use, review and accept the AI integration terms and complete AI Settings. The role uses the configured provider's account and model access. Outside EasyLogix AI Service Hub, separately started Coding Agent requests share the integration's application-run or configured server allowance; see AI Settings.
Ask for a new script
- Script list on the left: browse existing scripts or leave the editor empty when requesting a new one.
- Editor at the upper right: the generated script will appear here in its own tab.
- Coding Agent chat at the lower right: enter the task, including the data scope, exact output and whether to compile or run it.
- Lower-left results area: use Compiler Errors and Output Log when checking the script later.
The illustrated request creates an Excel netlist export. To reproduce it with an explicit review stage, send:
Create a new script that exports the active step's netlist to an XLSX file. Use these columns: Netname, Pin Count and Pins. Format Pins as component reference and pin name, for example R100-2, C200-1. Ask for the output file when the script runs. Create the script only; do not compile or run it yet.
State whether the task covers the active step, all steps or the current selection. Specify column names, units and file type rather than asking only for a general export. While the assistant works, progress messages can appear in the chat; these do not indicate completion.
Inspect the generated script
- Check the new editor tab, ExportNetlistXlsx.cs in this example. The file name in your result may differ.
- Read the assistant's summary: it should describe the scope, columns and output-file behavior you requested.
- Check the execution status. The example explicitly states The script has not been compiled or run. Creating a script does not create the XLSX output file yet.
- Request a correction if needed, or continue with Review Suggested Changes and Compile, Run and Save.
A new script is created in the Script Engine's local script collection and opened in the editor. Use Save current Script after later accepted edits to keep the final file up to date.
Review Suggested Changes
Use the Script Engine's Coding Agent chat to change an existing script. Select the intended script tab first and describe exactly what should change and what behavior should stay the same.
Request a focused change
For example, after creating the netlist export, ask:
Translate this script's user-facing messages, column headings and comments into German. Keep the export logic and data scope unchanged. Do not compile or run it yet.
You can similarly ask for an additional output column, a filter or a correction to a reported error. Name the script if several editor tabs are open.
Compare the proposed version
- Comparison area: the left side shows the previous version and the right side the proposed version. Removed or replaced lines are marked in red; added or changed lines are marked in green.
- Chat reply: read what the assistant says it changed. Check the displayed comparison against that summary and your request.
- Accept: keep the proposed version in the editor and close the comparison. The accepted edit still needs saving.
- Revert: reject the proposal, restore the previous editor content and close the comparison.
Review the actual differences before accepting. In the illustrated example the request is a language change, so the data-selection and export behavior should remain the same.
After accepting or reverting
- After Accept: choose Save current Script or File > Save to keep the changed file. Then compile and run it if that is the next requested step.
- After Revert: explain what was unsuitable and request a revised proposal. Keep the instruction focused on the intended result.
- Need another edit first: finish reviewing the current proposal, then give the next request so each change remains easy to assess.
Accepting or reverting editor changes is separate from executing the script. Revert restores editor content; it does not undo effects of a script that has already run on a design or created files. A completed chat message also does not mean the script was compiled or executed.
If the target is a read-only script from an online collection, first create or obtain an editable local copy. For general script-file management, see the Script Engine guide.
Compile, Run and Save
After reviewing a generated or changed script in PCB-Investigator Script, check it, run it when intended, and keep the version you want to reuse. These are separate steps.
Compile without executing
Use the Script Engine's Compile button, or ask the Coding Agent:
Compile the current script and report any errors. Do not run it.
Check Compiler Errors in the lower-left area. Its entries identify the error and the affected line. If compilation fails, ask the Coding Agent to repair the current script and include the reported error message. Review any proposed changes with Accept or Revert, then compile again.
Successful compilation checks that the script can be built; it does not prove that the export, calculation or design change is correct.
Run the script and check the output
- Confirm the intended design, active step and selection.
- Complete the review of pending changes and save the version you intend to use.
- Click the green Run Script button or explicitly ask the Coding Agent to run the script. The Script Engine also compiles the script before running it.
- Complete any dialog opened by the script. For the illustrated XLSX export, choose the destination file when prompted.
- Check the completion message, relevant Output Log entries and the actual output. Open the exported file and verify its columns and representative values against the active design.
For example:
Run the reviewed netlist-export script for the current active step. Let me choose the XLSX destination, then report whether the export succeeded.
Use the Script Engine's Stop running script. control when a running script needs to be stopped. Cancelling a chat request and stopping a running script are separate actions. Already completed file writes or design changes are not undone by stopping.
Save and reuse the result
Use Save current Script or File > Save after accepted edits. A newly created script is already added to the local script collection, but later editor changes still need saving. Give the file a useful name and keep it in the script collection you use for repeated tasks.
Use the Script Engine's existing Local and Favorites functions to find and reuse scripts. The Script Engine guide describes script collections and adding favorites.
Where learning is available, you can ask the assistant to learn a successfully executed and checked script as a reusable example. To capture the general procedure, use a Skill. Neither a learned example nor a saved chat replaces saving the script file you want to keep.
When something does not work
| Symptom | Next step |
|---|---|
| The Coding Agent is unavailable | Check the pcbi_coding_agent role's connection and sign-in, the Script Engine availability and permitted tools. |
| The editor says No script selected | Select a script to modify, or explicitly request creation of a new script. |
| Compilation fails | Read Compiler Errors, request a focused correction, review it and compile again. |
| Compilation succeeds but no output file exists | Check whether the script has actually run. A created or compiled script alone does not perform the export. |
| The output is incorrect or incomplete | State the expected scope and format, describe the discrepancy and request a correction. Verify the next run against the design. |


