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.2.tar.gz (3.9 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.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vial_ml-0.1.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • 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.2.tar.gz
Algorithm Hash digest
SHA256 008c7205033a020258e5fa3c2d01e22f55a373c4b68fca6563f51a52997a1611
MD5 14d988e6e47952dfbce70f5a35034aff
BLAKE2b-256 d2c9ddca2c35976d17729af942323129def3564079d5a78e4aa56ac6f420d560

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vial_ml-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f834aaafae673b0a5ac27f0782b931e09284a997cacdb515b5bfc0d28eac4a71
MD5 debe8632a54b827a5de3df7f0bde4468
BLAKE2b-256 51415ef4646e378df64138b015a04cbeaf615b6f32f0f3d3b0bada179454f43b

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