Skip to main content

Experiment tracker made for LLM interaction.

Project description

exprag

PyPI version

PyPI platforms

exprag is an experiment memory for coding agents with zero dependencies.

It is intentionally small: one JSONL file per run, plus enough structured context for an agent to answer questions about past experiments, compare runs, and recover the exact code state that produced a result.

This is not trying to be another ML dashboard. The main interface is your agent.

Ask things like:

"Which run had the best validation accuracy?"

"Compare the latest two runs and explain what changed."

"Find the best run, inspect the code that produced it, and tell me why it won."

"Restore the repository to the code state from the run with the lowest loss."

Every run records git state at startup: commit, branch, dirty status, status output. For dirty repositories, exprag creates a dedicated run/<uuid> branch that captures the exact commit plus any uncommitted edits that existed when the run started. That means an agent can always reconstruct the true code state.

The result is a lightweight loop:

  1. Run experiments from normal Python.
  2. Track structured values with short semantic notes.
  3. Let an agent inspect .exprag/runs/*.jsonl.
  4. Ask the agent to compare, explain, or roll code back to any run.

Install

uv pip install exprag

Install For Local Development

uv pip install -e . --group=dev

Create Agent-Readable Experiment Memory

from exprag import Experiment

exp = Experiment(
    "training my neural network",
    # this metadata is captured only once at the experiment start
    metadata={
        "hparams": {
            "learning_rate": 0.03,
            "batch_size": 32,
        }
    },
)

for step in range(5):
    loss = 1.0 / (step + 1)
    acc = 0.6 + step * 0.05

    exp.track(
        {"step": step, "metrics": {"loss": loss, "acc": acc}},
        note="training metrics after each step",
    )

Run:

python examples/track_experiment.py

The runs are written to:

.exprag/runs/<run_id>.jsonl

Each run starts with a run_start record containing process, host, metadata, and git state. Each track record contains your structured value, wall-clock time, monotonic elapsed_ms, and optional note context for the agent.

Give Your Agent the Exprag Skill

Write the SKILL.md to the appropriate place so your agent finds it:

exprag-skill --write .claude/skills/exprag/SKILL.md
exprag-skill --write .agents/skills/exprag/SKILL.md
exprag-skill --write .opencode/skills/exprag/SKILL.md

Then ask your agent questions in terms of outcomes, not files:

"Which run in the last two weeks has the highest accuracy?"

"Show me the git diff between the two latest runs."

"Which learning rates result in accuracies above 90%?"

"Compare the best run against the latest run."

"Show the metric history for the run where batch size was 32."

"Restore the code to the state from the run that achieved the highest accuracy."

"Check out the exact code for run X."

Code-State Rollback

The powerful part is that exprag captures git context per run.

A run_start record includes enough information for an agent to reason about the source tree at experiment time:

  • commit: the commit to check out (snapshot commit for dirty runs, HEAD for clean)
  • branch: the branch to check out (run/<uuid> for dirty runs, original branch for clean)
  • dirty: whether the worktree had uncommitted changes
  • process cwd and argv

That lets an agent perform a workflow like:

  1. Find the run with the best metric.
  2. Read its run_start git state.
  3. git checkout <branch> always works — branch is either run/<uuid> (dirty) or the original branch (clean).
  4. Compare with git diff between any two runs.
  5. To get the base commit for a dirty run: git log --oneline -1 <commit>^.

So a prompt like this is meaningful:

"Find the run with the best validation accuracy, reconstruct the code from that run, and show me the exact code changes compared with my current checkout."

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

exprag-0.1.2.tar.gz (25.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

exprag-0.1.2-cp38-abi3-win_arm64.whl (249.3 kB view details)

Uploaded CPython 3.8+Windows ARM64

exprag-0.1.2-cp38-abi3-win_amd64.whl (261.6 kB view details)

Uploaded CPython 3.8+Windows x86-64

exprag-0.1.2-cp38-abi3-musllinux_1_2_x86_64.whl (459.4 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ x86-64

exprag-0.1.2-cp38-abi3-musllinux_1_2_aarch64.whl (437.2 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

exprag-0.1.2-cp38-abi3-manylinux_2_28_x86_64.whl (385.9 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ x86-64

exprag-0.1.2-cp38-abi3-manylinux_2_28_aarch64.whl (371.8 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ ARM64

exprag-0.1.2-cp38-abi3-macosx_11_0_arm64.whl (324.1 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file exprag-0.1.2.tar.gz.

File metadata

  • Download URL: exprag-0.1.2.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for exprag-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1c93d6afe1a20087e2e603c94f65c26a4d4fe2b2a60a45d419f6a36546d8e3a1
MD5 21702ee50f14bccb7d8ee2c866a6530e
BLAKE2b-256 ffd695899afb58b05388abeb7d2a7a452d69d8c8a3eb140371124ab355f19dc5

See more details on using hashes here.

Provenance

The following attestation bundles were made for exprag-0.1.2.tar.gz:

Publisher: cd.yml on pfackeldey/exprag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exprag-0.1.2-cp38-abi3-win_arm64.whl.

File metadata

  • Download URL: exprag-0.1.2-cp38-abi3-win_arm64.whl
  • Upload date:
  • Size: 249.3 kB
  • Tags: CPython 3.8+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for exprag-0.1.2-cp38-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 c1bd58fb69972f87a1dd0dadbcead1b8947c5cf4c2f5793f03514b0c3fa9b1e8
MD5 7fc43af73ed484d2dad0ac0fa0d7f965
BLAKE2b-256 db0dc79286ce6129b8aeaee59ab4cfe4c3a1fb288481df3dbdb99fa3ae06796d

See more details on using hashes here.

Provenance

The following attestation bundles were made for exprag-0.1.2-cp38-abi3-win_arm64.whl:

Publisher: cd.yml on pfackeldey/exprag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exprag-0.1.2-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: exprag-0.1.2-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 261.6 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for exprag-0.1.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c47c9d232c2b0b65d76970a43fc07401dcdcbf893ab6b43f07f27d5dfcfa86fe
MD5 c462c84e8f1a278174d96fe251b97edc
BLAKE2b-256 f32550d7e54d5f946f03966bf6284f8075cd2c9ab36c67ee2c984e2b685819fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for exprag-0.1.2-cp38-abi3-win_amd64.whl:

Publisher: cd.yml on pfackeldey/exprag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exprag-0.1.2-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for exprag-0.1.2-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e95cc3a0fbec393dcbb90e446028042638159ec02773308905c5907a64b0f0c6
MD5 75c8b8bea3e08583cef53d26d001a23f
BLAKE2b-256 91ff3cb74ef2092fa8d7b72f00260684cc0fdb66f1280d22f5af3e99ffeb6d14

See more details on using hashes here.

Provenance

The following attestation bundles were made for exprag-0.1.2-cp38-abi3-musllinux_1_2_x86_64.whl:

Publisher: cd.yml on pfackeldey/exprag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exprag-0.1.2-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for exprag-0.1.2-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a925a8018d7c93a8a373e9ffd81184af2c7bcce52a8874408441d464dac69282
MD5 cd1a5a9665425cdd68f3d67f51371db8
BLAKE2b-256 219927c3e270bb26f0d4b14beec5600250e8ecdf669da97a1f68991cf0bbc2eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for exprag-0.1.2-cp38-abi3-musllinux_1_2_aarch64.whl:

Publisher: cd.yml on pfackeldey/exprag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exprag-0.1.2-cp38-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exprag-0.1.2-cp38-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f1c4f6be807895387e7ec547d33374c38c4f575e098bc551e4f85c75176a77ea
MD5 6ad9d54bac900f8d50eb1abb6a662894
BLAKE2b-256 5abe88bec8ed373a52d54ec46618f461d2b0146aa2571070303e31223b1b30f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for exprag-0.1.2-cp38-abi3-manylinux_2_28_x86_64.whl:

Publisher: cd.yml on pfackeldey/exprag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exprag-0.1.2-cp38-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for exprag-0.1.2-cp38-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6d8702d9c974c9e161cc3e45742b0c3d204b1b204001b1b35413380aed16cd83
MD5 ad7a197816627e0a14da4825a6215bb8
BLAKE2b-256 3fb272b60cad08ce26afcacdf87460bd0d308c413f73e47adbc178e46a972ee9

See more details on using hashes here.

Provenance

The following attestation bundles were made for exprag-0.1.2-cp38-abi3-manylinux_2_28_aarch64.whl:

Publisher: cd.yml on pfackeldey/exprag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exprag-0.1.2-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: exprag-0.1.2-cp38-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 324.1 kB
  • Tags: CPython 3.8+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for exprag-0.1.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6cd2bfbbed9c6480e476a7bb9e9f9a8d6b287f1e1409910369f41cf7f10808bb
MD5 65bbaee580bb594739971ac4d3cf0b90
BLAKE2b-256 50f6e1b5827a0bbf0339220ff8dae5228897e59263349a1bc43452dee2179570

See more details on using hashes here.

Provenance

The following attestation bundles were made for exprag-0.1.2-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: cd.yml on pfackeldey/exprag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page