# Quickstart

> Record a small job with ormaos run, follow the next line of each answer, change the code and compare the two recordings with ormaos diff.

[`order-sync`](/examples/order-sync.md) is a job that applies orders to an inventory in SQLite. It prints `sync finished: OK`. Every output on this page was printed by the real command line, on Python 3.14.

## Get the job

```bash
git clone https://github.com/ormaos/ormaos-examples
cd ormaos-examples/order-sync
python3 -m venv .venv && .venv/bin/pip install git+https://github.com/ormaos/ormaos-python
source .venv/bin/activate
```

`./reset.sh` puts the data back as it was, so that every run starts from the same inventory.

## Record a run

```bash
./reset.sh
ormaos run -- python job.py
```

```console
$ ormaos run -- python job.py
sync finished: OK
ormaos: r1 exit 0 in …: 1 Python process, 322 calls, 7 exceptions (6 swallowed), 182 io
ormaos: swallowed 6x validate.SkuFormatError at job.py:57, raised at validate.py:24 [r1:e1]
ormaos: not collected: io: reads of the 1 file opened at fetch.py:26: opened for reading, and no `read` call by Python code was seen on a file of that name: if it was read, that was inside C code (a file that is iterated, `for line in f`, `csv.reader`)
ormaos: saved in .ormaos/r1, next: ormaos exceptions r1:e1 | ormaos tree r1:c1
```

The first line is the job's own output, unchanged. The others are the summary, on stderr, at most five lines, each starting with `ormaos:`. Durations change from run to run; on this site they are written `…`.

The recording is the folder `.ormaos/r1`. `r1:e1` is an address: the first exception of recording `r1`. The last line gives the next commands.

## Follow the next line

The first suggested command:

```console
$ ormaos exceptions r1:e1
r1:e1 validate.SkuFormatError: swallowed
  raised at   validate.py:24 in check_sku  [r1:c168]
  left calls   check_sku [r1:c168], check_order [r1:c167]
  handled at  job.py:57 in sync_orders  [r1:c130]  and not raised again
  message     not recorded; args: tuple[1 str]
  logs        6 logging records in the call that handled it and below (6 dropped by the level)  [r1:l2]
  same type, same handler: 6 in all: r1:e1 r1:e2 r1:e3 r1:e4 r1:e5 ...
next: ormaos tree r1:c130 | ormaos logs r1:c130 | ormaos io r1:c130 | ormaos tree r1:c168 | ormaos exceptions r1:e2
```

`swallowed` means the exception entered an `except` and was not raised again. The handler at `job.py:57` is the call `r1:c130`. The exception message is not recorded: only its shape, `args: tuple[1 str]`.

The handler also logged each skipped order, and the level of the logger dropped all six records:

```console
$ ormaos logs r1:e1
r1:e1 sync_orders and the calls below it: 6 logging records (WARNING 6), 6 dropped by the level
  6x WARNING order_sync "order %s skipped: %s"  dropped by the level  at job.py:58 in sync_orders  [r1:l2]
next: ormaos logs r1:l2 | ormaos tree r1:c130 | ormaos logs r1:c16
```

What the handler's call did, one level down:

```console
$ ormaos tree r1:c130 --depth 1 --limit 4
inside: r1:c1 <module> > r1:c16 main
r1:c130 sync_orders(conn: sqlite3.Connection, orders: list[36 parse.Order]) -> int  job.py:49  …  io 180  logs 6  [swallowed 6x validate.SkuFormatError: r1:e1]  calls below: 66
  r1:c131 check_order(order: parse.Order) -> NoneType  validate.py:47  …  calls below: 3
  r1:c135 apply_order(conn: sqlite3.Connection, order: parse.Order) -> bool  inventory.py:78  …  io 6  calls below: 1
  r1:c137 check_order(order: parse.Order) -> NoneType  validate.py:47  …  calls below: 3
... 63 of the 66 calls directly below r1:c130 are not shown (34 check_order, 29 apply_order; 6 raised): --offset 3
next: ormaos exceptions r1:e1 | ormaos tree r1:c130 --offset 3 | ormaos tree r1:c131 | ormaos tree r1:c16 | ormaos exceptions r1:c130
```

And the I/O of that call and the calls below it, grouped by statement and by line of code:

```console
$ ormaos io r1:e1
r1:e1 sync_orders and the calls below it: 180 io events (sqlite 180)
  30x sqlite "SELECT on_hand, pack_size FROM stock WHERE sku = ?"  at inventory.py:87 in apply_order  [r1:i3]
  30x sqlite "SELECT ? FROM applied_orders WHERE order_id = ?"  at inventory.py:92 in apply_order  [r1:i4]
  30x sqlite BEGIN  at inventory.py:101 in apply_order  [r1:i5]
  30x sqlite "UPDATE stock SET on_hand = on_hand - ? WHERE sku = ?"  at inventory.py:101 in apply_order  [r1:i6]
  30x sqlite "INSERT INTO applied_orders (order_id, sku, quantity, applied_at) VALU..."  at inventory.py:105 in apply_order  [r1:i7]
  30x sqlite COMMIT  at inventory.py:100 in apply_order  [r1:i8]
calls directly below: 36 check_order (6 raised, no io), 30 apply_order (180 io)
next: ormaos io r1:i3 | ormaos io r1:i4 | ormaos tree r1:c130 | ormaos io r1:c16
```

## Change the code, record again, compare

Here `parse.py` is changed as in the README of ormaos-python: the SKU is cleaned when a row is read (`sku=row["sku"].strip().upper(),`). Then the job is recorded again. The run in between, `r2`, recorded lines with `--path`.

```bash
./reset.sh
ormaos run -- python job.py
ormaos diff r1 r3
```

```console
$ ormaos diff r1 r3
r1 -> r3, matched by place in the code and order, not by address
  r1: exit 0, 322 calls, 7 exceptions, 182 io events, 8 logging records
  r3: exit 0, 346 calls, 1 exception, 218 io events, 2 logging records
calls: 6 of 31 places differ
  check_order at validate.py:47: 36 calls in both; 6 raised in r1, none in r3; call 7 raised in r1 and returned in r3  [r1:c167 r3:c167]
  check_sku at validate.py:22: 36 calls in both; 6 raised in r1, none in r3; call 7 raised in r1 and returned in r3  [r1:c168 r3:c168]
  check_quantity at validate.py:27: 30 calls in r1, 36 in r3  [r1:c133 r3:c133]
  check_unit at validate.py:42: 30 calls in r1, 36 in r3  [r1:c134 r3:c134]
  apply_order at inventory.py:78: 30 calls in r1, 36 in r3  [r1:c135 r3:c135]
  to_units at inventory.py:71: 30 calls in r1, 36 in r3  [r1:c136 r3:c136]
exceptions: 1 of 2 groups differ
  swallowed validate.SkuFormatError, raised at validate.py:24, handled at job.py:57: 6 in r1, none in r3  [r1:e1]
io: 6 of 8 groups differ
  sqlite "SELECT on_hand, pack_size FROM stock WHERE sku = ?"  at inventory.py:87 in apply_order: 30 in r1, 36 in r3  [r1:i3 r3:i3]
  sqlite "SELECT ? FROM applied_orders WHERE order_id = ?"  at inventory.py:92 in apply_order: 30 in r1, 36 in r3  [r1:i4 r3:i4]
  sqlite BEGIN  at inventory.py:101 in apply_order: 30 in r1, 36 in r3  [r1:i5 r3:i5]
  sqlite "UPDATE stock SET on_hand = on_hand - ? WHERE sku = ?"  at inventory.py:101 in apply_order: 30 in r1, 36 in r3  [r1:i6 r3:i6]
  sqlite "INSERT INTO applied_orders (order_id, sku, quantity, applied_at) VALU..."  at inventory.py:105 in apply_order: 30 in r1, 36 in r3  [r1:i7 r3:i7]
  sqlite COMMIT  at inventory.py:100 in apply_order: 30 in r1, 36 in r3  [r1:i8 r3:i8]
logs: 1 of 3 groups differ
  WARNING order_sync "order %s skipped: %s"  dropped by the level  at job.py:58 in sync_orders: 6 in r1, none in r3  [r1:l2]
data: the same in both (0 places)
not compared: values, shapes of arguments and results, durations, cpu and memory, the lines of `path`, which process or thread an event was in, the versions of the code
next: ormaos exceptions r1:e1 | ormaos tree r1:c167 | ormaos io r1:i3 | ormaos logs r1:l2 | ormaos tree r3:c167
```

`diff` matches calls, exceptions, I/O and logging records by place in the code and by order, never by address. It says what each recording has, with the counts; it does not say which one is right.

## What you have now

```console
$ ormaos list
3 recordings in .ormaos, newest first
r3  2026-11-27 12:00:00  complete  exit 0  …  1 process, 346 calls, 1 exception (0 swallowed), 218 io  python job.py
r2  2026-11-27 12:00:00  complete  exit 0  …  1 process, 322 calls, 7 exceptions (6 swallowed), 182 io  python job.py
r1  2026-11-27 12:00:00  complete  exit 0  …  1 process, 322 calls, 7 exceptions (6 swallowed), 182 io  python job.py
next: ormaos show r3 | ormaos show r2 | ormaos show r1 | ormaos diff r2 r3
```

## Next

- [The verification loop](/python/agents.md), the same steps for a coding agent.
- [What a recording is](/python/concepts/recording.md).
- A guide for your kind of program: [web backend](/python/guides/web-backend.md), [data pipeline](/python/guides/data-pipeline.md), [notebook](/python/guides/notebook.md), [ML training](/python/guides/ml-training.md), [LLM app](/python/guides/llm-app.md).

---

Source: https://docs.ormaos.com/python/quickstart/ · ormaos 0.0.1 · ormaos-python 968f69776c · ormaos-examples 6e27be5922
