AI agent workflows with opp_repl
This skill is a cookbook for agents driving opp_repl. Each
recipe lists the prerequisite skills, the decision tree, and the
actual tool calls. Load together with opp-repl-mcp-server for
MCP-based integration, or opp-repl-cli-tools for pure-shell
orchestration.
Recipe 1 — "Run this simulation and report"
Prereqs: opp-repl-installation, opp-repl-opp-files,
opp-repl-running-simulations, opp-repl-tasks-and-results,
opp-repl-result-analysis.
If no .opp file exists for the target project, write one
(template from opp-repl-opp-files/templates/), OR run
create_project(name, path=...) on current opp_repl.
Start or attach to a REPL / MCP server.
Run:
r = run_simulations(
simulation_project=<name>_project,
config_filter="...",
sim_time_limit="1s")
Summarise r.get_error_results() and
r.is_all_results_done(). On failure, rerun a failing task
in debug mode and pull print_stderr() for diagnostics.
On success, aggregate scalars:
df = r.get_scalars() # DataFrame merged across reps
means = df.groupby("name").value.mean()
Recipe 2 — "Investigate a regression"
Prereqs: opp-repl-fingerprint-tests,
opp-repl-comparing-simulations, opp-repl-tasks-and-results.
Reproduce the failure:
r = run_fingerprint_tests(
simulation_project=<p>,
config_filter=<suspect>,
sim_time_limit="1s")
failures = r.get_fail_results()
Compare HEAD against the last-known-good tag/commit:
cr = compare_simulations_between_commits(
simulation_project=<p>,
git_hash_1="v4.5", git_hash_2="HEAD",
config_filter=<suspect>,
run_number=0)
Inspect the divergence:
first = cr.results[0]
first.fingerprint_trajectory_comparison_result
first.print_different_statistical_results(
include_relative_errors=True)
first.show_divergence_position_in_sequence_chart()
Once the suspect commit is identified, leave a report
explicitly referencing the first divergent event number and
simulation time.
Recipe 3 — "Tune a parameter to hit a target"
Prereqs: opp-repl-parameter-optimization,
opp-repl-running-simulations.
- Narrow to a single task with
get_simulation_task(...).
- Specify
expected_result_names, expected_result_values, and
parameter_* arguments (see the skill).
- Call
optimize_simulation_parameters(...).
- Report convergence: best values, residual error, number of
evaluations.
If the objective is noisy, lengthen sim_time_limit or use
repeats before giving up.
Recipe 4 — "Release gate on a feature branch"
Prereqs: opp-repl-feature-and-release-tests,
opp-repl-github-actions, opp-repl-cli-tools.
Locally: run_smoke_tests() on the default project.
If green, trigger a remote suite:
dispatch_workflow("release-tests.yml", ref="topic/my-feature")
In parallel, run run_fingerprint_tests() locally on the
subset of configs you actually touched (narrow filter).
Summarise pass/fail for both local and remote verdicts.
Recipe 5 — "Set up a new simulation project from scratch"
Prereqs: opp-repl-installation, opp-repl-project-scaffolding,
opp-repl-concepts, opp-repl-running-simulations,
opp-repl-result-analysis.
On current opp_repl (>= commit a17fcab, Apr 2026):
from opp_repl.simulation.project import create_project
# Generates <name>.opp, .oppbuildspec, .nedfolders, package.ned,
# omnetpp.ini; loads the project; returns the SimulationProject.
p = create_project("mm1k", path="/tmp", namespace=False)
# Now add NED + C++:
# /tmp/mm1k/Mm1k.ned
# /tmp/mm1k/Source.{h,cc} Queue.{h,cc} Sink.{h,cc}
# and edit /tmp/mm1k/omnetpp.ini to set `network = Mm1k` +
# parameter assignments.
p.build()
r = run_simulations(simulation_project=p, sim_time_limit="100s")
df = r.get_scalars()
On older opp_repl, copy templates from
opp-repl-project-scaffolding/templates/ into a fresh directory
instead, rename mm1k to your chosen name everywhere, then
load_opp_file() + build_project() + run_simulations().
Recipe 6 — "Distribute a parameter sweep to a cluster"
Prereqs: opp-repl-ssh-cluster,
opp-repl-running-simulations, opp-repl-filtering.
Authenticate SSH to each worker.
Make the built binaries reachable on every worker — via a shared
filesystem, or by building on each node (there is no auto-copy
helper):
p.build(mode="release")
# ensure each worker can reach the same compiled binaries
Launch:
c = SSHCluster(scheduler_hostname="node1",
worker_hostnames=["node1", "node2"])
c.start()
run_simulations(scheduler="cluster", cluster=c,
config_filter="PureAlohaExperiment")
Watch the Dask dashboard at localhost:8797.
Recipe 7 — "Keep baselines up to date after a planned change"
Prereqs: any opp-repl-*-tests skill for the test type.
Confirm the CHANGE is intentional (humans have reviewed it).
Regenerate the relevant baseline, SCOPED to the touched area:
update_fingerprint_test_results(
simulation_project=<p>,
working_directory_filter="examples/ethernet",
sim_time_limit="10s")
Commit the updated store JSON / statistics folder / media
folder alongside the code change. Never auto-update baselines
in CI.
General agent guardrails
- Always verify
r.is_all_results_done() / is_all_results_expected()
before reporting "green". A PASS summary can hide ERRORs in
sub-sub-results.
- Never
--break-system-packages; always install into a venv.
- Don't run
update_*_test_results without an explicit human
instruction — that overwrites baselines.
- When an
execute_python call fails, fetch the stderr via
print_stderr() before retrying; do NOT retry blindly with
higher time limits.
- For a local sub-agent REPL, prefer the tokenless
--mcp-socket
transport (clients connect via opp_repl_mcp_bridge). TCP
(--mcp-port) needs --mcp-token-hash (or
--mcp-bypass-token-hash-check) outside opp_sandbox. Keep the
MCP server OFF (both flags unset) in CI. See opp-repl-mcp-server.
See also
opp-repl-overview — skill map.
opp-repl-mcp-server — MCP endpoint details.
opp-repl-shared-terminal — co-drive one REPL with a human.
opp-repl-sandbox — isolate execute_python under bubblewrap.
opp-repl-cli-tools — shell-only alternative.
- Every task-specific
opp-repl-* skill referenced above.
1---2name: opp-repl-ai-workflows3description: End-to-end recipes for an AI agent working with opp_repl via its MCP server or shell tools — investigate a regression, bisect across git commits, tune parameters, run a full release gate, set up a new project from scratch. Load this ALONG WITH opp-repl-mcp-server when acting as an autonomous agent managing OMNeT++ simulations.4---56# AI agent workflows with opp_repl78This skill is a **cookbook** for agents driving opp_repl. Each9recipe lists the prerequisite skills, the decision tree, and the10actual tool calls. Load together with `opp-repl-mcp-server` for11MCP-based integration, or `opp-repl-cli-tools` for pure-shell12orchestration.1314## Recipe 1 — "Run this simulation and report"1516**Prereqs**: `opp-repl-installation`, `opp-repl-opp-files`,17`opp-repl-running-simulations`, `opp-repl-tasks-and-results`,18`opp-repl-result-analysis`.19201. If no `.opp` file exists for the target project, write one21 (template from `opp-repl-opp-files/templates/`), OR run22 `create_project(name, path=...)` on current opp_repl.232. Start or attach to a REPL / MCP server.243. Run:2526 r = run_simulations(27 simulation_project=<name>_project,28 config_filter="...",29 sim_time_limit="1s")30314. Summarise `r.get_error_results()` and32 `r.is_all_results_done()`. On failure, rerun a failing task33 in debug mode and pull `print_stderr()` for diagnostics.345. On success, aggregate scalars:3536 df = r.get_scalars() # DataFrame merged across reps37 means = df.groupby("name").value.mean()3839## Recipe 2 — "Investigate a regression"4041**Prereqs**: `opp-repl-fingerprint-tests`,42`opp-repl-comparing-simulations`, `opp-repl-tasks-and-results`.43441. Reproduce the failure:4546 r = run_fingerprint_tests(47 simulation_project=<p>,48 config_filter=<suspect>,49 sim_time_limit="1s")50 failures = r.get_fail_results()51522. Compare HEAD against the last-known-good tag/commit:5354 cr = compare_simulations_between_commits(55 simulation_project=<p>,56 git_hash_1="v4.5", git_hash_2="HEAD",57 config_filter=<suspect>,58 run_number=0)59603. Inspect the divergence:6162 first = cr.results[0]63 first.fingerprint_trajectory_comparison_result64 first.print_different_statistical_results(65 include_relative_errors=True)66 first.show_divergence_position_in_sequence_chart()67684. Once the suspect commit is identified, leave a report69 explicitly referencing the first divergent event number and70 simulation time.7172## Recipe 3 — "Tune a parameter to hit a target"7374**Prereqs**: `opp-repl-parameter-optimization`,75`opp-repl-running-simulations`.76771. Narrow to a single task with `get_simulation_task(...)`.782. Specify `expected_result_names`, `expected_result_values`, and79 `parameter_*` arguments (see the skill).803. Call `optimize_simulation_parameters(...)`.814. Report convergence: best values, residual error, number of82 evaluations.8384If the objective is noisy, lengthen `sim_time_limit` or use85repeats before giving up.8687## Recipe 4 — "Release gate on a feature branch"8889**Prereqs**: `opp-repl-feature-and-release-tests`,90`opp-repl-github-actions`, `opp-repl-cli-tools`.91921. Locally: `run_smoke_tests()` on the default project.932. If green, trigger a remote suite:9495 dispatch_workflow("release-tests.yml", ref="topic/my-feature")96973. In parallel, run `run_fingerprint_tests()` locally on the98 subset of configs you actually touched (narrow filter).994. Summarise pass/fail for both local and remote verdicts.100101## Recipe 5 — "Set up a new simulation project from scratch"102103**Prereqs**: `opp-repl-installation`, `opp-repl-project-scaffolding`,104`opp-repl-concepts`, `opp-repl-running-simulations`,105`opp-repl-result-analysis`.106107On current opp_repl (>= commit a17fcab, Apr 2026):108109```python110from opp_repl.simulation.project import create_project111112# Generates <name>.opp, .oppbuildspec, .nedfolders, package.ned,113# omnetpp.ini; loads the project; returns the SimulationProject.114p = create_project("mm1k", path="/tmp", namespace=False)115116# Now add NED + C++:117# /tmp/mm1k/Mm1k.ned118# /tmp/mm1k/Source.{h,cc} Queue.{h,cc} Sink.{h,cc}119# and edit /tmp/mm1k/omnetpp.ini to set `network = Mm1k` +120# parameter assignments.121122p.build()123r = run_simulations(simulation_project=p, sim_time_limit="100s")124df = r.get_scalars()125```126127On older opp_repl, copy templates from128`opp-repl-project-scaffolding/templates/` into a fresh directory129instead, rename `mm1k` to your chosen name everywhere, then130`load_opp_file()` + `build_project()` + `run_simulations()`.131132## Recipe 6 — "Distribute a parameter sweep to a cluster"133134**Prereqs**: `opp-repl-ssh-cluster`,135`opp-repl-running-simulations`, `opp-repl-filtering`.1361371. Authenticate SSH to each worker.1382. Make the built binaries reachable on every worker — via a shared139 filesystem, or by building on each node (there is no auto-copy140 helper):141142 p.build(mode="release")143 # ensure each worker can reach the same compiled binaries1441453. Launch:146147 c = SSHCluster(scheduler_hostname="node1",148 worker_hostnames=["node1", "node2"])149 c.start()150 run_simulations(scheduler="cluster", cluster=c,151 config_filter="PureAlohaExperiment")1521534. Watch the Dask dashboard at localhost:8797.154155## Recipe 7 — "Keep baselines up to date after a planned change"156157**Prereqs**: any `opp-repl-*-tests` skill for the test type.1581591. Confirm the CHANGE is intentional (humans have reviewed it).1602. Regenerate the relevant baseline, SCOPED to the touched area:161162 update_fingerprint_test_results(163 simulation_project=<p>,164 working_directory_filter="examples/ethernet",165 sim_time_limit="10s")1661673. Commit the updated store JSON / statistics folder / media168 folder alongside the code change. Never auto-update baselines169 in CI.170171## General agent guardrails172173- Always verify `r.is_all_results_done()` / `is_all_results_expected()`174 before reporting "green". A PASS summary can hide ERRORs in175 sub-sub-results.176- Never `--break-system-packages`; always install into a venv.177- Don't run `update_*_test_results` without an explicit human178 instruction — that overwrites baselines.179- When an `execute_python` call fails, fetch the stderr via180 `print_stderr()` before retrying; do NOT retry blindly with181 higher time limits.182- For a local sub-agent REPL, prefer the tokenless `--mcp-socket`183 transport (clients connect via `opp_repl_mcp_bridge`). TCP184 (`--mcp-port`) needs `--mcp-token-hash` (or185 `--mcp-bypass-token-hash-check`) outside `opp_sandbox`. Keep the186 MCP server OFF (both flags unset) in CI. See `opp-repl-mcp-server`.187188## See also189190- `opp-repl-overview` — skill map.191- `opp-repl-mcp-server` — MCP endpoint details.192- `opp-repl-shared-terminal` — co-drive one REPL with a human.193- `opp-repl-sandbox` — isolate `execute_python` under bubblewrap.194- `opp-repl-cli-tools` — shell-only alternative.195- Every task-specific `opp-repl-*` skill referenced above.