SDK
0.0.11
The read side of the SDK — everything you do after the data is recorded — is now one surface. connect() returns a handle that browses the catalog, queries live and recorded data, computes on unit-carrying series, charts, checks invariants, and re-opens .trz files, with one glob grammar and one time grammar across every call. It is the surface Zelos Notebooks run on.
Everything you already wrote keeps working: every old spelling is kept as a deprecated alias that warns once. The behavior changes below are the exceptions, and each one replaces a result that was quietly wrong.
Added¶
connect()— one entry point for a running agent. It verifies the connection before returning, readsZELOS_AGENT_URLwhen given no argument, and works as a context manager. Read more.SignalFrame—agent.query(paths, start=…)returns a frame that is one row per distinct timestamp, one column per signal, and null wherever a signal had no sample.ffill(),dropna(),between(),resample(),head(),rename(),short_names()anddescribe()operate on it directly. Read more.SignalSeriescarries its unit through arithmetic.voltage * currentarrives asW,.integrate()over time givesJ, andpower / currentcancels back toV. Adding mismatched units raises instead of lying, and reductions return aNamedScalarthat prints3.629 V.plot()on a frame or a series emits Vega-Lite. It renders inline in the app, offline in an exported HTML page, and in any Jupyter viewer — with nothing added todependencies.- One glob grammar.
*and?expand against the catalog everywhere a path is accepted:match(),query(),latest(),at(),window()andexport(). - One time grammar. The sign tells a time from a duration:
"-30s"is a point on the clock,"30s"is a length. ISO 8601 strings,datetimeandtimedeltaare accepted wherever they fit. agent.check.that(lhs, op, rhs)reports a verdict instead of raising, so a suite always runs to completion. Every result carries its evidence — the first violating sample on a failure, the closest approach on a pass — with a timestamp.agent.check.count()measures without judging. Read more.CheckResults.raise_if_failed()raisesAssertionErrorlisting every check that did not pass, each with its predicate, window and evidence. For a single check,assert agent.check.that(...)— a result is truthy when it passed.agent.window()returns aReplayWindow— the opening snapshot plus one entry per change — for states and events, where a query would return thousands of rows repeating one string.agent.watch()streams live values on an interval, with a deadline.agent.export()saves a window to a.trzfile, and.open()re-reads it with the same calls you used against the agent.- Everything renders itself.
Agent,SignalCatalog,SignalFrame,SignalSeries,Snapshot,ReplayWindow,TraceandCheckResultall print a useful summary and render as a rich table in a notebook.to_pandas()is for handing data to pandas, not for looking at it.
Changed¶
- A multi-signal frame is one row per timestamp, not one row per message table. Cells are null where a signal had no sample; nothing is interpolated on the way in.
- A bare
intpassed where a time belongs raises below 1015 instead of being read as an epoch in nanoseconds. A number that small is nearly always seconds by mistake — write"-30s". - A naive
datetimeis accepted and read as UTC instead of being rejected. - Wildcards in
query()expand against the query window rather than a fixed 60-second catalog, so a glob over a long window matches what the window actually contains. latest()takes a wildcard.agent.latest("bus0/BMS_message/cells.*")returns aSnapshotof every match; one literal path still returns a singleLatestValue.Trace.latest()/Trace.at()and theTraceSetpair return the live shapes — aLatestValuefor one literal path, aSnapshototherwise — andReplayWindow.snapshotis aSnapshotrather than a list.TraceSet.query()on offset bounds puts the runs on one grid. Every sample is numbered by how many sample periods into its own run it sits, and the runs join on that number at the coarsest run's rate, so two runs recorded at different sub-second phases share rows instead of leaving each other's columns null. Only the edge of the window can leave a row unshared, when it holds one more sample of one run than of the other.to_pandas()on such a frame indexes by offset, not by a 1970 date.Trace.signals()andTraceSet.signals()come back sorted by path, and so do the columns of aTrace.query()frame.- Relative times on a file anchor to the file's own span rather than to wall-clock now.
where()masks out values as nulls instead ofNaN.- Mixing a series with a pandas or numpy object raises instead of silently producing garbage. Convert explicitly with
to_pandas(). count()returns aCheckResultwhose.countisNoneon error, instead of0— a failed measurement no longer reads as a real zero.- A literal-vs-literal type mismatch in a check raises when the check is built, instead of producing an error row at evaluation.
to_pandas()returns a timezone-aware UTCDatetimeIndex. Passindex=Falsefortimeas an ordinary column.producers=onquery(),latest(),at()andwindow()defaults to every connected producer instead of localhost only. Oncheck.that()/check.count()it stays the local store; a check reports one verdict per target.- A trace duration check (
temporal="for_duration"/"within_duration") anchors at the end of the recording — its last N seconds — instead of the start. trace.checkacceptslookback=for signature parity withagent.checkand ignores it.- Trace checks no longer emit
zelos.check.result.v1events. std()usesddof=1— the sample standard deviation, matching pandas.median()is exact instead of approximate.- An enum value compares equal to its wire string:
DataType.Int32 == "int32". - A derived series names itself.
voltage * currentisvoltage × current, and÷,+,−follow; a chart legend never readsnull. - A
NamedScalarprints as a measurement: four significant digits and the unit (3.629 V), withf"{peak:.2f}"keeping the unit too.float(peak)is still the exact value. ExportResultandTraceSet.series()render themselves — one row per producer, one column per run.from zelos_sdk import *binds the agentTimeRange.- Every repr shares one time and number format — UTC to the millisecond, four significant digits, the unit after the value — and a check result renders as a checkerboard row: when it happened, the rule with the measured value in it, the window, the verdict.
window(duration=…)with a plain number means seconds, not nanoseconds.TraceSet.time_rangeis aTimeRange.watch()yields aSnapshot— aMappingthat renders itself — instead of a plain dict.- A cell that raises
AssertionErrorfails the notebook run (exit code1); any other exception errors it. --paramnames must be ASCII Python identifiers — no keywords and no dunders — so a parameter is always usable asparams.<name>in a cell. A bad name is refused before the run starts.- Notebook front matter no longer gains an empty
dependencies:list when the notebook declares none. - Core dependencies shrank to
jsonschemaandpyarrow.pytest,richandcoloramaare no longer installed by default;pip install "zelos-sdk[test]"restores pytest and rich, and[notebook]adds the analysis stack (pandas,numpy).
Deprecated¶
Each of these still works and raises one DeprecationWarning naming its replacement. Nothing is removed.
| Old | New |
|---|---|
Agent.connect() |
zelos_sdk.connect(target, timeout=…) |
Agent.health_check() |
Agent.health() |
Agent.resolve_paths() |
agent.signals().match(pattern) |
SignalCatalog.by_path(path) |
catalog[path] |
SignalCatalog.to_list() |
list(catalog) |
SignalSeries.derive() |
SignalSeries.from_arrow(values, name=…, unit=…) |
SignalSeries.get() |
SignalSeries.to_pandas() |
SignalSeries.time_arrow() |
the SignalSeries.time attribute |
sort_order= |
sort="asc" / sort="desc" |
relative_start= / relative_end= |
start="+30s" / end="+30s" |
time_mode= |
nothing — the bounds pick the axis |
export(paths=…) |
export(signals=…) |
lookback= on query() |
nothing — wildcards resolve against the query window |
Kept without a warning: the [analysis] extra is an alias of [notebook];
TraceSet.traces and TraceSet.max_duration remain as properties beside the new
TraceSet.time_range; and every alphabetic and
natural-language operator spelling (gt, is greater than, is not equal to,
in, …) still parses to the same canonical operator as its symbol.
Fixed¶
integrate()andderivative()refuse a series with nulls instead of guessing across a gap, and nameffill()/dropna()as the fix.
Upgrade notes¶
Three one-line fixes cover almost every migration:
# 1. to_pandas() already indexes by time.
frame.to_pandas().set_index("time") # before
frame.to_pandas() # after — or to_pandas(index=False) to keep the column
# 2. Look a signal up by path with an index.
catalog.by_path("bus0/BMS_message/status.pack_current") # before
catalog["bus0/BMS_message/status.pack_current"] # after
# 3. A relative time is a signed string, not a number.
agent.query(paths, start=-30) # before
agent.query(paths, start="-30s") # after
If you combine columns from different messages, add .ffill().dropna() — a frame is joined on time and sparse by construction, and integrate() / derivative() refuse a series with nulls rather than guessing across a gap.
0.0.10
Added¶
- Agent SDK (
zelos_sdk.agent): Connect to a running Zelos Agent from Python and query live or recorded data through one handle — browse the signal catalog, query and downsample time-series into Arrow/pandas, read latest values, watch for live updates, run actions, manage extensions, and open.trztrace files. Read more. - Layout version history:
agent.layoutsCRUD (list/show/create/update/delete) plus full version history — list a layout's versions, restore a previous version, or label one. Read more. - Typed Check API:
agent.check.that(lhs, op, rhs)asserts a predicate against a live signal or.trztrace, with temporal quantifiers such asalways/eventuallyevaluated server-side;agent.check.suite(...)runs a JSON suite of checks in one round-trip. Read more. zelos_sdk.schemas.Log— a predefined schema for typed log events (zelos.log.v1); pass a schema class directly toadd_event(name, schema)instead of a field list. Read more.TraceSource.log_batch()— log apyarrow.RecordBatchorTabledirectly for zero-copy, high-throughput ingestion.TraceSource.log_many()— log a list of(time_ns, event_name, data)tuples in a single call, cutting Python↔Rust overhead for high-frequency sources like CAN decoders.TraceSource(name, strict=True)— opt into strict type coercion; rejects lossy float→int narrowing instead of silently truncating it.TraceNamespace.drain()— flush every source and block until all queued events reach subscribers, for deterministic teardown ahead of closing aTraceWriter.
Changed¶
- Action execution now returns a typed
ActionExecuteResult(value + status) withPASS/FAIL/ERROR/DONEstates instead of a bare value; the oldActionResult/ExecuteStatusnames remain as deprecated aliases. - Action JSON Schema and UI Schema property order now matches
@actiondeclaration order end-to-end instead of being alphabetized, so generated forms render fields in the order they were declared.
Fixed¶
SignalFramenow resolves columns correctly when the same signal name appears across multiple producers or segments, raisingAmbiguousSignalon a genuine tie instead of matching the wrong column.TraceReaderno longer drops a trace's last row when its timestamp has sub-microsecond precision.TraceWriternow captures every event logged before itswithblock exits, without needing a sleep before close to avoid losing in-flight data.TraceSourceCachenow stores a PythonNoneas a null value instead of raising an error.
0.0.9
Added¶
FolderPickerWidgetfor Actions, enabling folder selection in extension UIspyarrowas a direct dependency — no longer needs to be installed separately for TraceReader
Fixed¶
- NaN and Infinity float values are now properly stored as null and read back as
Noneinstead of causing serialization errors
0.0.8
Added¶
- TraceReader API: Read
.trztrace files for offline analysis, debugging, and post-processing. Read more.- Query specific signals and time ranges from trace files
- Discover available fields hierarchically (sources → events → fields)
- List data segments and metadata
- Full PyArrow integration for efficient data processing
- Trace File Utilities:
- Hook to open existing trace files (useful for merging WAL and TRZ after ungraceful exit)
0.0.7
0.0.6
Added¶
- Action decorators now capture a
field_type, enabling richer, type-aware rendering in the Zelos App without custom widgets. - Action parameters default to
required=True, surfacing missing inputs during validation instead of at execution time.
Improved¶
- Updated examples and tests to exercise the stricter defaults so extension authors can adopt the new metadata with confidence.
0.0.5
Added¶
- Zelos Actions: A powerful new way to script interactions with your devices and services.
- Define actions with simple Python functions and decorators.
- Automatic discovery and registration of actions.
- Support for various field types for action inputs, including
object. - Note: Only available in the python release of the SDK
Changed¶
- Dependencies: Removed the
setuptoolsdependency.
Fixed¶
- Zelos Trace:
- Resolved a deadlock that could occur in async contexts.
- Fixed an issue that could prevent querying data if a
TraceSegmentStartmessage was missed. - Fixed URL handling in the
TracePublishClient.