Skip to main content

vekna

Run coding agents as rituals: ordinary Python programs whose steps you control and whose agent calls happen inside those steps. Agents run permissively within a step; determinism lives at the step boundaries.

Documentation is at vekna.fancysnake.dev.

Install

pip install vekna

Python 3.11+. Testing your rituals needs the trial extra: pip install 'vekna[trial]' — quoted, because zsh globs the brackets.

A ritual

Put a rituals.py in your project — or a rituals/ package, split however you like, once one file stops being enough:

from typing import Annotated

from pydantic import BaseModel, Field

from vekna.folio.coding import coding
from vekna.folio.shell import shell
from vekna.lexicon import Transition, done, goto, ritual, step


class FixTests(BaseModel):
    # A retry budget counts down to zero, so the CLI rejects a negative one
    # rather than letting `--bound -1` run until the step backstop.
    bound: Annotated[int, Field(ge=0)] = 3


class Attempt(BaseModel):
    left: int


class Verdict(BaseModel):
    outcome: str


@step
async def fix(state: Attempt) -> Transition:
    result = await shell("mise run test:py")
    if result.exit_code == 0:
        return done(Verdict(outcome="green"))
    if state.left <= 0:
        return done(Verdict(outcome="gave up"))
    await coding(f"The test suite fails:\n{result.stdout}\nFix it.")
    return goto(fix, Attempt(left=state.left - 1))


# `def`, not `async def`: naming the first step has nothing to await. A step or
# entrypoint is written whichever way its body needs.
@ritual("fix_tests")
def fix_tests(components: FixTests) -> Transition:
    return goto(fix, Attempt(left=components.bound))

Then cast it:

vekna cast fix_tests --bound 5

Output streams live as a tree of rites — one node per step, one nested under it per medium call, with the agent's own output indented beneath. The last line is the cast's result, as JSON:

result: {"outcome":"green"}

Claude Code plugin

The ritual-scribe skill teaches Claude Code to write rituals. Install it from this repo's marketplace:

claude plugin marketplace add fancysnake/vekna
claude plugin install ritual-scribe@vekna

Commands

Command What it does
vekna cast <ritual> [--<component> value …] Run a ritual from rituals.py
vekna cast --prompt "<text>" One-shot cast on the coding medium, no rituals.py needed
vekna rituals list Every ritual and the options it takes
vekna rituals show <ritual> A ritual's components and its step graph

Architecture

GLIMPSE layering, enforced by import-linter. See docs/architecture.md and docs/README.md for where the ideas live.

Development

mise run test:py     # all tests
mise run check:py    # the loop while you work: format, lint, tests
mise run fullcheck   # the gate before you push: adds diff-coverage and tingle

Licence

BSD-3-Clause.

Release files for vekna 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vekna 0.9.0
File Size Uploaded
vekna-0.9.0.tar.gz 74.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vekna 0.9.0
File Interpreter ABI Platform
vekna-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 168.5 kB

Release files / vekna-0.9.0.tar.gz

Download URL vekna-0.9.0.tar.gz
Size 74.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e7a3e02128c1d49d0693a8034c05168e3f665a1317b798c6a873fd37ffc22201
BLAKE2b-256 checksum
How to use checksums
a4e1512185219d4b1d82046d44f8dfedad1a607d4b4e40d1de9d15009de58556
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release files / vekna-0.9.0-py3-none-any.whl

Download URL vekna-0.9.0-py3-none-any.whl
Size 93.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0dc86efe372c72fee908eed63e0d2d7bcbe0d3ee85021ffc19e7ce1b108c339a
BLAKE2b-256 checksum
How to use checksums
37cf6267ac04137555ef12d34feba746aaab0ee0f7f99e8a890703ee0fead728
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page