Skip to main content

Surgical code isolation for AI agents

Project description

Vial

Surgical code isolation for AI agents.

Vial extracts a single function or class from a large Python file into a clean, focused workspace file so an agent only sees — and edits — exactly what it needs to.

Install

pip install vial-ml
# or with uv:
uv add vial-ml

CLI

# Isolate a function
vial extract billing.py process_payment

# Agent edits .vial_workspace/process_payment_isolated.py ...

# Stitch it back (validates syntax first)
vial merge

Python API

from vial import Vial

v = Vial()
isolated_path = v.extract("billing.py", "process_payment")
# agent edits isolated_path ...
v.merge()

Why

When an agent reads a 2,000-line file to fix a 20-line function it wastes tokens, risks editing the wrong code, and produces complex diffs that frequently fail. Vial reduces the context to only what matters, cutting token usage by 71–88% on typical files.

How it works

  1. Extract — AST-based line-bound finder locates the exact start/end of the target. A protected context header (imports + module-level globals, commented out) is prepended so the agent has the context it needs without being able to accidentally modify it.
  2. Edit — The agent modifies only the isolated file.
  3. Merge — Vial validates the modified code's syntax, then splices it back into the original file at the exact line range. Surrounding code is never touched.

All session state lives in a metadata.json file inside the workspace directory.

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

vial_ml-0.1.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

vial_ml-0.1.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file vial_ml-0.1.1.tar.gz.

File metadata

  • Download URL: vial_ml-0.1.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vial_ml-0.1.1.tar.gz
Algorithm Hash digest
SHA256 45afc8a89c3ea1d3c74d44d42e9659a1a973bce3304b296eb185225a160cc5ad
MD5 5ae1214a4bbed618add6cdc3751e02db
BLAKE2b-256 5e6220285a2de46e2e9958f0236fe5759bd80fd15c961d8004ddefd5afc654ae

See more details on using hashes here.

File details

Details for the file vial_ml-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: vial_ml-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vial_ml-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 585f7682dee87b8eef4b7c566fcd57e16187da2437470772753cfd67413d2b47
MD5 08415ee1b9da24b0c16be391c1b8c0a1
BLAKE2b-256 1cf143446d34aad0b381c72819afbfd9001f3670897ffaa81936ef99c9b6360c

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