redline
Targeted, exact document edits for AI agents - no full-document rewrites.
Install
pip install redline
pip install "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)
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.1.0.tar.gz
(160.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_redline-0.1.0.tar.gz.
File metadata
- Download URL: py_redline-0.1.0.tar.gz
- Upload date:
- Size: 160.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aaa53744f5d2341f83e8ff6eb236b036425531d5e9db3d4e4176ffe80940617d
|
|
| MD5 |
ae911d10df75167683d358ed0e904d32
|
|
| BLAKE2b-256 |
1a2820dabe83b1c821a6c483118fbf90f356016ebc460960ccc589ec2ad94ea9
|
File details
Details for the file py_redline-0.1.0-py3-none-any.whl.
File metadata
- Download URL: py_redline-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3dadcac79f4410f83d655981b6628e9f18227f85394232d20252e32e000e6de4
|
|
| MD5 |
3b83bb8c156dcfeecdc4d484f149b965
|
|
| BLAKE2b-256 |
b1099c1ab9e8ac1578ab2465971633c2e2b0b378311a41df579c68f0eddcd896
|