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
# or with uv:
uv add vial

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.0.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.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vial_ml-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.14

File hashes

Hashes for vial_ml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8b5bd996ca6487b30cbaa4c22ccef05cf423d3bf7993bd3de5f9c252f5856614
MD5 c405907b432e52a149f9425f691d9e3e
BLAKE2b-256 479cb748c931e4a9bcbce89cd0e0e0b6ee370392c90660f41ae269171bb56d9d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vial_ml-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.14

File hashes

Hashes for vial_ml-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30eb0783ee3f4c305f3e3bd2fa554337951af8d1cd2e3d4b7ab764ef217f7578
MD5 a40d35fe9ad7db0b3ddccbb7d6399984
BLAKE2b-256 172f2c37d708c5fed657bcaa5e19b7724da503cf9ed3680d4a757633e1a26592

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