Skip to main content

redline

Targeted, exact document edits for AI agents - no full-document rewrites.

Install

pip install py-redline
pip install "py-redline[pydantic-ai]"   # optional, for the pydantic-ai wrapper

Usage

from redline import Document, apply_edit, read

doc = Document("# Todo\n- buy milk\n")
apply_edit(doc, "buy milk", "buy oat milk")
print(read(doc))

Document holds the text. apply_edit finds old_str and swaps in new_str - it must match exactly once, unless allow_multiple=True. Other tools: read_lines, append, undo.

With pydantic-ai

from pydantic_ai import Agent
from redline import Document
from redline.pydantic_ai import TOOLS

doc = Document(your_text)
agent = Agent("your-model", deps_type=Document, tools=TOOLS)
agent.run_sync("fix the typo in the intro", deps=doc)
print(doc.text)

TOOLS includes everything. For a session that should only ever read, use READ_TOOLS instead - WRITE_TOOLS holds the tools that can change the document.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_redline-0.2.0.tar.gz (92.4 kB view details)

Uploaded Source

Built Distribution

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

py_redline-0.2.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file py_redline-0.2.0.tar.gz.

File metadata

  • Download URL: py_redline-0.2.0.tar.gz
  • Upload date:
  • Size: 92.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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 py_redline-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1e8f9a16d1fdf598669472f02ec6c3171268bdbdb96b251e4373d7414db67518
MD5 0581a3e37d5f80c8cb3b229598c64b00
BLAKE2b-256 f29a15069e197a9cd88e5e1bd9f8faf224ab6db500e0e25ce3739f32d57d6274

See more details on using hashes here.

File details

Details for the file py_redline-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: py_redline-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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 py_redline-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e164f167190e60ce236db21fe9df432f2cbaaff901ddf07843e657bbdea93a4
MD5 eff734f1deea64f4594f16449bd12947
BLAKE2b-256 fa3275081144fe2aef8113e303c9af6061abe719c20a0e761b656777122e840f

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 Sentry Error logging StatusPage Status page