Skip to main content

Content-addressed execution store for AI agents — git semantics for agent tool calls.

Project description

vek

Content-addressed execution store for AI agents — git semantics for agent tool calls.

CI

Vek is a minimal execution history layer for AI agents. Every tool call's input and output is stored as an immutable, content-addressed blob, forming a traceable, forkable, replayable execution DAG. Framework-agnostic — plug in with a single function call.

Philosophy

Manage agent execution history like git manages code. Git doesn't care what language you write in. Vek doesn't care what framework your agent runs on.

Install

pip install vek

Quick Start

import vek

vek.init()

# record a single tool call
h = vek.store(tool="search", input={"q": "climate change"}, output={"results": [...]})

# session — auto-chained, atomic recording
with vek.session() as s:
    s.store(tool="search", input=query, output=results)
    s.store(tool="summarise", input=text, output=summary)

# auto-record with decorator
@vek.wrap
def search(query: str) -> dict:
    return {"results": [...]}

# inspect
node = vek.show(h)
blob = vek.cat_file(node["input_hash"])

CLI

vek init                  # create .vek/ repository
vek status                # current branch, tip, stats
vek log [-n 20] [--graph] # execution history / ASCII DAG
vek show <hash>           # inspect a node (short hash OK)
vek cat-file <hash>       # dump raw object content
vek branch [name]         # list or create/switch branches
vek fork <hash>           # fork at a node
vek merge <branch>        # merge branch into current
vek diff <hash1> <hash2>  # structural JSON diff
vek replay <hash>         # replay execution chain
vek tag [name] [hash]     # list or create tags
vek fsck                  # verify repository integrity
vek gc [--dry-run]        # remove unreachable objects
vek export [--format json|jsonl] [--branch name]
vek import <file> [--format auto|json|jsonl]
vek --version

Python API

Function Description
vek.init() Initialise .vek/ repository
vek.store(tool, input, output) Record one tool call
vek.session() Context manager for atomic batch recording
vek.async_session() Async context manager
vek.wrap(fn) Decorator for auto-recording
vek.hook(dispatch_fn) Wrap a dispatch function
vek.log(n=20) Recent execution history
vek.log_graph() ASCII DAG visualisation
vek.show(hash) Node details with materialised content
vek.cat_file(hash) Raw object bytes
vek.status() Repository summary
vek.branch(name) Create/switch branch
vek.fork(hash, name) Fork at a node
vek.merge(branch) Merge branch (creates multi-parent node)
vek.diff(h1, h2) Structural JSON diff
vek.replay(hash) Full chain from root to hash
vek.tag(name, hash) Lightweight tags
vek.fsck() Integrity verification
vek.gc() Garbage collection
vek.export() Export chains (JSON/JSONL)
vek.import_data(data) Import chains

All hash arguments accept short prefixes (e.g. h[:8]).

Storage Layout

.vek/
├── objects/     # (reserved) content-addressed hash objects
├── refs/        # (reserved) branch pointer files
├── HEAD         # current branch
├── config       # repository configuration
└── vek.db       # SQLite — objects + nodes + refs

Data Model

objects:  hash | content
nodes:    hash | tool | input_hash | output_hash | parent_hash | timestamp | merge_parent
refs:     name | hash                     (branches, tags with "tag/" prefix)

Object Hashing (git-style)

SHA-256( "blob" + " " + size + "\0" + content )   # input/output blobs
SHA-256( "node" + " " + size + "\0" + content )   # execution nodes

Same content stored exactly once. Different types with identical content produce different hashes.

Merge Nodes

Merge creates a node with two parents: parent_hash (current branch) and merge_parent (target branch). Tool is __merge__.

Concurrency

  • SQLite WAL mode with 5s busy timeout
  • Advisory file lock (HEAD.lock) prevents concurrent branch pointer writes
  • Sessions batch all writes in a single transaction (atomic commit/rollback)

Design Principles

  • Content-addressed — identical content stored once, forever
  • Immutable — history cannot be tampered with
  • Framework-agnostic — no adapters, no shims
  • Local-first.vek/ directory, zero external dependencies
  • Minimal API — one function call to integrate
  • Atomic sessions — all-or-nothing batch writes
  • Portable — export/import execution chains as JSON/JSONL

License

AGPL-3.0

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

vek-0.2.1.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

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

vek-0.2.1-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

Details for the file vek-0.2.1.tar.gz.

File metadata

  • Download URL: vek-0.2.1.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for vek-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a24f22144f74899352ba3764817abdc9506d184d7f0b1f48e7ea1dd5d43a112d
MD5 6aee5d73d7ac89b62c1770a9458e8e5d
BLAKE2b-256 7b045b6cc35500f24b741eaa35f3e4bdf65347715d7d5e02a38114b887d23761

See more details on using hashes here.

File details

Details for the file vek-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: vek-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 36.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for vek-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72c09e0b0732e6c9b80b8ef8a8c7509ca3f76edb455ea4b4532c475884d911df
MD5 98f3c83c08a149c76661e2a9cab7123a
BLAKE2b-256 c5d9da58c62dfdc5023cc2f735abd4c5cadb89f9af0849e9dd1da724d4c91010

See more details on using hashes here.

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