Changelog¶
Unreleased¶
- Appearance format: a conveyor look's colours are the engine's material table, item forms are in the engine, and
nagasim.appearance(provisional) gives an outside rendererlook_of,material,forms_of, the colour helpers and a piece's place on the floor (piece_start,piece_segments,piece_pose,piece_length_m);frame_coloralso takes#RRGGBB, and every coloured frame, named or#RRGGBB, is drawn as paint; a pallet line above 0.2 m gets legs every 1.5 m by default and its drive hangs beside the frame (D1482-D1492). Existing raised pallet lines (above 0.2 m) now get legs by default, and "This piece only" keeps an explicitleg_spacing. -
A conveyor's look is a setting of its own (D1470-D1481): width, height, frame colour, belt kind, roller pitch, diameter and finish, legs, drive side, side guides with openings, chain strands and belt pulley, set for a whole line or one piece in Properties or by
update_block, drawn in 2D and 3D, and never read by the timing; an item shorter than three roller pitches raises the warningW_CONVEYOR_ROLLER_PITCH. An untouched file keeps its bytes and its results. Added: -
Agent tool
apply_editsapplies a list of model edits in one call, as one undo step and with one validation, so a build of thousands of pieces stays linear; the first failing edit stops it and nothing is applied. - Run log levels: a run records at
kpi(the summary frames),series(plus the time series) orfull(plus the three per-event logs), or a profile,study(kpi),exploreorreplay(full). Give it asrun_model(..., log_level=),simulation.log_levelin the model file ornaga run --log-level;optimize,run_designandcalibrateand the agent toolsrun_model,optimize,calibrateandfit_surrogatetake it too.Results.log_levelnames the level, and a frame or KPI the level left out raisesNotRecordedError(a KeyError) naming the level to re-run at; the agent tools answerE_NOT_RECORDED. - A study response or constraint
timeseries/<series>/maxor/mingets each replication's peak or low. - Conveyor lines on the floor: a CONVEYOR with a
pathof straight and arc pieces has the portsin,outandd<k>, and links name them withsource_portandtarget_port. A belttype(belt,roller,chain,pallet,mdr) sets datasheet defaults (belt,rollerandmdrstand 0.762 m, the knuckle height for loading by hand), and an entity type'ssizemakes an item take its own length on a typed belt. Belts gainzones(zero-pressure accumulation),releaserules (metering, singulation, slug), routing rules with alimitper exit, divertangle, reversible belts that turn as one chain, and the CONVEYOR_TRANSFER block (popup,turntable,lift). The bundled modelconveyor_lineshows a line built this way. - Area links: a link may carry a
delayand acapacityin place of drawn conveyors, reported in thelink_flowframe. - Conveyor checks and results:
W_CONVEYOR_OPEN_PORT,W_CONVEYOR_OVERLAPandW_CONVEYOR_SNAPon the floor, two run guards, andsimulation.strict_checksto make them errors; run warnings reachResults.run_problems. The framesconveyor_flow,conveyor_zones,transfer_summary,route_holdsandlink_flowappear only when a model uses the feature.expose: truewrites a belt's or a transfer's state as variables (VAR("B1.running")). - Agent tools for floor lines:
place_piece(withsnap_to, andgap,delay,capacityfor an area link),place_transfer,place_feeder(a belt whose end merges into a trunk's side),get_portsandcheck_layout.set_layoutmoves a floor piece by one rule: it unlinks the joins that no longer meet and lists what it dropped. - Agent tools
set_model_info(a model's title, category, description, author and notes) andsave_model(short=True)(the short file form the bundled models use; the default stays long). - Python:
nagasim.core.floorholds the floor pieces' rules (ports, open ports, a merge point, adding a piece, the move rule), as free functions over aModelDocument. - A CONVEYOR piece with
one_loadcarries one load at a time and clears when the load's tail is past its end, which gives the divert's clearing time and the merge belt's one zone.
Changed:
W_CONVEYOR_OVERLAPno longer flags two branches of one belt that cross only where both leave it, as the stubs of a left-right divert do; branches that run side by side beyond that are still flagged.- Parallel runs on Linux start their workers from a fork server preloaded with the engine, not by fork: forking a parent that runs threads could deadlock and warned of it on Python 3.12-3.13. A start method the caller set is kept.
- Studies, DOE and optimisation run at the lowest level that records their KPIs (kpi for plain KPIs). A run with no level records full, as before, and a legacy
record_logs=Falserun keeps its frames. forecast(...).resultsis a series run: itsentity_logno longer holds the live entities at the end, and the ten queue and store snapshot columns, which were empty, are left out.- Breaking for readers of results: in the
link_flowframe the columnTransfer Timeis nowAvg Delay, and a link with capacity 0 has no row, since such a link is instant (model schema 32). A link's oldtransfer_timemigrates todelay. - Faster runs: a plain visit makes about 42% fewer calls, with results identical. The engine now needs SimPy 4.1.2 or later (below 5), since it follows 4.1.2's own put and get code.
- Python:
Resource.queueis acollections.deque, so it cannot be sliced; uselist(resource.queue).
Fixed:
- A failed or error-answering edit inside an assistant turn now undoes only itself, not the half-edit it left in the turn.
- Playback keeps a part on the belt it moves to: the last belt's "off", written after the next belt's first stage, took it off the new belt, so the parts on zoned and metering belts were missing from
Timeline.state_at()["belts"]. Older traces read right too. - An area link writes a
link_transittrace event as a part enters it, and playback shows the part in transit along the link for its delay instead of at the target. A trace without the event reads as before. - The HTML player (and the video's tape) draws an entity type's colour given as
#rrggbb, asset_entity_typeswrites it; it drew black, since only palette names were read.
0.21.0 (2026-11-17)¶
0.21.0 makes answers readable and results lean. A study's write-up, control room and slides open with Yes, No or Not clear yet, judged from each goal's 95% interval, explain the terms they use, and write "not valid" with the reason in place of a number a law check refuses. A person can record their own check that the model matches reality, and validation checks the whole model, naming the nearest valid key. Breaking: run_model and run_scenarios return only the result frames that have rows, and MCP tools answer with typed structured content.
Added:
uncertainty.input_uncertainty_frame(...)gives input uncertainty as a table, one row per KPI (run counts and notes in.attrs), andnaga uncertainty --out FILEwrites it as CSV or Excel;input_uncertaintystill returns its dict.api.new_pool(workers): a process pool to pass aspool=whose workers report they are up, so a worker that never starts ends the run with an error instead of hanging it. A plainProcessPoolExecutorstill works, without that check.- Studies: a person can record their own check that the model matches reality, with the live room's "I checked this" form or
naga study confirm FOLDER --text ... --against ... [--by NAME] [--failed]. Only the engine (study_validate) or the person makes the validation item pass; an assistant's note reads "reported, not checked", and a check reopens when the model's blocks or links change. - Studies: each option's difference from the Baseline comes with its paired 95% interval (
diff_vs_baseline, common seeds), a modest note when a goal KPI is markedly steadier, and goal tables that lead with the recommended option. - Python:
Results.interval(key), a shortrepr, andrun_modeltakes a bundled model's name. naga --version, the nearest command for a misspelt one, and a short table fornaga scenarios.
Changed:
- Breaking:
run_model(andModel.run) returns only the result frames that have rows, plussystemalways; a single server now gets 7 frames instead of 33. Code that indexed an empty frame such asresults["store_summary"]now gets a KeyError naming the change: useresults.get("store_summary")or"store_summary" in results, orrun_model(..., keep_empty=True)for every frame.record_logs=Falsetherefore leaves the empty log frames out.run_scenariosfollows the same rule for each scenario's results, with the samekeep_empty=Trueopt-in. - MCP: every tool declares a typed output schema and each answer is sent once as structured content with a one-line summary (breaking for clients that parsed the text answer).
naga run --jsonrows carrykeyandci95; the old field names are deprecated.-
Long tools (
study_step,study_validate,optimize) report progress and can be stopped between replications. -
naga pluginslists the plugin folders that load (and honours--no-plugins); an unknown--exportformat is refused before the run with exit 2. - Every command on the hand-written documentation pages runs in the release check; the SimPy page's example and the quickstart notebook run as written.
- MCP and agent tools: each profile's instructions name only the tools it publishes,
find_toolis in every profile, closed sets are enums and list arguments declare their items,study_startreturns the study guide's key sections (whole guide atnaga://guide/study), andstudy_stepacceptsmodel=orpatch=. - Validation walks the whole model: a misspelt key at any level is
W_UNKNOWN_KEYwith the nearest name and is kept on save; scenario override paths are checked (W_SCENARIO_PATH); new codesE_FIELD_TYPE,E_RUN_BLOCK,E_MODEL_JSON.
Fixed:
- A task error at the same time as a pool worker that never starts no longer hangs when the pool closes; the run raises the start error, with the task error as its cause.
- A process-pool worker that never starts now ends the run with a clear error after 120 s at any start-payload size, instead of hanging until the pool closes.
- A zero, negative or empty distribution value is
E_DIST_PARAM_VALUEbefore the run, and a run error names its block on one line. Now refused where they ran before: a Triangular out of order, a Bernoulli p outside [0, 1], an explicit null number. - A wrongly shaped tool argument answers E_BAD_ARGUMENT naming it, not a raw Python error; an unknown
logic_classisE_LOGIC_CLASS_UNKNOWN. naga fitno longer prints a SciPy FutureWarning on SciPy 1.17 and later.- The live study room refuses a HEAD request on the routes that write.
- On Windows a study, DOE or optimisation whose worker process never started could hang forever; it now stops after 120 s with a clear error.
- The paired interval's bounds are plain floats in a Python answer.
- The PyPI page links the changelog and issues, its README links work, and the wheel ships
CITATION.cff.
0.20.1 (2026-11-11)¶
0.20.1 fixes the defects a review of 0.20.0 confirmed. Models that ran when they should have been refused, wrong study numbers, a resumed run that differed from the whole one, and trusted code that could change unasked are each fixed and kept fixed by a test. Bundled models give the same results as 0.20.0.
Changed:
- A warm-up at or past the run length is refused (
E_WARMUP_PAST_END) at validate and at run, never a table of zeros. - Model files keep keys this version does not know, with a warning naming the nearest valid key, and record the version that wrote them (
info.written_by,W_WRITTEN_BY_NEWER); the schema ismodel-v30.json. - An optimisation penalty always makes a point worse, also when the goal is max; a negative weight used as a workaround now has the opposite effect.
- Trust in a plugin folder is pinned by a digest of its top-level Python files: a changed folder loads nothing until a person trusts it again, and existing entries are asked about once.
naga study rerunreruns the versions and lists a folder'sreproduce.jsonsteps;--stepsor--step NAMEruns them.naga --no-pluginsruns without plugins, also in worker processes.
Fixed:
- A DECIDE that no branch takes is
W_DECIDE_NO_ELSEat validate and one line at run; a choice outside its list or a negative jitter isE_DIST_PARAM_VALUE; a JSON file with no model section is refused on open. - Studies: the optimisation baseline is the model's own values; capacity sizing stops on a plateau; a study step runs the scenarios that validate; sensitivity skips a variant the model cannot run; an unknown KPI is
E_UNKNOWN_KPIwith the nearest name; a goal named as a results key (system/...) is judged like its bare name;naga study numberschecks every registry tag and reads a decimal comma only for a write-up whoselanguagewrites one. - A run resumed from a state serves a jittered timetable's remaining times and counts queue-row slots as the uninterrupted run does; including a load mid-lift and a state taken at time 0; slot counts stop at the run's end. A state may carry
blocks.<row>.frees. - The trust store is never written over when it does not parse, and a policy whose name resolves to another module is refused before import.
- Study pages and the report run no script; a run player is titled by its question and its trust card names the warm-up the run used; the study deck's options table continues on further slides; the monitor folds tables unless something is wrong.
- Italian pages (
--lang it): the monitor's forecast, alerts, scores and event lines and the time units are in Italian, and tables wrap between words on a phone instead of inside them. - The source package no longer ships the tests.
0.20.0 (2026-11-08)¶
0.20.0 adds yards, plugin results and study checks. Layout-only cranes and stockpiles sections and queue rows with slots show lifts, piles and full rows in playback, and a run counts the arrivals that find a row full. A plugin block can record its own KPIs and hand objects to the caller, and the plugin folders and Python policy files a person trusts live in a per-user store. Optimisation gains percentile and composite objectives with holdout seeds, and a study folder can be rerun step by step and its write-up numbers checked. Bundled models give the same results as 0.19.0, except level averages in three hybrid models, which differ in the last digit.
Added:
naga run --player,naga scenarios --playerandnaga viewerdraw the model's floor plan: its building, or an SVG or PNG background read from the model's own folder.experiments.run_scenarios(logic=...)takes the caller's LOGIC module, asrun_modeldoes.nagasim.optimize.METHODSlists the optimiser's methods with the packages each needs.- A bundled model,
belt_points: one belt with stops, a divert and a merge. - Layout-only
cranesandstockpilessections: overhead and gantry cranes whose traced moves between served blocks are drawn as lifts, and store blocks drawn as piles keyed per area. A run never reads them, so they cannot change a result. - A block's
queue_rowmay giveslots(withlabelandfrees); a run counts the arrivals finding the row full in aslot_summaryframe, present only when a block gives slots. - FixedSchedule takes
jitterandjitter_law: each listed arrival shifts by a random amount drawn per replication from the CREATE's stream, kept in order. - Plugin results hook:
ctx.record_kpi(name, value)andctx.add_artifact(name, obj)from a plugin block fillResults["plugin_kpis"]andResults.artifacts, present only when a plugin recorded something; studies and the workbook carry the KPIs. - A per-user trusted-code store (
nagasim.settings.trusted) of plugin folders and policy files, read byload_pluginsbesidesNAGASIM_PLUGIN_PATH; an agent can only add an entry switched off.info.requires_pluginsnames the plugin types a model uses, andE_PLUGIN_NOT_LOADEDa listed type no loaded plugin provides. naga checkand the agent tools open a model as the editor does, read its errors, then run it.controllers=passes through every study function, andnaga run --controllers MODULE[:NAME]takes them from your module (NAME defaults toCONTROLLERS).optimizetakesstatistic(a percentile),penalties(a composite objective),holdoutandholdout_seed(the winner rerun on unseen seeds) andbaseline(the current design as trial 0).experiments.size_capacityfinds the smallest capacity that meets a criterion on paired replications.tornado(scenarios=..., secondary=...): named structural changes as low/high override sets, and a second KPI that breaks ties.naga study rerunalso runs a folder'sreproduce.jsonsteps in fresh processes with time limits and compares their output hashes;naga study numberschecks the write-ups' tagged numbers against their source files.- The HTML player draws slot rows, piles and crane lifts, follows a token into its group and shows a carrier's load (
nagasim.core.grouping). logic=and--logicreachoptimize,run_design,calibrateand the other study functions, andnaga doe,naga optimizeandnaga calibrate, so a study runs the same logic as the single run.naga mcp --toolstakesbuild,run,studyandtwinas well ascompact; the default is unchanged.- Player, viewer and twin monitor pages in Italian:
--lang it(naga run --player,naga scenarios --player,naga viewer,naga twin --monitor) orlanguage="it". naga viewer --pyodide cdnandbuild_viewer(pyodide="cdn"): a viewer of about 3 MB that loads the pinned Pyodide from cdn.jsdelivr.net, checks every file against the hash in the page and refuses to start on a mismatch or with no network. The offline file stays the default.- An asset's graphics may name seats (
queue_slots): waiting entities sit on them in order, then queue in the usual row. - A placed asset may turn its own waiting row;
W_QUEUE_ROW_CROSSINGwarns when a row runs through another place.
Changed:
workers="auto"uses up to 8 processes (was 4) and starts a pool for less work on Windows and macOS.- Faster nearest-vehicle dispatch on large path networks and faster composite-state checks for agents. Results are identical.
- The hybrid levels solver re-solves only the groups of levels whose flows or bounds changed, and levels no flow touches are no longer integrated on every update: about 2.3x faster on the 100-copy line model. Level averages may differ in the last digit.
- A run keeps about a third of the memory per finished entity (packed resource and entity logs, float sample arrays), and the resource log table builds faster on long runs. Results are unchanged.
- The offline viewer is about 35 MB instead of 41 MB: it carries only the parts of its numerical libraries a run uses.
Removed:
nagasim.viewer.engine_on_disk, the old name ofengine_available.
Fixed:
- Study numbers are compared after rounding half up, as a report writes them.
optimizerefuses holdout seeds that overlap the search's seeds.- The controllers pickling check covers a caller's own process pool.
0.19.0 (2026-10-28)¶
0.19.0 adds the building around a model. An optional building section holds rooms, walls with a height, thickness and finish, doors that stay on their wall, floor markings, labels and fixtures; a run never reads it, and two new checks flag a path through a wall and a door on no wall. naga run now prints a summary with intervals and law-check warnings. Bundled models give the same results as 0.18.0.
Changed:
naga runprints a summary (mean, 95% half-width and n per system KPI), aWARNline for each law check the run did not pass and the replications a +/-5% half-width needs;--rawkeeps the old per-replication frame dump,--jsonprints{kpis, checks, replications}and--no-checksskips the checks. A run cut short exits 1 with "stopped" on stderr.naga check --jsonprints{problems, laws, results}for one model.naga runhides the all-zero cost and log-truncation rows of its summary;--rawand--jsonkeep every row.naga verifygives each case its own random numbers;--blocks Kreports how many independent runs' 95% intervals hold the theory.nagacommands print a model's validation problems with code, path and hint, asnaga validatedoes.- A DECIDE in Condition mode with no true condition and no ELSE link stops the run with the block named, as Chance mode does, instead of stranding the entity with a log warning.
- The player calls a snake_case block id by its words ("get_bay" reads "Get bay") in labels and the bottleneck callout.
- The viewer names its first tab after an author's scenario that changes nothing, and lists that scenario once.
ModelDocument.savewrites a temporary file and swaps it in, so a crash mid-write leaves the old file whole.nagasim.viewer.engine_available()replacesengine_on_disk, kept as an alias for one release;write_engine_zipwrites the engine payload a viewer carries.freeze_data(..., confine_to=FOLDER)reads file data sources from that folder only, for a viewer of a model someone else wrote.
Added:
Results.checks()runs the law checks (utilisation, offered load, Little's law, flow conservation, censoring, initial bias) once on demand; in a notebook a result shows its warnings above the KPI table. Results themselves are unchanged.- "Did you mean" suggestions for misspelt block and distribution parameters;
E_ASSIGN_KEYfor an ASSIGN entry key other thantargetandexpr; literal DISC probabilities and TRIA(low, mode, high) ordering are checked at validation.ModelValidationError.structuredcarries the problems. run_model(logic=...)andnaga run --logic MODULEtake LOGIC block classes from your own module, withnagasim.core.custom_logicas the fallback; this works withworkers > 1.- A warm-start state carries belts with stops, diverts and merges at any instant without an event due.
- MCP: a client that sends a progress token receives progress notifications from run_model, run_scenarios, run_to_precision, forecast, optimize, calibrate, fit_surrogate and study_step.
nagasim.run_model,nagasim.Modelandnagasim.Resultsare importable from the package.- An optional
buildingsection, in metres: rooms (rectangle or polygon, walled or not), free-standingwall_lines, a wall height, thickness and finish, doors and curtains, floormarkings, labels and fixtures. It is validated and kept in the file, and a run never reads it, so it cannot change a result. The schema version stays 29. - A building opening is attached to its wall,
{"wall": {"room": NAME, "edge": K} or {"line": INDEX, "edge": K}, "at": 0..1, "width": M}, so it follows the wall when the wall moves; the older two-point form (a,b) is still read. - Floor markings: a line or closed area in a RAL signal colour (by name) or
#RRGGBB, solid, dashed or hatched, with a width and an optional label. nagasim.core.buildingderives the walls once for every drawing program:wall_runs,wall_pieces,wall_crossings,opening_endsandattach_opening.- Problem codes
E_BUILDING(a malformed building section),W_WALL_CROSSING(a path segment crosses a wall where it has no opening) andW_OPENING_OFF_WALL(an opening that cuts no wall). - A
presentationcapability (nagasim.core.sections.CAPABILITIES) owns thebuildingsection. E_ASSET_UNKNOWN_NAME: a library check places one instance of each asset and names an unknown name in a definition's expression, with the closest parameter.- Player:
pictures={"background": {...}}draws a floor plan (SVG or PNG, JPEG, WebP data URI) under the layout view. On a plan the view shows the plan, people and fleets at twice their size, and "Show model blocks" brings back the wiring; the viewer gives a plan the page's width and carries the author's pictures, so a run made in the browser draws them too. - Playback: fleet seize and release events carry the unit, and
Timeline.state_atgainscarriers, which entity holds each fleet unit. nagasim.experiments.headline_keys(means)picks the few KPIs that say what a run gave.- A bundled model,
ed_bedside_scan: a small emergency department with two pathways, two scenarios and a building.
Fixed:
- A state now carries when the last part left a belt's end, so a warm start after a recent exit matches the uninterrupted run.
- A LOGIC class that does not exist makes
naga runexit 2 with the class named, instead of a traceback. naga --helpanswers in well under 0.1 s, andimport nagasim.apino longer loads openpyxl.InverseGaussian(mu, lambda)has meanmu; it had meanmu * lambda. Input fitting writesmuto match, so a fit still reproduces its data. A model that uses it draws new values; the bundled models do not.- A CREATE with a FixedSchedule arrives at its listed times only; it no longer makes an extra entity at 0 or at
start_time. - Auxiliaries in a model with no level, flow, conversion or delay advance with the clock, so
TNOWandRAMPare no longer read once at 0. - The cpsat planner keeps a multi-entity order's entities back to back at a single-unit station, as the replay of its one planned start does.
0.18.0 (2026-10-26)¶
0.18.0 widens what a model can say about real logistics and energy sites. Trucks unload and load as carriers, AGVs can be kept across legs, belts divert and merge, sorters take up to 200 lanes, EVs charge per vehicle under a site cap, storage can be dispatched by an optimiser, and robots share named safety zones. Bundled models give the same results as 0.17.0.
- Trucks are carriers: SEPARATE
carrier: keepreleases members one at a time (FIFO or LIFO) while the carrier leaves on its own link, and BATCHcarrier_typeloads members onto an arriving carrier up to its own capacity or a cut-off. Logistics 3.0.0: the inbound dock unloads pallet by pallet and the truck can leave bytrucks_out; empty trucks are loaded at a new Truck loading dock; door times are statistics. - TRANSPORT
keep_vehiclekeeps a vehicle for the same part across several legs (an AGV that waits at a machine and carries the part on), freed by a RELEASE naming the fleet or when the part leaves;fleet_summarygainsHeld %(all zero in models that do not use it). - Conveyor
diverts(a part leaves the belt at a point onto its own link, waiting or riding on when the target is full) andmerges(a side stream joins at a point on a gap), withconveyor_divertsandconveyor_mergesframes anddivert/andmerge/KPI keys. Conveyor stops getstop/<belt>/<index>/<column>KPI keys, andW_CONVEYOR_STOP_HELDflags a stop that seizes a resource the part still holds. Fixed: a zero-time belt stop no longer slows a free-flowing belt. - Logistics 3.1.0: Sortation with 1 to 200 lanes and an optional reject chute (
max_recirculations); a submodel definition can repeat a block group by a parameter (repeat), each copy with its own port. - A new CHARGE block and the Energy asset "EV charging (per vehicle)" (Energy 1.6.0): each vehicle charges at its own and its charger's power under a shared site cap, so a small site's peak demand is right.
- Optimal storage dispatch: a
dispatchsection plans storage on a rolling-horizon linear program over the site's tariffs and profiles, with a perfect (model) or naive (persistence) forecast and a fallback to the battery's own rule; Energy 1.7.0 adds the battery'soptimalmode and adispatch_summaryframe. - Safety zones: a
zonessection that robots and cobots share by name, measured along the paths or in a straight line. Automation library 2.0.0: the Safety zone owns its radius. - Supply chain library 1.3.0: the Warehouse can draw from, report on and refill another asset's stock; its default is unchanged.
- A seize of more than one unit, from a resource set or a plain resource, now gets all its units at once or none: a waiting seize holds nothing, so utilisation, busy cost and shift or failure timing are exact.
W_SET_PARTIAL_HOLDis removed. Fixed: a crash when preempting a multi-unit seize. - A Condition HOLD whose
LEVELname is computed now wakes at every level change, not only on its scan. - Network: an
http(s)data source connects to the very address that was vetted, at every redirect hop. An https source works behind a proxy the caller set (HTTPS_PROXY/NO_PROXYor the system settings) as a tunnel, with the host checked first and the certificate verified by name; plain http through a proxy is refused. Caller files (--refit,--setpoints,--connections, outbox, audit,--asked, twin results) are read under one rule: a local regular file, no link, a size cap. --asked FILEonnaga run --player,naga scenarios --playerandnaga viewerquotes recorded input-uncertainty and ABC answers on the trust card.- The plant monitor takes a setpoints file: a setpoint recommendation shows the range, step and interval it would be written with, and approving it writes the reply for
naga plc-write. An opt-in OpenPLC smoke test coversplc-writeagainst a real soft PLC. --export "usd:PATH?fps=..&start=..&end=..&speed=..", and the USD replay draws asset state lamps and fill bars.nagasim.modeldiff.record_changes(a, b): record-level changes (section, key, label, kind, old, new) onnaga diff's identity rules.
0.17.0 (2026-10-26)¶
0.17.0 helps a model stay readable and lets a picture follow a run in more detail. A block or instance name over 20 characters now draws a warning, the playback state counts departures per exit and what ended in each sink, library assets can carry a small line icon, and auto-layout spaces blocks by their real width. The bundled models use shorter names, which changes results in four of them (see below).
W_LONG_NAME(warning): a block name, or a library instance name, over 20 characters. It checks instances nested in a submodel definition too, once per name.- Playback:
Timeline.state_atgainsdepartures(moves out of each block per outgoing branch),departed(the same moves summed per block) anddisposed(what ended in each sink), the data behind per-exit counters. - Blocks accept
counter_offsets, a dict that moves a counter beside an exit; the builder stubs carry it. - Auto-layout spaces blocks by their drawn width, so long names no longer overlap their neighbours.
- Library assets take an optional
graphics.icon, an SVG line icon under 2000 bytes that passes the same safety check as state graphics. The 89 bundled assets (airport, container terminals, energy, biogas, supply chain, system dynamics, agents, manufacturing, demo, automation, logistics, services) each ship one. - Bundled names are shorter: the
clinic_librarymodel and the three agent-based models that had names over 20 characters now use shorter ones. Their random draws follow the names, so each draws a new sample that is statistically equal to the old one. Every other bundled model gives identical results on two seed sets.
0.16.0 (2026-10-23)¶
0.16.0 makes a result say how far to trust it and lets the twin act on what it sees. Input data now carries its own uncertainty, a twin raises alerts on sustained shifts and proposes a refit for you to approve, and a recommended setpoint can be written to a soft PLC on request. Conveyors gain stops, models gain entity-path checks, and reinforcement learning, ABC calibration, a paced clock and a SimPy log helper join the toolbox. Results keep their values except for one case: an accumulating conveyor whose end blocks.
- Input uncertainty:
naga uncertainty MODEL --data PATH=FILE[:COLUMN]and the toolinput_uncertaintybootstrap each input's data, refit it in its best-fit family (arrival tables by whole cycles) and rerun the model on common random numbers. Each KPI gets its run interval, its input interval and the input's share of the spread.what_ifquotes the input spread asinput_noteand never runs one itself. - Twin: a two-sided CUSUM raises an alert when a series shifts and stays shifted (
--alert-k,--alert-h;W_TWIN_ALERT). After an alert,naga twin --refit FILE(needs--outbox) calibrates the factors you name and proposes the candidate only when it beats the current model's pinball loss; an approved reply adopts an overrides layer intwin_history.json, and the model file is never written. - Advisory setpoint writes: a
setpointcandidate names a tag of your--setpointsfile, andnaga plc-write(its own process, the only writer) sends an approved one to a soft PLC over Modbus TCP (function codes 6 and 16). It is a dry run unless--write, checks range, step and interval, reads the value back and audits before and after. Loopback only. - Conveyor
stops({at, time, resource?}): an accumulating belt packs against a stop and caps each section at the gap divided by the spacing; a non-accumulating belt stops whole. Adds theconveyor_stopsframe,E_CONVEYOR_STOPand abelt_stagetrace event per stage change.W_SET_PARTIAL_HOLDwarns on a set seize of quantity above 1. - Entity-path checks: the optional section
path_checks(order,never,at_most,always, optional entity type) is judged on one traced replication, andnaga checknames the entity and the time.naga discoverwrites up to four of each from an event log. calibrate(method="abc")andnaga calibrate --method abc --accept: rejection ABC over the factors' boxes keeps the nearest 5% (at least 20) and reports each factor's posterior median and 90% interval; the budget is a hard cap.- Reinforcement learning:
SimEnv.as_gymnasium_env()gives a gymnasium environment that passescheck_env;others=drives the other Policy DECIDEs (shortest queue by default) so one policy trains at a time; data-only JSON policies (table, linear) run withnaga policy-eval --policy-file. The recipe for Stable-Baselines3 is in the docs. - Paced clock:
run_model(pace=FACTOR)andnaga run --pace FACTORmake a model second take 1/FACTOR wall seconds; late events run at once and are counted inResults.pace. One worker only. nagasim.simpylog.EventLog, a stdlib helper that writes the CSVnaga discoverreads from a plain SimPy script; the new page "From a SimPy script" shows how. Naga never runs the script.- What next: study answers carry the top three ranked next options (fix, then missing, improve, extend) from recorded facts,
get_model_summarycarries them, and the control room has a What next? button. An allow-listed hosted model can add up to three checked ideas labelled "assistant"; they are never run automatically. explain_kpiandnaga explain MODEL KPI [--set PATH=VALUE]rank what drives a KPI with 95% intervals (level mode) or what a change does (paired differences, with one suggestedwhat_iftest that is never run).optimize,calibrateandfit_surrogateanswers carry operational-law warnings (laws) from one extra batch at the best point;fit_surrogate(confirm_top=N)confirms the surface's best suggestions with KN selection.- Trust card: the player and the viewer show run noise, input data and parameters as three rows with their bases ("not measured" when absent); the control room folds the same panel and the study deck has a "Validation and precision" slide.
naga study deck FOLDERprints the deck toslides.pdfwith a local Chrome or Edge. - Client pages: the player and viewer follow the editor's theme (light and slate-blue dark), with KPI cards, a bottleneck callout, "What happened when" lanes, results as interval bars with a word, scenario tabs, levers with notes and an answer card. New optional dashboard fields
question,targetandnote. The player plays in real model time, from 1x to 1 year per second. - Results change in one case: an accumulating belt whose end blocks now lets a part reach the end no sooner than spacing divided by speed after the one ahead left. In the bundled
warehouse_forklifts, the belt's Blocked % falls by 0.01 to 0.03 points and throughput is unchanged. Every other bundled model gives identical results on two seed sets.
0.15.0 (2026-10-22)¶
0.15.0 makes a run easier to trust. Every run now checks itself against the operational laws of queues, naga facts lists what happened in a run that nothing else reports, naga verify checks the engine against textbook queues, and what_if answers a change with a clear verdict. Reality checks gain eventually and time windows, and an agent can now see the model as a picture. Results keep their values; the system frame gains one measured Avg WIP row.
- Every run checks itself against the operational laws (
nagasim/laws.py): utilisation, offered load, Little's law per resource and for the system, flow conservation, censoring (over 5% of the entities still inside at the end) and initial bias (no warm-up while MSER-5 would move the mean by over 5%). They are warnings that name the law (W_LAW), skipped wherever an input cannot be computed, shown in therun_modeldigest, the study steps andnaga check. - The system frame gains
Avg WIP, the time-weighted count of entities in the system;Avg WIP (Little)keeps its values and is a lower bound when work is still inside at the end.resource_summarygainsQueue Length at End. naga verifyruns nine textbook queueing cases against their theory (a pass is within the larger of three confidence half-widths and 2%);--quicktakes about 20 s, and--htmlwrites a report.- Agent tools:
what_ifanswers "what if I change this" on paired common random numbers, doubling replications until each KPI's difference is clear or a cap is reached, and calls it better or worse only when told the goal's direction;check_draftcompares a generated model with its source's own figures (an event log or tables) and never calls it valid.run_scenariosrows gainReplications NeededandCRN Ratio. naga facts MODELruns one replication and lists what happened that nothing else reports, as facts, never verdicts: blocks no entity entered, resources never seized, resources with a unit doing no work (free, or held by an entity waiting for another resource) while entities waited for them, and entities left at the end ("never empty since t").--jsonfor scripts; exit 0 whenever the run happened. The same report is the read-only agent toolrun_facts.- Reality checks:
whenalso acceptsbefore <t>,between <t1> and <t2>andeventually, alone or with one of those windows: an eventually check passes when the constraint holds at least once in the window, and says so when it already held at the window's start. Therun_reality_checkstool answers each check's note. view_model(model, format), a read-only agent tool, draws the model's flowchart as a PNG image (SVG or text on request), so an agent can see what it built.- Optimisation:
method="optuna-gp"and"optuna-nsga2"(a Pareto set of two or more objectives), with themlextra; single-objective top candidates are confirmed under noise by KN selection, and GP falls back to multivariate TPE without torch. - A Modbus TCP reader for the twin: read-only (function codes 1 to 4), stdlib, with the host, unit and register map only in the caller's connection file.
calc_kpisis about three times faster on short replications, with identical results.- A physics-simulated test plant for the twin: five minutes of an Open Industry Project box belt (MIT), recorded headlessly, with a model and a plant map that replay it (
tests/data/oip_belt_line,tools/oip_trace_to_log.py). The digital-twin page has a section on it, with an OPC UA recipe for Open Industry Project's desktop app that has not been run yet. - Fixed: undo and redo inside an open transaction (an assistant turn) popped the edit made before it;
debug_inspectcounted a seize of several units as one busy unit; a twin whose plant map has counters only scored its WIP forecasts against a WIP of 0 it was never told.
0.14.0 (2026-10-21)¶
0.14.0 adds an offline backup for the Haiku tool picker. When Haiku cannot answer (no key, no network, an error), a local cross-encoder ranks every tool, so find_tool still puts the right one first. The cross-encoder also loads in the precision that suits the hardware.
naga mcp --tool-picker haiku --tool-picker-backup PATH(optional, off by default): PATH is a local folder or a Hugging Face id of a CrossEncoder model (thepickerextra). It is used when Haiku cannot answer and ranks every tool the server exposes, not onlyfind_tool's ten best; with no API key it runs alone.- A cross-encoder loads in float16 on a CUDA GPU and in float32 on a CPU: the same top pick on 549 test rows, about three times faster on a GPU, and six times faster than float16 would be on a CPU.
- The page Pick tools with a small model quotes the new evidence over all 90 tools (Haiku 190 of 274, a gte backup trained from Opus picks 183).
0.13.0 (2026-10-20)¶
0.13.0 lets an assistant run a whole simulation study through the engine: a study folder with the question, goals, assumptions, checks and every model version; a live control room in the browser with buttons that act and an assistant of its own; and the deliverables on request. An assistant finds the right agent tool with find_tool, optionally helped by a local or a hosted tool picker. The mcp extra now needs mcp>=1.19.
- Block types and distributions have a full plain-language summary:
list_block_typesgives a whole first sentence andlist_distributionsentries gainsummary(what it models and a typical use), so an assistant or a small model picks the right one more often. The NegativeBinomial description now says it counts failures before the r-th success. - The control room's own assistant shows its answers' Markdown, reads them aloud in the answer's language (or stays silent when no such voice is installed), sends on Enter, never pastes the room's link, and marks a call that failed in its panel; on Windows it also finds an
ANTHROPIC_API_KEYstored for the user withsetx. With a tool picker on,naga mcpanswers its client at once and loads the picker in the background. naga mcp --tool-picker haiku(optional, off by default): hosted Claude Haiku chooses among every tool the server exposes and its three picks leadfind_tool's answer (22 of 25 first on the frozen blind set, about 0.9 s). Needs theassistantextra andANTHROPIC_API_KEY; each query and the tool catalogue go to Anthropic, and any failure keepsfind_tool's own order.naga mcp --tool-picker gte(optional, off by default): a small re-ranking model (gte-reranker-modernbert-base, thepickerextra) reordersfind_tool's ten best candidates, and the answer says to try the first three in order. On the frozen blind set the right tool comes first for 14 of 25 requests (8 without it), in about 0.1 s on a laptop GPU; the first use downloads the weights from Hugging Face. New page: Pick tools with a small model, with the comparison and a link to the System-1 AI Gateway for other models.- AI-run studies have a live control room:
naga room <study folder>, ornaga mcp --roominside the assistant's own server, serves it on 127.0.0.1 with a random token; it updates itself while the chat works and has buttons that act (this answers my request, not quite, next iteration, approve plan, show flowchart, revert, run sensitivity, and make or open each deliverable) and its own assistant (study tools only, Stop, optional voice input; an Anthropic API key or a local model). Every study answer carriespage_urland, while a room runs,room_url; in MCP Apps chats the page shows after every study tool. A second naga process that tries to change an open study is refused (E_STUDY_BUSY). find_tool(query): a deterministic search over the agent tools (names, descriptions, argument docs, a small synonym table) so an assistant finds the right tool instead of guessing a name; an unknown tool name now answers close typos plus search hits, and on a server with a tool subset both only name tools that server exposes. Measured on blind queries written from the tool names only: the right tool in the top 3 for 14 of 25.- AI-run studies, on request: a sensitivity analysis (
study_sensitivity), verified candidate modules (study_extensions: shifts, failures, an arrival peak), a GIF of the model running (study_animation), a paper-style write-up (study_writeup) and a slide deck (study_slides), all from the study folder; the precision pass now adds replications to the first pass instead of rerunning them; the in-chat control room has expand all and collapse all. - AI-run studies, after the first build: replications come from a precision target (+-10%, 5% or 2% at 95% by study size, capped) and every step states the count and the precision reached; each version makes only the light output, with a version's full report (
study_report), the PNG flowchart and the package on request; the control room fits one screen, with goal chips and collapsible panels; the study tools accept common near-miss input and say what they changed, unknown tool and argument names get "did you mean", the plan and a step take one call each; tail goals ("at most 5% wait over 15 min") and a queue-formula validation (study_validate) are computed by the engine;naga study rerun FOLDERchecks a study reproduces. - Study tools: the scenarios in the model run with every
study_step(same replications and seed, capped by the study size) and come back judged against the goals, per scenario; the control room shows them. The study guide says how to write them and when a shift study differs from a steady-state one. - Study tools, after an assistant ran a whole study through them:
next_stepnames the realstudy_update(changes={...})call; a validation entry needslevelandpassed: true|falseand is refused otherwise, with an example; an unmet goal no longer fails verification; goals on statistics the model records are counted on the cover;study_stepreports the replications it used, which the study size sets. - AI-run studies have a study guide for assistants: an Agent Skills folder (protocol, an interview in rounds adapted from mattpocock/skills, the study steps with their sources) that
naga skillshows or copies and the MCP server offers as therun_simulation_studyandstudy_interviewprompts. - AI-run studies in the chat: in assistants that support MCP Apps (needs the
mcp2.x SDK),study_showopens the control room inside the chat, with buttons to go back to an earlier version and to accept the study with a reason; elsewhere it answers a short summary and the page's path. - AI-run studies have a control room:
control-room.htmlin the study folder opens with the verdict, then the goals and checklist, the target, and the version timeline with flowcharts and KPI charts; it runs no script, prints to PDF and is refreshed after every version.study_packagewrites the deliverable: the page, an Excel workbook, the current model and RO-Crate metadata. - AI-run studies can be seen: every study version keeps a flowchart of its model (SVG and a text list), with the step's changes outlined and the target's unbuilt parts dashed, and
study_viewreturns it to the assistant as a PNG image over MCP. Themcpextra now needsmcp>=1.19, the first SDK that passes an image result through. - AI-run studies: seven agent tools (
study_start,study_status,study_step,study_update,study_add_input,study_revert,study_accept) let any assistant run a simulation study through the engine. The study lives in a folder (the question, goals with KPI ranges, assumptions and sources, validation, inputs, and every model version with its checks and report), so a different assistant or a person can resume it. Each step runs the whole model, checks it (validation, utilisation and flow balance, reproducibility, assumption and goal ranges) and stores it as a version, or as a draft with its problems when it does not run; every answer ends with the next step. Checks end in one of four verdicts (passed, partial, failed, not verified), and a study is "sufficient for its goals" or "not yet sufficient", never finished. New page: Run a study with an assistant. - Docs: the engine site is reorganised for four readers. The landing page opens with the install line and a runnable ten-line example whose printed output the docs build generates; a six-step Learn path grows one model from a queue to scenarios and the event log; the menu is Learn, How-to, Reference, Background, Validation and Release notes, with the reference models, benchmarks, a Citing page and a stability policy under Validation and Background. The Python API reference is generated from numpydoc docstrings whose examples run as tests; the command-line reference has one page per command group; moved pages redirect. Every page has a plain-Markdown copy and
llms-full.txtholds the whole site for AI readers. New Coming from salabim and Mesa pages run the same model in both libraries. - Docs: the Python API reference's Model page lists
run,to_dict,save,definition,linkand theadd_*list builders, and a new Results page coverskpi,kpis,frame,plotandto_excel; every method has a doctested example, and the Markdown copies include them. - Docs: two worked examples on the engine's site, airport ground support and a container terminal, whose numbers and charts come from runs of the bundled models;
turnaround_workloadgains scenarios with fewer ramp agents and belt loaders.
0.12.0 (2026-10-17)¶
One table now holds what the engine knows about each field of a model, and the published schema, submodel flattening and validation all read it, so they can no longer disagree. A minor version, because validation is stricter (a number outside its field's bounds is refused, where a negative level inflow used to crash the run) and a few unused commands and Python names are removed.
- Validation warns when an asset reads a name from a parameter left empty, for example an Equipment draw with no equipment set, instead of failing when the model runs.
- The container terminal and ground support electrification showcases put their chargers' power on the grid through the Energy Equipment draw asset: the
Charging drawflow is now reported per Equipment draw (equipment_draw_1/Nrg equipment, ...), and every other result is unchanged. - Expanding a library asset in place now saves a model that validates against the published JSON schema.
- Fixed: flattening a submodel now resolves
$parameters in a delay'scondition, a fleet's load and unload times, a charger's swap time and a level conveyor's transit time, and a whole-number field such as a fleet'sloadsstays a whole number. - Validation now refuses a number outside the bounds of its field, which the published schema already refused: a zero time series
period, a zero fleet speed, a negativelength_morhoist_time, a zero chargerpower_kw, a negative levelmax_inflowormax_outflow(E_FIELD_RANGE). A negativemax_inflowormax_outflowused to crash the run with a ZeroDivisionError. - Fixed: expanding a library asset or a submodel instance writes its added variables in the same order every run.
- The published model schema takes the bounds the engine accepts:
simulation.timeseries_intervalmay be 0 (no sampling) and a charger'sswap_timemay be a number. The schema's field types, defaults and bounds now come from the same table the engine reads, so the two cannot disagree. - Removed:
naga state observe. A state of the plant comes fromnaga twin;naga state takeandnaga state checkstay. Hints that said "take or observe" now say "take it again" or "write it again". - Changed in the Python API:
report.build_report(twin=)is nowextra_sections=(finished HTML sections; the product builds its MES twin section withreport.esc,fmtandtable), and the values ofexpressions.LOOKUP_SECTIONare tuples of sections ("POWER"reads three). - Removed from the Python API:
costs.COST_KINDS,SimSession.take_events,ModelDocument.set_description_text(useset_info(description=...)) andapi.run_replication. naga twin statuskeeps its head line, source rows and view line, and now prints the forecast and the compared points in the monitor's wording (Status: ok, "N compared points ..."); the "forecast: ..." and "compared: ..." lines are gone, and the notes, counters, scores and recommendations follow the monitor page.naga run --outand--reportgo through the exporters and print "xlsx written to PATH" and "html written to PATH"; the files are unchanged.
0.11.0 (2026-10-17)¶
A bundled model sizes shore power at a berth, and validation catches a misspelt name passed through a submodel parameter. A minor version, because that check can now refuse a model that was accepted before (it would have failed when run).
- Added: a bundled model, shore power at a berth: ships' hotel loads fed from the grid up to the connection and the rest on their auxiliary engines, four like-for-like scenarios and an investment case that says who pays and who saves.
- Validation: a reference function (
POWER,TS,LEVEL,FLOWand the rest) whose argument is a submodel parameter bound to a name is checked like a literal name, in flows, system dynamics records, block expressions anddist_params. An unknown name is reported when the model is checked instead of failing the run; an unset (empty) parameter is not flagged.
0.10.0 (2026-10-17)¶
A model can now be drafted from an event log, and energy reaches every fleet. naga discover
turns a CSV or XES log into a model with a report of how far to trust it; POWER() and
batteries on any fleet price and bill equipment power; the debugger steps back exactly. A
minor version, because flow rates are now read in their own time unit and a tag mixing
units is refused (see the behaviour changes below).
- Added:
naga discover LOGdrafts a model from an event log (CSV or XES): arrivals, activity times, routing by chance or by variant, resources at their observed peak, and a report with a check of the log and next steps;--checkreads a log without drafting. The agent toolimport_event_logdoes the same in a workspace. A sample log (job_shop_log) and a tutorial come with it; the event-log page says how accurate drafts are on three public real logs. - Event logs: suspend and resume are read, so suspended hours no longer count as service time;
--idle-waitsadds a modelled wait before activities that wait long at mostly idle resources;--checkwarns when a log starts empty. - Added:
POWER("name")reads the kW a resource, fleet or charger draws, so energy flows can price, peak-bill and emit equipment power. Any vehicle, worker or gantry fleet can carry a battery;capacity_kwh0 switches it off. - Added: four bundled models, a container terminal from quay to yard, electrifying the terminal, an airport hub day and electrifying ground support.
- Debugger: a block stop may carry a
whencondition or one entity, can be switched off and counts its hits;debug_run(back=True)steps back exactly (a replay from the seed);debug_run(scope=)steps inside one submodel instance. - Scenarios take an optional
goal(text), shown in the HTML report's scenario table. - Submodels: a
dist_paramsvalue can take{"$arg": "<parameter>"}; a block-less asset (a crew pool, a vehicle fleet) owns the resources and fleets it names underscoped. - Orders bindings keep extra columns as order attributes; a column named like an order's own
field or that is no attribute name is skipped with a
W_ORDER_FIELDwarning. - Behaviour change: where a flow's
rate_time_unitdiffers from the simulation's time unit,FLOW(),FLOWSUM(), Avg/Peak Rate, thresholds and thepeak_pricedemand charge now read per that flow's unit, and a conversion with its owntime_unitreportsCONV()per that unit. Validation warns (W_RATE_UNIT_CHANGED,W_RATE_UNIT_READ); flows sharing a tag in two time units are refused. - Behaviour change: a battery fleet with an idle draw now charges while standing idle, and such a run ends at its time limit.
- Builder:
results.kpi("system/Total Entities Completed")reads one KPI's mean; a block's name may be given asname=; anadd_<item>keyword the record does not have raises, as a block method's does. - Added: the bundled model
order_priority_shop, an order shop whose cutter ranks jobs on priority, soexpediteshows its effect. - Fixed: a reality check using
FLOW()orFLOWSUM()no longer crashes, and one usingCONV(),FRACTION()orPOWER()says to read it through an auxiliary;POWER()after a shift change and in a flow price or a conversion feed. - Fixed: unit checks follow a flow's own time unit. The system-dynamics dimension check
expects level unit per
rate_time_unitand reads kW as kWh per hour; a flow threshold'svalueis a rate field, so switching the flow's unit converts it; switching a unit to "base" converts to what "base" means; a FLOWSUM tag built from a submodel parameter is checked as the literal it becomes, and a name computed at run time is checked against every one it may read, or warnedW_RATE_UNIT_UNCHECKEDwhen those differ in time unit.
0.9.1 (2026-10-16)¶
A small release: a keyword for running only the scenarios you name, and documentation that says what the engine is and how to write a model.
- Docs: the home page opens with what the engine is for, what it models, what it does around a run and the three ways in; the README shows how to write a model in Python and as a file; the twin page and the README's limits say what a state from a plant now carries.
run_scenarios(..., baseline=False)runs only the named scenarios;nagasim.dashboard. generated_widgetsgives the charts a dashboard viewer shows for a model that declares none.
0.9.0 (2026-10-16)¶
A twin now follows the plant's orders. A plant mapping reads one row per order from any MES or
ERP, the state carries the plant's order book, and the twin compares hold, release,
expedite and resequence on the forecast. A model's dashboard can hold a Live page read from
a separately started twin. A minor version, because a state now refuses a key the engine does
not know, and 0.8.0 refuses a file with a Live page and ignores an order book.
- The dashboard section gains the
liveactivity (status, view, forecast, recommendations), read by the product's Present mode; schema v29, no bump. A model file that stores a Live page needs this version: 0.8.0 refuses the whole file.nagasim.dashboard.generated_dashboardandinput_forare new. - Fixed: the twin result reader takes regular files only and refuses a UNC path; the bundled
models ship in
naga fmt's form (0.8.0's wheel had them in the long form; they ran the same). - Twin: a twin follows the plant's orders. A plant mapping's
ordersignal reads one row per order from any MES or ERP, anatsignal'sorder_fieldlinks each job to its order, and the state carries the plant's order book, so a forecast releases the plant's orders, each once, and never a held one. The order verbshold,release,expediteandresequenceare built and compared on the forecast likereroute, refused by name where the forecast cannot answer. - Changed: a state refuses an
initial_statekey the engine does not know (E_INITIAL_KEY); 0.8.0 ignores an order book silently. - Fixed: a part past a STATION keeps its
stationin a state from a plant;naga plant mockwith an order signal;heldmust be true or false; a released order from a plant completes in the forecast; a book dropsordersbindings; the schema listsinitial_state.tended.
0.8.0 (2026-10-16)¶
A model can now be written without an editor: nagasim.build builds one in Python, with an
editor completing every built-in parameter, distribution and unit; naga export --python turns
any model into that code; naga fmt writes a model file in its shortest form, and the bundled
models ship that way. A state read from a live plant now covers conveyors, batches, transfers and
robot and cobot cycles, so a twin forecasts the warehouse and automation models from plant data.
A minor version, because two results can change: a block parameter left out of a model file now
takes its published default (a state saved for such a file must be taken again), and a
deterministic Schedule arrival no longer depends on the seed.
- State: a MOTION job mid-cycle and a mobile cobot tending a machine (a pick held by its
machine, a place in progress, each cycle's time) are carried;
automation_cellandautomation_floorare reproduced from a state taken at any time tried. Tending from a plant stays refused by name. - Fixed: a run started from a state with a job in service beside a waiting preempting request no longer crashes or lets it overtake earlier waiters; a MOTION job put in service without a cycle takes a whole one; a cobot trip at a tending station is put back with its place cycle; a tending cycle time, a place into a machine with a queue, and an entry a TRANSPORT takes on with no station are checked on load.
- State: every bundled model that a state carries is now reproduced exactly from it: an order's counters, the order of arrivals due at one instant, and a schedule's offset are carried.
- Changed: in deterministic mode a Schedule arrival comes without a random draw: arrival k comes when the schedule's integrated rate reaches k, so results no longer depend on the seed.
- Changed results: the time-series sampler, its auxiliaries and dashboard widgets no longer
change the level accounting; six bundled models move in the last bits (at most
2.5e-14 relative), no value rounded to 4 decimals. A flow's Peak Rate no longer counts a rate
held for float noise after a warm-up:
sd_population, deterministic, warm-up 32.8, reports 21.403 instead of 21.728. - Fixed: a deterministic Schedule arrival no longer hangs the run on a tiny rate or a repeating schedule whose bounds are not exact floats; a state document with arrival keys on a Schedule CREATE, a huge integer, or an order counter below zero is refused by name.
- Twin: a state from a live plant now covers conveyors (from when each part entered), batches
(a manifest of their members), order lines and transfer amounts, a cobot's pick and place and
a robot's cycle step, so a twin forecasts
warehouse_forklifts,warehouse_library,mfg_line_library,automation_cellandautomation_floorfrom plant data. New mapping signals:attributesandbatch_fieldonat,tend,step;naga plant initmaps them. - Fixed: a state from a plant keeps the model's name and a resource a belt part holds;
a part merged on a belt frees its place;
naga plant inittypes the batches a model forms. - Authoring:
naga fmt FILE... [--check]rewrites a model in its shortest canonical form (defaults, units and empty sections left out,$schemafirst); the model and its runs are unchanged.nagasim.build(provisional) builds a model in Python, one method per block type generated from the registry;naga export --pythonwrites that code for any model. The model JSON Schema is published athttps://thematthub.github.io/naga/schema/model-v<N>.json: add"$schema"for completion in your editor. Bundled models ship in the short form. - Changed results: a block parameter left out of a model file now means its published default (a CREATE without an entity type made type "A", now "DEFAULT"; a HOLD/SIGNAL without a signal name used "Default", now ""). The model hash of a file that left any parameter out moves once: take a saved state for it again.
- Fixed:
naga export --pythonrefuses a block type that is not registered;naga fmtkeeps a value whose type differs from its default and refuses non-finite numbers and files that are not models. - Builder: a distribution constructor per distribution,
nb.Exponential(rate=1.25), wherever a model has a distribution (a misspelt parameter is an error;lambdaislambda_); run settings areModelkeywords,nb.Model(time_limit=1000, warmup=100, replications=5); the package shipsbuild.pyi, so editors complete block parameters, records, run settings and distribution parameters and flag a wrong one, a misspelt unit (setup_unit="secs") included. The string forms still work; model files and results are unchanged. - Fixed: a number given for a parameter that takes a number or an expression (a setup time, a renege time, a batch's maximum wait, ...) is accepted, as the schema says.
0.7.2 (2026-10-15)¶
A state now carries a batch that has already formed, with its members, and an entity waiting
at a TRANSFER, so the bundled warehouse_library and mfg_line_library models restart exactly
from a state taken at any time. From a plant both are still refused: no plant signal names a
batch's members or a transfer's amount. One result changes: a level's Min and Max now count the
value a TRANSFER leaves, which raises the Max of biogas_plant_library's feed stores slightly.
- State: a formed batch (a truck at the dock, a truckload, an oven load; of a BATCH or a MATCH)
is carried with its members, and an entity waiting at a TRANSFER for room or stock is carried
in its level's queue order;
warehouse_libraryandmfg_line_libraryare reproduced from a state taken at any time tried. From a plant both stay refused by name. - Fixed: hand-written states that put a batch's members where no batch can be, leave out a hold a later RELEASE needs, name an attribute after the engine's own, ask a transfer for more than its level holds, or date a hold before its entity are refused by name.
- Changed results: a level's Min and Max count the value a TRANSFER lump leaves; in
biogas_plant_librarythe feed stores report a slightly higher Max (10154.59 to 10155.70 at seed 0).
0.7.1 (2026-10-15)¶
The twin's live-data side is now tested against software we did not write: Mosquitto, an
independent Sparkplug B edge node and an asyncua OPC UA server, with two Sparkplug fixes found
that way. A state now carries parts on a conveyor and a job holding a resource between blocks,
so the bundled warehouse_forklifts model restarts exactly from a state taken at any time (from
a plant, a conveyor is still refused: no plant signal says where a part is on the belt). A state document that
was quietly wrong (a batch timer with nothing waiting, a unit held twice, a hold nothing
releases) is now refused by name.
- Tested: the MQTT reader, the MQTT outbox and Sparkplug B against Mosquitto 2.1.2 and an
independent Sparkplug B edge node (protobuf, Tahu's encoding), the OPC UA reader against an
asyncua 2.1.0 server, and
naga twin runend to end over them (opt-in,NAGA_REALSERVER=1). - Fixed: a negative Sparkplug Int8 or Int16 sent as Tahu's Python library sends it reads as the number it is; a Sparkplug node's death takes its devices offline.
- State: parts on an accumulating conveyor (every stage, and the hand-over to the next belt), a
job that holds a resource seized in an earlier block, and a batch's running maximum wait are
carried;
warehouse_forkliftsis reproduced exactly from a state taken at any time tried. A conveyor in a state from a plant is refused by name. - Fixed: a state from a plant puts a job back with the unit it holds; a resource used only before a taken state keeps its report row; hand-written states with a batch timer and nothing waiting, a unit held twice, a hold nothing releases, or a conveyor from a plant are refused by name.
0.7.0 (2026-10-15)¶
An agent now writes a whole model in one call, and in the LLM case study that made Claude Code
more often right through Naga than writing SimPy. A twin starts from the state of lines with
finite buffers and of fleets of vehicles, recommends a new action, reroute, and can publish
its advice to an MQTT topic of yours. A minor version, because validation is stricter: a model
that validated under 0.6.1 may now be refused where it was wrong all along, for example a
PROCESS that seizes with no resource named, or a distribution parameter the distribution does
not take.
- Added: the recommendation verb
reroute(a DECIDE of the model, to the block one of its links leads to);naga twin --outbox mqtt:<connection>publishes each record at QoS 1, not retained, to<root>/proposals/<id>over a connection of your file kept for an outbox, and reads replies from<root>/replies. The order verbs stay refused by name. - Added:
write_modeltakes a whole model file in one call and answers with its problems and their places;get_model_formatdescribes the file from the engine's own registries. The compact tool list of the assistant andnaga mcp --tools compactserve that surface. In the LLM case study this made Claude Code more often right through Naga than writing SimPy, at under two thirds of the cost of building block by block. - Added: warnings for a DECIDE or balking condition that reads
AVAILABLE()as if it were the free units (W_AVAILABLE_IS_CAPACITY) and for a time series whose period is never used (W_SERIES_PERIOD_UNUSED). - Fixed: a distribution parameter the distribution does not take is
E_DIST_PARAM_UNKNOWNinstead of being ignored; a DECIDE given conditions in chance mode is told to set its mode; a repeating time-series profile in another unit never returns the instant asked as its next change. - Added: a state carries a line with finite buffers (the parts in each buffer, a machine
holding its finished part, who waits for a place) and fleets and vehicles (where each
vehicle is, its drive, loading or unloading under way, its load, the dispatch queue in its
order, its battery charge, a vehicle driving to a charger, waiting for a point or
charging):
naga state take,naga run --state. - Added: a plant mapping can observe a vehicle (
"as": "vehicle": the node it last reported) and its load ("as": "load"); a twin of a line with finite buffers, or of a fleet whose vehicles each report where they are, forecasts instead of being refused. A twin refuses when any declared fleet is not observed whole. - Added:
naga state checksays when a state says nothing about the model's vehicles or buffers, and which version wrote it. - Still refused by name: conveyors, tours, segment capacities, gantries, worker fleets, mobile cobots that tend, swap stations, scheduled charging, a vehicle out of service, blocking before service.
- Changed: the minimum state of charge after a warm-up that falls during a charge is the charge at the warm-up, not the charge the vehicle plugged in with.
- Changed: a state no longer carries the cost charged to an entity before it was taken, so a
run started from it reports the costs of its own window, as a warm-up does. Infinity and
NaN are refused in a model file's
initial_state. - Fixed: a job put in service by an initial state blocks after service like any other. An
initial-state entry whose
attributesare no object, an entity that is no object, ablockthat is no name orentitiesthat is no list isE_INITIAL_BLOCK, not an exception. From a plant, the level a BUFFER mirrors is made of its parts. - Added: a twin started again, as each scheduled
naga twin onceis, goes on counting from each plant counter's last reading (readingsintwin.json), so its forecasts of throughput are scored and an action's measured effect survives a restart; a reset, a reading older than one horizon, or a damaged or missing reading starts the count again and is never an error. - Fixed: a flow rate that reads
TNOWin a model with no step grid (simulation.sd) is warned (W_FLOW_CLOCK_NO_GRID); before, the rate was read once at the start and a timed pump or draw never switched, with no signal. - Fixed: a PROCESS, SEIZE or RELEASE block with no resource is
E_RESOURCE_UNKNOWNat validation instead of an error in the run, and therun_modeltool answers a failed run asE_RUN_FAILED. - Checked: SimPy 4.1.2 leaves its stop event in the queue after
run(until=); the engine never calls it, results are identical on 4.1.1 and 4.1.2, and a test holds that.
0.6.1 (2026-10-13)¶
What the first days after the release asked for: a Step button in the recorded player, recommendations that say the action first, measured benchmarks and reference models in the documentation, and four fixes that let a small local model get further with the agent tools. Nothing in the model file or the Python API changed.
- Added: the engine's package carries
py.typed, so a type checker reads its annotations from an install. - Added: the HTML player has Step and Step back buttons that move the shown time by one recorded sample and pause (the twin monitor page does not show them).
- Changed: a recommendation on the monitor page and in
naga twin statusleads with what stands, the recommended action and the outbox line; the basis, the explanation and the compared candidates fold (a<details>block on the page, an indented "basis:" block in the status text). Nothing is removed and the result documents are unchanged. - Added: benchmarks.
benchmarks/compare.pymeasures Naga against raw SimPy, salabim and Ciw on four queueing models with known theory, timing an implementation only when its result agrees with it; the "Coming from SimPy" guide shows the measured table. - Added: reference models, a documentation page that sets eleven exact answers (queueing formulas, a Jackson network, logistic, Bass and SIR closed forms, an agent epidemic's exact mean final size, a tank followed by hand) beside what a run of the bundled model gives, with its 95% interval; the page is generated and a test repeats every run.
- Added: two bundled models,
single_server_general(an M/G/1 queue with a uniform service time) andtank_fill_and_drain(a tank that fills, overflows and runs dry, exact by hand). - Added:
core.debugger.watch_functions()andwatch_names(layout, function), andexpressions.name_sections(function): the functions a watch may call, with a call hint, and the model names each one's first argument takes. - Added: an LLM case study under
benchmarks/llm_study/(twelve tasks with derived answers, a tools arm and a SimPy arm, a local and a Claude Code harness) and its docs page. - Fixed: an agent tool called with a JSON string for an object or array argument (what small
local models send) now parses it; a string that is not that JSON is refused naming the
argument. A required argument left out is named, and said to be inside another argument
when it was put there. A block whose distribution is malformed is reported as a problem
instead of making validation raise. The
new_modeltool no longer says an empty model is invalid.
0.6.0 (2026-10-12)¶
The first public release. Naga is a simulation engine built on SimPy: a model is a data file of blocks, resources and expressions, run from the command line, from Python or by an agent over MCP. This version adds, to the engine of 0.5.0:
- Live data and a twin. Readers for files, SQL, REST, MQTT and OPC UA with one guarded way
in; a run that starts from a plant's observed state; a twin cycle (
naga twin) that follows a plant, forecasts from where it stands, scores each forecast against what happened, and compares candidate actions on the forecast and writes the better ones to a file you name. - Two things to share.
--playerwrites a recorded run as one small HTML file;naga viewerwrites one HTML file in which the engine itself runs in the browser, with no network. - A debugger for a run, a self-reloading monitor page for a twin, and 68 agent tools.
- Documentation with a gallery of the 52 bundled models, each run by name
(
naga run single_server,naga examples).
Limits you should know before relying on it:
- No test has run against a real broker, OPC UA server, MES or plant counter: the readers and the twin are tested on in-process stand-ins and recorded logs.
- A twin cannot yet start from the state of a model with vehicles or blocking buffers; such a model is monitored and its forecast is refused by name.
- Recommendations build one action, a resource's capacity, and one sink, a file.
- The viewer needs Chrome, Edge or Firefox on a desktop; it does not open in Safari.
- The API may still change between minor versions before 1.0.
The details, as they were written while it was built:
- Added: the README's first image, an overview diagram of the engine, and pictures of the
report, the recorded player, the twin's monitor and the viewer (
docs/img/); the documentation site carries the logo. Install lines readpip install nagasim. - Fixed:
NQ,NR,MR,AVAILABLEandIDLEread a resource set as their reference says; on a set they answered "unknown resource". - Added:
naga exampleslists the bundled models with their titles (--pathprints their folder), and the model argument of every command falls back to a bundled model's name when no file is at the path given:naga run single_server.nagasim.examples:names(),path(name),model_path(value). A name is letters, digits,_and-; an existing file always wins. - Added to the documentation site: the modelling guide, experiments, model assertions and semantic diff. The site loads nothing from another site except the script that draws the gallery's diagrams, and says so.
- Changed: block, schema, problem-code, tool and help texts no longer carry internal ids; the wording of some descriptions changed, no behaviour did.
- Fixed: the README's Python snippet read a result frame that does not exist.
- Changed: the descriptions of the bundled models say what each shows and what to read in its
results, name no editor feature, and
automation_cellandautomation_floorhave a title and a category. A model's description is part of its hash, so a state file (naga state take) taken from a bundled model before this version no longer matches it and must be taken again. - Added: the documentation site (
docs/,mkdocs.yml): quick start, a gallery of the bundled models with numbers from a run, guides for people coming from SimPy, Arena, AnyLogic, Vensim and NetLogo, the agent guide,llms.txtand a generated reference.tools/gen_engine_docs.pywrites the generated pages;tests/test_engine_docs.pyregenerates them and runs every command and snippet of the site. - Fixed: a block that names no
positionis placed at the origin: a model file written by hand passednaga validateand then stoppednaga runwithKeyError('position'). - Fixed: the entity log's "Exited At" and "Throughput Time" are float columns in every replication; a replication in which no entity left made them object columns, and joining the replications raised pandas' FutureWarning.
- Changed: the descriptions of sixteen bundled models no longer carry the development plan's own tags.
- Added:
nagasim.recommend,nagasim.outbox,naga twin run / once --candidates FILE [--outbox file:PATH]andnaga twin reproduce DIR MODEL [--id ID].twin.Cycle(advisor= recommend.Advisor(...))compares the caller's candidate actions (recommend.load; built:set_capacity) with the forecast on its own seed (recommend.effects: effect, 95% paired-t interval, confidence, verdict), keeps a record a clear gain intwin_outbox.jsonwith its state document understates/, appends it to the caller's file sink (outbox.open_sink,FileSink), reads replies from<path>.replies, applies a taken action to later forecasts and measures its effect from a plant counter.twin.jsongainsrecommend;monitor.summarygainsrecommend; one more read-only agent tool,get_twin_recommendations(68 tools). Candidates never enter the rolling score. New codes:E_CANDIDATES,E_CANDIDATE_VERB,E_RECOMMEND_KPI,W_TWIN_RECOMMEND,E_OUTBOX_SINK,W_OUTBOX.recommend.override_of(action, model): a target<instance>/<resource>is the instance's argument, and a capacity an instance binds is refused;record_idcovers the KPI and the horizon; a replyendedends a standing action; a sink with a second hard link or a:after its drive is refused. Not built, refused by name: themqtt:sink, the verbsexpedite,resequence,hold,release,reroute. - Added:
naga viewer MODEL -o FILE.htmlandnagasim.viewer(build_viewer,what_if,viewer_problems,freeze_data,compare): one HTML file in which this engine runs in a browser under Pyodide 314.0.7 and re-runs the model with the inputs of itsdashboarddefinition, beside the author's baseline and recorded run.naga viewer --fetchdownloads the pinned runtime (29 MB, checked by SHA-256;--runtime DIR,NAGASIM_VIEWER_RUNTIME); nothing is downloaded otherwise.--freezereads the model's data sources once and writes the values into the copy.build_viewertakeson_progressandshould_stop(viewer.Cancelled) and writes the file last. The file holds the whole model and the engine's source. Per-replication results equal the desktop's; interval bounds can differ in their last digits between scipy versions. Problem codesE_VIEWER_MODEL,W_VIEWER_LONG_RUN,W_VIEWER_EMPTY. - Added:
nagasim.scoreandnaga twin score DIR MODEL --map FILE --log FILE. A twin scores each stated point of its forecasts once (score.point: inside the 5% to 95% band, error, pinball loss), keeps a record'sscoreand a rolling score by series and lead (score.Totals, thescoreskey oftwin_history.json), and putsscores(withbasis, orreason; a row of whole numbers is markedwhole) intwin.json;score.recomputecomputes all of it again from a plant log. Plant mapping: a tenth signal kind,counter(block, optionalrollover),Mapper.counters(),scaffold(counters=True),naga plant init --counters; the result hasview.counters. Model file:simulation.timeseries_countsnames blocks whose departures are sampled asblock/<name>/out.monitor.summarygainscounters,countedandscores;get_twin_forecastreturnsscores. Problem codesE_TIMESERIES_COUNTS,W_TWIN_SCORE. -
Fixed: no reading is taken from a plant source that is down, silent past
max_ageor unread ; a value of an item delivered again after the item left makes no new item; an integer too large for a float is no number where a file or a plant is read. -
Added:
nagasim.monitorandnaga twin run | once --monitor: a monitor page,monitor.html, written beside the result at every cycle and reloading itself.summary(doc)is what a result says to a person,Logthe last event lines,state(summary, now)the sentence on its age and whether it is stale (two cadences with no result),Page(layout, path, every=).write(doc, events)the page.Cycle.eventsare the trace events of the latest step (never in the result), taken fromPlantSource.take(), which keeps what was mapped until it is asked;twin.write_textis the atomic write;TapeWriter.scene(frames)is public. -
Fixed: a run started from a state is sampled over its own window, from its clock to its end; a short horizon late on the clock had one sample or none.
-
Added:
nagasim.twin, the twin cycle.Cycle(source, horizon=...).step()observes a plant, starts a forecast from its state of now (forecast_every, inline or in the background, cancelled bystop()), compares the stored forecasts with what is observed and writes one result (twin.json, format 1, replaced atomically;read_result,write_json).PlantSourcereads aFeedthrough a plant mapping,LogFeedplays a recorded log,loopis the service loop. Commands:naga twin run | once | status,naga mcp --twin DIR. Agent tools:get_twin_monitor,get_twin_forecast(67 tools).state.refused_kind(model)names what no state can carry;state.start(..., until=)sets the end of the run a state is started for;plant.Mapper.at(seconds)gives a model time. Problem codesE_TWIN_*,W_TWIN_*.PlantSource(..., max_age=)andnaga twin run | once --max-age INTERVALskip the forecast while a source has been silent for longer than the caller allows (none by default). The result carriesstarted,cadence,model.time_unit,model.epoch, andfinishedandtookon a forecast; the k-th forecast of a cycle runs onseed + k * replications;stop()is terminal andjoin()returns whether no forecast is still running. -
Added:
initial_stategainsentities[].deadline(a patience running out),entities[].memberandresource_sets.<name>.cursor(a resource set),blocks.<name>.setup(a changeover key), andsinceat a HOLD, BATCH or MATCH (entry time in the store).nagasim.state.takecarries them: store waits, queues with patience, set members and a Cyclical cursor, and setups are no longer refused. StillE_STATE_UNSUPPORTED: fleets, chargers, blocking and finite buffers, conveyors, agents, a changeover under way. New codeE_INITIAL_SET. - Fixed: a state of a run started from a state keeps
sinceof each waiting entity. - Fixed: a resource set no longer sends an arriving entity to queue on one member alone when that member's freed unit is owed to its queue.
- Fixed: a state lists waiting entities in the order they entered a queue or a store (a timed link reordered them); a waiting entity of a state no longer seizes a unit that is down or off shift; a resource set counts its open waits rightly after a warm start.
- Added: schema v29 and
nagasim.dashboard. Thedashboardsection may declare what a person who did not build the model may do with it:inputs(an override path as a number in a range, a switch or a listed choice),results,limits,pagesandhidden, each with a ceiling (E_DASHBOARD_DEFINITION,E_DASHBOARD_INPUT).default_dashboard(layout)generates a definition,resolve_dashboardreturns the stored one or the generated one, andinput_overrides(layout, values)turns a viewer's values into scenario overrides, refusing any value outside its input. No migration step: a model without the new keys is unchanged. - Fixed: a malformed
dashboardsection is a validation problem, not an exception. - Added:
nagasim.plant, a plant as a timeline. A plant mapping (*.plantmap.json:load,check,schema,scaffold) says what each key of a live source asserts about a model;Mapper.feed(observations)returns trace events forTimeline,replaymaps a recorded log,Watch.step()a liveFeed,log_ofwrites the plant log of a recorded run, andstate.from_plant(model, mapper.snapshot())is the state of the plant now, with its clock. Commands:naga plant check | init | mock | replay | watch. Agent tool:get_plant_timeline(65 tools). Problem codesE_PLANTMAP_*,E_PLANT_LOG,W_PLANT_*. Not mappable yet: vehicles, chargers, conveyors, cycle phases, agents, counters, an entity on a timed link. - Added:
nagasim.state, a model's state as a hashed document:take(layout, at, seed)from a run,observe(layout, ...)from a plant through bindings intoinitial_state.*,start(layout, doc)with coded refusals (E_STATE_*), and the commandsnaga state take | observe | checkandnaga run --state FILE.initial_stategainsclock(the run's clock starts there and its statistics cover the run from there),arrivals, per-failure clocks,ends,since,arrivesand an observedbusy; a state is validated as a whole (E_INITIAL_BUSY,E_INITIAL_QUEUE_CAPACITY).SimSession(..., subscribers=). A run started from a state reproduces the uninterrupted run with a warm-up of that time: exactly when nothing random follows, in distribution otherwise. Agents, fleets, conveyors, blocking, changeovers, a store's content and an instant with an event due are refused (E_STATE_UNSUPPORTED), not carried. - Fixed: a warm-started job in service keeps its unit when the shift is closed at the start; a failure that starts in the instant a shift closes is repaired on time.
- Added: live data sources.
rest,mqtt(plain topics and Sparkplug B scalar metrics) andopcua(the optional extranagasim[opcua]) read over connections only the caller defines:netguard.load_connections,--connections FILEonnaga bind,forecast,watchandmcp.nagasim.live.Feedanswers "what changed since a cursor" (events, an exactlostcount, agapflag) andnaga watchprints it. Read-only: no reader can publish, post or write.databind.READERSis the table of readers;databind.read_rowsreads one source as plain rows. - Security: a
sqldata source may carry only a few URL parameters (connect_timeout,application_name,charset, a verifyingsslmode); any other is refused (E_DATA_URL_PARAMETER). Asqliteorsqlquery must be one SELECT or WITH statement, with no comment before it and nothing after a semicolon (E_DATA_QUERY). - Security: a model file may reference only environment variables whose names start with
NAGASIM_DATA_; any other${NAME}is refused (E_DATA_ENV_NAME) before the environment is read. Rename a variable a model of yours used, for exampleMY_DB_URLtoNAGASIM_DATA_DB_URL. - Added: the shareable HTML player.
nagasim.player.build_playerwrites one self-contained HTML file that replays a recorded run in a browser, with no server;naga run MODEL --player PATHandnaga scenarios MODEL --player PATH(experiments.record_scenariosrecords the first replication of each scenario again with its seed). The file is a constant page plus one escaped data block, names no address and carries a Content-Security-Policy that refuses every request. - Added:
nagasim.core.tape(TapeWriter: a run sampled at a fixed step into drawable state) and the view derivations besideTimelineinnagasim.core.playback(asset_states,unit_counts,resource_rows,kpi_snapshotand the maps they read);network.block_place. - Added:
Exporter.needs_trace. Only an exporter that sets it is giventrace=; the built-inplayerexporter does. - Fixed:
Timelineno longer counts an entity in a block it has left when a delayed move ends a float after the entity's next event; a liveTimelineanswers each chunk's moves once; a warm-started entity gets itsentity_createdevent, so a trace starts with it. - Security: failure messages, hints and log lines about a data source now quote a
${NAME}as written in the model file, not the environment variable's value, except a value shorter than four characters and a part of a value that a library extracts (the host of a URL held in a variable), which can still be shown. A value can still leave as data, through a query, an option or a filter: do not run a model file you do not trust with secrets in the environment. - Added:
Section.tabandSection.group(nagasim.core.sections): the heading, and the family of headings, a client lists a section's records under. - Added:
SimSession.advance(until=predicate)andnagasim.core.debugger(stops on a block or an expression, watch values, an entity's attributes); the agent toolsdebug_runanddebug_inspectuse them. - Fixed: entity ids belong to the run (
SimulationContext.entity_ids), so a second run in one process no longer restarts the ids of a paused session. - Fixed: a deeply nested expression is an
ExpressionError("expression is nested too deeply"), not aRecursionErroror aMemoryError. - Fixed: the MCP server runs one tool at a time, so batched calls no longer share a workspace
mid-edit (two
debug_runcalls on one model built two sessions). - Added: 64 agent tools (
nagasim.agent_tools), an MCP server (naga mcp, extramcp) and an assistant loop (naga assist, extraassistantfor Claude) with Anthropic and OpenAI-compatible providers; a local server such as Ollama needs no key. The endpoint is set by flags andNAGASIM_LLM_*variables only. A model's Python behaviour never runs through an agent (E_AGENT_PYTHON_REFUSED), and only the tools a session offers run (E_TOOL_NOT_OFFERED). - Added: a test matrix (Ubuntu, Windows, macOS x Python 3.11 to 3.14) run on a button and weekly, and a release workflow for PyPI.
0.5.0¶
- First version of the engine as its own package.